Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@diego3g
Created October 31, 2017 17:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diego3g/15e2a90f225438d8cb7308b59eb90a81 to your computer and use it in GitHub Desktop.
Save diego3g/15e2a90f225438d8cb7308b59eb90a81 to your computer and use it in GitHub Desktop.
import React from 'react';
import { View, TextInput, Button } from 'react-native';
import { withFormik } from 'formik';
const Form = (props) => (
<View style={styles.container}>
<TextInput
value={props.values.email}
onChangeText={text => props.setFieldValue('email', text)}
/>
<TextInput
value={props.values.password}
onChangeText={text => props.setFieldValue('password', text)}
/>
<Button
onPress={props.handleSubmit}
title="Login"
/>
</View>
);
export default withFormik({
mapPropsToValues: () => ({ email: '', password: '' }),
handleSubmit: (values) => {
console.log(values);
}
})(Form);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment