I'm having problem in implementing goBack
function in React-navigation/drawer 6 ("@react-navigation/drawer": "^6.1.4", precisely).
I was able to perfectly achieve it in react-navigation/drawer 5 with the following codes:
<Drawer.Navigator>
<Drawer.Screen
....
options={{
header: ({ scene }) => {
const { options } = scene.descriptor;
const title = options.headerTitle;
return (
<MyHeader
title={title}
iconName={"menu"}
goback={() => scene.descriptor.navigation.goBack()}
/>
);
},
}}
/>
</Drawer.Navigator>
The same revised codes for react-navigation/drawer 6 (as shown below) will take me back to the initial screen (and not on previous screen). It will also give a warning and error message.
<Drawer.Navigator>
<Drawer.Screen
....
options={{
header: ({ navigation, route, options }) => {
const title = getHeaderTitle(options, route.name);
return (
<MyHeader
title={title}
iconName={"menu"}
goback={() => navigation.goBack()}
/>
);
},
}}
/>
</Drawer.Navigator>
Please, how can I achieve this 'goBack' in react-navigation/drawer 6?