Skip to content
Autofocus the next input field on enter in React Native
Branch: master
Clone or download
Latest commit 6ae1955 Jun 28, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md Update README.md Aug 1, 2017
form.js Check for null and undefined Jun 28, 2018
index.js First push Jul 30, 2017
package-lock.json Update version for recusrive children fix Sep 8, 2017
package.json Release new version Jun 28, 2018
text-input.js First push Jul 30, 2017

README.md

react-native-autofocus

npm install react-native-autofocus

Autofocus the next input field on enter in React Native.

Have you started with React Native, added a few inputs, and then realized you had to add refs just to focus onto the next input field? This little package solves that problem. Import your text input from this library and wrap them in a form:

import { Form, TextInput } from 'react-native-autofocus'

export default () => (
  <Form>
    <TextInput placeholder="test" />
    <TextInput placeholder="test 2" />
  </Form>
)

Hit enter inside your first input, and the next field will be focused. The logic is all abstracted for you!

You can’t perform that action at this time.