I am using Formik in my TypeScript React Native app. I have a problem where the type of handleSubmit
is not corresponding with onPress
's. I have been looking around and could not find an answer.
When I hover onPress
:
When I hover handleSubmit
:
And here is my code :
import React from "react";import { View, StyleSheet } from "react-native";import { Formik } from "formik";import AppButton from "./AppButton";import AppInput from "./AppTextInput";export default function Form({ submitMessage }: { submitMessage: string }) { return (<View><Formik initialValues={{ email: "", password: "" }} onSubmit={(values) => console.log(values)}> {({ handleChange, handleSubmit }) => (<><AppInput placeholder="Email" icon="email" keyboardType="email-address" autoCapitalize="none" textContentType="emailAddress" autoCorrect={false} onChangeText={handleChange("email")} /><AppInput placeholder="Password" icon="lock" secureTextEntry onChangeText={handleChange("password")} /><AppButton title={submitMessage} primary onPress={handleSubmit} /></> )}</Formik></View> );}const styles = StyleSheet.create({});