Skip to content

Commit a515aa1

Browse files
authored
Added onBlur handler
https://formik.org/docs/api/formik#handleblur-e-any--void In order to get formik.touched to work, need to count track whether it has been touched.
1 parent b8f9370 commit a515aa1

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/content/10/en/part10b.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,7 @@ const BodyMassIndexForm = ({ onSubmit }) => {
791791
placeholder="Weight (kg)"
792792
value={formik.values.mass}
793793
onChangeText={formik.handleChange('mass')}
794+
onBlur={formik.handleBlur('mass')}
794795
/>
795796
{formik.touched.mass && formik.errors.mass && (
796797
<Text style={{ color: 'red' }}>{formik.errors.mass}</Text>
@@ -799,6 +800,7 @@ const BodyMassIndexForm = ({ onSubmit }) => {
799800
placeholder="Height (m)"
800801
value={formik.values.height}
801802
onChangeText={formik.handleChange('height')}
803+
onBlur={formik.handleBlur('height')}
802804
/>
803805
{formik.touched.height && formik.errors.height && (
804806
<Text style={{ color: 'red' }}>{formik.errors.height}</Text>

0 commit comments

Comments
 (0)