react-native-form-auto-next
A simple React Native form component that automatically focuses the next TextInput on return
Installation
npm install react-native-form-auto-next
yarn add react-native-form-auto-next
expo install react-native-form-auto-next
Usage
;;; { const submit = { // Submit the form }; return <Form> <TextInput /> <View> // Nesting works <TextInput /> </View> // Override behaviour with onSubmitEditing prop <TextInput onSubmitEditing=submit /> </Form> ;};
Usage with custom/abstracted inputs
// Form.js;;;; { const submit = { // Submit the form }; return <Form> <CustomInput /> <View> // Nesting works <CustomInput /> </View> // Override behaviour with onSubmitEditing prop <CustomInput onSubmitEditing=submit /> </Form> ;}; // CustomInput.js;; { superprops; thisinput = null; } { const onRef = thisprops; if !onRef return; ; } { if !thisinput return; thisinput; }; { return <TextInput ref= thisinput = input />; }