diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index dd9efa0de4..381f2320dd 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -607,6 +607,7 @@ export interface NavigationScene { isStale: boolean; key: string; route: NavigationRoute; + descriptor: NavigationDescriptor; } export interface NavigationTransitionProps { @@ -1058,6 +1059,7 @@ export interface NavigationDescriptor { key: string; state: NavigationLeafRoute | NavigationStateRoute; navigation: NavigationScreenProp; + options: NavigationScreenOptions; getComponent: () => React.ComponentType; } diff --git a/types/react-navigation/react-navigation-tests.tsx b/types/react-navigation/react-navigation-tests.tsx index 9697e61de8..7563708163 100644 --- a/types/react-navigation/react-navigation-tests.tsx +++ b/types/react-navigation/react-navigation-tests.tsx @@ -1,5 +1,6 @@ import * as React from 'react'; import { + Text, TouchableOpacity, View, ViewStyle, @@ -469,3 +470,22 @@ const BottomStack = createBottomTabNavigator({ } } }); + +const CustomHeaderStack = createStackNavigator({ + Page1: { screen: Page1 }, + Page2: { screen: Page2 } +}, +{ + navigationOptions: { + header: headerProps => { + const { scene } = headerProps; + const { options } = scene.descriptor; + const { title, headerStyle, headerTitleStyle } = options; + return ( + + {title} + + ); + } + } +});