Currently, I am working on a Windows app using react-native version 0.54.0. For one of the functionalities, I have incorporated a TextInput
element and would like to use onKeyPress
. Here is my code snippet:
<TextInput
ref = { this.setTextInputRef }
onChange = { (e) => this.setState({ currentString: e.nativeEvent.text }) }
onKeyPress = { (e) => { console.log(e) }}
onSubmitEditing = { () => this.doAThing() }
multiline = { true }
/>
When checking the e
event in onKeyPress
, it appears as a string in the editor. However, upon running console.log(e)
, it turns out to be a SyntheticEvent where all properties are null. I have read that onKeyPress
works fine with Android, but does it not support Windows? If there is compatibility, what adjustments do I need to make for it to function properly?
The primary goal here is to detect an enter event, so if there is an alternative method available, I am open to suggestions.