react-router-native
react-router-native copied to clipboard
Unnecessary warning: An <IndexRoute> is not allowed for <TabsRoute>?
This project contains components that are currently under active development and considered experimental. If it is something you can debug and fix, please consider submitting a pull request instead!
Version
Dependency | Version |
---|---|
react-router-native | 2.0.0-beta.0 |
react-router | 3.0.0 |
react-native | 0.37.0 |
Expected Behavior
First of all, thank you for creating this library and sharing with the community.
We are migrating from the react-router-native-flux
library. I have an IndexRoute in a TabsRoute that sets the initial active route, similar to an IndexRedirect
from react-router.
const to = (value) => (nextState, replace) => replace(value);
...
<TabsRoute path={routes.default} component={TabBarNavigation} >
<IndexRoute onEnter={to(routes.cart)} />
<Route path={routes.cart} component={CartContainer} />
<Route path={routes.shop} component={Shop} />
<Route path={routes.account} component={Account} />
</TabsRoute>
The IndexRoute
definition is working just fine, except I am seeing a warning:
Warning: An <IndexRoute> is not allowed for <TabsRoute>
Actual Behavior
I believe an IndexRoute should continue to work in this configuration, but with no warning.
Steps to Reproduce
See router configuration above.
we try indexRoute in stackRoute but it not work .props.children is undefine