[ReactNative] Sync [react_native] Text Input missing letters fix

This commit is contained in:
Andrei Coman 2015-08-06 05:02:36 -07:00
parent 8463625bd9
commit 0d981c06de
1 changed files with 8 additions and 0 deletions

View File

@ -47,6 +47,7 @@ var AndroidTextInputAttributes = {
textAlign: true, textAlign: true,
textAlignVertical: true, textAlignVertical: true,
keyboardType: true, keyboardType: true,
mostRecentEventCount: true,
multiline: true, multiline: true,
password: true, password: true,
placeholder: true, placeholder: true,
@ -481,6 +482,7 @@ var TextInput = React.createClass({
textAlign={textAlign} textAlign={textAlign}
textAlignVertical={textAlignVertical} textAlignVertical={textAlignVertical}
keyboardType={this.props.keyboardType} keyboardType={this.props.keyboardType}
mostRecentEventCount={this.state.mostRecentEventCount}
multiline={this.props.multiline} multiline={this.props.multiline}
onFocus={this._onFocus} onFocus={this._onFocus}
onBlur={this._onBlur} onBlur={this._onBlur}
@ -519,6 +521,12 @@ var TextInput = React.createClass({
}, },
_onChange: function(event: Event) { _onChange: function(event: Event) {
if (Platform.OS === 'android') {
// Android expects the event count to be updated as soon as possible.
this.refs.input.setNativeProps({
mostRecentEventCount: event.nativeEvent.eventCount,
});
}
var text = event.nativeEvent.text; var text = event.nativeEvent.text;
var eventCount = event.nativeEvent.eventCount; var eventCount = event.nativeEvent.eventCount;
this.props.onChange && this.props.onChange(event); this.props.onChange && this.props.onChange(event);