mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 14:20:12 +00:00
Add missing fields required for custom header use in v2.x.
See https://github.com/react-navigation/react-navigation/issues/4286
This commit is contained in:
2
types/react-navigation/index.d.ts
vendored
2
types/react-navigation/index.d.ts
vendored
@@ -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<Params = NavigationParams> {
|
||||
key: string;
|
||||
state: NavigationLeafRoute<Params> | NavigationStateRoute<Params>;
|
||||
navigation: NavigationScreenProp<any>;
|
||||
options: NavigationScreenOptions;
|
||||
getComponent: () => React.ComponentType;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 (
|
||||
<View style={headerStyle}>
|
||||
<Text style={headerTitleStyle}>{title}</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user