-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
withNextInputAutoFocus does not work with nested components #42
Comments
Hi @Gguigre, thanks for reporting! In getInputs, Would it be possible in your case to use |
Hi @Almouro, Actually, the renderForm method is more like
So if I create one |
@Gguigre I believe you should also add that |
Recently merge doesn't fix the issue. The thing is that const Address = () => {
return <Box>
<Input name={'address_line_1'}
<Input name={'address_line_2'}
</Box>
}
const RegistrationForm = () => {
<Form>
<Box>
<Input name={'a'} />
<Input name={'b'} />
<Input name={'c'} />
<Input name={'d'} />
</Box>
<Address />
</Form>
} where it doesn't not get into const getInputs = children =>
//...
if (child && child.props && child.props.children) { // <- well, this
//...
}
//...
}, []); I'm trying to get the solution for that. I will leave PR for you @Almouro if I have any 🤷♂️ EDIT const Address = () => {
return <Form>
<Input name={'address_line_1'}
<Input name={'address_line_2'}
</Form>
}
const App = () => {
<Form>
//...
<Address />
//...
</Form>
} |
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
In this case, getInputs does not see any children in the props of
<AircraftInformationSection />
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.
The text was updated successfully, but these errors were encountered: