Skip to content

Instantly share code, notes, and snippets.

@anchetaWern
Last active May 31, 2019 08:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anchetaWern/44702f478f63b5a330248dc6a4507c4d to your computer and use it in GitHub Desktop.
Save anchetaWern/44702f478f63b5a330248dc6a4507c4d to your computer and use it in GitHub Desktop.
React Native Stream Group Chat Tutorial: render login screen UI
// 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