Hello,
I followed the example in the video #9 under the Forms Lecture of the React Native course:
After extracting the Form component I have a structure like this:
<Form
initialValues={{
fieldA: "",
fieldB: "",
}}
onSubmit={handleSubmit}
validationSchema={validationSchema}>
<FormTextInput
name="fieldA"
placeholder="Field A"
required
/>
<FormTextInput
name="fieldB"
placeholder="Field B"
required
/>
<SubmitButton>Send</SubmitButton>
</Form>
In a scenario like this, I would like the text in fieldB
to be cleared when the text in fieldA
is cleared manually.
In this set up I don’t have access to formik methods like setFieldValue
etc.
How can I detect one field changing (ok i could create an onChange
event), and especially how do I edit the value of another field?