Skip to content

Instantly share code, notes, and snippets.

@adelowo
Created February 13, 2020 02:15
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 adelowo/4a87c1db668b93d7baa2fe739ea14b7d to your computer and use it in GitHub Desktop.
Save adelowo/4a87c1db668b93d7baa2fe739ea14b7d to your computer and use it in GitHub Desktop.
import React, {Component} from 'react';
import {Alert, Button, TextInput, View, StyleSheet} from 'react-native';
export default class Login extends Component {
constructor(props) {
super(props);
this.state = {
email: '',
password: '',
};
}
render() {
return (
<View style={styles.container}>
<TextInput
value={this.state.email}
onChangeText={email => this.setState({email: email.trim()})}
placeholder={'Email address'}
style={styles.input}
/>
<TextInput
value={this.state.password}
onChangeText={password => this.setState({password: password.trim()})}
placeholder={'Password'}
style={styles.input}
secureTextEntry={true}
/>
<Button
title={'Login'}
style={styles.input}
onPress={() => {
this.props.cb(this.state);
}}
/>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
input: {
width: 200,
height: 44,
padding: 10,
borderWidth: 1,
borderColor: 'black',
marginBottom: 10,
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment