You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using Formik in React native to handle forms in my React native app.
I want to show a field for children. If the person filling the form has children then they check the radio button with the label 'yes'. When the user focuses on the child name field I keep getting:
TypeError: undefined is not a function (near '...values.children.map...')
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am using Formik in React native to handle forms in my React native app.
I want to show a field for children. If the person filling the form has children then they check the radio button with the label 'yes'. When the user focuses on the child name field I keep getting:
TypeError: undefined is not a function (near '...values.children.map...')
I took the code from Formik documentation here: https://formik.org/docs/examples/field-arrays
<Formik initialValues={{ name: "", birthday: "", sex: "", maritalStatus: "", spouse: "", children: [{ name: "", age: "", schooling: "" }], job: "", rent: "", address: "", phone: "", health: "", skills: "", }}
`
<RadioForm
radio_props={radio_props}
initial={-1}
formHorizontal={true}
// labelHorizontal={true}
buttonColor={brand}
selectedButtonColor={brand}
animation={true}
onPress={(value) => {
setRadioButton(value);
values.children = [{ name: "", age: "", schooling: "" }];
}}
style={{ marginVertical: 5 }}
/>
`
Beta Was this translation helpful? Give feedback.
All reactions