Created
November 13, 2019 05:09
-
-
Save aravi365/d5df1169ff601ecf13ee0ed8b4bb0e56 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, | |
ToastAndroid, | |
} from 'react-native'; | |
export default class Login extends React.Component { | |
state = {email: '', password: '', errorMessage: null}; | |
handleLogin = () => { | |
// TODO: Firebase auth code here... | |
console.log('handleLogin') | |
}; | |
render() { | |
return ( | |
<View style={styles.container}> | |
<Text style={{color: 'blue', fontSize: 40}}>Login</Text> | |
<TextInput | |
style={styles.textInput} | |
autoCapitalize="none" | |
placeholder="Email" | |
onChangeText={email => this.setState({email})} | |
value={this.state.email} | |
/> | |
<TextInput | |
secureTextEntry | |
style={styles.textInput} | |
autoCapitalize="none" | |
placeholder="Password" | |
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="Login" color="blue" onPress={this.handleLogin} /> | |
</View> | |
<View> | |
<Text> | |
{' '} | |
Don't have an account? | |
<Text | |
onPress={() => this.props.navigation.navigate('SignUp')} | |
style={{color: 'blue', fontSize: 16}}> | |
{' '} | |
Sign Up{' '} | |
</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