Add connecting banner

This commit is contained in:
Rodrigo Nascimento 2017-08-09 16:11:00 -03:00
parent d5fa6cb2ea
commit f131287182
1 changed files with 27 additions and 1 deletions

View File

@ -10,7 +10,7 @@ import RoomItem from '../components/RoomItem';
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
flex: 1, flex: 1,
alignItems: 'center', alignItems: 'stretch',
justifyContent: 'center' justifyContent: 'center'
}, },
separator: { separator: {
@ -24,6 +24,13 @@ const styles = StyleSheet.create({
textAlign: 'center', textAlign: 'center',
fontSize: 18, fontSize: 18,
color: '#ccc' color: '#ccc'
},
bannerContainer: {
backgroundColor: '#ddd'
},
bannerText: {
lineHeight: 28,
textAlign: 'center'
} }
}); });
@ -99,6 +106,24 @@ export default class RoomsListView extends React.Component {
navigate('Room', { sid: id }); navigate('Room', { sid: id });
} }
renderBanner = () => {
if (Meteor.getData().ddp.status !== 'connected') {
return (
<View style={styles.bannerContainer}>
<Text style={styles.bannerText}>Connecting...</Text>
</View>
);
}
if (Meteor._isLoggingIn) {
return (
<View style={styles.bannerContainer}>
<Text style={styles.bannerText}>Loggining...</Text>
</View>
)
}
}
renderItem = ({ item }) => ( renderItem = ({ item }) => (
<RoomItem <RoomItem
id={item._id} id={item._id}
@ -132,6 +157,7 @@ export default class RoomsListView extends React.Component {
render() { render() {
return ( return (
<View style={styles.container}> <View style={styles.container}>
{this.renderBanner()}
{this.renderList()} {this.renderList()}
</View> </View>
); );