in

Formik handle submit type not corresponding with onPress’s


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 :

enter image description here

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({});



Source: https://stackoverflow.com/questions/70605910/formik-handle-submit-type-not-corresponding-with-onpresss

2022 is Going to be an Exciting Year for KDE, Here’s Why!

OpenPortfolio — Treat yourself as a product from an HR perspective