text: import React, { PropTypes, Component } from 'react';
  import { View, StyleSheet, StatusBar, ActivityIndicator } from 'react-native';
  import NavigatorViewContainer from './navigator/NavigatorViewContainer';
  import * as auth0 from '../services/auth0';
  import * as snapshotUtil from '../utils/snapshot';
  import * as SessionStateActions from '../modules/session/SessionState';
  import store from '../redux/store';
  import DeveloperMenu from '../components/DeveloperMenu';
  import SplashScreen from 'react-native-splash-screen';
  
  class AppView extends Component {
    static displayName = 'AppView';
  
    static propTypes = {
      isReady: PropTypes.bool.isRequired,
      dispatch: PropTypes.func.isRequired
    };
  
    componentDidMount() {
      snapshotUtil.resetSnapshot()
        .then(snapshot => {
          const {dispatch} = this.props;
  
          if (snapshot) {
            dispatch(SessionStateActions.resetSessionStateFromSnapshot(snapshot));
          } else {
            dispatch(SessionStateActions.initializeSessionState());
          }
  
          store.subscribe(() => {
            snapshotUtil.saveSnapshot(store.getState());
          });
        });
    }
  
    componentWillReceiveProps({isReady, isLoggedIn}) {
      if (!this.props.isReady) {
        if (isReady && !isLoggedIn) {
          auth0.showLogin();
        }
      }
    }
  
    render() {
      if (!this.props.isReady) {
        return (
          <View style={{flex: 1}}>
            <ActivityIndicator style={styles.centered}/>
          </View>
        );
      }
  
      return (
        <View style={{flex: 1}}>
          <StatusBar backgroundColor='#455a64' barStyle='light-content'/>
          <NavigatorViewContainer />
          {__DEV__ && <DeveloperMenu />}
        </View>
      );
    }
  }
  
  const styles = StyleSheet.create({
    centered: {
      flex: 1,
      alignSelf: 'center'
    }
  });
  
  export default AppView;
  