Skip to content
This repository has been archived by the owner on Feb 25, 2020. It is now read-only.

feat: typescript generic navigation params #310

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions scripts/stack.patch
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ diff -ruN node_modules/@react-navigation/stack/src/types.tsx src/vendor/types.ts

export type StackNavigationEventMap = {
/**
@@ -26,42 +41,29 @@
@@ -26,42 +41,30 @@
transitionEnd: { closing: boolean };
};

Expand Down Expand Up @@ -218,16 +218,17 @@ diff -ruN node_modules/@react-navigation/stack/src/types.tsx src/vendor/types.ts
- */
- popToTop(): void;
+State = NavigationRoute,
+Params = NavigationParams
+> = NavigationScreenProp<State, Params> & {
+Params = NavigationParams,
+NextParams = NavigationParams
+> = NavigationScreenProp<State, Params, NextParams> & {
+ push: (
+ routeName: string,
+ params?: NavigationParams,
+ params?: NextParams,
+ action?: NavigationNavigateAction
+ ) => boolean;
+ replace: (
+ routeName: string,
+ params?: NavigationParams,
+ params?: NextParams,
+ action?: NavigationNavigateAction
+ ) => boolean;
+ reset: (actions: NavigationAction[], index: number) => boolean;
Expand Down
5 changes: 3 additions & 2 deletions src/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ import { StackNavigationProp, StackNavigationOptions } from './vendor/types';

export type NavigationStackScreenProps<
Params = NavigationParams,
ScreenProps = unknown
ScreenProps = unknown,
NextParams = NavigationParams
> = {
theme: SupportedThemes;
navigation: StackNavigationProp<NavigationRoute, Params>;
navigation: StackNavigationProp<NavigationRoute, Params, NextParams>;
screenProps: ScreenProps;
};

Expand Down