Last active
November 13, 2019 05:08
-
-
Save aravi365/8210d3b794ad3fbef009fa2f18234652 to your computer and use it in GitHub Desktop.
This file contains 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 { | |
StyleSheet, | |
Text, | |
TextInput, | |
View, | |
Button, | |
TouchableOpacity, | |
ToastAndroid, | |
} from 'react-native'; | |
export default class signUp extends React.Component { | |
state = {email: '', password: '', errorMessage: null}; | |
signupNow = () => { | |
//to do => firebase authentication with email & password code goes here | |
}; | |
render() { | |
return ( | |
<View style={styles.container}> | |
<Text style={{color: 'blue', fontSize: 40}}>Sign Up Now</Text> | |
<TextInput | |
placeholder="Email" | |
autoCapitalize="none" | |
style={styles.textInput} | |
onChangeText={email => this.setState({email})} | |
value={this.state.email} | |
/> | |
<TextInput | |
secureTextEntry | |
placeholder="Password" | |
autoCapitalize="none" | |
style={styles.textInput} | |
onChangeText={password => { | |
this.setState({password}); | |
}} | |
value={this.state.password} | |
/> | |
{this.state.errorMessage && ( | |
<Text style={{color: 'red'}}>{this.state.errorMessage}</Text> | |
)} | |
<View style={{marginVertical: 20}}> | |
<Button | |
title="Sign Up" | |
color="blue" | |
onPress={() => this.signupNow()} | |
/> | |
</View> | |
<View> | |
<Text> | |
Already have an account? | |
<Text | |
onPress={() => this.props.navigation.navigate('Login')} | |
style={{color: 'blue', fontSize: 18}}> | |
Login | |
</Text> | |
</Text> | |
</View> | |
</View> | |
); | |
} | |
} | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
justifyContent: 'center', | |
alignItems: 'center', | |
marginHorizontal: 20, | |
}, | |
textInput: { | |
height: 40, | |
fontSize: 20, | |
width: '90%', | |
borderColor: '#9b9b9b', | |
borderBottomWidth: 1, | |
marginTop: 8, | |
marginVertical: 15, | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment