@symbiote-native/navigation 2.0.3 → 2.2.0
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/README.md +42 -12
- package/build/angular/drawer/index.js +29 -13
- package/build/angular/index.d.ts +4 -4
- package/build/angular/injectors/inject-navigation.js +1 -1
- package/build/angular/navigation-scope.directive.js +1 -1
- package/build/angular/search-bar-ref.directive.js +1 -1
- package/build/angular/stack/index.d.ts +2 -0
- package/build/angular/stack/index.js +43 -9
- package/build/angular/tabs/index.d.ts +1 -1
- package/build/angular/tabs/index.js +40 -13
- package/build/core/drawer-options/index.js +19 -5
- package/build/core/drawer-router-state/index.js +8 -2
- package/build/core/guards.js +3 -1
- package/build/core/header-bar-buttons.js +14 -4
- package/build/core/index.d.ts +6 -5
- package/build/core/index.js +7 -3
- package/build/core/navigator-state/index.js +12 -4
- package/build/core/render-drawer.js +4 -1
- package/build/core/render-stack.js +13 -4
- package/build/core/screen-options.js +1 -1
- package/build/core/search-bar-commands.js +1 -1
- package/build/core/stack-router-state/index.d.ts +2 -0
- package/build/core/stack-router-state/index.js +44 -0
- package/build/core/state-persistence/index.js +6 -2
- package/build/core/tab-router-state/index.d.ts +1 -0
- package/build/core/tab-router-state/index.js +27 -2
- package/build/react/drawer/index.js +59 -26
- package/build/react/index.d.ts +7 -7
- package/build/react/index.js +2 -2
- package/build/react/stack/index.js +47 -10
- package/build/react/tabs/index.js +36 -12
- package/build/solid/drawer/index.d.ts +22 -0
- package/build/solid/drawer/index.js +394 -0
- package/build/solid/drawer-screen-props.d.ts +13 -0
- package/build/solid/drawer-screen-props.js +2 -0
- package/build/solid/host.d.ts +2 -0
- package/build/solid/host.js +23 -0
- package/build/solid/index.d.ts +19 -0
- package/build/solid/index.js +24 -0
- package/build/solid/linking.d.ts +3 -0
- package/build/solid/linking.js +55 -0
- package/build/solid/navigation-context.d.ts +13 -0
- package/build/solid/navigation-context.js +37 -0
- package/build/solid/primitives/create-focus-effect.d.ts +1 -0
- package/build/solid/primitives/create-focus-effect.js +30 -0
- package/build/solid/primitives/create-is-focused.d.ts +2 -0
- package/build/solid/primitives/create-is-focused.js +31 -0
- package/build/solid/primitives/create-navigation-state.d.ts +3 -0
- package/build/solid/primitives/create-navigation-state.js +30 -0
- package/build/solid/primitives/index.d.ts +12 -0
- package/build/solid/primitives/index.js +8 -0
- package/build/solid/primitives/use-drawer-navigation.d.ts +5 -0
- package/build/solid/primitives/use-drawer-navigation.js +15 -0
- package/build/solid/primitives/use-navigation.d.ts +8 -0
- package/build/solid/primitives/use-navigation.js +23 -0
- package/build/solid/primitives/use-route.d.ts +3 -0
- package/build/solid/primitives/use-route.js +14 -0
- package/build/solid/primitives/use-stack-navigation.d.ts +5 -0
- package/build/solid/primitives/use-stack-navigation.js +19 -0
- package/build/solid/primitives/use-tab-navigation.d.ts +5 -0
- package/build/solid/primitives/use-tab-navigation.js +15 -0
- package/build/solid/screen-props.d.ts +19 -0
- package/build/solid/screen-props.js +9 -0
- package/build/solid/screen-registry.d.ts +31 -0
- package/build/solid/screen-registry.js +86 -0
- package/build/solid/screen.d.ts +6 -0
- package/build/solid/screen.js +69 -0
- package/build/solid/stack/index.d.ts +15 -0
- package/build/solid/stack/index.js +348 -0
- package/build/solid/tab-screen-props.d.ts +13 -0
- package/build/solid/tab-screen-props.js +3 -0
- package/build/solid/tabs/index.d.ts +14 -0
- package/build/solid/tabs/index.js +228 -0
- package/build/svelte/attachments.d.ts +5 -0
- package/build/svelte/attachments.js +61 -0
- package/build/svelte/descriptor-subtree.d.ts +3 -0
- package/build/svelte/descriptor-subtree.js +39 -0
- package/build/svelte/drawer/drawer-props.d.ts +14 -0
- package/build/svelte/drawer/drawer-props.js +3 -0
- package/build/svelte/drawer/index.d.ts +10 -0
- package/build/svelte/drawer/index.js +6 -0
- package/build/svelte/drawer/index.svelte +559 -0
- package/build/svelte/drawer/index.svelte.d.ts +10 -0
- package/build/svelte/drawer-screen-props.d.ts +13 -0
- package/build/svelte/drawer-screen-props.js +4 -0
- package/build/svelte/drawer-screen.svelte +25 -0
- package/build/svelte/drawer-screen.svelte.d.ts +4 -0
- package/build/svelte/index.d.ts +21 -0
- package/build/svelte/index.js +20 -0
- package/build/svelte/linking.svelte.d.ts +2 -0
- package/build/svelte/linking.svelte.js +55 -0
- package/build/svelte/navigation-context.d.ts +14 -0
- package/build/svelte/navigation-context.js +44 -0
- package/build/svelte/navigation-scope.svelte +27 -0
- package/build/svelte/navigation-scope.svelte.d.ts +9 -0
- package/build/svelte/registry-host.d.ts +1 -0
- package/build/svelte/registry-host.js +26 -0
- package/build/svelte/runes/index.d.ts +12 -0
- package/build/svelte/runes/index.js +12 -0
- package/build/svelte/runes/use-drawer-navigation.svelte.d.ts +6 -0
- package/build/svelte/runes/use-drawer-navigation.svelte.js +19 -0
- package/build/svelte/runes/use-focus-effect.svelte.d.ts +1 -0
- package/build/svelte/runes/use-focus-effect.svelte.js +31 -0
- package/build/svelte/runes/use-is-focused.svelte.d.ts +3 -0
- package/build/svelte/runes/use-is-focused.svelte.js +34 -0
- package/build/svelte/runes/use-navigation-state.svelte.d.ts +4 -0
- package/build/svelte/runes/use-navigation-state.svelte.js +39 -0
- package/build/svelte/runes/use-navigation.svelte.d.ts +9 -0
- package/build/svelte/runes/use-navigation.svelte.js +26 -0
- package/build/svelte/runes/use-route.svelte.d.ts +4 -0
- package/build/svelte/runes/use-route.svelte.js +12 -0
- package/build/svelte/runes/use-stack-navigation.svelte.d.ts +6 -0
- package/build/svelte/runes/use-stack-navigation.svelte.js +22 -0
- package/build/svelte/runes/use-tab-navigation.svelte.d.ts +6 -0
- package/build/svelte/runes/use-tab-navigation.svelte.js +19 -0
- package/build/svelte/screen-props.d.ts +21 -0
- package/build/svelte/screen-props.js +6 -0
- package/build/svelte/screen-registry.d.ts +17 -0
- package/build/svelte/screen-registry.js +57 -0
- package/build/svelte/screen.svelte +28 -0
- package/build/svelte/screen.svelte.d.ts +4 -0
- package/build/svelte/stack/index.d.ts +14 -0
- package/build/svelte/stack/index.js +7 -0
- package/build/svelte/stack/index.svelte +261 -0
- package/build/svelte/stack/index.svelte.d.ts +15 -0
- package/build/svelte/stack/stack-props.d.ts +20 -0
- package/build/svelte/stack/stack-props.js +4 -0
- package/build/svelte/stack/stack-screen.svelte +205 -0
- package/build/svelte/stack/stack-screen.svelte.d.ts +4 -0
- package/build/svelte/tab-screen-props.d.ts +13 -0
- package/build/svelte/tab-screen-props.js +4 -0
- package/build/svelte/tab-screen.svelte +26 -0
- package/build/svelte/tab-screen.svelte.d.ts +4 -0
- package/build/svelte/tabs/index.d.ts +8 -0
- package/build/svelte/tabs/index.js +6 -0
- package/build/svelte/tabs/index.svelte +269 -0
- package/build/svelte/tabs/index.svelte.d.ts +8 -0
- package/build/svelte/tabs/tab-props.d.ts +7 -0
- package/build/svelte/tabs/tab-props.js +3 -0
- package/build/vue/composables/use-navigation.js +5 -1
- package/build/vue/drawer/index.js +36 -13
- package/build/vue/index.d.ts +3 -3
- package/build/vue/navigation-context.js +1 -1
- package/build/vue/stack/index.js +43 -18
- package/build/vue/tabs/index.js +65 -39
- package/build-ngc/angular/drawer/index.js +40 -18
- package/build-ngc/angular/drawer/index.js.map +1 -1
- package/build-ngc/angular/drawer-screen.directive.js +3 -3
- package/build-ngc/angular/index.d.ts +4 -4
- package/build-ngc/angular/index.js.map +1 -1
- package/build-ngc/angular/injectors/inject-focus-effect.js.map +1 -1
- package/build-ngc/angular/injectors/inject-is-focused.js.map +1 -1
- package/build-ngc/angular/injectors/inject-navigation-state.js.map +1 -1
- package/build-ngc/angular/injectors/inject-navigation.js +1 -1
- package/build-ngc/angular/injectors/inject-navigation.js.map +1 -1
- package/build-ngc/angular/linking.js.map +1 -1
- package/build-ngc/angular/navigation-context.service.js +3 -3
- package/build-ngc/angular/navigation-context.service.js.map +1 -1
- package/build-ngc/angular/navigation-scope.directive.js +4 -4
- package/build-ngc/angular/navigation-scope.directive.js.map +1 -1
- package/build-ngc/angular/screen.directive.js +3 -3
- package/build-ngc/angular/screen.directive.js.map +1 -1
- package/build-ngc/angular/search-bar-ref.directive.js +4 -4
- package/build-ngc/angular/search-bar-ref.directive.js.map +1 -1
- package/build-ngc/angular/stack/index.d.ts +2 -0
- package/build-ngc/angular/stack/index.js +52 -14
- package/build-ngc/angular/stack/index.js.map +1 -1
- package/build-ngc/angular/tab-screen.directive.js +3 -3
- package/build-ngc/angular/tab-screen.directive.js.map +1 -1
- package/build-ngc/angular/tabs/index.d.ts +1 -1
- package/build-ngc/angular/tabs/index.js +43 -16
- package/build-ngc/angular/tabs/index.js.map +1 -1
- package/build-ngc/core/constants.js.map +1 -1
- package/build-ngc/core/drawer-options/index.js +19 -5
- package/build-ngc/core/drawer-options/index.js.map +1 -1
- package/build-ngc/core/drawer-router-state/index.js +8 -2
- package/build-ngc/core/drawer-router-state/index.js.map +1 -1
- package/build-ngc/core/guards.js +3 -1
- package/build-ngc/core/guards.js.map +1 -1
- package/build-ngc/core/header-bar-buttons.js +14 -4
- package/build-ngc/core/header-bar-buttons.js.map +1 -1
- package/build-ngc/core/index.d.ts +6 -5
- package/build-ngc/core/index.js +7 -3
- package/build-ngc/core/index.js.map +1 -1
- package/build-ngc/core/linking-config/index.js.map +1 -1
- package/build-ngc/core/navigation-events/index.js.map +1 -1
- package/build-ngc/core/navigator-handles/index.js.map +1 -1
- package/build-ngc/core/navigator-state/index.js +12 -4
- package/build-ngc/core/navigator-state/index.js.map +1 -1
- package/build-ngc/core/render-drawer.js +4 -1
- package/build-ngc/core/render-drawer.js.map +1 -1
- package/build-ngc/core/render-stack.js +13 -4
- package/build-ngc/core/render-stack.js.map +1 -1
- package/build-ngc/core/render-tabs.js.map +1 -1
- package/build-ngc/core/screen-options.js +1 -1
- package/build-ngc/core/screen-options.js.map +1 -1
- package/build-ngc/core/search-bar-commands.js +1 -1
- package/build-ngc/core/search-bar-commands.js.map +1 -1
- package/build-ngc/core/stack-router-state/index.d.ts +2 -0
- package/build-ngc/core/stack-router-state/index.js +45 -0
- package/build-ngc/core/stack-router-state/index.js.map +1 -0
- package/build-ngc/core/state-persistence/index.js +6 -2
- package/build-ngc/core/state-persistence/index.js.map +1 -1
- package/build-ngc/core/tab-router-state/index.d.ts +1 -0
- package/build-ngc/core/tab-router-state/index.js +27 -2
- package/build-ngc/core/tab-router-state/index.js.map +1 -1
- package/package.json +44 -16
- package/src/angular/drawer/index.ts +75 -29
- package/src/angular/index.ts +20 -4
- package/src/angular/injectors/inject-focus-effect.ts +8 -2
- package/src/angular/injectors/inject-is-focused.ts +6 -4
- package/src/angular/injectors/inject-navigation-state.ts +7 -4
- package/src/angular/injectors/inject-navigation.ts +12 -3
- package/src/angular/linking.ts +4 -1
- package/src/angular/navigation-context.service.ts +5 -2
- package/src/angular/navigation-scope.directive.ts +6 -2
- package/src/angular/screen.directive.ts +13 -3
- package/src/angular/search-bar-ref.directive.ts +10 -2
- package/src/angular/stack/index.ts +91 -24
- package/src/angular/tab-screen.directive.ts +3 -1
- package/src/angular/tabs/index.ts +54 -16
- package/src/core/constants.ts +6 -3
- package/src/core/drawer-options/index.ts +40 -13
- package/src/core/drawer-router-state/index.ts +11 -3
- package/src/core/guards.ts +3 -1
- package/src/core/header-bar-buttons.ts +41 -12
- package/src/core/index.ts +29 -5
- package/src/core/linking-config/index.ts +31 -10
- package/src/core/navigation-events/index.ts +8 -2
- package/src/core/navigator-handles/index.ts +8 -3
- package/src/core/navigator-props.ts +13 -4
- package/src/core/navigator-state/index.ts +24 -7
- package/src/core/render-drawer.ts +24 -9
- package/src/core/render-stack.ts +52 -13
- package/src/core/render-tabs.ts +24 -6
- package/src/core/screen-options.ts +15 -5
- package/src/core/search-bar-commands.ts +12 -3
- package/src/core/stack-router-state/index.ts +52 -0
- package/src/core/state-persistence/index.ts +13 -3
- package/src/core/tab-router-state/index.ts +35 -3
- package/src/react/drawer/index.ts +409 -330
- package/src/react/drawer-screen.ts +8 -2
- package/src/react/hooks/use-focus-effect.ts +8 -2
- package/src/react/hooks/use-is-focused.ts +6 -2
- package/src/react/hooks/use-navigation.ts +8 -2
- package/src/react/index.ts +37 -7
- package/src/react/linking.ts +4 -1
- package/src/react/navigation-context.ts +6 -2
- package/src/react/screen.ts +12 -3
- package/src/react/stack/index.ts +297 -220
- package/src/react/tab-screen.ts +3 -1
- package/src/react/tabs/index.ts +202 -139
- package/src/solid/drawer/index.ts +570 -0
- package/src/solid/drawer-screen-props.ts +24 -0
- package/src/solid/host.ts +29 -0
- package/src/solid/index.ts +87 -0
- package/src/solid/linking.ts +74 -0
- package/src/solid/navigation-context.ts +56 -0
- package/src/solid/primitives/create-focus-effect.ts +41 -0
- package/src/solid/primitives/create-is-focused.ts +41 -0
- package/src/solid/primitives/create-navigation-state.ts +44 -0
- package/src/solid/primitives/index.ts +12 -0
- package/src/solid/primitives/use-drawer-navigation.ts +25 -0
- package/src/solid/primitives/use-navigation.ts +44 -0
- package/src/solid/primitives/use-route.ts +18 -0
- package/src/solid/primitives/use-stack-navigation.ts +29 -0
- package/src/solid/primitives/use-tab-navigation.ts +25 -0
- package/src/solid/screen-props.ts +51 -0
- package/src/solid/screen-registry.ts +159 -0
- package/src/solid/screen.ts +80 -0
- package/src/solid/stack/index.ts +528 -0
- package/src/solid/tab-screen-props.ts +21 -0
- package/src/solid/tabs/index.ts +327 -0
- package/src/svelte/attachments.ts +70 -0
- package/src/svelte/descriptor-subtree.ts +51 -0
- package/src/svelte/drawer/drawer-props.ts +28 -0
- package/src/svelte/drawer/index.svelte +559 -0
- package/src/svelte/drawer/index.ts +10 -0
- package/src/svelte/drawer-screen-props.ts +26 -0
- package/src/svelte/drawer-screen.svelte +25 -0
- package/src/svelte/fabric-tree.test-helper.ts +95 -0
- package/src/svelte/index.ts +83 -0
- package/src/svelte/linking.svelte.ts +72 -0
- package/src/svelte/navigation-context.ts +62 -0
- package/src/svelte/navigation-scope.svelte +27 -0
- package/src/svelte/registry-host.ts +26 -0
- package/src/svelte/runes/index.ts +17 -0
- package/src/svelte/runes/use-drawer-navigation.svelte.ts +31 -0
- package/src/svelte/runes/use-focus-effect.svelte.ts +41 -0
- package/src/svelte/runes/use-is-focused.svelte.ts +38 -0
- package/src/svelte/runes/use-navigation-state.svelte.ts +48 -0
- package/src/svelte/runes/use-navigation.svelte.ts +49 -0
- package/src/svelte/runes/use-route.svelte.ts +16 -0
- package/src/svelte/runes/use-stack-navigation.svelte.ts +34 -0
- package/src/svelte/runes/use-tab-navigation.svelte.ts +29 -0
- package/src/svelte/screen-props.ts +50 -0
- package/src/svelte/screen-registry.ts +98 -0
- package/src/svelte/screen.svelte +28 -0
- package/src/svelte/stack/index.svelte +261 -0
- package/src/svelte/stack/index.ts +11 -0
- package/src/svelte/stack/stack-props.ts +31 -0
- package/src/svelte/stack/stack-screen.svelte +205 -0
- package/src/svelte/svelte-ambient.d.ts +6 -0
- package/src/svelte/svelte-compile.test-helper.ts +147 -0
- package/src/svelte/tab-screen-props.ts +22 -0
- package/src/svelte/tab-screen.svelte +26 -0
- package/src/svelte/tabs/index.svelte +269 -0
- package/src/svelte/tabs/index.ts +10 -0
- package/src/svelte/tabs/tab-props.ts +13 -0
- package/src/vue/composables/use-navigation-state.ts +7 -4
- package/src/vue/composables/use-navigation.ts +13 -3
- package/src/vue/drawer/index.ts +128 -41
- package/src/vue/drawer-screen.ts +12 -5
- package/src/vue/index.ts +15 -3
- package/src/vue/linking.ts +7 -2
- package/src/vue/navigation-context.ts +17 -5
- package/src/vue/screen.ts +7 -2
- package/src/vue/stack/index.ts +108 -43
- package/src/vue/tab-screen.ts +3 -1
- package/src/vue/tabs/index.ts +109 -68
|
@@ -5,7 +5,11 @@
|
|
|
5
5
|
// <third_party_rn_packages_are_react_only> - this and Drawer import nothing from react-native.
|
|
6
6
|
|
|
7
7
|
import type { FC, ReactElement } from 'react';
|
|
8
|
-
import type {
|
|
8
|
+
import type {
|
|
9
|
+
IDrawerNavigatorHandle,
|
|
10
|
+
IDrawerScreenOptions,
|
|
11
|
+
IRoute,
|
|
12
|
+
} from '../core';
|
|
9
13
|
|
|
10
14
|
// The options resolver runs INSIDE Drawer while it computes a screen's options, closing over the
|
|
11
15
|
// live navigator handle - not the mounted screen component (that reads navigation/route via the
|
|
@@ -15,7 +19,9 @@ export type IDrawerScreenOptionsArgs = {
|
|
|
15
19
|
navigation: IDrawerNavigatorHandle;
|
|
16
20
|
};
|
|
17
21
|
|
|
18
|
-
export type IDrawerScreenOptionsResolver = (
|
|
22
|
+
export type IDrawerScreenOptionsResolver = (
|
|
23
|
+
args: IDrawerScreenOptionsArgs,
|
|
24
|
+
) => IDrawerScreenOptions;
|
|
19
25
|
|
|
20
26
|
export type IDrawerScreenProps = {
|
|
21
27
|
name: string;
|
|
@@ -24,8 +24,14 @@ export function useFocusEffect(effect: EffectCallback): void {
|
|
|
24
24
|
cleanup = undefined;
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
const unsubscribeFocus = emitter.addListener(
|
|
28
|
-
|
|
27
|
+
const unsubscribeFocus = emitter.addListener(
|
|
28
|
+
NAVIGATION_EVENT_FOCUS,
|
|
29
|
+
runEffect,
|
|
30
|
+
);
|
|
31
|
+
const unsubscribeBlur = emitter.addListener(
|
|
32
|
+
NAVIGATION_EVENT_BLUR,
|
|
33
|
+
runCleanup,
|
|
34
|
+
);
|
|
29
35
|
|
|
30
36
|
return () => {
|
|
31
37
|
unsubscribeFocus();
|
|
@@ -14,8 +14,12 @@ export function useIsFocused(): boolean {
|
|
|
14
14
|
const [isFocused, setIsFocused] = useState(false);
|
|
15
15
|
|
|
16
16
|
useEffect(() => {
|
|
17
|
-
const unsubscribeFocus = emitter.addListener(NAVIGATION_EVENT_FOCUS, () =>
|
|
18
|
-
|
|
17
|
+
const unsubscribeFocus = emitter.addListener(NAVIGATION_EVENT_FOCUS, () =>
|
|
18
|
+
setIsFocused(true),
|
|
19
|
+
);
|
|
20
|
+
const unsubscribeBlur = emitter.addListener(NAVIGATION_EVENT_BLUR, () =>
|
|
21
|
+
setIsFocused(false),
|
|
22
|
+
);
|
|
19
23
|
return () => {
|
|
20
24
|
unsubscribeFocus();
|
|
21
25
|
unsubscribeBlur();
|
|
@@ -5,12 +5,18 @@
|
|
|
5
5
|
// ../../core/navigation-events; this hook only reads NavigationContext and binds identity.
|
|
6
6
|
|
|
7
7
|
import { useMemo } from 'react';
|
|
8
|
-
import type {
|
|
8
|
+
import type {
|
|
9
|
+
INavigationEventListener,
|
|
10
|
+
INavigationEventName,
|
|
11
|
+
} from '../../core';
|
|
9
12
|
import { useRequiredNavigationContext } from '../navigation-context';
|
|
10
13
|
import type { IAnyNavigatorHandle } from '../navigation-context';
|
|
11
14
|
|
|
12
15
|
export type INavigationHandle = IAnyNavigatorHandle & {
|
|
13
|
-
addListener: (
|
|
16
|
+
addListener: (
|
|
17
|
+
event: INavigationEventName,
|
|
18
|
+
listener: INavigationEventListener,
|
|
19
|
+
) => () => void;
|
|
14
20
|
// Walks exactly ONE hop up navigation-context.ts's `parent` chain to the enclosing navigator's
|
|
15
21
|
// handle - e.g. a Tab screen nested inside a Stack screen calling getParent() to push a new
|
|
16
22
|
// Stack route. Callers narrow the union themselves ('push' in parent, etc.). Deliberately NOT
|
package/src/react/index.ts
CHANGED
|
@@ -8,19 +8,40 @@ import '../register';
|
|
|
8
8
|
export { Stack } from './stack';
|
|
9
9
|
export type { INavigatorHandle, IStackProps } from './stack';
|
|
10
10
|
export { Screen } from './screen';
|
|
11
|
-
export type {
|
|
12
|
-
|
|
11
|
+
export type {
|
|
12
|
+
IScreenOptionsArgs,
|
|
13
|
+
IScreenOptionsResolver,
|
|
14
|
+
IScreenProps,
|
|
15
|
+
} from './screen';
|
|
16
|
+
export type {
|
|
17
|
+
IScreenOptions,
|
|
18
|
+
IStackAnimation,
|
|
19
|
+
IStackPresentation,
|
|
20
|
+
} from '../core';
|
|
13
21
|
|
|
14
|
-
export {
|
|
22
|
+
export {
|
|
23
|
+
useNavigation,
|
|
24
|
+
useRoute,
|
|
25
|
+
useIsFocused,
|
|
26
|
+
useFocusEffect,
|
|
27
|
+
useNavigationState,
|
|
28
|
+
} from './hooks';
|
|
15
29
|
export type { INavigationHandle } from './hooks';
|
|
16
|
-
export {
|
|
30
|
+
export {
|
|
31
|
+
useStackNavigation,
|
|
32
|
+
useTabNavigation,
|
|
33
|
+
useDrawerNavigation,
|
|
34
|
+
} from './hooks';
|
|
17
35
|
export type {
|
|
18
36
|
IStackNavigationHandle,
|
|
19
37
|
ITabNavigationHandle,
|
|
20
38
|
IDrawerNavigationHandle,
|
|
21
39
|
} from './hooks';
|
|
22
40
|
export { NavigationContext } from './navigation-context';
|
|
23
|
-
export type {
|
|
41
|
+
export type {
|
|
42
|
+
INavigationContextValue,
|
|
43
|
+
IAnyNavigatorHandle,
|
|
44
|
+
} from './navigation-context';
|
|
24
45
|
|
|
25
46
|
export { useLinkingIntegration } from './linking';
|
|
26
47
|
export type { ILinkingConfig, IScreenLinkingConfig } from '../core';
|
|
@@ -42,11 +63,20 @@ export type { ITabOptions, ITabBarIcon } from '../core';
|
|
|
42
63
|
// ../register import above). See react/drawer.ts's header for the feasibility note re:
|
|
43
64
|
// react-native-gesture-handler / react-native-reanimated parity gaps.
|
|
44
65
|
export { Drawer } from './drawer';
|
|
45
|
-
export type {
|
|
66
|
+
export type {
|
|
67
|
+
IDrawerNavigatorHandle,
|
|
68
|
+
IDrawerProps,
|
|
69
|
+
IDrawerDescriptorMap,
|
|
70
|
+
} from './drawer';
|
|
46
71
|
export { DrawerScreen } from './drawer-screen';
|
|
47
72
|
export type {
|
|
48
73
|
IDrawerScreenOptionsArgs,
|
|
49
74
|
IDrawerScreenOptionsResolver,
|
|
50
75
|
IDrawerScreenProps,
|
|
51
76
|
} from './drawer-screen';
|
|
52
|
-
export type {
|
|
77
|
+
export type {
|
|
78
|
+
IDrawerOptions,
|
|
79
|
+
IDrawerScreenOptions,
|
|
80
|
+
IDrawerType,
|
|
81
|
+
IDrawerPosition,
|
|
82
|
+
} from '../core';
|
package/src/react/linking.ts
CHANGED
|
@@ -24,7 +24,10 @@ export function useLinkingIntegration(
|
|
|
24
24
|
handleRef.current = navigatorHandle;
|
|
25
25
|
|
|
26
26
|
useEffect(() => {
|
|
27
|
-
function applyRoute(
|
|
27
|
+
function applyRoute(
|
|
28
|
+
url: string,
|
|
29
|
+
dispatch: (name: string, params?: unknown) => void,
|
|
30
|
+
): void {
|
|
28
31
|
const route = resolveRouteFromUrl(configRef.current, url);
|
|
29
32
|
if (route === null) {
|
|
30
33
|
dlog(`useLinkingIntegration: no route resolved for "${url}"`);
|
|
@@ -24,12 +24,16 @@ export type INavigationContextValue = {
|
|
|
24
24
|
parent?: INavigationContextValue;
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
export const NavigationContext = createContext<
|
|
27
|
+
export const NavigationContext = createContext<
|
|
28
|
+
INavigationContextValue | undefined
|
|
29
|
+
>(undefined);
|
|
28
30
|
|
|
29
31
|
// Every hook in ./hooks needs the same `useContext(NavigationContext)` + missing-provider throw,
|
|
30
32
|
// so it's co-located here instead of repeated per hook. `hookName` keeps each hook's own name in
|
|
31
33
|
// the thrown message.
|
|
32
|
-
export function useRequiredNavigationContext(
|
|
34
|
+
export function useRequiredNavigationContext(
|
|
35
|
+
hookName: string,
|
|
36
|
+
): INavigationContextValue {
|
|
33
37
|
const context = useContext(NavigationContext);
|
|
34
38
|
if (!context) {
|
|
35
39
|
throw new Error(
|
package/src/react/screen.ts
CHANGED
|
@@ -5,7 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
import type { FC, ReactElement, RefObject } from 'react';
|
|
7
7
|
import type { IRoute } from '../core';
|
|
8
|
-
import type {
|
|
8
|
+
import type {
|
|
9
|
+
ISearchBarCommands,
|
|
10
|
+
ISearchBarOptions,
|
|
11
|
+
IScreenOptions,
|
|
12
|
+
} from '../core';
|
|
9
13
|
import type { INavigatorHandle } from '../core';
|
|
10
14
|
|
|
11
15
|
// The imperative ref (focus/blur/clearText/setText/cancelSearch/toggleCancelButton) carries a
|
|
@@ -17,7 +21,10 @@ export type IReactSearchBarOptions = ISearchBarOptions & {
|
|
|
17
21
|
ref?: RefObject<ISearchBarCommands | null>;
|
|
18
22
|
};
|
|
19
23
|
|
|
20
|
-
export type IReactScreenOptions = Omit<
|
|
24
|
+
export type IReactScreenOptions = Omit<
|
|
25
|
+
IScreenOptions,
|
|
26
|
+
'headerSearchBarOptions'
|
|
27
|
+
> & {
|
|
21
28
|
headerSearchBarOptions?: IReactSearchBarOptions;
|
|
22
29
|
};
|
|
23
30
|
|
|
@@ -30,7 +37,9 @@ export type IScreenOptionsArgs = {
|
|
|
30
37
|
navigation: INavigatorHandle;
|
|
31
38
|
};
|
|
32
39
|
|
|
33
|
-
export type IScreenOptionsResolver = (
|
|
40
|
+
export type IScreenOptionsResolver = (
|
|
41
|
+
args: IScreenOptionsArgs,
|
|
42
|
+
) => IReactScreenOptions;
|
|
34
43
|
|
|
35
44
|
export type IScreenProps = {
|
|
36
45
|
name: string;
|