Skip to content

Instantly share code, notes, and snippets.

@JeffKGabriel
Last active June 15, 2018 21:30
Show Gist options
  • Select an option

  • Save JeffKGabriel/4ffaf0c525cf539711830fa670c94f89 to your computer and use it in GitHub Desktop.

Select an option

Save JeffKGabriel/4ffaf0c525cf539711830fa670c94f89 to your computer and use it in GitHub Desktop.
import React, { Component } from 'react';
import { View } from 'react-native';
import { connect } from 'react-redux'
import { createSwitchNavigator, withNavigation } from 'react-navigation'
import TabNavigator from './TabNavigator'
import AuthStack from './AuthStack'
import SplashScreen from '../components/SplashScreen'
const RootNavigator = (props) =>{
let routeName = 'splash'
if(!props.showSplash){
if(props.authed){
routeName = 'signedIn'
}else{
routeName = 'signedOut'
}
}
const ShowSignedIn = createSwitchNavigator(
{
signedIn : {
screen : SplashScreen //TabNavigator
},
signedOut : {
screen : SplashScreen //AuthStack
},
splash : {
screen : SplashScreen
},
},
{
initialRouteName: routeName
}
)
console.log('ShowSignedIn',ShowSignedIn);
//return <ShowSignedIn /> // element type invalid
return ShowSignedIn
}
const mapStateToProps = state => ({
authed: state.Auth.authed,
showSplash: state.Auth.showSplash
})
export default connect(mapStateToProps)(RootNavigator)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment