Closed
Description
I wasted all day trying to get it to work with a custom input component and all the difference I could make is to either make the form submit by tapping Next button, or to defocus the field. Unlike the other issue here I don't even have any nesting. Unlike TextField and inbuilt native inputs it won't work in any way if I use a custom element that is seemingly compliant with the requirements set in readme. Here's the element wrapper:
export default class StyledInput extends React.Component {
constructor(props) {
super(props);
}
focus = () => this.setState({ focused: true });
render() {
return (
<TextField {...this.props} />
);
}
}
Here's how it used:
const Form = withNextInputAutoFocusForm(View);
const MyInput = withNextInputAutoFocusInput(StyledInput);
export default class Login extends Screen {
...
render() {
return (
<View >
<Formik
onSubmit={(values, actions) => this.formSubmit(values, actions)}
validationSchema={validationSchema}
initialValues={{
...
}}
render={formikProps => {
return (
<Form>
<MyInput
label='Blah'
autoFocus
name='login'
type='email'
/>
<MyInput
label='Password'
name='password'
type='password'
/>
</Form>
);
}}
/>
</View>
);
}
}
Am I doing something wrong or is it really broken?
Metadata
Metadata
Assignees
Labels
No labels