Skip to content

Instantly share code, notes, and snippets.

@varmais
Last active November 20, 2017 12:10
Show Gist options
  • Save varmais/5b3212e6e89ee7096820fa246e81c66c to your computer and use it in GitHub Desktop.
Save varmais/5b3212e6e89ee7096820fa246e81c66c to your computer and use it in GitHub Desktop.
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