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

Most upvoted comments

npmPackages:
    @react-native-community/cli: Not Found
    react: 16.11.0 => 16.11.0 
    react-native: 0.62.2 => 0.62.2 
"react-hook-form": "6.0.1",

Simulator Screen Shot - iPhone 11 - 2020-07-07 at 08 49 05

() => handleSubmit(onSubmit)() will do

Thanks!

You don’t have an release-on-master merge GH action, do you? 😉

I don’t 😦 but we looking for a solution right now.

@bluebill1049 thanks, i’ll try this