I was following this example on the react-navigation docs and the handleSubmit from the Formik form mainly on onPress={handleSubmit} isn't handled.
React.useLayoutEffect(() => {
navigation.setOptions({
headerRight: () => <Button onPress={handleSubmit} title='Update' />,
});
}, [navigation]);
const handleSubmit = (values: IUser) => {
setLoadingVisible(true);
updateAccountDetails(values);
setUser(values);
};
<Form
initialValues={{
id: user.id,
name: user.name,
email: user.email,
address: user.address,
}}
onSubmit={handleSubmit}
validationSchema={accountDetailsValidationSchema}
>