React-Native refs undefined on text input React-Native refs undefined on text input reactjs reactjs

React-Native refs undefined on text input


Try setting the reference using a function. Like this:

<TextInput ref={(ref) => { this.FirstInput = ref; }} />

Then you can access to the reference with this.FirstInput instead of this.refs.FirstInput


Try changing the Navigator's renderScene callback to the following (based on Navigator documentation) cause you will need the navigator object later.

renderScene={(route, navigator) => this.renderScene(route, navigator)}

Then, use 'navigator' instead of 'this' to get the refs.

navigator.refs.SecondInput.focus()