import { StyleSheet, View, Text } from 'react-native';
import PropTypes from 'prop-types';
import React from 'react';
import { connect } from 'react-redux';
const styles = StyleSheet.create({
bannerContainer: {
backgroundColor: '#ddd',
position: 'absolute',
top: '0%',
zIndex: 10,
width: '100%'
},
bannerText: {
textAlign: 'center',
margin: 5
}
});
@connect(state => ({
connecting: state.meteor.connecting,
authenticating: state.login.isFetching,
offline: !state.meteor.connected
}))
export default class Banner extends React.PureComponent {
static propTypes = {
connecting: PropTypes.bool,
authenticating: PropTypes.bool,
offline: PropTypes.bool
}
render() {
const { connecting, authenticating, offline } = this.props;
if (connecting) {
return (
Connecting...
);
}
if (authenticating) {
return (
Authenticating...
);
}
if (offline) {
return (
offline...
);
}
return null;
}
}