question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question: How to navigate in nested navigators?

See original GitHub issue

For example, I have this config:

const secondNavigator = new StateNavigator([
  { key: 'ScreenOne', trackCrumbTrail: true },
  { key: 'ScreenTwo', trackCrumbTrail: true },
]);

const { ScreenOne, ScreenTwo } = secondNavigator.states;

ScreenOne.renderScene = () => <ScreenOneComp />;
ScreenTwo.renderScene = () => <ScreenTwoComp />;


const stateNavigator = new StateNavigator([
  { key: 'MainApp', trackCrumbTrail: true },
  { key: 'nestedApp', trackCrumbTrail: true },
]);

const { MainApp, nestedApp } = stateNavigator.states;

MainApp.renderScene = () => <MainAppComp />;
nestedApp.renderScene = () => (
 <NavigationHandler stateNavigator={secondNavigator}>
    <NavigationStack />
  </NavigationHandler>
);


export default () => (
<NavigationHandler stateNavigator={stateNavigator}>
    <NavigationStack />
  </NavigationHandler>
);

When I navigate to the nested navigator and press back - I get an error that there is nowhere to return to, because in the new navigator the state is empty (and it doesn’t have access to the main navigator?)

I guess I don’t completely understand how the navigator works that why it happens.

Thanks!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
melkayam92commented, Oct 20, 2019

Android and React better, ios less.

0reactions
grahammendickcommented, Oct 20, 2019

Just so that I know, what kind of stuff do you like working on? Android, iOS or React or all three?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to navigate between different nested stacks in react ...
Navigation.navigate now takes one object as the parameter. You set the stack name then navigate to the route within that stack as follows......
Read more >
How to Navigate Between Nested Stacks? · Issue #983 - GitHub
So my question is this: how do you navigate between nested / leaf stacks? Or worded a different way: how do you make...
Read more >
Nesting navigators - React Navigation
Nesting navigators means rendering a navigator inside a screen of another navigator, for example:
Read more >
React Navigation v6 with TypeScript: Nested Navigation
A tutorial on how to set up nested navigation with full type-check for your React app using TypeScript.
Read more >
20 React Navigation Interview Questions and Answers - CLIMB
5. What do you understand by nesting routes in React Navigation? ... Nesting routes refers to the ability to define child routes within...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found