I started using formik in react-native and a warning is shown to me whenever I try typing something.
const CustomInputComponent = ({ field, form: { touched, errors, handleBlur, handleChange, values }, ...props }) => {
return (
<View style={Styles.w100}>
<Input {...field} {...props} onBlur={handleBlur(field.name)} onChangeText={handleChange(field.name)} value={values[field.name]} />
</View>
)
}
and the field
<Field placeholder='Password' name='password' icon='key' component={CustomInputComponent} />
I had this problem as well. It turned out thet TextInput didn't like to get all of the field properties. I think your code will work if you remove {...field} from your Input properties.
I didn't dig any further, so I don't know the actual reason to the problem. Anyway, I don't think there are any important stuff in the field variable that you'd want to send to your Input (apart from "name", which you access via field.name anyway). It also has value, but you are using values[field.name] anyway.
Most helpful comment
I had this problem as well. It turned out thet TextInput didn't like to get all of the
fieldproperties. I think your code will work if you remove{...field}from your Input properties.I didn't dig any further, so I don't know the actual reason to the problem. Anyway, I don't think there are any important stuff in the field variable that you'd want to send to your Input (apart from "name", which you access via field.name anyway). It also has
value, but you are using values[field.name] anyway.