Add titles and move around inputs

This commit is contained in:
Jake Howard 2016-02-02 19:16:21 +00:00
parent 47ffb6658b
commit af2da9ea19

View File

@ -18,14 +18,12 @@ const styles = StyleSheet.create({
}, },
contentWrapper: { contentWrapper: {
flex: 0.85, flex: 0.85,
justifyContent: 'center', justifyContent: 'flex-start',
alignItems: 'center' alignItems: 'center'
}, },
input: { input: {
marginHorizontal: 10, marginHorizontal: 15,
height: 50, fontSize: 15,
borderColor: 'gray',
borderWidth: 1,
textAlign: 'center' textAlign: 'center'
}, },
loginButton: { loginButton: {
@ -33,20 +31,29 @@ const styles = StyleSheet.create({
backgroundColor: GlobalStyles.get('CIRCLE_BLUE'), backgroundColor: GlobalStyles.get('CIRCLE_BLUE'),
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
padding: 10
}, },
loginButtonText: { loginButtonText: {
fontSize: 16, fontSize: 18,
color: 'white', color: 'white',
}, },
buttonContainer: { buttonContainer: {
flexDirection: 'row', flexDirection: 'row',
height: 80,
justifyContent: 'center', justifyContent: 'center',
padding: 10 padding: 10,
paddingVertical: 15
}, },
title: { title: {
fontSize: 25, fontSize: 30,
margin: 13 margin: 13
},
heading: {
fontSize: 18,
margin: 8,
marginVertical: 20
},
helpText: {
fontSize: 12,
} }
}); });
@ -54,7 +61,7 @@ export default class Login extends React.Component {
constructor() { constructor() {
super(); super();
this.state = { this.state = {
token: ''
}; };
this.validate = this.validate.bind(this); this.validate = this.validate.bind(this);
this.updateState = this.updateState.bind(this); this.updateState = this.updateState.bind(this);
@ -69,6 +76,10 @@ export default class Login extends React.Component {
validate() { validate() {
} }
componentWillUnmount() {
BackAndroid.removeEventListener('hardwareBackPress', () => { return true; }); // Re-enable back button
}
componentWillMount() { componentWillMount() {
BackAndroid.addEventListener('hardwareBackPress', () => { return true; }); // Disable back button BackAndroid.addEventListener('hardwareBackPress', () => { return true; }); // Disable back button
} }
@ -76,21 +87,28 @@ export default class Login extends React.Component {
render() { render() {
return ( return (
<View style={styles.container}> <View style={styles.container}>
<View style={styles.buttonContainer}>
<Text style={styles.title}>
Sphere
</Text>
</View>
<ScrollView keyboardShouldPersistTaps={false} contentContainerStyle={styles.container}> <ScrollView keyboardShouldPersistTaps={false} contentContainerStyle={styles.container}>
<View style={styles.contentWrapper}> <View style={styles.contentWrapper}>
<Text style={styles.title}> <Text style={styles.heading}>
Login to continue Please enter your CircleCI token
</Text> </Text>
<TextInput <TextInput
style={styles.input} style={styles.input}
onChangeText={(password) => this.updateState('password', password)} onChangeText={(token) => this.updateState('token', token)}
value={this.state.password} value={this.state.token}
onSubmitEditing={this.validate} onSubmitEditing={this.validate}
placeholder="Password" placeholder="CircleCI Token"
autoCorrect={true} autoCorrect={false}
/> />
<Text style={styles.helpText}>
What's this?
</Text>
</View> </View>
</ScrollView> </ScrollView>
<View style={styles.buttonContainer}> <View style={styles.buttonContainer}>
<TouchableHighlight style={styles.loginButton} onPress={this.validate}> <TouchableHighlight style={styles.loginButton} onPress={this.validate}>