You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2024. It is now read-only.
I've noticed that people have had a hard time grasping how nesting navigators works in React Navigation, and part of that might be due to the relatively flat appearance of defining navigators with functions and then passing the navigators in as screens to others.
It might be good to provide a library that lets people use a JSX oriented API that gives a more natural sense of nesting. A proof of concept of this can be found here: https://snack.expo.io/@notbrent/dsl
See:
// Notice in this example that the modal is inside of the tabs -- the tabs UI// appears on top of the modal profile stackconstNavigation=createAppContainer(<BottomTabs><Routename="Home"path="/"screen={HomeScreen}/><Routename="Profile"path="/profile"><Stackmode="modal"><Routename="ProfileShow"path="/"screen={ProfileScreen}navigationOptions={{title: 'Profile'}}/><Routename="Settings"path="/settings"><StacknavigationOptions={{header: null}}><Routename="SettingsShow"path="/"screen={SettingsScreen}navigationOptions={{title: 'Settings'}}/><Routename="About"path="/"screen={AboutScreen}navigationOptions={{title: 'About'}}/></Stack></Route></Stack></Route></BottomTabs>);
And compare it with
// Here we put the modal stack at the root so the stack ui appears on top of// the tabs rather than underneat the tabsconstAlternativeNavigation=createAppContainer(<Stackmode="modal"headerMode="none"><Routename="Tabs"><BottomTabs><Routename="Home"path="/"screen={HomeScreen}/><Routename="Profile"path="/profile"><Stack><Routename="ProfileShow"path="/"screen={ProfileScreen}navigationOptions={{title: 'Profile'}}/></Stack></Route></BottomTabs></Route><Routename="Settings"path="/settings"><Stack><Routename="SettingsShow"path="/"screen={SettingsScreen}navigationOptions={{title: 'Settings'}}/><Routename="About"path="/"screen={AboutScreen}navigationOptions={{title: 'About'}}/></Stack></Route></Stack>);
at a glance it may be easier to understand than the alternative of using createXNavigator
I've noticed that people have had a hard time grasping how nesting navigators works in React Navigation, and part of that might be due to the relatively flat appearance of defining navigators with functions and then passing the navigators in as screens to others.
It might be good to provide a library that lets people use a JSX oriented API that gives a more natural sense of nesting. A proof of concept of this can be found here: https://snack.expo.io/@notbrent/dsl
See:
And compare it with
at a glance it may be easier to understand than the alternative of using
createXNavigator