Page MenuHomePhabricator

D5402.diff
No OneTemporary

D5402.diff

diff --git a/native/chat/chat-router.js b/native/chat/chat-router.js
--- a/native/chat/chat-router.js
+++ b/native/chat/chat-router.js
@@ -1,8 +1,6 @@
// @flow
import type {
- StackNavigationProp,
- ParamListBase,
StackAction,
Route,
Router,
@@ -62,11 +60,7 @@
| ClearThreadsAction
| PushNewThreadAction;
-export type ChatRouterNavigationProp<
- ParamList: ParamListBase = ParamListBase,
- RouteName: string = string,
-> = {
- ...StackNavigationProp<ParamList, RouteName>,
+export type ChatRouterNavigationHelpers = {
+clearScreens: (routeNames: $ReadOnlyArray<string>) => void,
+replaceWithThread: (threadInfo: ThreadInfo) => void,
+clearThreads: (threadIDs: $ReadOnlyArray<string>) => void,
diff --git a/native/chat/chat.react.js b/native/chat/chat.react.js
--- a/native/chat/chat.react.js
+++ b/native/chat/chat.react.js
@@ -13,6 +13,9 @@
type StackNavigatorProps,
type ExtraStackNavigatorProps,
type StackHeaderProps as CoreStackHeaderProps,
+ type StackNavigationProp,
+ type StackNavigationHelpers,
+ type ParamListBase,
} from '@react-navigation/native';
import { StackView, type StackHeaderProps } from '@react-navigation/stack';
import invariant from 'invariant';
@@ -47,7 +50,7 @@
import { useColors, useStyles } from '../themes/colors';
import BackgroundChatThreadList from './background-chat-thread-list.react';
import ChatHeader from './chat-header.react';
-import ChatRouter, { type ChatRouterNavigationProp } from './chat-router';
+import ChatRouter, { type ChatRouterNavigationHelpers } from './chat-router';
import ComposeSubchannel from './compose-subchannel.react';
import ComposeThreadButton from './compose-thread-button.react';
import HomeChatThreadList from './home-chat-thread-list.react';
@@ -131,7 +134,12 @@
);
}
-type ChatNavigatorProps = StackNavigatorProps<ChatRouterNavigationProp<>>;
+export type ChatNavigationHelpers<ParamList: ParamListBase = ParamListBase> = {
+ ...$Exact<StackNavigationHelpers<ParamList>>,
+ ...ChatRouterNavigationHelpers,
+};
+
+type ChatNavigatorProps = StackNavigatorProps<ChatNavigationHelpers<>>;
function ChatNavigator({
initialRouteName,
children,
@@ -174,7 +182,7 @@
StackNavigationState,
StackOptions,
StackNavigationEventMap,
- ChatRouterNavigationProp<>,
+ ChatNavigationHelpers<>,
ExtraStackNavigatorProps,
>(ChatNavigator);
@@ -248,12 +256,15 @@
export type ChatNavigationProp<
RouteName: $Keys<ChatParamList> = $Keys<ChatParamList>,
-> = ChatRouterNavigationProp<ScreenParamList, RouteName>;
+> = {
+ ...StackNavigationProp<ScreenParamList, RouteName>,
+ ...ChatRouterNavigationHelpers,
+};
const Chat = createChatNavigator<
ScreenParamList,
ChatParamList,
- ChatNavigationProp<>,
+ ChatNavigationHelpers<ScreenParamList>,
>();
// eslint-disable-next-line no-unused-vars
export default function ChatComponent(props: { ... }): React.Node {
diff --git a/native/flow-typed/npm/@react-navigation/bottom-tabs_v5.x.x.js b/native/flow-typed/npm/@react-navigation/bottom-tabs_v5.x.x.js
--- a/native/flow-typed/npm/@react-navigation/bottom-tabs_v5.x.x.js
+++ b/native/flow-typed/npm/@react-navigation/bottom-tabs_v5.x.x.js
@@ -855,7 +855,7 @@
>,
) => void;
- declare type NavigationHelpers<
+ declare type CoreNavigationHelpers<
ParamList: ParamListBase,
State: PossiblyStaleNavigationState = PossiblyStaleNavigationState,
EventMap: EventMapBase = EventMapCore<State>,
@@ -887,6 +887,19 @@
...
};
+ declare export type NavigationHelpers<
+ ParamList: ParamListBase,
+ State: PossiblyStaleNavigationState = PossiblyStaleNavigationState,
+ EventMap: EventMapBase = EventMapCore<State>,
+ > = {
+ ...$Exact<CoreNavigationHelpers<
+ ParamList,
+ State,
+ EventMap,
+ >>,
+ ...
+ };
+
declare type SetParamsInput<
ParamList: ParamListBase,
RouteName: $Keys<ParamList> = $Keys<ParamList>,
@@ -903,7 +916,7 @@
ScreenOptions: {...} = {...},
EventMap: EventMapBase = EventMapCore<State>,
> = {
- ...$Exact<NavigationHelpers<
+ ...$Exact<CoreNavigationHelpers<
ParamList,
State,
EventMap,
@@ -1243,7 +1256,7 @@
*/
declare export type StackDescriptor = Descriptor<
- StackNavigationProp<>,
+ StackNavigationHelpers<>,
StackOptions,
>;
@@ -1263,7 +1276,7 @@
+insets: EdgeInsets,
+scene: Scene<Route<>>,
+previous?: Scene<Route<>>,
- +navigation: StackNavigationProp<ParamListBase>,
+ +navigation: StackNavigationHelpers<ParamListBase>,
+styleInterpolator: StackHeaderStyleInterpolator,
|};
@@ -1354,23 +1367,25 @@
+gestureCancel: {| +data: void, +canPreventDefault: false |},
|};
- declare type InexactStackNavigationProp<
+ declare type StackExtraNavigationHelpers<
+ ParamList: ParamListBase = ParamListBase,
+ > = {|
+ +replace: SimpleNavigate<ParamList>,
+ +push: SimpleNavigate<ParamList>,
+ +pop: (count?: number) => void,
+ +popToTop: () => void,
+ |};
+
+ declare export type StackNavigationHelpers<
ParamList: ParamListBase = ParamListBase,
- RouteName: $Keys<ParamList> = $Keys<ParamList>,
- Options: {...} = StackOptions,
EventMap: EventMapBase = StackNavigationEventMap,
> = {
- ...$Exact<NavigationProp<
+ ...$Exact<NavigationHelpers<
ParamList,
- RouteName,
StackNavigationState,
- Options,
EventMap,
>>,
- +replace: SimpleNavigate<ParamList>,
- +push: SimpleNavigate<ParamList>,
- +pop: (count?: number) => void,
- +popToTop: () => void,
+ ...StackExtraNavigationHelpers<ParamList>,
...
};
@@ -1379,12 +1394,16 @@
RouteName: $Keys<ParamList> = $Keys<ParamList>,
Options: {...} = StackOptions,
EventMap: EventMapBase = StackNavigationEventMap,
- > = $Exact<InexactStackNavigationProp<
- ParamList,
- RouteName,
- Options,
- EventMap,
- >>;
+ > = {|
+ ...$Exact<NavigationProp<
+ ParamList,
+ RouteName,
+ StackNavigationState,
+ Options,
+ EventMap,
+ >>,
+ ...StackExtraNavigationHelpers<ParamList>,
+ |};
/**
* Miscellaneous stack exports
@@ -1404,10 +1423,10 @@
|};
declare export type StackNavigatorProps<
- NavProp: InexactStackNavigationProp<> = StackNavigationProp<>,
+ NavHelpers: StackNavigationHelpers<> = StackNavigationHelpers<>,
> = {|
...ExtraStackNavigatorProps,
- ...ScreenOptionsProp<StackOptions, NavProp>,
+ ...ScreenOptionsProp<StackOptions, NavHelpers>,
|};
/**
diff --git a/native/flow-typed/npm/@react-navigation/devtools_v5.x.x.js b/native/flow-typed/npm/@react-navigation/devtools_v5.x.x.js
--- a/native/flow-typed/npm/@react-navigation/devtools_v5.x.x.js
+++ b/native/flow-typed/npm/@react-navigation/devtools_v5.x.x.js
@@ -855,7 +855,7 @@
>,
) => void;
- declare type NavigationHelpers<
+ declare type CoreNavigationHelpers<
ParamList: ParamListBase,
State: PossiblyStaleNavigationState = PossiblyStaleNavigationState,
EventMap: EventMapBase = EventMapCore<State>,
@@ -887,6 +887,19 @@
...
};
+ declare export type NavigationHelpers<
+ ParamList: ParamListBase,
+ State: PossiblyStaleNavigationState = PossiblyStaleNavigationState,
+ EventMap: EventMapBase = EventMapCore<State>,
+ > = {
+ ...$Exact<CoreNavigationHelpers<
+ ParamList,
+ State,
+ EventMap,
+ >>,
+ ...
+ };
+
declare type SetParamsInput<
ParamList: ParamListBase,
RouteName: $Keys<ParamList> = $Keys<ParamList>,
@@ -903,7 +916,7 @@
ScreenOptions: {...} = {...},
EventMap: EventMapBase = EventMapCore<State>,
> = {
- ...$Exact<NavigationHelpers<
+ ...$Exact<CoreNavigationHelpers<
ParamList,
State,
EventMap,
@@ -1243,7 +1256,7 @@
*/
declare export type StackDescriptor = Descriptor<
- StackNavigationProp<>,
+ StackNavigationHelpers<>,
StackOptions,
>;
@@ -1263,7 +1276,7 @@
+insets: EdgeInsets,
+scene: Scene<Route<>>,
+previous?: Scene<Route<>>,
- +navigation: StackNavigationProp<ParamListBase>,
+ +navigation: StackNavigationHelpers<ParamListBase>,
+styleInterpolator: StackHeaderStyleInterpolator,
|};
@@ -1354,23 +1367,25 @@
+gestureCancel: {| +data: void, +canPreventDefault: false |},
|};
- declare type InexactStackNavigationProp<
+ declare type StackExtraNavigationHelpers<
+ ParamList: ParamListBase = ParamListBase,
+ > = {|
+ +replace: SimpleNavigate<ParamList>,
+ +push: SimpleNavigate<ParamList>,
+ +pop: (count?: number) => void,
+ +popToTop: () => void,
+ |};
+
+ declare export type StackNavigationHelpers<
ParamList: ParamListBase = ParamListBase,
- RouteName: $Keys<ParamList> = $Keys<ParamList>,
- Options: {...} = StackOptions,
EventMap: EventMapBase = StackNavigationEventMap,
> = {
- ...$Exact<NavigationProp<
+ ...$Exact<NavigationHelpers<
ParamList,
- RouteName,
StackNavigationState,
- Options,
EventMap,
>>,
- +replace: SimpleNavigate<ParamList>,
- +push: SimpleNavigate<ParamList>,
- +pop: (count?: number) => void,
- +popToTop: () => void,
+ ...StackExtraNavigationHelpers<ParamList>,
...
};
@@ -1379,12 +1394,16 @@
RouteName: $Keys<ParamList> = $Keys<ParamList>,
Options: {...} = StackOptions,
EventMap: EventMapBase = StackNavigationEventMap,
- > = $Exact<InexactStackNavigationProp<
- ParamList,
- RouteName,
- Options,
- EventMap,
- >>;
+ > = {|
+ ...$Exact<NavigationProp<
+ ParamList,
+ RouteName,
+ StackNavigationState,
+ Options,
+ EventMap,
+ >>,
+ ...StackExtraNavigationHelpers<ParamList>,
+ |};
/**
* Miscellaneous stack exports
@@ -1404,10 +1423,10 @@
|};
declare export type StackNavigatorProps<
- NavProp: InexactStackNavigationProp<> = StackNavigationProp<>,
+ NavHelpers: StackNavigationHelpers<> = StackNavigationHelpers<>,
> = {|
...ExtraStackNavigatorProps,
- ...ScreenOptionsProp<StackOptions, NavProp>,
+ ...ScreenOptionsProp<StackOptions, NavHelpers>,
|};
/**
diff --git a/native/flow-typed/npm/@react-navigation/material-top-tabs_v5.x.x.js b/native/flow-typed/npm/@react-navigation/material-top-tabs_v5.x.x.js
--- a/native/flow-typed/npm/@react-navigation/material-top-tabs_v5.x.x.js
+++ b/native/flow-typed/npm/@react-navigation/material-top-tabs_v5.x.x.js
@@ -855,7 +855,7 @@
>,
) => void;
- declare type NavigationHelpers<
+ declare type CoreNavigationHelpers<
ParamList: ParamListBase,
State: PossiblyStaleNavigationState = PossiblyStaleNavigationState,
EventMap: EventMapBase = EventMapCore<State>,
@@ -887,6 +887,19 @@
...
};
+ declare export type NavigationHelpers<
+ ParamList: ParamListBase,
+ State: PossiblyStaleNavigationState = PossiblyStaleNavigationState,
+ EventMap: EventMapBase = EventMapCore<State>,
+ > = {
+ ...$Exact<CoreNavigationHelpers<
+ ParamList,
+ State,
+ EventMap,
+ >>,
+ ...
+ };
+
declare type SetParamsInput<
ParamList: ParamListBase,
RouteName: $Keys<ParamList> = $Keys<ParamList>,
@@ -903,7 +916,7 @@
ScreenOptions: {...} = {...},
EventMap: EventMapBase = EventMapCore<State>,
> = {
- ...$Exact<NavigationHelpers<
+ ...$Exact<CoreNavigationHelpers<
ParamList,
State,
EventMap,
@@ -1243,7 +1256,7 @@
*/
declare export type StackDescriptor = Descriptor<
- StackNavigationProp<>,
+ StackNavigationHelpers<>,
StackOptions,
>;
@@ -1263,7 +1276,7 @@
+insets: EdgeInsets,
+scene: Scene<Route<>>,
+previous?: Scene<Route<>>,
- +navigation: StackNavigationProp<ParamListBase>,
+ +navigation: StackNavigationHelpers<ParamListBase>,
+styleInterpolator: StackHeaderStyleInterpolator,
|};
@@ -1354,23 +1367,25 @@
+gestureCancel: {| +data: void, +canPreventDefault: false |},
|};
- declare type InexactStackNavigationProp<
+ declare type StackExtraNavigationHelpers<
+ ParamList: ParamListBase = ParamListBase,
+ > = {|
+ +replace: SimpleNavigate<ParamList>,
+ +push: SimpleNavigate<ParamList>,
+ +pop: (count?: number) => void,
+ +popToTop: () => void,
+ |};
+
+ declare export type StackNavigationHelpers<
ParamList: ParamListBase = ParamListBase,
- RouteName: $Keys<ParamList> = $Keys<ParamList>,
- Options: {...} = StackOptions,
EventMap: EventMapBase = StackNavigationEventMap,
> = {
- ...$Exact<NavigationProp<
+ ...$Exact<NavigationHelpers<
ParamList,
- RouteName,
StackNavigationState,
- Options,
EventMap,
>>,
- +replace: SimpleNavigate<ParamList>,
- +push: SimpleNavigate<ParamList>,
- +pop: (count?: number) => void,
- +popToTop: () => void,
+ ...StackExtraNavigationHelpers<ParamList>,
...
};
@@ -1379,12 +1394,16 @@
RouteName: $Keys<ParamList> = $Keys<ParamList>,
Options: {...} = StackOptions,
EventMap: EventMapBase = StackNavigationEventMap,
- > = $Exact<InexactStackNavigationProp<
- ParamList,
- RouteName,
- Options,
- EventMap,
- >>;
+ > = {|
+ ...$Exact<NavigationProp<
+ ParamList,
+ RouteName,
+ StackNavigationState,
+ Options,
+ EventMap,
+ >>,
+ ...StackExtraNavigationHelpers<ParamList>,
+ |};
/**
* Miscellaneous stack exports
@@ -1404,10 +1423,10 @@
|};
declare export type StackNavigatorProps<
- NavProp: InexactStackNavigationProp<> = StackNavigationProp<>,
+ NavHelpers: StackNavigationHelpers<> = StackNavigationHelpers<>,
> = {|
...ExtraStackNavigatorProps,
- ...ScreenOptionsProp<StackOptions, NavProp>,
+ ...ScreenOptionsProp<StackOptions, NavHelpers>,
|};
/**
diff --git a/native/flow-typed/npm/@react-navigation/native_v5.x.x.js b/native/flow-typed/npm/@react-navigation/native_v5.x.x.js
--- a/native/flow-typed/npm/@react-navigation/native_v5.x.x.js
+++ b/native/flow-typed/npm/@react-navigation/native_v5.x.x.js
@@ -855,7 +855,7 @@
>,
) => void;
- declare type NavigationHelpers<
+ declare type CoreNavigationHelpers<
ParamList: ParamListBase,
State: PossiblyStaleNavigationState = PossiblyStaleNavigationState,
EventMap: EventMapBase = EventMapCore<State>,
@@ -887,6 +887,19 @@
...
};
+ declare export type NavigationHelpers<
+ ParamList: ParamListBase,
+ State: PossiblyStaleNavigationState = PossiblyStaleNavigationState,
+ EventMap: EventMapBase = EventMapCore<State>,
+ > = {
+ ...$Exact<CoreNavigationHelpers<
+ ParamList,
+ State,
+ EventMap,
+ >>,
+ ...
+ };
+
declare type SetParamsInput<
ParamList: ParamListBase,
RouteName: $Keys<ParamList> = $Keys<ParamList>,
@@ -903,7 +916,7 @@
ScreenOptions: {...} = {...},
EventMap: EventMapBase = EventMapCore<State>,
> = {
- ...$Exact<NavigationHelpers<
+ ...$Exact<CoreNavigationHelpers<
ParamList,
State,
EventMap,
@@ -1243,7 +1256,7 @@
*/
declare export type StackDescriptor = Descriptor<
- StackNavigationProp<>,
+ StackNavigationHelpers<>,
StackOptions,
>;
@@ -1263,7 +1276,7 @@
+insets: EdgeInsets,
+scene: Scene<Route<>>,
+previous?: Scene<Route<>>,
- +navigation: StackNavigationProp<ParamListBase>,
+ +navigation: StackNavigationHelpers<ParamListBase>,
+styleInterpolator: StackHeaderStyleInterpolator,
|};
@@ -1354,23 +1367,25 @@
+gestureCancel: {| +data: void, +canPreventDefault: false |},
|};
- declare type InexactStackNavigationProp<
+ declare type StackExtraNavigationHelpers<
+ ParamList: ParamListBase = ParamListBase,
+ > = {|
+ +replace: SimpleNavigate<ParamList>,
+ +push: SimpleNavigate<ParamList>,
+ +pop: (count?: number) => void,
+ +popToTop: () => void,
+ |};
+
+ declare export type StackNavigationHelpers<
ParamList: ParamListBase = ParamListBase,
- RouteName: $Keys<ParamList> = $Keys<ParamList>,
- Options: {...} = StackOptions,
EventMap: EventMapBase = StackNavigationEventMap,
> = {
- ...$Exact<NavigationProp<
+ ...$Exact<NavigationHelpers<
ParamList,
- RouteName,
StackNavigationState,
- Options,
EventMap,
>>,
- +replace: SimpleNavigate<ParamList>,
- +push: SimpleNavigate<ParamList>,
- +pop: (count?: number) => void,
- +popToTop: () => void,
+ ...StackExtraNavigationHelpers<ParamList>,
...
};
@@ -1379,12 +1394,16 @@
RouteName: $Keys<ParamList> = $Keys<ParamList>,
Options: {...} = StackOptions,
EventMap: EventMapBase = StackNavigationEventMap,
- > = $Exact<InexactStackNavigationProp<
- ParamList,
- RouteName,
- Options,
- EventMap,
- >>;
+ > = {|
+ ...$Exact<NavigationProp<
+ ParamList,
+ RouteName,
+ StackNavigationState,
+ Options,
+ EventMap,
+ >>,
+ ...StackExtraNavigationHelpers<ParamList>,
+ |};
/**
* Miscellaneous stack exports
@@ -1404,10 +1423,10 @@
|};
declare export type StackNavigatorProps<
- NavProp: InexactStackNavigationProp<> = StackNavigationProp<>,
+ NavHelpers: StackNavigationHelpers<> = StackNavigationHelpers<>,
> = {|
...ExtraStackNavigatorProps,
- ...ScreenOptionsProp<StackOptions, NavProp>,
+ ...ScreenOptionsProp<StackOptions, NavHelpers>,
|};
/**
diff --git a/native/flow-typed/npm/@react-navigation/stack_v5.x.x.js b/native/flow-typed/npm/@react-navigation/stack_v5.x.x.js
--- a/native/flow-typed/npm/@react-navigation/stack_v5.x.x.js
+++ b/native/flow-typed/npm/@react-navigation/stack_v5.x.x.js
@@ -855,7 +855,7 @@
>,
) => void;
- declare type NavigationHelpers<
+ declare type CoreNavigationHelpers<
ParamList: ParamListBase,
State: PossiblyStaleNavigationState = PossiblyStaleNavigationState,
EventMap: EventMapBase = EventMapCore<State>,
@@ -887,6 +887,19 @@
...
};
+ declare export type NavigationHelpers<
+ ParamList: ParamListBase,
+ State: PossiblyStaleNavigationState = PossiblyStaleNavigationState,
+ EventMap: EventMapBase = EventMapCore<State>,
+ > = {
+ ...$Exact<CoreNavigationHelpers<
+ ParamList,
+ State,
+ EventMap,
+ >>,
+ ...
+ };
+
declare type SetParamsInput<
ParamList: ParamListBase,
RouteName: $Keys<ParamList> = $Keys<ParamList>,
@@ -903,7 +916,7 @@
ScreenOptions: {...} = {...},
EventMap: EventMapBase = EventMapCore<State>,
> = {
- ...$Exact<NavigationHelpers<
+ ...$Exact<CoreNavigationHelpers<
ParamList,
State,
EventMap,
@@ -1243,7 +1256,7 @@
*/
declare export type StackDescriptor = Descriptor<
- StackNavigationProp<>,
+ StackNavigationHelpers<>,
StackOptions,
>;
@@ -1263,7 +1276,7 @@
+insets: EdgeInsets,
+scene: Scene<Route<>>,
+previous?: Scene<Route<>>,
- +navigation: StackNavigationProp<ParamListBase>,
+ +navigation: StackNavigationHelpers<ParamListBase>,
+styleInterpolator: StackHeaderStyleInterpolator,
|};
@@ -1354,23 +1367,25 @@
+gestureCancel: {| +data: void, +canPreventDefault: false |},
|};
- declare type InexactStackNavigationProp<
+ declare type StackExtraNavigationHelpers<
+ ParamList: ParamListBase = ParamListBase,
+ > = {|
+ +replace: SimpleNavigate<ParamList>,
+ +push: SimpleNavigate<ParamList>,
+ +pop: (count?: number) => void,
+ +popToTop: () => void,
+ |};
+
+ declare export type StackNavigationHelpers<
ParamList: ParamListBase = ParamListBase,
- RouteName: $Keys<ParamList> = $Keys<ParamList>,
- Options: {...} = StackOptions,
EventMap: EventMapBase = StackNavigationEventMap,
> = {
- ...$Exact<NavigationProp<
+ ...$Exact<NavigationHelpers<
ParamList,
- RouteName,
StackNavigationState,
- Options,
EventMap,
>>,
- +replace: SimpleNavigate<ParamList>,
- +push: SimpleNavigate<ParamList>,
- +pop: (count?: number) => void,
- +popToTop: () => void,
+ ...StackExtraNavigationHelpers<ParamList>,
...
};
@@ -1379,12 +1394,16 @@
RouteName: $Keys<ParamList> = $Keys<ParamList>,
Options: {...} = StackOptions,
EventMap: EventMapBase = StackNavigationEventMap,
- > = $Exact<InexactStackNavigationProp<
- ParamList,
- RouteName,
- Options,
- EventMap,
- >>;
+ > = {|
+ ...$Exact<NavigationProp<
+ ParamList,
+ RouteName,
+ StackNavigationState,
+ Options,
+ EventMap,
+ >>,
+ ...StackExtraNavigationHelpers<ParamList>,
+ |};
/**
* Miscellaneous stack exports
@@ -1404,10 +1423,10 @@
|};
declare export type StackNavigatorProps<
- NavProp: InexactStackNavigationProp<> = StackNavigationProp<>,
+ NavHelpers: StackNavigationHelpers<> = StackNavigationHelpers<>,
> = {|
...ExtraStackNavigatorProps,
- ...ScreenOptionsProp<StackOptions, NavProp>,
+ ...ScreenOptionsProp<StackOptions, NavHelpers>,
|};
/**
@@ -2139,7 +2158,7 @@
declare export var StackView: React$ComponentType<{|
...StackNavigationConfig,
+state: StackNavigationState,
- +navigation: StackNavigationProp<>,
+ +navigation: StackNavigationHelpers<>,
+descriptors: {| +[key: string]: StackDescriptor |},
|}>;
diff --git a/native/navigation/app-navigator.react.js b/native/navigation/app-navigator.react.js
--- a/native/navigation/app-navigator.react.js
+++ b/native/navigation/app-navigator.react.js
@@ -30,7 +30,10 @@
import { waitForInteractions } from '../utils/timers';
import ActionResultModal from './action-result-modal.react';
import { createOverlayNavigator } from './overlay-navigator.react';
-import type { OverlayRouterNavigationProp } from './overlay-router';
+import type {
+ OverlayNavigationProp,
+ OverlayNavigationHelpers,
+} from './overlay-navigator.react';
import type { RootNavigationProp } from './root-navigator.react';
import {
CalendarRouteName,
@@ -147,12 +150,12 @@
export type AppNavigationProp<
RouteName: $Keys<OverlayParamList> = $Keys<OverlayParamList>,
-> = OverlayRouterNavigationProp<ScreenParamList, RouteName>;
+> = OverlayNavigationProp<ScreenParamList, RouteName>;
const App = createOverlayNavigator<
ScreenParamList,
OverlayParamList,
- AppNavigationProp<>,
+ OverlayNavigationHelpers<ScreenParamList>,
>();
type AppNavigatorProps = {
navigation: RootNavigationProp<'App'>,
diff --git a/native/navigation/overlay-navigator.react.js b/native/navigation/overlay-navigator.react.js
--- a/native/navigation/overlay-navigator.react.js
+++ b/native/navigation/overlay-navigator.react.js
@@ -5,6 +5,9 @@
NavigatorPropsBase,
ExtraNavigatorPropsBase,
CreateNavigator,
+ StackNavigationProp,
+ ParamListBase,
+ StackNavigationHelpers,
} from '@react-navigation/native';
import {
useNavigationBuilder,
@@ -22,14 +25,30 @@
import { isMessageTooltipKey } from '../chat/utils';
import { OverlayContext } from './overlay-context';
import OverlayRouter from './overlay-router';
-import type { OverlayRouterNavigationProp } from './overlay-router';
+import type { OverlayRouterExtraNavigationHelpers } from './overlay-router';
import { scrollBlockingModals, TabNavigatorRouteName } from './route-names';
+export type OverlayNavigationHelpers<
+ ParamList: ParamListBase = ParamListBase,
+> = {
+ ...$Exact<StackNavigationHelpers<ParamList, {}>>,
+ ...OverlayRouterExtraNavigationHelpers,
+ ...
+};
+
+export type OverlayNavigationProp<
+ ParamList: ParamListBase = ParamListBase,
+ RouteName: $Keys<ParamList> = $Keys<ParamList>,
+> = {
+ ...StackNavigationProp<ParamList, RouteName, {}, {}>,
+ ...OverlayRouterExtraNavigationHelpers,
+};
+
/* eslint-disable import/no-named-as-default-member */
const { Value, timing, cond, call, lessOrEq, block } = Animated;
/* eslint-enable import/no-named-as-default-member */
-type Props = $Exact<NavigatorPropsBase<{}, OverlayRouterNavigationProp<>>>;
+type Props = $Exact<NavigatorPropsBase<{}, OverlayNavigationHelpers<>>>;
const OverlayNavigator = React.memo<Props>(
({ initialRouteName, children, screenOptions }: Props) => {
const { state, descriptors, navigation } = useNavigationBuilder(
@@ -463,7 +482,7 @@
StackNavigationState,
{},
{},
- OverlayRouterNavigationProp<>,
+ OverlayNavigationHelpers<>,
ExtraNavigatorPropsBase,
>(OverlayNavigator);
diff --git a/native/navigation/overlay-router.js b/native/navigation/overlay-router.js
--- a/native/navigation/overlay-router.js
+++ b/native/navigation/overlay-router.js
@@ -1,8 +1,6 @@
// @flow
import type {
- StackNavigationProp,
- ParamListBase,
StackAction,
Route,
Router,
@@ -25,11 +23,7 @@
| StackAction
| ClearOverlayModalsAction;
-export type OverlayRouterNavigationProp<
- ParamList: ParamListBase = ParamListBase,
- RouteName: string = string,
-> = {
- ...StackNavigationProp<ParamList, RouteName, {}, {}>,
+export type OverlayRouterExtraNavigationHelpers = {
+clearOverlayModals: (keys: $ReadOnlyArray<string>) => void,
+goBackOnce: () => void,
};
diff --git a/native/navigation/root-navigator.react.js b/native/navigation/root-navigator.react.js
--- a/native/navigation/root-navigator.react.js
+++ b/native/navigation/root-navigator.react.js
@@ -8,6 +8,9 @@
type StackNavigationEventMap,
type StackNavigatorProps,
type ExtraStackNavigatorProps,
+ type ParamListBase,
+ type StackNavigationHelpers,
+ type StackNavigationProp,
} from '@react-navigation/native';
import { StackView, TransitionPresets } from '@react-navigation/stack';
import * as React from 'react';
@@ -25,7 +28,9 @@
import AppNavigator from './app-navigator.react';
import { defaultStackScreenOptions } from './options';
import { RootNavigatorContext } from './root-navigator-context';
-import RootRouter, { type RootRouterNavigationProp } from './root-router';
+import RootRouter, {
+ type RootRouterExtraNavigationHelpers,
+} from './root-router';
import {
LoggedOutModalRouteName,
AppRouteName,
@@ -42,7 +47,13 @@
enableScreens();
-type RootNavigatorProps = StackNavigatorProps<RootRouterNavigationProp<>>;
+export type RootNavigationHelpers<ParamList: ParamListBase = ParamListBase> = {
+ ...$Exact<StackNavigationHelpers<ParamList>>,
+ ...RootRouterExtraNavigationHelpers,
+ ...
+};
+
+type RootNavigatorProps = StackNavigatorProps<RootNavigationHelpers<>>;
function RootNavigator({
initialRouteName,
children,
@@ -80,7 +91,7 @@
StackNavigationState,
StackOptions,
StackNavigationEventMap,
- RootRouterNavigationProp<>,
+ RootNavigationHelpers<>,
ExtraStackNavigatorProps,
>(RootNavigator);
@@ -121,14 +132,25 @@
cardOverlayEnabled: true,
};
+export type RootRouterNavigationProp<
+ ParamList: ParamListBase = ParamListBase,
+ RouteName: $Keys<ParamList> = $Keys<ParamList>,
+> = {
+ ...StackNavigationProp<ParamList, RouteName>,
+ ...RootRouterExtraNavigationHelpers,
+};
+
export type RootNavigationProp<
RouteName: $Keys<ScreenParamList> = $Keys<ScreenParamList>,
-> = RootRouterNavigationProp<ScreenParamList, RouteName>;
+> = {
+ ...StackNavigationProp<ScreenParamList, RouteName>,
+ ...RootRouterExtraNavigationHelpers,
+};
const Root = createRootNavigator<
ScreenParamList,
RootParamList,
- RootNavigationProp<>,
+ RootNavigationHelpers<ScreenParamList>,
>();
function RootComponent(): React.Node {
return (
diff --git a/native/navigation/root-router.js b/native/navigation/root-router.js
--- a/native/navigation/root-router.js
+++ b/native/navigation/root-router.js
@@ -1,8 +1,6 @@
// @flow
import type {
- StackNavigationProp,
- ParamListBase,
NavigationState,
StackAction,
PossiblyStaleRoute,
@@ -56,11 +54,7 @@
| ClearRootModalsAction
| SetNavStateAction;
-export type RootRouterNavigationProp<
- ParamList: ParamListBase = ParamListBase,
- RouteName: string = string,
-> = {
- ...StackNavigationProp<ParamList, RouteName>,
+export type RootRouterExtraNavigationHelpers = {
+logIn: () => void,
+logOut: () => void,
+clearRootModals: (keys: $ReadOnlyArray<string>) => void,
diff --git a/native/profile/profile.react.js b/native/profile/profile.react.js
--- a/native/profile/profile.react.js
+++ b/native/profile/profile.react.js
@@ -3,6 +3,7 @@
import {
createStackNavigator,
type StackNavigationProp,
+ type StackNavigationHelpers,
type StackHeaderProps,
} from '@react-navigation/stack';
import * as React from 'react';
@@ -56,7 +57,7 @@
const Profile = createStackNavigator<
ScreenParamList,
ProfileParamList,
- ProfileNavigationProp<>,
+ StackNavigationHelpers<ScreenParamList>,
>();
// eslint-disable-next-line no-unused-vars
function ProfileComponent(props: { ... }): React.Node {

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 16, 12:16 PM (21 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2497764
Default Alt Text
D5402.diff (28 KB)

Event Timeline