Skip to content

Commit e3d2ce1

Browse files
committed
fix: improve type definitions
1 parent d1ec360 commit e3d2ce1

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

example/src/StackWithTranslucentHeader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ const StackWithTranslucentHeader = createStackNavigator(
227227
},
228228
},
229229
{
230-
defaultNavigationOptions: ({ theme }) => ({
230+
defaultNavigationOptions: ({ theme }: { theme: SupportedThemes }) => ({
231231
headerBackground:
232232
Platform.OS === 'ios' ? (
233233
<BlurView

typescript/react-navigation.d.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ declare module 'react-navigation' {
200200
| Options
201201
| ((
202202
navigationOptionsContainer: NavigationScreenConfigProps<NavigationScreenPropType> & {
203-
navigationOptions: NavigationScreenConfig<Options, NavigationScreenPropType>;
203+
navigationOptions: Options;
204204
}
205205
) => Options);
206206

@@ -439,6 +439,7 @@ declare module 'react-navigation' {
439439
| { screen: NavigationComponent<Options, NavigationScreenPropType> }
440440
| { getScreen(): NavigationScreenComponent<Options, NavigationScreenPropType> }) & {
441441
navigationOptions?: NavigationScreenConfig<Options, NavigationScreenPropType>;
442+
params?: { [key: string]: any }
442443
path?: string;
443444
};
444445

@@ -745,9 +746,9 @@ declare module 'react-navigation' {
745746
} & NavigationInjectedProps
746747
>;
747748

748-
export type CreateNavigatorConfig<NavigatorConfig, RouterConfig, Options> = NavigatorConfig & RouterConfig & {
749-
defaultNavigationOptions?: Options;
750-
navigationOptions?: { [key: string]: any };
749+
export type CreateNavigatorConfig<NavigatorConfig, RouterConfig, Options, NavigationScreenPropType> = NavigatorConfig & RouterConfig & {
750+
defaultNavigationOptions?: NavigationScreenConfig<Options, NavigationScreenPropType>;
751+
navigationOptions?: NavigationScreenConfig<{ [key: string]: any }, NavigationScreenProp<NavigationRoute>>;
751752
}
752753

753754
export function createNavigator<S, Options>(

0 commit comments

Comments
 (0)