Created
May 4, 2020 17:14
-
-
Save andreferi3/527e876da98163deb97b032a28fae794 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // variable to hold the references of the textfields | |
| inputs = {}; | |
| // function to focus the field | |
| focusTheField = (id) => { | |
| this.inputs[id].focus(); | |
| } | |
| // upon submitting the Field 1, we want to focus the Field 2 | |
| render() { | |
| return ( | |
| <> | |
| <TextInput | |
| label={"Field 1"} | |
| blurOnSubmit={ false } | |
| returnKeyType={ 'next' } | |
| onSubmitEditing={() => { this.focusTheField('field2'); }} | |
| /> | |
| <TextInput | |
| ref={input => { this.inputs['field2'] = input }} | |
| label={"Field 2"} | |
| /> | |
| </> | |
| ) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment