Redux and Navigation multiple renderings in one call

0

Hello I was writing because I suggested an error so to speak, the question is that I'm working with Redux and Navigation.

I could make it go from one component to another and go back, the issue is that for example if I'm in HOME (where there is a FlatList where in your render you put a console.log('[IMG]--> '+this.props.radio.imagen) to see in detail when I called the rendering of the elements of the list) and I go from HOME-> SECONDWINDOW when I am in the SECONDWINDOW, the START is re-rendered! and if I press a button of SEGUNDA_VENTANA also re-render the START I do not understand the relationship that there is so that for each action I perform the list is rendered again (I know that within the state of nav there is an arrangement that keeps the stack in this case route [0] = HOME, route [1] = SEGUNDA_VENTANA).

Also if after going to SEGUNDA_VENTANA I return to HOME (leaving route [0] = HOME, route [1] = SEGUNDA_VENTANA, route [2] = HOME) the list is broken, not loading completely (it is necessary to clarify which elements of the list are images obtained from the internet).

The strange thing is that as I stack more items in the navigation there are actions that are executed more than 1 time as it should and all this started when you added the navigation to the app.

I hope you understand the error, if someone could give me an orientation how to solve it would be very helpful, thank you very much.

I leave the Reducer code:

const AppNavigator = StackNavigator(Routes,{headerMode: 'screen'});
const navigateReducer = (state , action) => {
switch (action.type){
    case 'NAVIGATE':
       return AppNavigator.router.getStateForAction(NavigationActions.navigate({ routeName: action.payload, params: action.params }), state);
    case 'BACK_SCREEN':
        return AppNavigator.router.getStateForAction(NavigationActions.back(), state);
    default:
        return AppNavigator.router.getStateForAction(action, state);
};
return state;}
    
asked by Nehuen Pereyra 04.09.2017 в 19:49
source

0 answers