Skip to content

Instantly share code, notes, and snippets.

@chaitanya-bhagavan
Created February 2, 2017 16:51
Show Gist options
  • Save chaitanya-bhagavan/34222ce1a3a5da40dc17525ac514cb38 to your computer and use it in GitHub Desktop.
Save chaitanya-bhagavan/34222ce1a3a5da40dc17525ac514cb38 to your computer and use it in GitHub Desktop.
import { Provider } from 'react-redux';
import { Navigation } from 'react-native-navigation';
import { iconsMap, iconsLoaded } from './app-icons';
import configureStore from './Store/Store';
const store = configureStore()
import { registerScreens } from './Screens';
registerScreens(store, Provider);
module.exports = class App {
constructor() {
this.onStoreUpdate = this.onStoreUpdate.bind(this);
this.unsubscribe = store.subscribe(this.onStoreUpdate);
}
onStoreUpdate() {
const {app: {root, props}, login} = store.getState();
if (this.currentRoot !== root) {
this.currentRoot = root;
this.startApp(this.currentRoot, props);
}
}
startApp(root: String, props) {
switch (root) {
case 'login':
Navigation.startSingleScreenApp({
screen: {
screen: 'app.LoginScreen',
title: 'Login',
navigatorStyle: {}
},
appStyle: {
titleBarButtonColor: '#FFFFFF'
},
animationType: 'none'
});
return;
default:
console.log('Unknown app root');
}
}
}
import { iconsLoaded, iconsMap } from './App/app-icons';
iconsLoaded.then(() => {
const App = require('./App/App')
app = new App();
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment