Skip to content

Instantly share code, notes, and snippets.

@adelowo

adelowo/Auth.js Secret

Created April 22, 2020 09:40
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/c74be27e9a70767b72c299587aa23b85 to your computer and use it in GitHub Desktop.
Save adelowo/c74be27e9a70767b72c299587aa23b85 to your computer and use it in GitHub Desktop.
import React, {Component} from 'react';
import {Button, TextInput, View, StyleSheet} from 'react-native';
export default class Auth extends Component {
constructor(props) {
super(props);
this.state = {
moniker: '',
password: '',
};
}
render() {
return (
<View style={styles.container}>
<TextInput
value={this.state.moniker}
onChangeText={moniker => this.setState({moniker: moniker.trim()})}
placeholder={'Moniker'}
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