nmac
nmac

Reputation: 680

Focus Does Not Work for React Native TextInput

I have a multiline textinput that I want to focus to in the onComponentDidMount function. If I just set the autoFocus prop to 'true' instead, then everything works fine. But If I want to focus manually, via this.refs.myRefName.focus(), I get an error that informs me that that is not a function. However, I've used this previously in React Native to its desired effect (I'm currently using v0.36.0). So, how do you manually focus a textinput now?

Upvotes: 0

Views: 2834

Answers (1)

Autofocus now works on android with this pull request pull request does't need to call focus() function in componentDidMound. only set autoFocus={true} enough.

Upvotes: 2

Related Questions