-
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
TypeError: undefined is not an object (evaluating '(i === 0 ? obj : resVal)[pathArray[i]]') #173
Comments
I have the same issue any solution ? |
Can anybody explain what is happening here? Facing the same issue:
My code class ParentComponent {
render() {
return (
<FormCantainer>
<Formik
onSubmit={(values) => this.onFormSubmit(values)}
validate={(values) => this.validateForm(values)}
>
{(props) => this.renderForm(props)}
</Formik>
</FormCantainer>
);
}
renderForm() {
return (<Field component={CustomTextInput} name="userId" label="User ID" keyboardType={'numeric'} required={true} />);
}
} class CustomTextInput {
render() {
const { field } = this.props;
return (
<TextInput
onChangeText={(text) => form.setFieldValue(field.name, text)}
{ ...this.props } />
);
}
} |
Fixed it!!! Seems like class ParentComponent {
render() {
return (
<FormCantainer>
<Formik
initialValues={{}} // Only this line was needed to fix the issue!
onSubmit={(values) => this.onFormSubmit(values)}
validate={(values) => this.validateForm(values)}
>
{(props) => this.renderForm(props)}
</Formik>
</FormCantainer>
);
}
renderForm() {
return (<Field component={CustomTextInput} name="userId" label="User ID" keyboardType={'numeric'} required={true} />);
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
when i try to type something in the input text this error appears
i'm using "formik": "^2.2.9", and "react-native-formik": "^1.7.8"
any solution plz
The text was updated successfully, but these errors were encountered: