Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

GestureResponderEvent #3233

Open
gruckionvit opened this issue Jun 7, 2021 · 4 comments
Open

GestureResponderEvent #3233

gruckionvit opened this issue Jun 7, 2021 · 4 comments

Comments

@gruckionvit
Copy link

gruckionvit commented Jun 7, 2021

Bug report

Current Behavior

Screenshot 2021-06-07 at 16 20 31

Expected behavior

The types to work for react and react native

Reproducible example

Have a component that uses FormikProps

  const renderForm: React.FC<FormikProps<typeof initialValues>> = ({
    isSubmitting,
    handleSubmit,
    handleChange,
    handleBlur,
    values,
    errors,
    touched,
  }) => (

Have a Button use the handleSubmit

        <Button
          text="Save"
          onPress={handleSubmit}
        />

Suggested solution(s)

https://github.com/formium/formik/pull/379/files

Put this code change back in

Additional context

N/A

Your environment

Software Version(s)
Formik 2.2.6
React 16.13.1
TypeScript 4.0.0
Browser N/A
npm/Yarn Yarn 1.22.10
Operating System OSX N/A
@gruckionvit
Copy link
Author

Temp solution for anyone else using patch package.

diff --git a/node_modules/formik/dist/types.d.ts b/node_modules/formik/dist/types.d.ts
index 9630a4f..0716c70 100644
--- a/node_modules/formik/dist/types.d.ts
+++ b/node_modules/formik/dist/types.d.ts
@@ -1,4 +1,6 @@
 import * as React from 'react';
+import { GestureResponderEvent } from 'react-native';
+
 /**
  * Values of fields in the form
  */
@@ -90,7 +92,7 @@ export interface FormikHelpers<Values> {
  */
 export interface FormikHandlers {
     /** Form submit handler */
-    handleSubmit: (e?: React.FormEvent<HTMLFormElement>) => void;
+    handleSubmit: (e?: React.FormEvent<HTMLFormElement> | GestureResponderEvent) => void;
     /** Reset form event handler  */
     handleReset: (e?: React.SyntheticEvent<any>) => void;
     handleBlur: {

Ben has a video on how to use patch package if you've not used it before.

https://www.youtube.com/watch?v=2AVs-Yh1bS8&t=582s

@github-actions
Copy link
Contributor

github-actions bot commented Jul 8, 2021

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 60 days

@github-actions github-actions bot added the stale label Jul 8, 2021
@johnrom johnrom removed the stale label Jul 8, 2021
@benschac
Copy link

benschac commented Jul 15, 2021

assuming this will get handled in formik-native?

@github-actions
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 60 days

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

3 participants