Last active
November 20, 2017 12:10
-
-
Save varmais/5b3212e6e89ee7096820fa246e81c66c 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
render() { | |
if (showSpinner) { | |
return this.renderSpinner(); | |
} | |
if (user) { | |
return this.renderUserInfo(); | |
} | |
return this.renderAuthScreen(); | |
} | |
renderSpinner () { | |
return <Spinner size="large" text="Logging" />; | |
} | |
renderUserInfo () { | |
return <UserInfoBox />; // Notice name change! | |
} | |
renderAuthScreen () { | |
return <AuthScreen {...this.props} />; | |
} | |
class AuthScreen extends React.Component { | |
render () { | |
return ( | |
<View style={styles.viewStyle}> | |
<Input | |
autoCapitalize='none' | |
autoFocus | |
label="Email" | |
onChangeText={(value) => this.setState({ email: value })} | |
outerViewStyle={{ borderTopWidth: 1 }} | |
placeholder="[email protected]" | |
value={email} | |
/> | |
<Input | |
autoCapitalize='none' | |
label="Password" | |
onChangeText={(value) => this.setState({ password: value })} | |
placeholder="password" | |
secureTextEntry | |
value={password} | |
/> | |
<ErrorText message={error} /> | |
<Button onPress={this.onButtonPress.bind(this)}>Log in</Button> | |
</View> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment