This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
Sphere/app/components/routes/login.js

92 lines
2 KiB
JavaScript
Raw Normal View History

2016-02-01 20:58:00 +00:00
import React from 'react-native';
import GlobalStyles from '../../settings/styles';
const {
StyleSheet,
Text,
View,
TextInput,
TouchableHighlight,
ScrollView,
BackAndroid
} = React;
const styles = StyleSheet.create({
container: {
flex: .5,
flexWrap: 'nowrap',
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
input: {
height: 50,
width: 300,
borderColor: 'gray',
borderWidth: 1
},
loginButton: {
backgroundColor: GlobalStyles.get('CIRCLE_BLUE'),
margin: 10,
justifyContent: 'center',
alignItems: 'center',
padding: 10
},
loginButtonText: {
fontSize: 16,
color: 'white',
},
title: {
fontSize: 25,
margin: 13
}
});
export default class Login extends React.Component {
constructor() {
super();
2016-02-01 22:41:36 +00:00
this.state = {
};
this.validate = this.validate.bind(this);
this.updateState = this.updateState.bind(this);
2016-02-01 20:58:00 +00:00
}
2016-02-01 22:41:36 +00:00
updateState(key, value) {
let state = this.state;
state[key] = value;
this.setState(state);
}
2016-02-01 20:58:00 +00:00
2016-02-01 22:41:36 +00:00
validate() {
2016-02-01 20:58:00 +00:00
}
componentWillMount() {
BackAndroid.addEventListener('hardwareBackPress', () => { return true; }); // Disable back button
}
render() {
return (
<ScrollView keyboardShouldPersistTaps={false} contentContainerStyle={styles.container}>
<View style={styles.container}>
<Text style={styles.title}>
Login to continue
</Text>
<TextInput
style={styles.input}
2016-02-01 22:41:36 +00:00
onChangeText={(password) => this.updateState('password', password)}
value={this.state.password}
2016-02-01 20:58:00 +00:00
onSubmitEditing={this.validate}
placeholder="Password"
/>
<TouchableHighlight style={styles.loginButton} onPress={this.validate}>
<Text style={styles.loginButtonText}>
Authenticate
</Text>
</TouchableHighlight>
</View>
</ScrollView>
);
}
};