Skip to content

Instantly share code, notes, and snippets.

@ssdev-95
Created September 9, 2021 20:38
Show Gist options
  • Select an option

  • Save ssdev-95/d678d79615cd0545dc083f0aa4e343b1 to your computer and use it in GitHub Desktop.

Select an option

Save ssdev-95/d678d79615cd0545dc083f0aa4e343b1 to your computer and use it in GitHub Desktop.
Form React Native
import React from 'react';
import { View, TextInput } from 'react-native';
import {Formik} from 'formik';
// Baseado nas docs do Formik: https://formik.org/docs/guides/react-native
// Button customizado, faca o seu :D
const Form = ({action}) => {
return (
<Formik initialValues={{ email: '' }} onSubmit={values => action(values)}>
{({handleChange, handleBlur, handleSubmit, values}) => (
<View>
<TextInput
onChangeText={handleChange('email')}
onBlur={handleBlur('email')}
value={values.email}
/>
<Button title="Pagar" onPress={handleSubmit} />
</View>
)}
</Formik>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment