@react-navigation/core 6.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +38 -0
- package/lib/commonjs/BaseNavigationContainer.js +393 -0
- package/lib/commonjs/BaseNavigationContainer.js.map +1 -0
- package/lib/commonjs/CurrentRenderContext.js +21 -0
- package/lib/commonjs/CurrentRenderContext.js.map +1 -0
- package/lib/commonjs/EnsureSingleNavigator.js +53 -0
- package/lib/commonjs/EnsureSingleNavigator.js.map +1 -0
- package/lib/commonjs/Group.js +15 -0
- package/lib/commonjs/Group.js.map +1 -0
- package/lib/commonjs/NavigationBuilderContext.js +23 -0
- package/lib/commonjs/NavigationBuilderContext.js.map +1 -0
- package/lib/commonjs/NavigationContainerRefContext.js +20 -0
- package/lib/commonjs/NavigationContainerRefContext.js.map +1 -0
- package/lib/commonjs/NavigationContext.js +20 -0
- package/lib/commonjs/NavigationContext.js.map +1 -0
- package/lib/commonjs/NavigationHelpersContext.js +21 -0
- package/lib/commonjs/NavigationHelpersContext.js.map +1 -0
- package/lib/commonjs/NavigationRouteContext.js +20 -0
- package/lib/commonjs/NavigationRouteContext.js.map +1 -0
- package/lib/commonjs/NavigationStateContext.js +42 -0
- package/lib/commonjs/NavigationStateContext.js.map +1 -0
- package/lib/commonjs/SceneView.js +97 -0
- package/lib/commonjs/SceneView.js.map +1 -0
- package/lib/commonjs/Screen.js +15 -0
- package/lib/commonjs/Screen.js.map +1 -0
- package/lib/commonjs/StaticContainer.js +43 -0
- package/lib/commonjs/StaticContainer.js.map +1 -0
- package/lib/commonjs/UnhandledActionContext.js +17 -0
- package/lib/commonjs/UnhandledActionContext.js.map +1 -0
- package/lib/commonjs/checkDuplicateRouteNames.js +31 -0
- package/lib/commonjs/checkDuplicateRouteNames.js.map +1 -0
- package/lib/commonjs/checkSerializable.js +59 -0
- package/lib/commonjs/checkSerializable.js.map +1 -0
- package/lib/commonjs/createNavigationContainerRef.js +82 -0
- package/lib/commonjs/createNavigationContainerRef.js.map +1 -0
- package/lib/commonjs/createNavigatorFactory.js +34 -0
- package/lib/commonjs/createNavigatorFactory.js.map +1 -0
- package/lib/commonjs/findFocusedRoute.js +22 -0
- package/lib/commonjs/findFocusedRoute.js.map +1 -0
- package/lib/commonjs/fromEntries.js +19 -0
- package/lib/commonjs/fromEntries.js.map +1 -0
- package/lib/commonjs/getActionFromState.js +99 -0
- package/lib/commonjs/getActionFromState.js.map +1 -0
- package/lib/commonjs/getFocusedRouteNameFromRoute.js +23 -0
- package/lib/commonjs/getFocusedRouteNameFromRoute.js.map +1 -0
- package/lib/commonjs/getPathFromState.js +238 -0
- package/lib/commonjs/getPathFromState.js.map +1 -0
- package/lib/commonjs/getStateFromPath.js +450 -0
- package/lib/commonjs/getStateFromPath.js.map +1 -0
- package/lib/commonjs/index.js +227 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/isArrayEqual.js +15 -0
- package/lib/commonjs/isArrayEqual.js.map +1 -0
- package/lib/commonjs/types.js +18 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/useChildListeners.js +38 -0
- package/lib/commonjs/useChildListeners.js.map +1 -0
- package/lib/commonjs/useComponent.js +36 -0
- package/lib/commonjs/useComponent.js.map +1 -0
- package/lib/commonjs/useCurrentRender.js +33 -0
- package/lib/commonjs/useCurrentRender.js.map +1 -0
- package/lib/commonjs/useDescriptors.js +141 -0
- package/lib/commonjs/useDescriptors.js.map +1 -0
- package/lib/commonjs/useEventEmitter.js +118 -0
- package/lib/commonjs/useEventEmitter.js.map +1 -0
- package/lib/commonjs/useFocusEffect.js +97 -0
- package/lib/commonjs/useFocusEffect.js.map +1 -0
- package/lib/commonjs/useFocusEvents.js +77 -0
- package/lib/commonjs/useFocusEvents.js.map +1 -0
- package/lib/commonjs/useFocusedListenersChildrenAdapter.js +57 -0
- package/lib/commonjs/useFocusedListenersChildrenAdapter.js.map +1 -0
- package/lib/commonjs/useIsFocused.js +47 -0
- package/lib/commonjs/useIsFocused.js.map +1 -0
- package/lib/commonjs/useKeyedChildListeners.js +35 -0
- package/lib/commonjs/useKeyedChildListeners.js.map +1 -0
- package/lib/commonjs/useNavigation.js +36 -0
- package/lib/commonjs/useNavigation.js.map +1 -0
- package/lib/commonjs/useNavigationBuilder.js +480 -0
- package/lib/commonjs/useNavigationBuilder.js.map +1 -0
- package/lib/commonjs/useNavigationCache.js +122 -0
- package/lib/commonjs/useNavigationCache.js.map +1 -0
- package/lib/commonjs/useNavigationContainerRef.js +27 -0
- package/lib/commonjs/useNavigationContainerRef.js.map +1 -0
- package/lib/commonjs/useNavigationHelpers.js +77 -0
- package/lib/commonjs/useNavigationHelpers.js.map +1 -0
- package/lib/commonjs/useNavigationState.js +41 -0
- package/lib/commonjs/useNavigationState.js.map +1 -0
- package/lib/commonjs/useOnAction.js +118 -0
- package/lib/commonjs/useOnAction.js.map +1 -0
- package/lib/commonjs/useOnGetState.js +60 -0
- package/lib/commonjs/useOnGetState.js.map +1 -0
- package/lib/commonjs/useOnPreventRemove.js +89 -0
- package/lib/commonjs/useOnPreventRemove.js.map +1 -0
- package/lib/commonjs/useOnRouteFocus.js +45 -0
- package/lib/commonjs/useOnRouteFocus.js.map +1 -0
- package/lib/commonjs/useOptionsGetters.js +99 -0
- package/lib/commonjs/useOptionsGetters.js.map +1 -0
- package/lib/commonjs/useRegisterNavigator.js +40 -0
- package/lib/commonjs/useRegisterNavigator.js.map +1 -0
- package/lib/commonjs/useRoute.js +32 -0
- package/lib/commonjs/useRoute.js.map +1 -0
- package/lib/commonjs/useRouteCache.js +61 -0
- package/lib/commonjs/useRouteCache.js.map +1 -0
- package/lib/commonjs/useScheduleUpdate.js +44 -0
- package/lib/commonjs/useScheduleUpdate.js.map +1 -0
- package/lib/commonjs/useSyncState.js +76 -0
- package/lib/commonjs/useSyncState.js.map +1 -0
- package/lib/commonjs/validatePathConfig.js +31 -0
- package/lib/commonjs/validatePathConfig.js.map +1 -0
- package/lib/module/BaseNavigationContainer.js +360 -0
- package/lib/module/BaseNavigationContainer.js.map +1 -0
- package/lib/module/CurrentRenderContext.js +9 -0
- package/lib/module/CurrentRenderContext.js.map +1 -0
- package/lib/module/EnsureSingleNavigator.js +38 -0
- package/lib/module/EnsureSingleNavigator.js.map +1 -0
- package/lib/module/Group.js +8 -0
- package/lib/module/Group.js.map +1 -0
- package/lib/module/NavigationBuilderContext.js +11 -0
- package/lib/module/NavigationBuilderContext.js.map +1 -0
- package/lib/module/NavigationContainerRefContext.js +8 -0
- package/lib/module/NavigationContainerRefContext.js.map +1 -0
- package/lib/module/NavigationContext.js +8 -0
- package/lib/module/NavigationContext.js.map +1 -0
- package/lib/module/NavigationHelpersContext.js +9 -0
- package/lib/module/NavigationHelpersContext.js.map +1 -0
- package/lib/module/NavigationRouteContext.js +8 -0
- package/lib/module/NavigationRouteContext.js.map +1 -0
- package/lib/module/NavigationStateContext.js +27 -0
- package/lib/module/NavigationStateContext.js.map +1 -0
- package/lib/module/SceneView.js +80 -0
- package/lib/module/SceneView.js.map +1 -0
- package/lib/module/Screen.js +8 -0
- package/lib/module/Screen.js.map +1 -0
- package/lib/module/StaticContainer.js +30 -0
- package/lib/module/StaticContainer.js.map +1 -0
- package/lib/module/UnhandledActionContext.js +4 -0
- package/lib/module/UnhandledActionContext.js.map +1 -0
- package/lib/module/checkDuplicateRouteNames.js +24 -0
- package/lib/module/checkDuplicateRouteNames.js.map +1 -0
- package/lib/module/checkSerializable.js +52 -0
- package/lib/module/checkSerializable.js.map +1 -0
- package/lib/module/createNavigationContainerRef.js +71 -0
- package/lib/module/createNavigationContainerRef.js.map +1 -0
- package/lib/module/createNavigatorFactory.js +24 -0
- package/lib/module/createNavigatorFactory.js.map +1 -0
- package/lib/module/findFocusedRoute.js +15 -0
- package/lib/module/findFocusedRoute.js.map +1 -0
- package/lib/module/fromEntries.js +12 -0
- package/lib/module/fromEntries.js.map +1 -0
- package/lib/module/getActionFromState.js +92 -0
- package/lib/module/getActionFromState.js.map +1 -0
- package/lib/module/getFocusedRouteNameFromRoute.js +15 -0
- package/lib/module/getFocusedRouteNameFromRoute.js.map +1 -0
- package/lib/module/getPathFromState.js +223 -0
- package/lib/module/getPathFromState.js.map +1 -0
- package/lib/module/getStateFromPath.js +434 -0
- package/lib/module/getStateFromPath.js.map +1 -0
- package/lib/module/index.js +24 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/isArrayEqual.js +8 -0
- package/lib/module/isArrayEqual.js.map +1 -0
- package/lib/module/types.js +9 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/useChildListeners.js +27 -0
- package/lib/module/useChildListeners.js.map +1 -0
- package/lib/module/useComponent.js +24 -0
- package/lib/module/useComponent.js.map +1 -0
- package/lib/module/useCurrentRender.js +19 -0
- package/lib/module/useCurrentRender.js.map +1 -0
- package/lib/module/useDescriptors.js +122 -0
- package/lib/module/useDescriptors.js.map +1 -0
- package/lib/module/useEventEmitter.js +107 -0
- package/lib/module/useEventEmitter.js.map +1 -0
- package/lib/module/useFocusEffect.js +83 -0
- package/lib/module/useFocusEffect.js.map +1 -0
- package/lib/module/useFocusEvents.js +63 -0
- package/lib/module/useFocusEvents.js.map +1 -0
- package/lib/module/useFocusedListenersChildrenAdapter.js +43 -0
- package/lib/module/useFocusedListenersChildrenAdapter.js.map +1 -0
- package/lib/module/useIsFocused.js +34 -0
- package/lib/module/useIsFocused.js.map +1 -0
- package/lib/module/useKeyedChildListeners.js +24 -0
- package/lib/module/useKeyedChildListeners.js.map +1 -0
- package/lib/module/useNavigation.js +21 -0
- package/lib/module/useNavigation.js.map +1 -0
- package/lib/module/useNavigationBuilder.js +443 -0
- package/lib/module/useNavigationBuilder.js.map +1 -0
- package/lib/module/useNavigationCache.js +107 -0
- package/lib/module/useNavigationCache.js.map +1 -0
- package/lib/module/useNavigationContainerRef.js +12 -0
- package/lib/module/useNavigationContainerRef.js.map +1 -0
- package/lib/module/useNavigationHelpers.js +59 -0
- package/lib/module/useNavigationHelpers.js.map +1 -0
- package/lib/module/useNavigationState.js +27 -0
- package/lib/module/useNavigationState.js.map +1 -0
- package/lib/module/useOnAction.js +103 -0
- package/lib/module/useOnAction.js.map +1 -0
- package/lib/module/useOnGetState.js +43 -0
- package/lib/module/useOnGetState.js.map +1 -0
- package/lib/module/useOnPreventRemove.js +68 -0
- package/lib/module/useOnPreventRemove.js.map +1 -0
- package/lib/module/useOnRouteFocus.js +31 -0
- package/lib/module/useOnRouteFocus.js.map +1 -0
- package/lib/module/useOptionsGetters.js +83 -0
- package/lib/module/useOptionsGetters.js.map +1 -0
- package/lib/module/useRegisterNavigator.js +27 -0
- package/lib/module/useRegisterNavigator.js.map +1 -0
- package/lib/module/useRoute.js +18 -0
- package/lib/module/useRoute.js.map +1 -0
- package/lib/module/useRouteCache.js +47 -0
- package/lib/module/useRouteCache.js.map +1 -0
- package/lib/module/useScheduleUpdate.js +29 -0
- package/lib/module/useScheduleUpdate.js.map +1 -0
- package/lib/module/useSyncState.js +64 -0
- package/lib/module/useSyncState.js.map +1 -0
- package/lib/module/validatePathConfig.js +24 -0
- package/lib/module/validatePathConfig.js.map +1 -0
- package/lib/typescript/src/BaseNavigationContainer.d.ts +14 -0
- package/lib/typescript/src/CurrentRenderContext.d.ts +9 -0
- package/lib/typescript/src/EnsureSingleNavigator.d.ts +13 -0
- package/lib/typescript/src/Group.d.ts +6 -0
- package/lib/typescript/src/NavigationBuilderContext.d.ts +34 -0
- package/lib/typescript/src/NavigationContainerRefContext.d.ts +8 -0
- package/lib/typescript/src/NavigationContext.d.ts +24 -0
- package/lib/typescript/src/NavigationHelpersContext.d.ts +9 -0
- package/lib/typescript/src/NavigationRouteContext.d.ts +7 -0
- package/lib/typescript/src/NavigationStateContext.d.ts +45 -0
- package/lib/typescript/src/SceneView.d.ts +21 -0
- package/lib/typescript/src/Screen.d.ts +6 -0
- package/lib/typescript/src/StaticContainer.d.ts +7 -0
- package/lib/typescript/src/UnhandledActionContext.d.ts +4 -0
- package/lib/typescript/src/checkDuplicateRouteNames.d.ts +2 -0
- package/lib/typescript/src/checkSerializable.d.ts +9 -0
- package/lib/typescript/src/createNavigationContainerRef.d.ts +3 -0
- package/lib/typescript/src/createNavigatorFactory.d.ts +11 -0
- package/lib/typescript/src/findFocusedRoute.d.ts +22 -0
- package/lib/typescript/src/fromEntries.d.ts +1 -0
- package/lib/typescript/src/getActionFromState.d.ts +16 -0
- package/lib/typescript/src/getFocusedRouteNameFromRoute.d.ts +2 -0
- package/lib/typescript/src/getPathFromState.d.ts +38 -0
- package/lib/typescript/src/getStateFromPath.d.ts +32 -0
- package/lib/typescript/src/index.d.ts +23 -0
- package/lib/typescript/src/isArrayEqual.d.ts +5 -0
- package/lib/typescript/src/types.d.ts +485 -0
- package/lib/typescript/src/useChildListeners.d.ts +11 -0
- package/lib/typescript/src/useComponent.d.ts +2 -0
- package/lib/typescript/src/useCurrentRender.d.ts +13 -0
- package/lib/typescript/src/useDescriptors.d.ts +89 -0
- package/lib/typescript/src/useEventEmitter.d.ts +8 -0
- package/lib/typescript/src/useFocusEffect.d.ts +10 -0
- package/lib/typescript/src/useFocusEvents.d.ts +12 -0
- package/lib/typescript/src/useFocusedListenersChildrenAdapter.d.ts +12 -0
- package/lib/typescript/src/useIsFocused.d.ts +5 -0
- package/lib/typescript/src/useKeyedChildListeners.d.ts +11 -0
- package/lib/typescript/src/useNavigation.d.ts +7 -0
- package/lib/typescript/src/useNavigationBuilder.d.ts +223 -0
- package/lib/typescript/src/useNavigationCache.d.ts +19 -0
- package/lib/typescript/src/useNavigationContainerRef.d.ts +2 -0
- package/lib/typescript/src/useNavigationHelpers.d.ts +174 -0
- package/lib/typescript/src/useNavigationState.d.ts +9 -0
- package/lib/typescript/src/useOnAction.d.ts +25 -0
- package/lib/typescript/src/useOnGetState.d.ts +8 -0
- package/lib/typescript/src/useOnPreventRemove.d.ts +16 -0
- package/lib/typescript/src/useOnRouteFocus.d.ts +14 -0
- package/lib/typescript/src/useOptionsGetters.d.ts +12 -0
- package/lib/typescript/src/useRegisterNavigator.d.ts +5 -0
- package/lib/typescript/src/useRoute.d.ts +8 -0
- package/lib/typescript/src/useRouteCache.d.ts +13 -0
- package/lib/typescript/src/useScheduleUpdate.d.ts +13 -0
- package/lib/typescript/src/useSyncState.d.ts +4 -0
- package/lib/typescript/src/validatePathConfig.d.ts +1 -0
- package/package.json +73 -0
- package/src/BaseNavigationContainer.tsx +453 -0
- package/src/CurrentRenderContext.tsx +10 -0
- package/src/EnsureSingleNavigator.tsx +53 -0
- package/src/Group.tsx +14 -0
- package/src/NavigationBuilderContext.tsx +70 -0
- package/src/NavigationContainerRefContext.tsx +14 -0
- package/src/NavigationContext.tsx +12 -0
- package/src/NavigationHelpersContext.tsx +13 -0
- package/src/NavigationRouteContext.tsx +10 -0
- package/src/NavigationStateContext.tsx +39 -0
- package/src/SceneView.tsx +134 -0
- package/src/Screen.tsx +17 -0
- package/src/StaticContainer.tsx +29 -0
- package/src/UnhandledActionContext.tsx +9 -0
- package/src/checkDuplicateRouteNames.tsx +33 -0
- package/src/checkSerializable.tsx +74 -0
- package/src/createNavigationContainerRef.tsx +97 -0
- package/src/createNavigatorFactory.tsx +40 -0
- package/src/findFocusedRoute.tsx +13 -0
- package/src/fromEntries.tsx +13 -0
- package/src/getActionFromState.tsx +154 -0
- package/src/getFocusedRouteNameFromRoute.tsx +28 -0
- package/src/getPathFromState.tsx +297 -0
- package/src/getStateFromPath.tsx +575 -0
- package/src/index.tsx +23 -0
- package/src/isArrayEqual.tsx +7 -0
- package/src/types.tsx +645 -0
- package/src/useChildListeners.tsx +37 -0
- package/src/useComponent.tsx +30 -0
- package/src/useCurrentRender.tsx +35 -0
- package/src/useDescriptors.tsx +229 -0
- package/src/useEventEmitter.tsx +130 -0
- package/src/useFocusEffect.tsx +112 -0
- package/src/useFocusEvents.tsx +73 -0
- package/src/useFocusedListenersChildrenAdapter.tsx +47 -0
- package/src/useIsFocused.tsx +43 -0
- package/src/useKeyedChildListeners.tsx +40 -0
- package/src/useNavigation.tsx +26 -0
- package/src/useNavigationBuilder.tsx +640 -0
- package/src/useNavigationCache.tsx +159 -0
- package/src/useNavigationContainerRef.tsx +17 -0
- package/src/useNavigationHelpers.tsx +98 -0
- package/src/useNavigationState.tsx +41 -0
- package/src/useOnAction.tsx +166 -0
- package/src/useOnGetState.tsx +47 -0
- package/src/useOnPreventRemove.tsx +99 -0
- package/src/useOnRouteFocus.tsx +47 -0
- package/src/useOptionsGetters.tsx +98 -0
- package/src/useRegisterNavigator.tsx +29 -0
- package/src/useRoute.tsx +22 -0
- package/src/useRouteCache.tsx +55 -0
- package/src/useScheduleUpdate.tsx +32 -0
- package/src/useSyncState.tsx +74 -0
- package/src/validatePathConfig.tsx +32 -0
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { DefaultRouterOptions, NavigationState, ParamListBase, PartialState, RouterFactory } from '@react-navigation/routers';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { DefaultNavigatorOptions, EventMapCore, PrivateValueStore } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Hook for building navigators.
|
|
6
|
+
*
|
|
7
|
+
* @param createRouter Factory method which returns router object.
|
|
8
|
+
* @param options Options object containing `children` and additional options for the router.
|
|
9
|
+
* @returns An object containing `state`, `navigation`, `descriptors` objects.
|
|
10
|
+
*/
|
|
11
|
+
export default function useNavigationBuilder<State extends NavigationState, RouterOptions extends DefaultRouterOptions, ActionHelpers extends Record<string, () => void>, ScreenOptions extends {}, EventMap extends Record<string, any>>(createRouter: RouterFactory<State, any, RouterOptions>, options: DefaultNavigatorOptions<ParamListBase, State, ScreenOptions, EventMap> & RouterOptions): {
|
|
12
|
+
state: State;
|
|
13
|
+
navigation: {
|
|
14
|
+
dispatch(action: Readonly<{
|
|
15
|
+
type: string;
|
|
16
|
+
payload?: object | undefined;
|
|
17
|
+
source?: string | undefined;
|
|
18
|
+
target?: string | undefined;
|
|
19
|
+
}> | ((state: Readonly<{
|
|
20
|
+
key: string;
|
|
21
|
+
index: number;
|
|
22
|
+
routeNames: string[];
|
|
23
|
+
history?: unknown[] | undefined;
|
|
24
|
+
routes: (Readonly<{
|
|
25
|
+
key: string;
|
|
26
|
+
name: string;
|
|
27
|
+
path?: string | undefined;
|
|
28
|
+
}> & Readonly<{
|
|
29
|
+
params?: Readonly<object | undefined>;
|
|
30
|
+
}> & {
|
|
31
|
+
state?: Readonly<any> | PartialState<Readonly<any>> | undefined;
|
|
32
|
+
})[];
|
|
33
|
+
type: string;
|
|
34
|
+
stale: false;
|
|
35
|
+
}>) => Readonly<{
|
|
36
|
+
type: string;
|
|
37
|
+
payload?: object | undefined;
|
|
38
|
+
source?: string | undefined;
|
|
39
|
+
target?: string | undefined;
|
|
40
|
+
}>)): void;
|
|
41
|
+
navigate<RouteName extends string>(...args: [screen: RouteName] | [screen: RouteName, params: object | undefined]): void;
|
|
42
|
+
navigate<RouteName_1 extends string>(options: {
|
|
43
|
+
key: string;
|
|
44
|
+
params?: object | undefined;
|
|
45
|
+
merge?: boolean | undefined;
|
|
46
|
+
} | {
|
|
47
|
+
name: RouteName_1;
|
|
48
|
+
key?: string | undefined;
|
|
49
|
+
params: object | undefined;
|
|
50
|
+
merge?: boolean | undefined;
|
|
51
|
+
}): void;
|
|
52
|
+
reset(state: Readonly<{
|
|
53
|
+
key: string;
|
|
54
|
+
index: number;
|
|
55
|
+
routeNames: string[];
|
|
56
|
+
history?: unknown[] | undefined;
|
|
57
|
+
routes: (Readonly<{
|
|
58
|
+
key: string;
|
|
59
|
+
name: string;
|
|
60
|
+
path?: string | undefined;
|
|
61
|
+
}> & Readonly<{
|
|
62
|
+
params?: Readonly<object | undefined>;
|
|
63
|
+
}> & {
|
|
64
|
+
state?: Readonly<any> | PartialState<Readonly<any>> | undefined;
|
|
65
|
+
})[];
|
|
66
|
+
type: string;
|
|
67
|
+
stale: false;
|
|
68
|
+
}> | PartialState<Readonly<{
|
|
69
|
+
key: string;
|
|
70
|
+
index: number;
|
|
71
|
+
routeNames: string[];
|
|
72
|
+
history?: unknown[] | undefined;
|
|
73
|
+
routes: (Readonly<{
|
|
74
|
+
key: string;
|
|
75
|
+
name: string;
|
|
76
|
+
path?: string | undefined;
|
|
77
|
+
}> & Readonly<{
|
|
78
|
+
params?: Readonly<object | undefined>;
|
|
79
|
+
}> & {
|
|
80
|
+
state?: Readonly<any> | PartialState<Readonly<any>> | undefined;
|
|
81
|
+
})[];
|
|
82
|
+
type: string;
|
|
83
|
+
stale: false;
|
|
84
|
+
}>>): void;
|
|
85
|
+
goBack(): void;
|
|
86
|
+
isFocused(): boolean;
|
|
87
|
+
canGoBack(): boolean;
|
|
88
|
+
getParent<T = import("./types").NavigationProp<ParamListBase, string, Readonly<{
|
|
89
|
+
key: string;
|
|
90
|
+
index: number;
|
|
91
|
+
routeNames: string[];
|
|
92
|
+
history?: unknown[] | undefined;
|
|
93
|
+
routes: (Readonly<{
|
|
94
|
+
key: string;
|
|
95
|
+
name: string;
|
|
96
|
+
path?: string | undefined;
|
|
97
|
+
}> & Readonly<{
|
|
98
|
+
params?: Readonly<object | undefined>;
|
|
99
|
+
}> & {
|
|
100
|
+
state?: Readonly<any> | PartialState<Readonly<any>> | undefined;
|
|
101
|
+
})[];
|
|
102
|
+
type: string;
|
|
103
|
+
stale: false;
|
|
104
|
+
}>, {}, {}> | undefined>(): T;
|
|
105
|
+
getState(): Readonly<{
|
|
106
|
+
key: string;
|
|
107
|
+
index: number;
|
|
108
|
+
routeNames: string[];
|
|
109
|
+
history?: unknown[] | undefined;
|
|
110
|
+
routes: (Readonly<{
|
|
111
|
+
key: string;
|
|
112
|
+
name: string;
|
|
113
|
+
path?: string | undefined;
|
|
114
|
+
}> & Readonly<{
|
|
115
|
+
params?: Readonly<object | undefined>;
|
|
116
|
+
}> & {
|
|
117
|
+
state?: Readonly<any> | PartialState<Readonly<any>> | undefined;
|
|
118
|
+
})[];
|
|
119
|
+
type: string;
|
|
120
|
+
stale: false;
|
|
121
|
+
}>;
|
|
122
|
+
} & PrivateValueStore<ParamListBase, string, {}> & import("./types").EventEmitter<EventMap> & {
|
|
123
|
+
setParams<RouteName_2 extends string>(params: Partial<object | undefined>): void;
|
|
124
|
+
} & {
|
|
125
|
+
dispatch(action: Readonly<{
|
|
126
|
+
type: string;
|
|
127
|
+
payload?: object | undefined;
|
|
128
|
+
source?: string | undefined;
|
|
129
|
+
target?: string | undefined;
|
|
130
|
+
}> | ((state: any) => Readonly<{
|
|
131
|
+
type: string;
|
|
132
|
+
payload?: object | undefined;
|
|
133
|
+
source?: string | undefined;
|
|
134
|
+
target?: string | undefined;
|
|
135
|
+
}>)): void;
|
|
136
|
+
navigate<RouteName extends string>(...args: [screen: RouteName] | [screen: RouteName, params: object | undefined]): void;
|
|
137
|
+
navigate<RouteName_1 extends string>(options: {
|
|
138
|
+
key: string;
|
|
139
|
+
params?: object | undefined;
|
|
140
|
+
merge?: boolean | undefined;
|
|
141
|
+
} | {
|
|
142
|
+
name: RouteName_1;
|
|
143
|
+
key?: string | undefined;
|
|
144
|
+
params: object | undefined;
|
|
145
|
+
merge?: boolean | undefined;
|
|
146
|
+
}): void;
|
|
147
|
+
reset(state: any): void;
|
|
148
|
+
goBack(): void;
|
|
149
|
+
isFocused(): boolean;
|
|
150
|
+
canGoBack(): boolean;
|
|
151
|
+
getParent<T = import("./types").NavigationProp<ParamListBase, string, Readonly<{
|
|
152
|
+
key: string;
|
|
153
|
+
index: number;
|
|
154
|
+
routeNames: string[];
|
|
155
|
+
history?: unknown[] | undefined;
|
|
156
|
+
routes: (Readonly<{
|
|
157
|
+
key: string;
|
|
158
|
+
name: string;
|
|
159
|
+
path?: string | undefined;
|
|
160
|
+
}> & Readonly<{
|
|
161
|
+
params?: Readonly<object | undefined>;
|
|
162
|
+
}> & {
|
|
163
|
+
state?: Readonly<any> | PartialState<Readonly<any>> | undefined;
|
|
164
|
+
})[];
|
|
165
|
+
type: string;
|
|
166
|
+
stale: false;
|
|
167
|
+
}>, {}, {}> | undefined>(): T;
|
|
168
|
+
getState(): any;
|
|
169
|
+
} & {
|
|
170
|
+
setParams(params: Partial<object | undefined>): void;
|
|
171
|
+
setOptions(options: Partial<any>): void;
|
|
172
|
+
} & import("./types").EventConsumer<any> & PrivateValueStore<ParamListBase, string, any> & ActionHelpers;
|
|
173
|
+
descriptors: Record<string, import("./types").Descriptor<ScreenOptions, {
|
|
174
|
+
dispatch(action: Readonly<{
|
|
175
|
+
type: string;
|
|
176
|
+
payload?: object | undefined;
|
|
177
|
+
source?: string | undefined;
|
|
178
|
+
target?: string | undefined;
|
|
179
|
+
}> | ((state: State) => Readonly<{
|
|
180
|
+
type: string;
|
|
181
|
+
payload?: object | undefined;
|
|
182
|
+
source?: string | undefined;
|
|
183
|
+
target?: string | undefined;
|
|
184
|
+
}>)): void;
|
|
185
|
+
navigate<RouteName extends string>(...args: [screen: RouteName] | [screen: RouteName, params: object | undefined]): void;
|
|
186
|
+
navigate<RouteName_1 extends string>(options: {
|
|
187
|
+
key: string;
|
|
188
|
+
params?: object | undefined;
|
|
189
|
+
merge?: boolean | undefined;
|
|
190
|
+
} | {
|
|
191
|
+
name: RouteName_1;
|
|
192
|
+
key?: string | undefined;
|
|
193
|
+
params: object | undefined;
|
|
194
|
+
merge?: boolean | undefined;
|
|
195
|
+
}): void;
|
|
196
|
+
reset(state: State | PartialState<State>): void;
|
|
197
|
+
goBack(): void;
|
|
198
|
+
isFocused(): boolean;
|
|
199
|
+
canGoBack(): boolean;
|
|
200
|
+
getParent<T = import("./types").NavigationProp<ParamListBase, string, Readonly<{
|
|
201
|
+
key: string;
|
|
202
|
+
index: number;
|
|
203
|
+
routeNames: string[];
|
|
204
|
+
history?: unknown[] | undefined;
|
|
205
|
+
routes: (Readonly<{
|
|
206
|
+
key: string;
|
|
207
|
+
name: string;
|
|
208
|
+
path?: string | undefined;
|
|
209
|
+
}> & Readonly<{
|
|
210
|
+
params?: Readonly<object | undefined>;
|
|
211
|
+
}> & {
|
|
212
|
+
state?: Readonly<any> | PartialState<Readonly<any>> | undefined;
|
|
213
|
+
})[];
|
|
214
|
+
type: string;
|
|
215
|
+
stale: false;
|
|
216
|
+
}>, {}, {}> | undefined>(): T;
|
|
217
|
+
getState(): State;
|
|
218
|
+
} & PrivateValueStore<ParamListBase, string, {}> & {
|
|
219
|
+
setParams(params: Partial<object | undefined>): void;
|
|
220
|
+
setOptions(options: Partial<ScreenOptions>): void;
|
|
221
|
+
} & import("./types").EventConsumer<EventMap & EventMapCore<State>> & PrivateValueStore<ParamListBase, string, EventMap> & ActionHelpers, import("./types").RouteProp<ParamListBase, string>>>;
|
|
222
|
+
NavigationContent: (rest: Omit<React.ProviderProps<import("./types").NavigationHelpers<ParamListBase, {}> | undefined>, "value">) => JSX.Element;
|
|
223
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { NavigationAction, NavigationState, ParamListBase, Router } from '@react-navigation/routers';
|
|
2
|
+
import type { NavigationHelpers, NavigationProp } from './types';
|
|
3
|
+
import type { NavigationEventEmitter } from './useEventEmitter';
|
|
4
|
+
declare type Options<State extends NavigationState, EventMap extends Record<string, any>> = {
|
|
5
|
+
state: State;
|
|
6
|
+
getState: () => State;
|
|
7
|
+
navigation: NavigationHelpers<ParamListBase> & Partial<NavigationProp<ParamListBase, string, any, any, any>>;
|
|
8
|
+
setOptions: (cb: (options: Record<string, object>) => Record<string, object>) => void;
|
|
9
|
+
router: Router<State, NavigationAction>;
|
|
10
|
+
emitter: NavigationEventEmitter<EventMap>;
|
|
11
|
+
};
|
|
12
|
+
declare type NavigationCache<State extends NavigationState, ScreenOptions extends {}, EventMap extends Record<string, any>> = Record<string, NavigationProp<ParamListBase, string, State, ScreenOptions, EventMap>>;
|
|
13
|
+
/**
|
|
14
|
+
* Hook to cache navigation objects for each screen in the navigator.
|
|
15
|
+
* It's important to cache them to make sure navigation objects don't change between renders.
|
|
16
|
+
* This lets us apply optimizations like `React.memo` to minimize re-rendering screens.
|
|
17
|
+
*/
|
|
18
|
+
export default function useNavigationCache<State extends NavigationState, ScreenOptions extends {}, EventMap extends Record<string, any>>({ state, getState, navigation, setOptions, router, emitter, }: Options<State, EventMap>): NavigationCache<State, ScreenOptions, EventMap>;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { NavigationAction, NavigationState, ParamListBase, Router } from '@react-navigation/routers';
|
|
2
|
+
import { NavigationProp, PrivateValueStore } from './types';
|
|
3
|
+
import type { NavigationEventEmitter } from './useEventEmitter';
|
|
4
|
+
declare type Options<State extends NavigationState, Action extends NavigationAction> = {
|
|
5
|
+
onAction: (action: NavigationAction) => boolean;
|
|
6
|
+
getState: () => State;
|
|
7
|
+
emitter: NavigationEventEmitter<any>;
|
|
8
|
+
router: Router<State, Action>;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Navigation object with helper methods to be used by a navigator.
|
|
12
|
+
* This object includes methods for common actions as well as methods the parent screen's navigation object.
|
|
13
|
+
*/
|
|
14
|
+
export default function useNavigationHelpers<State extends NavigationState, ActionHelpers extends Record<string, () => void>, Action extends NavigationAction, EventMap extends Record<string, any>>({ onAction, getState, emitter, router }: Options<State, Action>): {
|
|
15
|
+
dispatch(action: Readonly<{
|
|
16
|
+
type: string;
|
|
17
|
+
payload?: object | undefined;
|
|
18
|
+
source?: string | undefined;
|
|
19
|
+
target?: string | undefined;
|
|
20
|
+
}> | ((state: Readonly<{
|
|
21
|
+
key: string;
|
|
22
|
+
index: number;
|
|
23
|
+
routeNames: string[];
|
|
24
|
+
history?: unknown[] | undefined;
|
|
25
|
+
routes: (Readonly<{
|
|
26
|
+
key: string;
|
|
27
|
+
name: string;
|
|
28
|
+
path?: string | undefined;
|
|
29
|
+
}> & Readonly<{
|
|
30
|
+
params?: Readonly<object | undefined>;
|
|
31
|
+
}> & {
|
|
32
|
+
state?: Readonly<any> | import("@react-navigation/routers").PartialState<Readonly<any>> | undefined;
|
|
33
|
+
})[];
|
|
34
|
+
type: string;
|
|
35
|
+
stale: false;
|
|
36
|
+
}>) => Readonly<{
|
|
37
|
+
type: string;
|
|
38
|
+
payload?: object | undefined;
|
|
39
|
+
source?: string | undefined;
|
|
40
|
+
target?: string | undefined;
|
|
41
|
+
}>)): void;
|
|
42
|
+
navigate<RouteName extends string>(...args: [screen: RouteName] | [screen: RouteName, params: object | undefined]): void;
|
|
43
|
+
navigate<RouteName_1 extends string>(options: {
|
|
44
|
+
key: string;
|
|
45
|
+
params?: object | undefined;
|
|
46
|
+
merge?: boolean | undefined;
|
|
47
|
+
} | {
|
|
48
|
+
name: RouteName_1;
|
|
49
|
+
key?: string | undefined;
|
|
50
|
+
params: object | undefined;
|
|
51
|
+
merge?: boolean | undefined;
|
|
52
|
+
}): void;
|
|
53
|
+
reset(state: Readonly<{
|
|
54
|
+
key: string;
|
|
55
|
+
index: number;
|
|
56
|
+
routeNames: string[];
|
|
57
|
+
history?: unknown[] | undefined;
|
|
58
|
+
routes: (Readonly<{
|
|
59
|
+
key: string;
|
|
60
|
+
name: string;
|
|
61
|
+
path?: string | undefined;
|
|
62
|
+
}> & Readonly<{
|
|
63
|
+
params?: Readonly<object | undefined>;
|
|
64
|
+
}> & {
|
|
65
|
+
state?: Readonly<any> | import("@react-navigation/routers").PartialState<Readonly<any>> | undefined;
|
|
66
|
+
})[];
|
|
67
|
+
type: string;
|
|
68
|
+
stale: false;
|
|
69
|
+
}> | import("@react-navigation/routers").PartialState<Readonly<{
|
|
70
|
+
key: string;
|
|
71
|
+
index: number;
|
|
72
|
+
routeNames: string[];
|
|
73
|
+
history?: unknown[] | undefined;
|
|
74
|
+
routes: (Readonly<{
|
|
75
|
+
key: string;
|
|
76
|
+
name: string;
|
|
77
|
+
path?: string | undefined;
|
|
78
|
+
}> & Readonly<{
|
|
79
|
+
params?: Readonly<object | undefined>;
|
|
80
|
+
}> & {
|
|
81
|
+
state?: Readonly<any> | import("@react-navigation/routers").PartialState<Readonly<any>> | undefined;
|
|
82
|
+
})[];
|
|
83
|
+
type: string;
|
|
84
|
+
stale: false;
|
|
85
|
+
}>>): void;
|
|
86
|
+
goBack(): void;
|
|
87
|
+
isFocused(): boolean;
|
|
88
|
+
canGoBack(): boolean;
|
|
89
|
+
getParent<T = NavigationProp<ParamListBase, string, Readonly<{
|
|
90
|
+
key: string;
|
|
91
|
+
index: number;
|
|
92
|
+
routeNames: string[];
|
|
93
|
+
history?: unknown[] | undefined;
|
|
94
|
+
routes: (Readonly<{
|
|
95
|
+
key: string;
|
|
96
|
+
name: string;
|
|
97
|
+
path?: string | undefined;
|
|
98
|
+
}> & Readonly<{
|
|
99
|
+
params?: Readonly<object | undefined>;
|
|
100
|
+
}> & {
|
|
101
|
+
state?: Readonly<any> | import("@react-navigation/routers").PartialState<Readonly<any>> | undefined;
|
|
102
|
+
})[];
|
|
103
|
+
type: string;
|
|
104
|
+
stale: false;
|
|
105
|
+
}>, {}, {}> | undefined>(): T;
|
|
106
|
+
getState(): Readonly<{
|
|
107
|
+
key: string;
|
|
108
|
+
index: number;
|
|
109
|
+
routeNames: string[];
|
|
110
|
+
history?: unknown[] | undefined;
|
|
111
|
+
routes: (Readonly<{
|
|
112
|
+
key: string;
|
|
113
|
+
name: string;
|
|
114
|
+
path?: string | undefined;
|
|
115
|
+
}> & Readonly<{
|
|
116
|
+
params?: Readonly<object | undefined>;
|
|
117
|
+
}> & {
|
|
118
|
+
state?: Readonly<any> | import("@react-navigation/routers").PartialState<Readonly<any>> | undefined;
|
|
119
|
+
})[];
|
|
120
|
+
type: string;
|
|
121
|
+
stale: false;
|
|
122
|
+
}>;
|
|
123
|
+
} & PrivateValueStore<ParamListBase, string, {}> & import("./types").EventEmitter<EventMap> & {
|
|
124
|
+
setParams<RouteName_2 extends string>(params: Partial<object | undefined>): void;
|
|
125
|
+
} & {
|
|
126
|
+
dispatch(action: Readonly<{
|
|
127
|
+
type: string;
|
|
128
|
+
payload?: object | undefined;
|
|
129
|
+
source?: string | undefined;
|
|
130
|
+
target?: string | undefined;
|
|
131
|
+
}> | ((state: any) => Readonly<{
|
|
132
|
+
type: string;
|
|
133
|
+
payload?: object | undefined;
|
|
134
|
+
source?: string | undefined;
|
|
135
|
+
target?: string | undefined;
|
|
136
|
+
}>)): void;
|
|
137
|
+
navigate<RouteName extends string>(...args: [screen: RouteName] | [screen: RouteName, params: object | undefined]): void;
|
|
138
|
+
navigate<RouteName_1 extends string>(options: {
|
|
139
|
+
key: string;
|
|
140
|
+
params?: object | undefined;
|
|
141
|
+
merge?: boolean | undefined;
|
|
142
|
+
} | {
|
|
143
|
+
name: RouteName_1;
|
|
144
|
+
key?: string | undefined;
|
|
145
|
+
params: object | undefined;
|
|
146
|
+
merge?: boolean | undefined;
|
|
147
|
+
}): void;
|
|
148
|
+
reset(state: any): void;
|
|
149
|
+
goBack(): void;
|
|
150
|
+
isFocused(): boolean;
|
|
151
|
+
canGoBack(): boolean;
|
|
152
|
+
getParent<T = NavigationProp<ParamListBase, string, Readonly<{
|
|
153
|
+
key: string;
|
|
154
|
+
index: number;
|
|
155
|
+
routeNames: string[];
|
|
156
|
+
history?: unknown[] | undefined;
|
|
157
|
+
routes: (Readonly<{
|
|
158
|
+
key: string;
|
|
159
|
+
name: string;
|
|
160
|
+
path?: string | undefined;
|
|
161
|
+
}> & Readonly<{
|
|
162
|
+
params?: Readonly<object | undefined>;
|
|
163
|
+
}> & {
|
|
164
|
+
state?: Readonly<any> | import("@react-navigation/routers").PartialState<Readonly<any>> | undefined;
|
|
165
|
+
})[];
|
|
166
|
+
type: string;
|
|
167
|
+
stale: false;
|
|
168
|
+
}>, {}, {}> | undefined>(): T;
|
|
169
|
+
getState(): any;
|
|
170
|
+
} & {
|
|
171
|
+
setParams(params: Partial<object | undefined>): void;
|
|
172
|
+
setOptions(options: Partial<any>): void;
|
|
173
|
+
} & import("./types").EventConsumer<any> & PrivateValueStore<ParamListBase, string, any> & ActionHelpers;
|
|
174
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { NavigationState, ParamListBase } from '@react-navigation/routers';
|
|
2
|
+
declare type Selector<ParamList extends ParamListBase, T> = (state: NavigationState<ParamList>) => T;
|
|
3
|
+
/**
|
|
4
|
+
* Hook to get a value from the current navigation state using a selector.
|
|
5
|
+
*
|
|
6
|
+
* @param selector Selector function to get a value from the state.
|
|
7
|
+
*/
|
|
8
|
+
export default function useNavigationState<ParamList extends ParamListBase, T>(selector: Selector<ParamList, T>): T;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { NavigationAction, NavigationState, PartialState, Router, RouterConfigOptions } from '@react-navigation/routers';
|
|
2
|
+
import { ChildActionListener, ChildBeforeRemoveListener } from './NavigationBuilderContext';
|
|
3
|
+
import type { EventMapCore } from './types';
|
|
4
|
+
import type { NavigationEventEmitter } from './useEventEmitter';
|
|
5
|
+
declare type Options = {
|
|
6
|
+
router: Router<NavigationState, NavigationAction>;
|
|
7
|
+
key?: string;
|
|
8
|
+
getState: () => NavigationState;
|
|
9
|
+
setState: (state: NavigationState | PartialState<NavigationState>) => void;
|
|
10
|
+
actionListeners: ChildActionListener[];
|
|
11
|
+
beforeRemoveListeners: Record<string, ChildBeforeRemoveListener | undefined>;
|
|
12
|
+
routerConfigOptions: RouterConfigOptions;
|
|
13
|
+
emitter: NavigationEventEmitter<EventMapCore<any>>;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Hook to handle actions for a navigator, including state updates and bubbling.
|
|
17
|
+
*
|
|
18
|
+
* Bubbling an action is achieved in 2 ways:
|
|
19
|
+
* 1. To bubble action to parent, we expose the action handler in context and then access the parent context
|
|
20
|
+
* 2. To bubble action to child, child adds event listeners subscribing to actions from parent
|
|
21
|
+
*
|
|
22
|
+
* When the action handler handles as action, it returns `true`, otherwise `false`.
|
|
23
|
+
*/
|
|
24
|
+
export default function useOnAction({ router, getState, setState, key, actionListeners, beforeRemoveListeners, routerConfigOptions, emitter, }: Options): (action: NavigationAction, visitedNavigators?: Set<string>) => boolean;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { NavigationState } from '@react-navigation/routers';
|
|
2
|
+
import { GetStateListener } from './NavigationBuilderContext';
|
|
3
|
+
declare type Options = {
|
|
4
|
+
getState: () => NavigationState;
|
|
5
|
+
getStateListeners: Record<string, GetStateListener | undefined>;
|
|
6
|
+
};
|
|
7
|
+
export default function useOnGetState({ getState, getStateListeners, }: Options): void;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { NavigationAction, NavigationState } from '@react-navigation/routers';
|
|
2
|
+
import { ChildBeforeRemoveListener } from './NavigationBuilderContext';
|
|
3
|
+
import type { EventMapCore } from './types';
|
|
4
|
+
import type { NavigationEventEmitter } from './useEventEmitter';
|
|
5
|
+
declare type Options = {
|
|
6
|
+
getState: () => NavigationState;
|
|
7
|
+
emitter: NavigationEventEmitter<EventMapCore<any>>;
|
|
8
|
+
beforeRemoveListeners: Record<string, ChildBeforeRemoveListener | undefined>;
|
|
9
|
+
};
|
|
10
|
+
export declare const shouldPreventRemove: (emitter: NavigationEventEmitter<EventMapCore<any>>, beforeRemoveListeners: Record<string, ChildBeforeRemoveListener | undefined>, currentRoutes: {
|
|
11
|
+
key: string;
|
|
12
|
+
}[], nextRoutes: {
|
|
13
|
+
key?: string | undefined;
|
|
14
|
+
}[], action: NavigationAction) => boolean;
|
|
15
|
+
export default function useOnPreventRemove({ getState, emitter, beforeRemoveListeners, }: Options): void;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { NavigationAction, NavigationState, Router } from '@react-navigation/routers';
|
|
2
|
+
declare type Options<Action extends NavigationAction> = {
|
|
3
|
+
router: Router<NavigationState, Action>;
|
|
4
|
+
getState: () => NavigationState;
|
|
5
|
+
setState: (state: NavigationState) => void;
|
|
6
|
+
key?: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Hook to handle focus actions for a route.
|
|
10
|
+
* Focus action needs to be treated specially, coz when a nested route is focused,
|
|
11
|
+
* the parent navigators also needs to be focused.
|
|
12
|
+
*/
|
|
13
|
+
export default function useOnRouteFocus<Action extends NavigationAction>({ router, getState, key: sourceRouteKey, setState, }: Options<Action>): (key: string) => void;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ParamListBase } from '@react-navigation/routers';
|
|
2
|
+
import type { NavigationProp } from './types';
|
|
3
|
+
declare type Options = {
|
|
4
|
+
key?: string;
|
|
5
|
+
navigation?: NavigationProp<ParamListBase>;
|
|
6
|
+
options?: object | undefined;
|
|
7
|
+
};
|
|
8
|
+
export default function useOptionsGetters({ key, options, navigation, }: Options): {
|
|
9
|
+
addOptionsGetter: (key: string, getter: () => object | undefined | null) => () => void;
|
|
10
|
+
getCurrentOptions: () => object | null | undefined;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ParamListBase } from '@react-navigation/routers';
|
|
2
|
+
import type { RouteProp } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Hook to access the route prop of the parent screen anywhere.
|
|
5
|
+
*
|
|
6
|
+
* @returns Route prop of the parent screen.
|
|
7
|
+
*/
|
|
8
|
+
export default function useRoute<T extends RouteProp<ParamListBase>>(): T;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { NavigationState, ParamListBase } from '@react-navigation/routers';
|
|
2
|
+
import type { RouteProp } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Utilites such as `getFocusedRouteNameFromRoute` need to access state.
|
|
5
|
+
* So we need a way to suppress the warning for those use cases.
|
|
6
|
+
* This is fine since they are internal utilities and this is not public API.
|
|
7
|
+
*/
|
|
8
|
+
export declare const CHILD_STATE: unique symbol;
|
|
9
|
+
/**
|
|
10
|
+
* Hook to cache route props for each screen in the navigator.
|
|
11
|
+
* This lets add warnings and modifications to the route object but keep references between renders.
|
|
12
|
+
*/
|
|
13
|
+
export default function useRouteCache<State extends NavigationState>(routes: State['routes']): RouteProp<ParamListBase, string>[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare const ScheduleUpdateContext: React.Context<{
|
|
3
|
+
scheduleUpdate: (callback: () => void) => void;
|
|
4
|
+
flushUpdates: () => void;
|
|
5
|
+
}>;
|
|
6
|
+
/**
|
|
7
|
+
* When screen config changes, we want to update the navigator in the same update phase.
|
|
8
|
+
* However, navigation state is in the root component and React won't let us update it from a child.
|
|
9
|
+
* This is a workaround for that, the scheduled update is stored in the ref without actually calling setState.
|
|
10
|
+
* It lets all subsequent updates access the latest state so it stays correct.
|
|
11
|
+
* Then we call setState during after the component updates.
|
|
12
|
+
*/
|
|
13
|
+
export default function useScheduleUpdate(callback: () => void): void;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is definitely not compatible with concurrent mode, but we don't have a solution for sync state yet.
|
|
3
|
+
*/
|
|
4
|
+
export default function useSyncState<T>(initialState?: (() => T) | T): readonly [T, () => T, (state: T) => void, (callback: () => void) => void, () => void];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function validatePathConfig(config: any, root?: boolean): void;
|
package/package.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@react-navigation/core",
|
|
3
|
+
"description": "Core utilities for building navigators",
|
|
4
|
+
"version": "6.0.2",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"react",
|
|
7
|
+
"react-native",
|
|
8
|
+
"react-navigation"
|
|
9
|
+
],
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/react-navigation/react-navigation.git",
|
|
14
|
+
"directory": "packages/core"
|
|
15
|
+
},
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/react-navigation/react-navigation/issues"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://reactnavigation.org",
|
|
20
|
+
"main": "lib/commonjs/index.js",
|
|
21
|
+
"react-native": "src/index.tsx",
|
|
22
|
+
"source": "src/index.tsx",
|
|
23
|
+
"module": "lib/module/index.js",
|
|
24
|
+
"types": "lib/typescript/src/index.d.ts",
|
|
25
|
+
"files": [
|
|
26
|
+
"src",
|
|
27
|
+
"lib",
|
|
28
|
+
"!**/__tests__"
|
|
29
|
+
],
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"prepare": "bob build",
|
|
35
|
+
"clean": "del lib"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@react-navigation/routers": "^6.0.1",
|
|
39
|
+
"escape-string-regexp": "^4.0.0",
|
|
40
|
+
"nanoid": "^3.1.23",
|
|
41
|
+
"query-string": "^7.0.0",
|
|
42
|
+
"react-is": "^16.13.0"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@testing-library/react-native": "^7.2.0",
|
|
46
|
+
"@types/react": "^17.0.9",
|
|
47
|
+
"@types/react-is": "^17.0.0",
|
|
48
|
+
"del-cli": "^3.0.1",
|
|
49
|
+
"immer": "^9.0.2",
|
|
50
|
+
"react": "~16.13.1",
|
|
51
|
+
"react-native-builder-bob": "^0.18.1",
|
|
52
|
+
"react-test-renderer": "~16.13.1",
|
|
53
|
+
"typescript": "^4.3.2"
|
|
54
|
+
},
|
|
55
|
+
"peerDependencies": {
|
|
56
|
+
"react": "*"
|
|
57
|
+
},
|
|
58
|
+
"react-native-builder-bob": {
|
|
59
|
+
"source": "src",
|
|
60
|
+
"output": "lib",
|
|
61
|
+
"targets": [
|
|
62
|
+
"commonjs",
|
|
63
|
+
"module",
|
|
64
|
+
[
|
|
65
|
+
"typescript",
|
|
66
|
+
{
|
|
67
|
+
"project": "tsconfig.build.json"
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
"gitHead": "38ac69f17ee314f96d3d4bcee02349fa4a02d422"
|
|
73
|
+
}
|