Fix onSelectionChange "this" binding
Reviewed By: tadeuzagallo Differential Revision: D2660071 fb-gh-sync-id: 3fc50c0af8566dd7db5a56b220df979625673d07
This commit is contained in:
parent
e4f0971a55
commit
7aa789ad57
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue