Created
May 16, 2020 09:32
-
-
Save Karthik-B-06/e07b3805722d97295115e09f9d2d40c9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import { View, Text, StyleSheet } from 'react-native'; | |
| import FormField from './FormField'; | |
| import { formData } from '../formData'; | |
| const RegisterForm = (props) => { | |
| const [formValues, handleFormValueChange, setFormValues] = formData({ | |
| username: '', | |
| email: '', | |
| password: '' | |
| }) | |
| return ( | |
| <View style={styles.container}> | |
| <Text style={{ | |
| fontSize: 24, | |
| textAlign: 'center', | |
| fontWeight: "300", | |
| paddingBottom: 30 | |
| }}>Hellooww !!</Text> | |
| <FormField | |
| label='Username' | |
| formKey='username' | |
| placeholder='Your username' | |
| handleFormValueChange={handleFormValueChange} | |
| /> | |
| <FormField | |
| label='Email' | |
| formKey='email' | |
| placeholder='Your email id' | |
| textInputProps={{ | |
| autoCapitalize: "none" | |
| }} | |
| handleFormValueChange={handleFormValueChange} | |
| /> | |
| <FormField | |
| label='Password' | |
| formKey='password' | |
| placeholder='Your password' | |
| textInputProps={{ | |
| autoCapitalize: "none" | |
| }} | |
| handleFormValueChange={handleFormValueChange} | |
| /> | |
| <Text style={styles.header}>Values in Hook: </Text> | |
| <View> | |
| <Text style={styles.formText}>Username is : {formValues.username}</Text> | |
| <Text style={styles.formText}>Email is: {formValues.email}</Text> | |
| <Text style={styles.formText}>Password is: {formValues.password}</Text> | |
| </View> | |
| </View> | |
| ) | |
| } | |
| const styles = StyleSheet.create({ | |
| container: { | |
| display: 'flex', | |
| margin: 20, | |
| }, | |
| header: { | |
| fontSize: 20, | |
| paddingTop: 30 | |
| }, | |
| formText: { | |
| fontSize: 20, | |
| padding: 10, | |
| paddingLeft: 0 | |
| } | |
| }) | |
| export default RegisterForm; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment