Search code examples
javascriptiosfacebookreactjsreact-native

How do I get a React Native TextInput to maintain focus after submit?


I could explain what I am trying to do, but this ReactJS example is a walkthrough of exactly what I want. The problem is I can't figure out what the equivelant would be for react native.

Basically, when I press return in the TextInput, I want the text cleared and focus maintained.

Any thoughts?


Solution

  • I've submitted a PR with a blurOnSubmit property.

    Set it to false and the TextInput never blurs, onSubmitEditing still fires though.

    Hopefully it gets merged. :)

    https://github.com/facebook/react-native/pull/2149