Fix onSelectionChange "this" binding

Reviewed By: tadeuzagallo

Differential Revision: D2660071

fb-gh-sync-id: 3fc50c0af8566dd7db5a56b220df979625673d07
This commit is contained in:
Nick Lockwood 2015-11-16 14:01:53 -08:00 коммит произвёл facebook-github-bot-4
Родитель e4f0971a55
Коммит 7aa789ad57
2 изменённых файлов: 6 добавлений и 1 удалений

Просмотреть файл

@ -75,6 +75,11 @@ var TextEventsExample = React.createClass({
onSubmitEditing={(event) => this.updateText(
'onSubmitEditing text: ' + event.nativeEvent.text
)}
onSelectionChange={(event) => this.updateText(
'onSelectionChange range: ' +
event.nativeEvent.selection.start + ',' +
event.nativeEvent.selection.end
)}
onKeyPress={(event) => {
this.updateText('onKeyPress key: ' + event.nativeEvent.key);
}}

Просмотреть файл

@ -414,7 +414,7 @@ var TextInput = React.createClass({
var onSelectionChange;
if (this.props.selectionState || this.props.onSelectionChange) {
onSelectionChange = function(event: Event) {
onSelectionChange = (event: Event) => {
if (this.props.selectionState) {
var selection = event.nativeEvent.selection;
this.props.selectionState.update(selection.start, selection.end);