reactjs - The navigation reducer is not called while navigating -


i trying achive nested navigation using reactnavigation have reducer following below :

import appnavigation '../navigation/appnavigation'  export const reducer = (state, action) => {   const newstate = appnavigation.router.getstateforaction(action, state)    console.log("reducer running")        return nextstate || state; } 

from 1 of screen trying navigate screen using

this.props.navigation.navigate('orderpreviewassigned')

i can see dispatch action in console reducer not getting triggered.

console output : enter image description here

ps : reason trying achieve because i want prevent navigating twice when clicking button quickly , plan read current route , if route different navigate or don't.

it looks have not set redux integration correctly react navigation. need pass state , dispatch main appnavigator so:

import { addnavigationhelpers } 'react-navigation';  const appnavigator = stacknavigator(approuteconfigs);  class app extends react.component {   render() {     return (       <appnavigator navigation={addnavigationhelpers({         dispatch: this.props.dispatch,         state: this.props.nav,       })} />     );   } } 

see redux integration docs react navigation more info , working example: https://reactnavigation.org/docs/guides/redux


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -