1

I want to send params with goBack function in react navigation. Here is my code:

const onSelectClick = () => {
        props.navigation.goBack({ permissionId: value.id, permissionName: value.name })}

What I get is just undefined.

Faizan Mubasher
  • 4,427
  • 11
  • 45
  • 81
M. Aleem
  • 21
  • 5

1 Answers1

0
    navigation.dispatch(state => {
        const prevRoute = state.routes[state.routes.length - 2];
        return CommonActions.navigate({
            name: prevRoute.name,
            params: {
                
            },
            merge: true,
         });
     });

This is for 6.x react navigation, probably will work in 7.x as well. This emulates goBack(params); No need for passing previousScreen as parametar.

Mladen Skrbic
  • 154
  • 2
  • 12