How to use the @react-navigation/core.StackRouter function in @react-navigation/core

To help you get started, we’ve selected a few @react-navigation/core 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 kmagiera / react-native-screens / createNativeStackNavigator.js View on Github external
function createStackNavigator(routeConfigMap, stackConfig = {}) {
  const router = StackRouter(routeConfigMap, stackConfig);

  // Create a navigator with StackView as the view
  let Navigator = createNavigator(StackView, router, stackConfig);
  // if (!stackConfig.disableKeyboardHandling) {
  //   Navigator = createKeyboardAwareNavigator(Navigator, stackConfig);
  // }

  return Navigator;
}
github keybase / client / shared / settings / routes.desktop.tsx View on Github external
return (
      
        
          
        
      
    )
  }
}
const SettingsSubNavigator = createNavigator(
  SettingsSubNav,
  StackRouter(Shim.shim(settingsSubRoutes), {initialRouteName: Constants.accountTab}),
  {}
)

SettingsSubNavigator.navigationOptions = {
  title: 'Settings',
}

export const newRoutes = {
  // MUST use screen and not getScreen for subnavs!
  settingsRoot: {screen: SettingsSubNavigator},
}
export const newModalRoutes = {
  [Constants.logOutTab]: {getScreen: (): typeof LogOutTab => require('./logout/container').default},
  // TODO connect broken
  changePassword: {getScreen: (): typeof ChangePassword => require('./password/container').default},
  deleteConfirm: {getScreen: (): typeof DeleteConfirm => require('./delete-confirm/container').default},
github keybase / client / shared / router-v2 / router.desktop.tsx View on Github external
StackRouter(Shim.shim(routes), {
          initialRouteName: tabRoots[tab],
          initialRouteParams: undefined,
        }),
        {}
      )
      return map
    }, {}),
    {backBehavior: 'none', resetOnBlur: false}
  ),
  {}
)

const LoggedInStackNavigator = createNavigator(
  ModalView,
  StackRouter(
    {
      Main: {screen: TabNavigator},
      ...Shim.shim(modalRoutes),
    },
    {}
  ),
  {}
)

const LoggedOutStackNavigator = createNavigator(
  AppView,
  StackRouter(
    {...Shim.shim(loggedOutRoutes)},
    {
      // @ts-ignore TODO add custom nav options somewhere
      defaultNavigationOptions: () => ({headerHideBorder: true}),
github flow-typed / flow-typed / definitions / npm / @react-navigation / core_v3.x.x / test_core.js View on Github external
import React from 'react';

const FunctionalScreenComponent = (
  { navigation }: { navigation: NavigationScreenProp<*>, ... },
) => {
  return "Test";
};
const innerRouteConfig = {
  Test1: { screen: FunctionalScreenComponent },
};

/**
 * StackRouter
 */

const stackRouter = StackRouter(innerRouteConfig);
const stackNavigateAction = {
  type: "Navigation/NAVIGATE",
  routeName: "Test3",
};
stackRouter.getStateForAction(stackNavigateAction, null);

/**
 * TabRouter
 */

const tabRouter = TabRouter(innerRouteConfig);
const tabNavigateAction = {
  type: "Navigation/NAVIGATE",
  routeName: "Test1",
};
tabRouter.getStateForAction(tabNavigateAction, null);
github react-navigation / experimental-transitioner / example / src / examples / CardStack.js View on Github external
's Profile
          
          <button> navigation.push('HomeScreen')}
            title="Go Home"
          /&gt;
          </button><button> navigation.goBack()} title="Go Back" /&gt;
        
      
    );
  }
}

const App = createNavigator(
  Transitioner,
  StackRouter({
    HomeScreen,
    ProfileScreen,
  }),
  {}
);

export default App;
</button>
github react-navigation / experimental-transitioner / example / src / examples / Fade.js View on Github external
's Profile
          
          <button> navigation.push('HomeScreen')}
            title="Go Home"
          /&gt;
          </button><button> navigation.goBack()} title="Go Back" /&gt;
        
      
    );
  }
}

const App = createNavigator(
  Transitioner,
  StackRouter({
    HomeScreen,
    ProfileScreen,
  }),
  {}
);

export default App;
</button>
github keybase / client / shared / router-v2 / router.desktop.js View on Github external
key="ModalLayer"
              navigation={childNav}
              component={descriptor.getComponent()}
              screenProps={this.props.screenProps}
            /&gt;
          
        )}
        
      
    )
  }
}

const LoggedInStackNavigator = createNavigator(
  ModalView,
  StackRouter(
    {
      Main: {screen: MainNavigator},
      ...Shim.shim(modalRoutes),
    },
    {}
  ),
  {}
)

const LoggedOutStackNavigator = createNavigator(
  AppView,
  StackRouter(
    {...Shim.shim(loggedOutRoutes)},
    {
      defaultNavigationOptions: p =&gt; ({headerHideBorder: true}),
      initialRouteName: 'login',
github react-navigation / experimental-transitioner / src / createStackTransitionNavigator.js View on Github external
export default function createStackTransitionNavigator(
  routeConfigs,
  options = {}
) {
  const router = StackRouter(routeConfigs, options);

  return createNavigator(Transitioner, router, options);
}
github keybase / client / shared / router-v2 / router.desktop.tsx View on Github external
tabs.reduce((map, tab) => {
      map[tab] = createNavigator(
        AppView,
        StackRouter(Shim.shim(routes), {
          initialRouteName: tabRoots[tab],
          initialRouteParams: undefined,
        }),
        {}
      )
      return map
    }, {}),
    {backBehavior: 'none', resetOnBlur: false}