bamlab / bamlab/react-native-formik
withNextInputAutoFocus does not work with nested components
- Dominant language
- JavaScript
- Stars
- 398
- Forks
- 50
- PR merge metrics
- No merged PRs in 30d
Description
# Description
When using self-closing-tag components to generate text fields in a form, the `withNextInputAutoFocusForm` does not register the generated textInputs and the expected behaviour does not work : pressing "OK" with a textInput focused submits the entire form.
# Steps to reproduce / example
```
const Form = withNextInputAutoFocusForm(View);
export class ReportForm extends PureComponent {
renderForm = ({ values, handleSubmit }: { values: any, handleSubmit: Function }) => {
return (
);
};
render() {
return (
);
}
}
```
```
export class AircraftInformationSection extends PureComponent {
render() {
return (
);
}
}
```
In this case, [getInputs](https://github.com/bamlab/react-native-formik/blob/master/src/withNextInputAutoFocus.js#L12) does not see any children in the props of ``
# Ideas of technical solution
Create a Provider/Consumer system with textFields subscribing to the form.
Add a prop to the form to specify the order of the fields to be focused.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.