fix: provide correct context to drawe header

This commit is contained in:
Satyajit Sahoo
2020-11-09 20:37:26 +01:00
parent 151055cf5a
commit 18bbd177d9

View File

@@ -10,6 +10,8 @@ import {
import { ScreenContainer } from 'react-native-screens';
import {
NavigationHelpersContext,
NavigationContext,
NavigationRouteContext,
DrawerNavigationState,
DrawerActions,
useTheme,
@@ -184,12 +186,16 @@ export default function DrawerView({
isVisible={isFocused}
enabled={detachInactiveScreens}
>
{headerShown
? header({
layout: dimensions,
scene: { route, descriptor },
})
: null}
{headerShown ? (
<NavigationContext.Provider value={descriptor.navigation}>
<NavigationRouteContext.Provider value={route}>
{header({
layout: dimensions,
scene: { route, descriptor },
})}
</NavigationRouteContext.Provider>
</NavigationContext.Provider>
) : null}
{descriptor.render()}
</ResourceSavingScene>
);