-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError when calling handleSubmit in react-native #376
Comments
Yeah this is legit. Hmmmmm. I think it may be time for Formik-native. In the mean time you can call submitForm() |
I got stuck there too when trying to support React Native and TypeScript. I’m cool with dropping types/node if this works. |
Thanks for the tip on As a side note, I'm really digging this library. Thanks for all the hard work! This has solved a lot of the issues I was having with redux-form, and the ease of integration with react native has made it a joy to work with. |
For all coming here: The issue seems to be still open.
|
@jaredpalmer Any valid solution for correct typing in react-native? |
TypeScript is supported and React Native is supported but both at the same time aren't? 🤔 |
Any update on this issue? This makes it feel like React Native was largely an afterthought for Formik and not officially supported. Casting things to |
Still is the issue. |
I can confirm that this is still an issue. |
wondering why this issue was closed 👀 the problem, obviously, still hitting us badly with inability of normalizing the types properly. |
Bug
Current Behavior
The recommended usage of formik in react native is:
<Button onPress={props.handleSubmit} />
. However, when using typescript, the type of event thathandleSubmit
accepts is different than what react-native'sonPress
generates.Desired Behavior
Formik's
handleSubmit
should take aGestureResponderEvent
in addition toReact.FormEvent<HTMLFormElement>
.Suggested Solutions
This branch fixes this issue: https://github.com/Shurelia/formik/tree/handleSubmit-fix
Unfortunately, there is a typings conflict between
@types/node
and@types/react-native
which prevents the build. Since the only type used from node wasprocess
, I've manually declared that as any and removed@types/node
. Not an elegant solution, and I'd be open to working on it more if the maintainers are okay with removing@types/node
from the project (and perhaps manually declaringprocess
?).Info
The text was updated successfully, but these errors were encountered: