Developers Notes

My Journey as Software Architect

react-navigation, navigate to same screen with different params

If you have some screen like blog post, and you have a related news, you can navigate using this

             const navigateAction = NavigationActions.navigate({
                 routeName: 'APage',
            
                params: {
                     title: title,
                     name: 'APage',
                 },
                 key: 'APage' + APageUUID
            });
            
            this.props.navigation.dispatch(navigateAction);

or

            this.props.navigation.navigate({
                routeName: 'APage',
                params: {
                    title: title,
                    name: 'APage',
                },
                key: 'APage' + APageUUID
            })

 

References:

Cannot navigate to same route with different params · Issue #2882 · react-navigation/react-navigation
https://github.com/react-navigation/react-navigation/issues/2882

Using the navigation key · React Navigation
https://reactnavigation.org/docs/en/navigation-key.html#usage-with-the-navigate-navigation-actionshtml-navigate-call