react-navigation-addons icon indicating copy to clipboard operation
react-navigation-addons copied to clipboard

Support for Nested Navigators?

Open joncursi opened this issue 8 years ago • 4 comments

If I have a single stack Navigator, I don't get any runtime issues:

const SingleNavigator = enhance(StackNavigator)({
  ...
});

export default SingleNavigator;

But when I have multiple navigators nested, such as:

const AnotherNavigator = StackNavigator({
  ...
});

const MainNavigator = enhance(StackNavigator)({
  ...
  [key]: { screen: AnotherNavigator },
});

export default MainNavigator;

When I try to load up a route provided by AnotherNavigator I get the following runtime error:

screen shot 2017-04-09 at 2 32 21 pm

I tried wrapping just the main navigator in enhance, both navigators in enhance, but they produce the same error.

joncursi avatar Apr 09 '17 18:04 joncursi

Can you try master and see if it still happens? Note that master compatible with react-navigation alpha.8

satya164 avatar Apr 21 '17 18:04 satya164

I can confirm this is an issue on the latest master on both react-navigation (afe3c2be9ee1ada8ba37d2ccaed5a5f242e5ea07) and react-navigation-addons (9c58d89300d78ce0c42219d9ad5e304e8f3e6783).

I tried the obvious fix of checking if nextState.routes is defined before calling .forEach on it but that results in the following error:

Invariant Violation: there should always be only one scene active, not 0.
    at invariant (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:3193:15)
    at ScenesReducer (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:70758:27)
    at new Transitioner (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:70429:43)
    at http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:21515:18
    at measureLifeCyclePerf (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:21339:12)
    at ReactCompositeComponentWrapper._constructComponentWithoutOwner (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:21514:16)
    at ReactCompositeComponentWrapper._constructComponent (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:21500:21)
    at ReactCompositeComponentWrapper.mountComponent (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:21393:21)
    at Object.mountComponent (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:17765:35)
    at ReactCompositeComponentWrapper.performInitialMount (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:21566:34)

ghuh avatar Apr 22 '17 05:04 ghuh

Will this be fixed anytime soon?

jeffpc1993 avatar Sep 18 '17 21:09 jeffpc1993

+1, when using enhance on a StackNavigator I experience this issue

nkov avatar Jan 26 '18 09:01 nkov