react-hook-form: TypeError: e.preventDefault is not a function
when i use react-native-ui-lib code:
<Button
marginT-20
label="Confirm"
onPress={handleSubmit(onSubmit)}
disabled={isSubmitting}>
{isSubmitting ? <ActivityIndicator color="#fdfdfd" /> : null}
</Button>
error:
TypeError: e.preventDefault is not a function. (In 'e.preventDefault()', 'e.preventDefault' is undefined)
i changed useForm.ts#L903
const handleSubmit = React.useCallback((callback) => async (e) => {
if (e && e.preventDefault) { // add?
e.preventDefault();
e.persist();
}
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 16 (13 by maintainers)
Commits related to this issue
- close #2037 with RN handleSubmit arg empty object — committed to react-hook-form/react-hook-form by bluebill1049 4 years ago
() => handleSubmit(onSubmit)()will doI don’t 😦 but we looking for a solution right now.
@bluebill1049 thanks, i’ll try this