Invariant violation: calling a pop route for a route that doesn't exist
I am using NavigatorIOS, and when the props that I pass to the initial re-route, I try to update them by dropping the component you find below with the new updated props in "componentWillReceiveProps".
componentWillReceiveProps: function(nextProps) {
this.refs.navigator.resetTo({
title: 'Home',
component: search,
backButtonTitle: 'Back',
passProps: {
api: nextProps.api,
slug: nextProps.slug
}
});
}
I'm sure I'm not getting the route right, but to be honest, I haven't found any helpful resource regarding this issue.
Replace () does the job of updating the props, but I also want it to popToTop (). Replace and ResetTo take the route object, so I don't understand why replace () works and resetTo () is giving me this error.
This is my NavigatorIOS:
<NavigatorIOS
ref='navigator'
initialRoute={
{
title: 'Home',
component: search,
backButtonTitle: 'Back',
passProps: {
api: this.props.api,
slug: this.props.slug
}
}
}
/>
source to share
Try using more tame, but less limited React.Navigator
and β¦navigator.immediatelyResetRouteStack()
.
See the Navigator docs https://facebook.github.io/react-native/docs/navigator.html
source to share