I'd like to know how to render this button and if so is it autobound to the text in the input field ?
To select the next TextInput after pressing the "next" keyboard button with React Native, we can assign refs to the TextInput s we want to set focus on. And then we call focus on the ref. current of the TextInput to set focus on the input.
Two methods exposed via the native element are .focus() and .blur() that will focus or blur the TextInput programmatically.
onSubmitEditing is triggered when you click the text input submit button (keyboard button). onChangeText is triggered when you type any symbol in the text input. In your example, you will achieve what you need in both cases.
Basically onSumbitEditing
will trigger and event provided when go button is clicked from android soft keyboard as in below example :
<TextInput
style={[styles.zipCode, styles.mainText]}
returnKeyType='My Custom button'
onSubmitEditing={(event) => this.updateText( event.nativeEvent.text
)}/>
in above code snippet : I have action name is 'My Custom button' which will appera in soft keyboard in android and when you press that the updateText event is tiggered , thats what is the meaning on onSubmitEditing
Note : if physical keyboard is enable in android emulator so onSubmitEditing will not tigger any event since you would not be also to press virtual key which is given name as 'My Custom Button'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With