How to use the @react-navigation/core.SwitchRouter 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 react-navigation / create-react-app-example / src / App.js View on Github external
</Link>
        </div>
        <div>
          <SceneView
            component={descriptor.getComponent()}
            navigation={descriptor.navigation}
          />
        </div>
      </div>
    );
  }
}

const AppNavigator = createNavigator(
  SidebarView,
  SwitchRouter({
    Home,
    About,
    Profile
  }),
  {}
);

const App = createBrowserApp(AppNavigator);

export default App;
github keybase / client / shared / router-v2 / router.desktop.tsx View on Github external
/>
    )
    return (
      <Kb.Box2 direction="horizontal" fullHeight={true} fullWidth={true}>
        <TabBar navigation={navigation} selectedTab={selectedTab as Tabs.AppTab} />
        {sceneView}
      </Kb.Box2>
    )
  }
}

const tabs = Shared.desktopTabs

const TabNavigator = createNavigator(
  TabView,
  SwitchRouter(
    tabs.reduce((map, tab) => {
      map[tab] = createNavigator(
        AppView,
        StackRouter(Shim.shim(routes), {
          initialRouteName: tabRoots[tab],
          initialRouteParams: undefined,
        }),
        {}
      )
      return map
    }, {}),
    {backBehavior: 'none', resetOnBlur: false}
  ),
  {}
)
github react-navigation / web-server-example / src / App.js View on Github external
getActiveChildNavigationOptions
} from "@react-navigation/core";

import About from "./screens/About";
import Home from "./screens/Home";
import DocHome from "./screens/DocHome";
import DocA from "./screens/DocA";
import DocB from "./screens/DocB";
import Contributor from "./screens/Contributor";

import AppView from "./AppView";
import SidebarView from "./SidebarView";

const Docs = createNavigator(
  SidebarView,
  SwitchRouter({
    DocHome,
    DocA,
    DocB
  }),
  {
    navigationOptions: ({ navigation, screenProps }) => {
      const options = getActiveChildNavigationOptions(navigation, screenProps);
      return { title: options.title };
    }
  }
);
Docs.path = "docs";

const AppNavigator = createNavigator(
  AppView,
  SwitchRouter({