How to use the react-navigation.createSwitchNavigator function in react-navigation

To help you get started, we’ve selected a few react-navigation examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fugitivelabs / yote / mobile / Yote / js / AppContainer.js View on Github external
import { createAppContainer, createSwitchNavigator } from 'react-navigation';
import { createStackNavigator } from 'react-navigation-stack';
import { connect } from 'react-redux';

import Home from './global/landing/Home'; 
import Login from './resources/user/views/Login'; 
import ProductRoot from './resources/product/views/ProductRoot'; 
import AuthLoadingScreen from './AuthLoadingScreen'; 
import TabNavigator from './TabNavigator'; 
import DrawerNavigator from './DrawerNavigator'; 

const AppStack = createStackNavigator({ Home: Home, Product: ProductRoot });
const AuthStack = createStackNavigator({ SignIn: Login });

const AppContainer = createAppContainer(
  createSwitchNavigator(
    {
      AuthLoading: AuthLoadingScreen,
      App: TabNavigator, // could also use regular stack or DrawerNavigator
      Auth: AuthStack,
    },
    {
      initialRouteName: 'AuthLoading',
    }
  )
);

const mapStoreToProps = (store) => {
  return {
    isLoggedIn: store.user.loggedIn.apiToken
  }
}
github LeuAlmeida / app.october / mobile / src / routes.js View on Github external
import {createAppContainer, createSwitchNavigator} from 'react-navigation';

import Main from '~/pages/Main';
import Statement from '~/pages/Statement';
import Account from '~/pages/Account';

const Routes = createAppContainer(
  createSwitchNavigator({
    Main,
    Statement,
    Account,
  }),
);

export default Routes;
github MetaMask / metamask-mobile / app / components / Nav / App / index.js View on Github external
if (action) {
		if (action.type === 'Navigation/MARK_DRAWER_SETTLING' && action.willShow) {
			DrawerStatusTracker.setStatus('open');
		} else if (action.type === 'Navigation/MARK_DRAWER_SETTLING' && !action.willShow) {
			DrawerStatusTracker.setStatus('closed');
		}
	}

	return defaultGetStateForAction(action, state);
};

/**
 * Top level switch navigator which decides
 * which top level view to show
 */
const App = createSwitchNavigator(
	{
		Entry,
		HomeNav,
		OnboardingRootNav,
		Login,
		OnboardingCarousel,
		LockScreen
	},
	{
		initialRouteName: 'Entry'
	}
);

export default createAppContainer(App);
github voximplant / react-native-demo / src / routes / routes.js View on Github external
headerStyle: {
                    backgroundColor: COLOR.PRIMARY,
                },
                headerTintColor: COLOR.WHITE,
                headerTitleStyle: {
                    fontWeight: 'bold',
                },
            },
        },
    },
    {
        headerLayoutPreset: 'center',
    }
);

const RootStack = createSwitchNavigator(
    {
        Login: LoginScreen,
        App: AppStack,
        Call: CallScreen,
        IncomingCall: IncomingCallScreen,
    },
    {
        initialRouteName: 'Login',
    }
);

export default createAppContainer(RootStack);
github Rocketseat / react-native-template-rocketseat-advanced / src / routes.js View on Github external
import { createAppContainer, createSwitchNavigator } from 'react-navigation';

import Main from '~/pages/Main';

const Routes = createAppContainer(createSwitchNavigator({ Main }));

export default Routes;
github TAFKA-Labs / yaba-social / navigation / index.js View on Github external
} from 'react-navigation'

import { AuthLoadingScreen, SignInScreen } from '../screens'
import BaseStack from './BaseStack'

const AuthStack = createStackNavigator(
  {
    SignIn: SignInScreen,
  },
  {
    headerMode: 'none',
  }
)

export default createAppContainer(
  createSwitchNavigator(
    {
      AuthLoading: AuthLoadingScreen,
      App: BaseStack,
      Auth: AuthStack,
    },
    {
      initialRouteName: 'AuthLoading',
    }
  )
)
github airsecure / airsecure / src / Navigation / index.ts View on Github external
import {
  createAppContainer,
  createSwitchNavigator
} from 'react-navigation'

import Initializing from '../Containers/Initializing'
import Scanner from '../Containers/Scanner'
import Home from '../Containers/Home'

const nav = createSwitchNavigator(
  {
    Initializing,
    Home,
    Scanner
  },
  {
    initialRouteName: 'Home'
  }
)

const app = createAppContainer(nav)

export default app
github czy0729 / Bangumi / AppNavigator.js View on Github external
createStackNavigator
} from 'react-navigation'
import { Constants } from 'expo'
import { Icon } from '@components'
import {
  Auth,
  Home,
  Login,
  Calendar,
  Settings,
  Subject,
  Timeline
} from '@screens'
import { wind, colorMain, colorTitle } from '@styles'

const HomeSwitch = createSwitchNavigator({
  Auth,
  Home
})

const NavBottomTab = createBottomTabNavigator(
  {
    Timeline: {
      navigationOptions: {
        tabBarIcon: ({ tintColor }) => (
          
        ),
        tabBarLabel: '时间胶囊'
      },
      screen: Timeline
    },
    Home: {
github dooboolab / react-native-training / react-navigation-ex / src / components / navigation / SwitchNavigator.js View on Github external
import { createSwitchNavigator, createAppContainer } from 'react-navigation';

import AuthStackNavigator from './AuthStackNavigator';
import MainStackNavigator from './MainStackNavigator';
import Loading from '../screen/Loading';
import LifeCycle from '../screen/LifeCycle';

export const SwitchNavigator = createSwitchNavigator(
  {
    Loading,
    LifeCycle,
    AuthStackNavigator,
    MainStackNavigator,
  },
  {
    initialRouteName: 'Loading',
  }
);
export const AppContainer = createAppContainer(SwitchNavigator);
github XingXiaoWu / react-native-template-wx / src / index.js View on Github external
-----------------------------------------------------------------------------------------------
 ----------- 时间      |   修改人    |     修改的方法       |         修改描述   ---------------
 -----------------------------------------------------------------------------------------------
 
 ************************************************************************************************/
import React, {Component} from 'react';
import {createSwitchNavigator, createAppContainer} from "react-navigation";
import {AppLoginNav} from "./navigation/Regist/RegisterLogin";
import {AppRegist} from "./navigation/Regist/RegisterApp";
import index from './store'
import {Provider} from "mobx-react/index";
import {NavigationService, NavTheme} from "./navigation";
import {inject, observer} from "mobx-react/index";

const AppTopNav = createAppContainer(
    createSwitchNavigator({
            AppLogin: AppLoginNav,
            AppRegister: AppRegist,
        }, {
            initialRouteName: "AppLogin",
        }
    )
)

@observer
export class App extends Component {
    constructor(props){
        super(props)
    }
    render() {
        return (