Created
March 19, 2017 22:53
Revisions
-
dev created this gist
Mar 19, 2017 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ /** * Sample React Native App * https://github.com/facebook/react-native * @flow */ import React from 'react'; import { AppRegistry, StyleSheet, Text, View } from 'react-native'; import setup from './src/screens/setup' AppRegistry.registerComponent('splash_app', () => setup); This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ import {Router, Scene, StackNavigator, TabNavigator, CardStack} from 'react-navigation'; import Login from './loginScreen' import Home from './homeScreen' import Splash from './splashScreen' import Settings from './settingsScreen' import Profile from './profileScreen' const MainNavigator = TabNavigator({ Home: { screen: Home, path: 'home' }, Profile: { screen: Profile, path: 'profile' } }, { initialRouteName: 'Home', tabBarPosition: 'bottom', tabBarOptions: { showLabel: false, showIcon: true, activeTintColor: 'red', labelStyle: { fontWeight: 'bold', color: 'black' }, style: { backgroundColor: 'white' }, indicatorStyle: { backgroundColor: 'red' } } }); export default MainNavigator This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ import {StackNavigator} from 'react-navigation' // import Register from './screenRegister' import Login from './loginScreen' // import PwdForget from './screenPwdforget' // import Tour from './screenTour' const OnboardingNavigator = StackNavigator({ Login: { screen: Login }, // Not implimented yet! :( // Register: { // screen: Register // }, // PwdForgot: { // screen: PwdForgot // }, // Tour: { // screen: Tour // } }, {initialRouteName: 'Login'}) export default OnboardingNavigator This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,45 @@ import React, {Component} from 'react' import {connect} from 'react-redux' import {bindActionCreators} from 'redux' import OnboardingNavigator from './navigationOnboarding' import MainNavigator from './navigationMain' import Splash from './splashScreen' import * as actions from '../actions' class Navigator extends Component { constructor(props) { super(props) // console.log(props); if (props.user.loginState === 'LOGGEDIN_CHECKING') { this.props.actions.startListeningToAuth(); } } render() { switch (this.props.user.loginState) { case 'LOGGEDIN': return (<MainNavigator/>); break; case 'LOGGEDOUT': return (<OnboardingNavigator/>); break; default: return ( <Splash></Splash> ); } } } function mapDispatchToProps(dispatch) { return { actions: bindActionCreators(actions, dispatch) } } const mapStateToProps = state => (state) export default connect(mapStateToProps, mapDispatchToProps)(Navigator) This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ import React, {Component} from 'react' import {Provider} from 'react-redux' import Navigator from './navigator' import { createStore, applyMiddleware, combineReducers } from 'redux' import thunk from 'redux-thunk' import rootReducer from '../reducers' const store = createStore(rootReducer, undefined, applyMiddleware(thunk)) class setup extends Component { render() { return ( <Provider store={store}> <Navigator/> </Provider> ) } } export default setup