Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

Formik handle submit type not corresponding with onPress's

$
0
0

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 :

enter image description here

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

Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>