satya164/react-navigation-addons

Support for Nested Navigators?

joncursi opened this issue · 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.

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

ghuh commented

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)

Will this be fixed anytime soon?

nkov commented

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