Last active
May 31, 2019 08:55
-
-
Save anchetaWern/44702f478f63b5a330248dc6a4507c4d to your computer and use it in GitHub Desktop.
React Native Stream Group Chat Tutorial: render login screen UI
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
// src/screens/Login.js | |
render() { | |
const { username, is_loading } = this.state; | |
return ( | |
<View style={styles.wrapper}> | |
<View style={styles.container}> | |
<View style={styles.main}> | |
<View style={styles.field_container}> | |
<Text style={styles.label}>Enter your username</Text> | |
<TextInput | |
style={styles.text_input} | |
onChangeText={username => this.setState({ username })} | |
value={username} | |
/> | |
</View> | |
{!is_loading && ( | |
<Button title="Login" color="#0064e1" onPress={this.login} /> | |
)} | |
{is_loading && ( | |
<Text style={styles.loading_text}>Loading...</Text> | |
)} | |
</View> | |
</View> | |
</View> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment