In IOS, after clearing TextInput value (setting it to empty string) and then pressing any key (e.g. 'a') two onKeyPress events are fired: A, Backspace. First is for the pressed key and second is a Backspace.
Environment
Environment:
OS: macOS Sierra 10.12.6
Node: 8.9.1
Yarn: 1.3.2
npm: 5.5.1
Watchman: 4.9.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: 3.0 AI-171.4443003
Packages: (wanted => installed)
react: ^16.3.0-alpha.1 => 16.3.0-alpha.1
react-native: 0.54.2 => 0.54.2
Expected Behavior
Only one event for the pressed key should be fired (e. g. 'A').
Actual Behavior
An additional 'Backspace' event is fired.
Steps to Reproduce
- write anythig in the textfield
- press clear
- press 'a' >>> events 'A' and 'Backspace' will be fired
typeProps={};typeState={text: string,keys: string};exportdefaultclassAppextendsComponent<Props,State>{state={text: '',keys: ''}render(){return(<Viewstyle={styles.container}><TextInputstyle={styles.textInput}value={this.state.text}onChangeText={this.onChangeText}onKeyPress={this.onKeyPress}/><Buttontitle="Clear"onPress={this.onClear}/><Text>Text: {this.state.text}</Text><Text>Keys: {this.state.keys}</Text></View>);}onChangeText=(text: string)=>{this.setState({text})}onKeyPress=({ nativeEvent }: Object)=>{this.setState({keys: this.state.keys+nativeEvent.key+', '})}onClear=()=>{this.setState({text: '',keys: ''})}}
In IOS, after clearing TextInput value (setting it to empty string) and then pressing any key (e.g. 'a') two onKeyPress events are fired: A, Backspace. First is for the pressed key and second is a Backspace.
Environment
Environment:
OS: macOS Sierra 10.12.6
Node: 8.9.1
Yarn: 1.3.2
npm: 5.5.1
Watchman: 4.9.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: 3.0 AI-171.4443003
Packages: (wanted => installed)
react: ^16.3.0-alpha.1 => 16.3.0-alpha.1
react-native: 0.54.2 => 0.54.2
Expected Behavior
Only one event for the pressed key should be fired (e. g. 'A').
Actual Behavior
An additional 'Backspace' event is fired.
Steps to Reproduce