Created
February 2, 2017 16:51
-
-
Save chaitanya-bhagavan/34222ce1a3a5da40dc17525ac514cb38 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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