@symbiote-native/navigation 1.0.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/LICENSE +21 -0
- package/build/angular/drawer/index.d.ts +76 -0
- package/build/angular/drawer/index.js +508 -0
- package/build/angular/drawer-screen.directive.d.ts +14 -0
- package/build/angular/drawer-screen.directive.js +87 -0
- package/build/angular/index.d.ts +23 -0
- package/build/angular/index.js +22 -0
- package/build/angular/injectors/index.d.ts +13 -0
- package/build/angular/injectors/index.js +8 -0
- package/build/angular/injectors/inject-drawer-navigation.d.ts +4 -0
- package/build/angular/injectors/inject-drawer-navigation.js +12 -0
- package/build/angular/injectors/inject-focus-effect.d.ts +2 -0
- package/build/angular/injectors/inject-focus-effect.js +29 -0
- package/build/angular/injectors/inject-is-focused.d.ts +2 -0
- package/build/angular/injectors/inject-is-focused.js +20 -0
- package/build/angular/injectors/inject-navigation-state.d.ts +3 -0
- package/build/angular/injectors/inject-navigation-state.js +35 -0
- package/build/angular/injectors/inject-navigation.d.ts +7 -0
- package/build/angular/injectors/inject-navigation.js +16 -0
- package/build/angular/injectors/inject-route.d.ts +3 -0
- package/build/angular/injectors/inject-route.js +20 -0
- package/build/angular/injectors/inject-stack-navigation.d.ts +4 -0
- package/build/angular/injectors/inject-stack-navigation.js +15 -0
- package/build/angular/injectors/inject-tab-navigation.d.ts +4 -0
- package/build/angular/injectors/inject-tab-navigation.js +11 -0
- package/build/angular/linking.d.ts +3 -0
- package/build/angular/linking.js +43 -0
- package/build/angular/navigation-context.service.d.ts +13 -0
- package/build/angular/navigation-context.service.js +105 -0
- package/build/angular/navigation-scope.directive.d.ts +10 -0
- package/build/angular/navigation-scope.directive.js +90 -0
- package/build/angular/screen.directive.d.ts +22 -0
- package/build/angular/screen.directive.js +90 -0
- package/build/angular/search-bar-ref.directive.d.ts +10 -0
- package/build/angular/search-bar-ref.directive.js +88 -0
- package/build/angular/stack/index.d.ts +55 -0
- package/build/angular/stack/index.js +386 -0
- package/build/angular/tab-screen.directive.d.ts +14 -0
- package/build/angular/tab-screen.directive.js +87 -0
- package/build/angular/tabs/index.d.ts +42 -0
- package/build/angular/tabs/index.js +263 -0
- package/build/core/constants.d.ts +27 -0
- package/build/core/constants.js +61 -0
- package/build/core/drawer-options/index.d.ts +64 -0
- package/build/core/drawer-options/index.js +200 -0
- package/build/core/drawer-router-state/index.d.ts +21 -0
- package/build/core/drawer-router-state/index.js +40 -0
- package/build/core/guards.d.ts +2 -0
- package/build/core/guards.js +22 -0
- package/build/core/header-bar-buttons.d.ts +9 -0
- package/build/core/header-bar-buttons.js +163 -0
- package/build/core/index.d.ts +29 -0
- package/build/core/index.js +32 -0
- package/build/core/linking-config/index.d.ts +13 -0
- package/build/core/linking-config/index.js +171 -0
- package/build/core/navigation-events/index.d.ts +16 -0
- package/build/core/navigation-events/index.js +57 -0
- package/build/core/navigator-handles/index.d.ts +30 -0
- package/build/core/navigator-handles/index.js +15 -0
- package/build/core/navigator-props.d.ts +216 -0
- package/build/core/navigator-props.js +7 -0
- package/build/core/navigator-state/index.d.ts +36 -0
- package/build/core/navigator-state/index.js +81 -0
- package/build/core/render-drawer.d.ts +13 -0
- package/build/core/render-drawer.js +88 -0
- package/build/core/render-stack.d.ts +35 -0
- package/build/core/render-stack.js +294 -0
- package/build/core/render-tabs.d.ts +20 -0
- package/build/core/render-tabs.js +97 -0
- package/build/core/screen-options.d.ts +4 -0
- package/build/core/screen-options.js +133 -0
- package/build/core/search-bar-commands.d.ts +10 -0
- package/build/core/search-bar-commands.js +42 -0
- package/build/core/state-persistence/index.d.ts +3 -0
- package/build/core/state-persistence/index.js +23 -0
- package/build/core/tab-options.d.ts +13 -0
- package/build/core/tab-options.js +10 -0
- package/build/core/tab-router-state/index.d.ts +19 -0
- package/build/core/tab-router-state/index.js +51 -0
- package/build/react/collect-registry.d.ts +4 -0
- package/build/react/collect-registry.js +15 -0
- package/build/react/drawer/index.d.ts +29 -0
- package/build/react/drawer/index.js +277 -0
- package/build/react/drawer-screen.d.ts +14 -0
- package/build/react/drawer-screen.js +8 -0
- package/build/react/hooks/index.d.ts +12 -0
- package/build/react/hooks/index.js +8 -0
- package/build/react/hooks/use-drawer-navigation.d.ts +4 -0
- package/build/react/hooks/use-drawer-navigation.js +12 -0
- package/build/react/hooks/use-focus-effect.d.ts +2 -0
- package/build/react/hooks/use-focus-effect.js +29 -0
- package/build/react/hooks/use-is-focused.d.ts +1 -0
- package/build/react/hooks/use-is-focused.js +22 -0
- package/build/react/hooks/use-navigation-state/index.d.ts +2 -0
- package/build/react/hooks/use-navigation-state/index.js +39 -0
- package/build/react/hooks/use-navigation.d.ts +7 -0
- package/build/react/hooks/use-navigation.js +16 -0
- package/build/react/hooks/use-route.d.ts +2 -0
- package/build/react/hooks/use-route.js +8 -0
- package/build/react/hooks/use-stack-navigation.d.ts +4 -0
- package/build/react/hooks/use-stack-navigation.js +14 -0
- package/build/react/hooks/use-tab-navigation.d.ts +4 -0
- package/build/react/hooks/use-tab-navigation.js +12 -0
- package/build/react/index.d.ts +24 -0
- package/build/react/index.js +21 -0
- package/build/react/linking.d.ts +3 -0
- package/build/react/linking.js +47 -0
- package/build/react/navigation-context.d.ts +10 -0
- package/build/react/navigation-context.js +22 -0
- package/build/react/screen.d.ts +22 -0
- package/build/react/screen.js +7 -0
- package/build/react/stack/index.d.ts +13 -0
- package/build/react/stack/index.js +202 -0
- package/build/react/tab-screen.d.ts +15 -0
- package/build/react/tab-screen.js +8 -0
- package/build/react/tabs/index.d.ts +12 -0
- package/build/react/tabs/index.js +116 -0
- package/build/register.d.ts +7 -0
- package/build/register.js +58 -0
- package/build/vue/composables/index.d.ts +12 -0
- package/build/vue/composables/index.js +8 -0
- package/build/vue/composables/use-drawer-navigation.d.ts +5 -0
- package/build/vue/composables/use-drawer-navigation.js +15 -0
- package/build/vue/composables/use-focus-effect.d.ts +1 -0
- package/build/vue/composables/use-focus-effect.js +31 -0
- package/build/vue/composables/use-is-focused.d.ts +2 -0
- package/build/vue/composables/use-is-focused.js +28 -0
- package/build/vue/composables/use-navigation-state.d.ts +3 -0
- package/build/vue/composables/use-navigation-state.js +29 -0
- package/build/vue/composables/use-navigation.d.ts +8 -0
- package/build/vue/composables/use-navigation.js +13 -0
- package/build/vue/composables/use-route.d.ts +3 -0
- package/build/vue/composables/use-route.js +9 -0
- package/build/vue/composables/use-stack-navigation.d.ts +5 -0
- package/build/vue/composables/use-stack-navigation.js +18 -0
- package/build/vue/composables/use-tab-navigation.d.ts +5 -0
- package/build/vue/composables/use-tab-navigation.js +15 -0
- package/build/vue/drawer/index.d.ts +19 -0
- package/build/vue/drawer/index.js +390 -0
- package/build/vue/drawer-screen.d.ts +14 -0
- package/build/vue/drawer-screen.js +12 -0
- package/build/vue/index.d.ts +21 -0
- package/build/vue/index.js +19 -0
- package/build/vue/linking.d.ts +3 -0
- package/build/vue/linking.js +57 -0
- package/build/vue/navigation-context.d.ts +16 -0
- package/build/vue/navigation-context.js +65 -0
- package/build/vue/screen.d.ts +21 -0
- package/build/vue/screen.js +12 -0
- package/build/vue/stack/index.d.ts +9 -0
- package/build/vue/stack/index.js +279 -0
- package/build/vue/tab-screen.d.ts +14 -0
- package/build/vue/tab-screen.js +11 -0
- package/build/vue/tabs/index.d.ts +10 -0
- package/build/vue/tabs/index.js +209 -0
- package/build-ngc/angular/drawer/index.d.ts +79 -0
- package/build-ngc/angular/drawer/index.js +479 -0
- package/build-ngc/angular/drawer/index.js.map +1 -0
- package/build-ngc/angular/drawer-screen.directive.d.ts +17 -0
- package/build-ngc/angular/drawer-screen.directive.js +32 -0
- package/build-ngc/angular/drawer-screen.directive.js.map +1 -0
- package/build-ngc/angular/drawer.d.ts +79 -0
- package/build-ngc/angular/drawer.js +475 -0
- package/build-ngc/angular/drawer.js.map +1 -0
- package/build-ngc/angular/index.d.ts +23 -0
- package/build-ngc/angular/index.js +23 -0
- package/build-ngc/angular/index.js.map +1 -0
- package/build-ngc/angular/injectors/index.d.ts +13 -0
- package/build-ngc/angular/injectors/index.js +9 -0
- package/build-ngc/angular/injectors/index.js.map +1 -0
- package/build-ngc/angular/injectors/inject-drawer-navigation.d.ts +4 -0
- package/build-ngc/angular/injectors/inject-drawer-navigation.js +13 -0
- package/build-ngc/angular/injectors/inject-drawer-navigation.js.map +1 -0
- package/build-ngc/angular/injectors/inject-focus-effect.d.ts +2 -0
- package/build-ngc/angular/injectors/inject-focus-effect.js +30 -0
- package/build-ngc/angular/injectors/inject-focus-effect.js.map +1 -0
- package/build-ngc/angular/injectors/inject-is-focused.d.ts +2 -0
- package/build-ngc/angular/injectors/inject-is-focused.js +22 -0
- package/build-ngc/angular/injectors/inject-is-focused.js.map +1 -0
- package/build-ngc/angular/injectors/inject-navigation-state.d.ts +3 -0
- package/build-ngc/angular/injectors/inject-navigation-state.js +37 -0
- package/build-ngc/angular/injectors/inject-navigation-state.js.map +1 -0
- package/build-ngc/angular/injectors/inject-navigation.d.ts +7 -0
- package/build-ngc/angular/injectors/inject-navigation.js +17 -0
- package/build-ngc/angular/injectors/inject-navigation.js.map +1 -0
- package/build-ngc/angular/injectors/inject-route.d.ts +3 -0
- package/build-ngc/angular/injectors/inject-route.js +21 -0
- package/build-ngc/angular/injectors/inject-route.js.map +1 -0
- package/build-ngc/angular/injectors/inject-stack-navigation.d.ts +4 -0
- package/build-ngc/angular/injectors/inject-stack-navigation.js +16 -0
- package/build-ngc/angular/injectors/inject-stack-navigation.js.map +1 -0
- package/build-ngc/angular/injectors/inject-tab-navigation.d.ts +4 -0
- package/build-ngc/angular/injectors/inject-tab-navigation.js +12 -0
- package/build-ngc/angular/injectors/inject-tab-navigation.js.map +1 -0
- package/build-ngc/angular/linking.d.ts +3 -0
- package/build-ngc/angular/linking.js +44 -0
- package/build-ngc/angular/linking.js.map +1 -0
- package/build-ngc/angular/navigation-context.service.d.ts +16 -0
- package/build-ngc/angular/navigation-context.service.js +63 -0
- package/build-ngc/angular/navigation-context.service.js.map +1 -0
- package/build-ngc/angular/navigation-scope.directive.d.ts +13 -0
- package/build-ngc/angular/navigation-scope.directive.js +42 -0
- package/build-ngc/angular/navigation-scope.directive.js.map +1 -0
- package/build-ngc/angular/screen.directive.d.ts +25 -0
- package/build-ngc/angular/screen.directive.js +35 -0
- package/build-ngc/angular/screen.directive.js.map +1 -0
- package/build-ngc/angular/search-bar-ref.directive.d.ts +13 -0
- package/build-ngc/angular/search-bar-ref.directive.js +44 -0
- package/build-ngc/angular/search-bar-ref.directive.js.map +1 -0
- package/build-ngc/angular/stack/index.d.ts +58 -0
- package/build-ngc/angular/stack/index.js +406 -0
- package/build-ngc/angular/stack/index.js.map +1 -0
- package/build-ngc/angular/stack.d.ts +58 -0
- package/build-ngc/angular/stack.js +402 -0
- package/build-ngc/angular/stack.js.map +1 -0
- package/build-ngc/angular/tab-screen.directive.d.ts +17 -0
- package/build-ngc/angular/tab-screen.directive.js +32 -0
- package/build-ngc/angular/tab-screen.directive.js.map +1 -0
- package/build-ngc/angular/tabs/index.d.ts +45 -0
- package/build-ngc/angular/tabs/index.js +231 -0
- package/build-ngc/angular/tabs/index.js.map +1 -0
- package/build-ngc/angular/tabs.d.ts +45 -0
- package/build-ngc/angular/tabs.js +231 -0
- package/build-ngc/angular/tabs.js.map +1 -0
- package/build-ngc/core/constants.d.ts +27 -0
- package/build-ngc/core/constants.js +62 -0
- package/build-ngc/core/constants.js.map +1 -0
- package/build-ngc/core/drawer-options/index.d.ts +64 -0
- package/build-ngc/core/drawer-options/index.js +201 -0
- package/build-ngc/core/drawer-options/index.js.map +1 -0
- package/build-ngc/core/drawer-options.d.ts +64 -0
- package/build-ngc/core/drawer-options.js +201 -0
- package/build-ngc/core/drawer-options.js.map +1 -0
- package/build-ngc/core/drawer-router-state/index.d.ts +21 -0
- package/build-ngc/core/drawer-router-state/index.js +41 -0
- package/build-ngc/core/drawer-router-state/index.js.map +1 -0
- package/build-ngc/core/drawer-router-state.d.ts +21 -0
- package/build-ngc/core/drawer-router-state.js +41 -0
- package/build-ngc/core/drawer-router-state.js.map +1 -0
- package/build-ngc/core/guards.d.ts +2 -0
- package/build-ngc/core/guards.js +23 -0
- package/build-ngc/core/guards.js.map +1 -0
- package/build-ngc/core/header-bar-buttons.d.ts +9 -0
- package/build-ngc/core/header-bar-buttons.js +164 -0
- package/build-ngc/core/header-bar-buttons.js.map +1 -0
- package/build-ngc/core/href.d.ts +16 -0
- package/build-ngc/core/href.js +55 -0
- package/build-ngc/core/href.js.map +1 -0
- package/build-ngc/core/index.d.ts +29 -0
- package/build-ngc/core/index.js +33 -0
- package/build-ngc/core/index.js.map +1 -0
- package/build-ngc/core/linking-config/index.d.ts +13 -0
- package/build-ngc/core/linking-config/index.js +172 -0
- package/build-ngc/core/linking-config/index.js.map +1 -0
- package/build-ngc/core/linking-config.d.ts +13 -0
- package/build-ngc/core/linking-config.js +172 -0
- package/build-ngc/core/linking-config.js.map +1 -0
- package/build-ngc/core/navigation-events/index.d.ts +16 -0
- package/build-ngc/core/navigation-events/index.js +58 -0
- package/build-ngc/core/navigation-events/index.js.map +1 -0
- package/build-ngc/core/navigation-events.d.ts +16 -0
- package/build-ngc/core/navigation-events.js +58 -0
- package/build-ngc/core/navigation-events.js.map +1 -0
- package/build-ngc/core/navigator-handles/index.d.ts +30 -0
- package/build-ngc/core/navigator-handles/index.js +16 -0
- package/build-ngc/core/navigator-handles/index.js.map +1 -0
- package/build-ngc/core/navigator-handles.d.ts +30 -0
- package/build-ngc/core/navigator-handles.js +16 -0
- package/build-ngc/core/navigator-handles.js.map +1 -0
- package/build-ngc/core/navigator-props.d.ts +216 -0
- package/build-ngc/core/navigator-props.js +8 -0
- package/build-ngc/core/navigator-props.js.map +1 -0
- package/build-ngc/core/navigator-state/index.d.ts +36 -0
- package/build-ngc/core/navigator-state/index.js +82 -0
- package/build-ngc/core/navigator-state/index.js.map +1 -0
- package/build-ngc/core/navigator-state.d.ts +36 -0
- package/build-ngc/core/navigator-state.js +82 -0
- package/build-ngc/core/navigator-state.js.map +1 -0
- package/build-ngc/core/render-drawer.d.ts +13 -0
- package/build-ngc/core/render-drawer.js +89 -0
- package/build-ngc/core/render-drawer.js.map +1 -0
- package/build-ngc/core/render-stack.d.ts +35 -0
- package/build-ngc/core/render-stack.js +295 -0
- package/build-ngc/core/render-stack.js.map +1 -0
- package/build-ngc/core/render-tabs.d.ts +20 -0
- package/build-ngc/core/render-tabs.js +98 -0
- package/build-ngc/core/render-tabs.js.map +1 -0
- package/build-ngc/core/screen-options.d.ts +4 -0
- package/build-ngc/core/screen-options.js +134 -0
- package/build-ngc/core/screen-options.js.map +1 -0
- package/build-ngc/core/search-bar-commands.d.ts +10 -0
- package/build-ngc/core/search-bar-commands.js +43 -0
- package/build-ngc/core/search-bar-commands.js.map +1 -0
- package/build-ngc/core/search-params.d.ts +9 -0
- package/build-ngc/core/search-params.js +60 -0
- package/build-ngc/core/search-params.js.map +1 -0
- package/build-ngc/core/state-persistence/index.d.ts +3 -0
- package/build-ngc/core/state-persistence/index.js +24 -0
- package/build-ngc/core/state-persistence/index.js.map +1 -0
- package/build-ngc/core/state-persistence.d.ts +3 -0
- package/build-ngc/core/state-persistence.js +24 -0
- package/build-ngc/core/state-persistence.js.map +1 -0
- package/build-ngc/core/tab-options.d.ts +13 -0
- package/build-ngc/core/tab-options.js +11 -0
- package/build-ngc/core/tab-options.js.map +1 -0
- package/build-ngc/core/tab-router-state/index.d.ts +19 -0
- package/build-ngc/core/tab-router-state/index.js +52 -0
- package/build-ngc/core/tab-router-state/index.js.map +1 -0
- package/build-ngc/core/tab-router-state.d.ts +19 -0
- package/build-ngc/core/tab-router-state.js +52 -0
- package/build-ngc/core/tab-router-state.js.map +1 -0
- package/build-ngc/register.d.ts +7 -0
- package/build-ngc/register.js +59 -0
- package/build-ngc/register.js.map +1 -0
- package/codegen-specs/FullWindowOverlayNativeComponent.ts +13 -0
- package/codegen-specs/ModalScreenNativeComponent.ts +129 -0
- package/codegen-specs/NativeScreensModule.ts +8 -0
- package/codegen-specs/NativeScreensModule.web.ts +1 -0
- package/codegen-specs/ScreenContainerNativeComponent.ts +8 -0
- package/codegen-specs/ScreenContentWrapperNativeComponent.ts +9 -0
- package/codegen-specs/ScreenFooterNativeComponent.ts +6 -0
- package/codegen-specs/ScreenNativeComponent.ts +133 -0
- package/codegen-specs/ScreenNavigationContainerNativeComponent.ts +11 -0
- package/codegen-specs/ScreenStackHeaderConfigNativeComponent.ts +99 -0
- package/codegen-specs/ScreenStackHeaderSubviewNativeComponent.ts +25 -0
- package/codegen-specs/ScreenStackNativeComponent.ts +17 -0
- package/codegen-specs/SearchBarNativeComponent.ts +101 -0
- package/codegen-specs/codegenUtils.ts +6 -0
- package/codegen-specs/gamma/ScrollViewMarkerNativeComponent.ts +15 -0
- package/codegen-specs/gamma/modals/form-sheet/FormSheetContentWrapperNativeComponent.ts +10 -0
- package/codegen-specs/gamma/modals/form-sheet/FormSheetHostNativeComponent.ts +47 -0
- package/codegen-specs/gamma/split/SplitHostNativeComponent.ts +124 -0
- package/codegen-specs/gamma/split/SplitScreenNativeComponent.ts +24 -0
- package/codegen-specs/gamma/stack/StackHeaderConfigAndroidNativeComponent.ts +144 -0
- package/codegen-specs/gamma/stack/StackHeaderConfigIOSNativeComponent.ts +34 -0
- package/codegen-specs/gamma/stack/StackHeaderItemIOSNativeComponent.ts +47 -0
- package/codegen-specs/gamma/stack/StackHeaderItemSpacerIOSNativeComponent.ts +20 -0
- package/codegen-specs/gamma/stack/StackHeaderSubviewAndroidNativeComponent.ts +27 -0
- package/codegen-specs/gamma/stack/StackHostNativeComponent.ts +8 -0
- package/codegen-specs/gamma/stack/StackScreenNativeComponent.ts +42 -0
- package/codegen-specs/safe-area/SafeAreaViewNativeComponent.ts +24 -0
- package/codegen-specs/tabs/TabsBottomAccessoryContentNativeComponent.ts +15 -0
- package/codegen-specs/tabs/TabsBottomAccessoryNativeComponent.ts +19 -0
- package/codegen-specs/tabs/TabsHostAndroidNativeComponent.ts +69 -0
- package/codegen-specs/tabs/TabsHostIOSNativeComponent.ts +92 -0
- package/codegen-specs/tabs/TabsScreenAndroidNativeComponent.ts +112 -0
- package/codegen-specs/tabs/TabsScreenIOSNativeComponent.ts +171 -0
- package/package.json +201 -0
- package/react-native.config.cjs +58 -0
- package/src/angular/drawer/drawer.test.ts +299 -0
- package/src/angular/drawer/index.ts +546 -0
- package/src/angular/drawer-screen.directive.ts +28 -0
- package/src/angular/index.ts +63 -0
- package/src/angular/injectors/index.ts +13 -0
- package/src/angular/injectors/inject-drawer-navigation.ts +21 -0
- package/src/angular/injectors/inject-focus-effect.ts +37 -0
- package/src/angular/injectors/inject-is-focused.ts +28 -0
- package/src/angular/injectors/inject-navigation-state.ts +46 -0
- package/src/angular/injectors/inject-navigation.ts +26 -0
- package/src/angular/injectors/inject-route.ts +25 -0
- package/src/angular/injectors/inject-stack-navigation.ts +24 -0
- package/src/angular/injectors/inject-tab-navigation.ts +20 -0
- package/src/angular/injectors/injectors.test.ts +247 -0
- package/src/angular/injectors/use-typed-navigation.test.ts +229 -0
- package/src/angular/linking.ts +55 -0
- package/src/angular/navigation-context.service.ts +68 -0
- package/src/angular/navigation-scope.directive.ts +31 -0
- package/src/angular/nested-navigation.test.ts +189 -0
- package/src/angular/screen.directive.ts +48 -0
- package/src/angular/search-bar-ref.directive.ts +38 -0
- package/src/angular/stack/index.ts +401 -0
- package/src/angular/stack/stack.test.ts +419 -0
- package/src/angular/tab-screen.directive.ts +26 -0
- package/src/angular/tabs/index.ts +254 -0
- package/src/angular/tabs/tabs.test.ts +249 -0
- package/src/core/constants.ts +68 -0
- package/src/core/drawer-options/drawer-options.test.ts +415 -0
- package/src/core/drawer-options/index.ts +331 -0
- package/src/core/drawer-router-state/drawer-router-state.test.ts +116 -0
- package/src/core/drawer-router-state/index.ts +71 -0
- package/src/core/guards.ts +23 -0
- package/src/core/header-bar-buttons.ts +212 -0
- package/src/core/index.ts +170 -0
- package/src/core/linking-config/index.ts +209 -0
- package/src/core/linking-config/linking-config.test.ts +109 -0
- package/src/core/navigation-events/index.ts +94 -0
- package/src/core/navigation-events/navigation-events.test.ts +56 -0
- package/src/core/navigator-handles/index.ts +63 -0
- package/src/core/navigator-handles/navigator-handles.test.ts +46 -0
- package/src/core/navigator-props.ts +323 -0
- package/src/core/navigator-state/index.ts +112 -0
- package/src/core/navigator-state/navigator-state.test.ts +80 -0
- package/src/core/render-drawer.ts +123 -0
- package/src/core/render-stack.ts +414 -0
- package/src/core/render-tabs.ts +138 -0
- package/src/core/screen-options.ts +181 -0
- package/src/core/search-bar-commands.ts +57 -0
- package/src/core/state-persistence/index.ts +30 -0
- package/src/core/state-persistence/state-persistence.test.ts +42 -0
- package/src/core/tab-options.ts +25 -0
- package/src/core/tab-router-state/index.ts +75 -0
- package/src/core/tab-router-state/tab-router-state.test.ts +34 -0
- package/src/globals.d.ts +4 -0
- package/src/react/collect-registry.ts +19 -0
- package/src/react/drawer/drawer.test.tsx +472 -0
- package/src/react/drawer/index.ts +451 -0
- package/src/react/drawer-screen.ts +29 -0
- package/src/react/hooks/hooks.test.tsx +199 -0
- package/src/react/hooks/index.ts +12 -0
- package/src/react/hooks/use-drawer-navigation.ts +21 -0
- package/src/react/hooks/use-focus-effect.ts +36 -0
- package/src/react/hooks/use-is-focused.ts +26 -0
- package/src/react/hooks/use-navigation-state/index.ts +47 -0
- package/src/react/hooks/use-navigation-state/use-navigation-state.test.ts +85 -0
- package/src/react/hooks/use-navigation.ts +36 -0
- package/src/react/hooks/use-route.ts +11 -0
- package/src/react/hooks/use-stack-navigation.ts +23 -0
- package/src/react/hooks/use-tab-navigation.ts +21 -0
- package/src/react/hooks/use-typed-navigation.test.tsx +187 -0
- package/src/react/index.ts +52 -0
- package/src/react/linking.ts +59 -0
- package/src/react/navigation-context.ts +40 -0
- package/src/react/nested-navigation.test.tsx +145 -0
- package/src/react/screen.ts +44 -0
- package/src/react/stack/index.ts +323 -0
- package/src/react/stack/stack.test.tsx +514 -0
- package/src/react/tab-screen.ts +30 -0
- package/src/react/tabs/index.ts +204 -0
- package/src/react/tabs/tabs.test.tsx +256 -0
- package/src/register.ts +59 -0
- package/src/vue/composables/composables.test.ts +221 -0
- package/src/vue/composables/index.ts +12 -0
- package/src/vue/composables/use-drawer-navigation.ts +25 -0
- package/src/vue/composables/use-focus-effect.ts +37 -0
- package/src/vue/composables/use-is-focused.ts +34 -0
- package/src/vue/composables/use-navigation-state.ts +38 -0
- package/src/vue/composables/use-navigation.ts +30 -0
- package/src/vue/composables/use-route.ts +13 -0
- package/src/vue/composables/use-stack-navigation.ts +28 -0
- package/src/vue/composables/use-tab-navigation.ts +25 -0
- package/src/vue/composables/use-typed-navigation.test.ts +205 -0
- package/src/vue/drawer/drawer.test.ts +451 -0
- package/src/vue/drawer/index.ts +550 -0
- package/src/vue/drawer-screen.ts +32 -0
- package/src/vue/index.ts +70 -0
- package/src/vue/linking.ts +69 -0
- package/src/vue/navigation-context.ts +87 -0
- package/src/vue/nested-navigation.test.ts +155 -0
- package/src/vue/screen.ts +52 -0
- package/src/vue/stack/index.ts +376 -0
- package/src/vue/stack/stack.test.ts +501 -0
- package/src/vue/tab-screen.ts +29 -0
- package/src/vue/tabs/index.ts +302 -0
- package/src/vue/tabs/tabs.test.ts +278 -0
- package/symbiote-navigation.podspec +84 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// Co-located unit test (ADR 0025) for the pure linking-config resolver: URL->route and
|
|
2
|
+
// route->URL, over a flat route and a ':param' route, plus the nested-config flattening and the
|
|
3
|
+
// prefix-vs-bare-path forms called out in the task ('myapp://user/42' and '/user/42').
|
|
4
|
+
|
|
5
|
+
import { describe, expect, it } from 'vitest';
|
|
6
|
+
import { resolveRouteFromUrl, resolveUrlFromRoute } from './index';
|
|
7
|
+
import type { ILinkingConfig } from './index';
|
|
8
|
+
import type { IRoute } from '../navigator-state';
|
|
9
|
+
|
|
10
|
+
const CONFIG: ILinkingConfig = {
|
|
11
|
+
prefixes: ['myapp://', 'https://example.com'],
|
|
12
|
+
config: {
|
|
13
|
+
screens: {
|
|
14
|
+
Home: '',
|
|
15
|
+
User: 'user/:id',
|
|
16
|
+
Settings: {
|
|
17
|
+
path: 'settings',
|
|
18
|
+
screens: {
|
|
19
|
+
Profile: 'profile',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
describe('resolveRouteFromUrl', () => {
|
|
27
|
+
it('resolves a flat route with no params, scheme prefix', () => {
|
|
28
|
+
expect(resolveRouteFromUrl(CONFIG, 'myapp://')).toEqual({
|
|
29
|
+
key: 'Home',
|
|
30
|
+
name: 'Home',
|
|
31
|
+
params: undefined,
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('resolves a :param route through a scheme prefix', () => {
|
|
36
|
+
expect(resolveRouteFromUrl(CONFIG, 'myapp://user/42')).toEqual({
|
|
37
|
+
key: 'User',
|
|
38
|
+
name: 'User',
|
|
39
|
+
params: { id: '42' },
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('resolves the same :param route through a bare path (no configured prefix match)', () => {
|
|
44
|
+
expect(resolveRouteFromUrl(CONFIG, '/user/42')).toEqual({
|
|
45
|
+
key: 'User',
|
|
46
|
+
name: 'User',
|
|
47
|
+
params: { id: '42' },
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('resolves a :param route through an https prefix', () => {
|
|
52
|
+
expect(resolveRouteFromUrl(CONFIG, 'https://example.com/user/7')).toEqual({
|
|
53
|
+
key: 'User',
|
|
54
|
+
name: 'User',
|
|
55
|
+
params: { id: '7' },
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('resolves a nested screen to its leaf name, path accumulated from the group', () => {
|
|
60
|
+
expect(resolveRouteFromUrl(CONFIG, 'myapp://settings/profile')).toEqual({
|
|
61
|
+
key: 'Profile',
|
|
62
|
+
name: 'Profile',
|
|
63
|
+
params: undefined,
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('decodes a percent-encoded param segment', () => {
|
|
68
|
+
expect(resolveRouteFromUrl(CONFIG, 'myapp://user/john%20doe')).toEqual({
|
|
69
|
+
key: 'User',
|
|
70
|
+
name: 'User',
|
|
71
|
+
params: { id: 'john doe' },
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('returns null for a url matching no configured screen', () => {
|
|
76
|
+
expect(resolveRouteFromUrl(CONFIG, 'myapp://nowhere')).toBeNull();
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it('returns null for a url matching no configured prefix and no leading slash', () => {
|
|
80
|
+
expect(resolveRouteFromUrl(CONFIG, 'otherapp://user/42')).toBeNull();
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
describe('resolveUrlFromRoute', () => {
|
|
85
|
+
it('builds a url for a flat route with no params', () => {
|
|
86
|
+
const route: IRoute<unknown> = { key: 'k', name: 'Home', params: undefined };
|
|
87
|
+
expect(resolveUrlFromRoute(CONFIG, route)).toBe('myapp://');
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it('builds a url for a :param route', () => {
|
|
91
|
+
const route: IRoute<unknown> = { key: 'k', name: 'User', params: { id: '42' } };
|
|
92
|
+
expect(resolveUrlFromRoute(CONFIG, route)).toBe('myapp://user/42');
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it('builds a url for a nested screen using its accumulated path', () => {
|
|
96
|
+
const route: IRoute<unknown> = { key: 'k', name: 'Profile', params: undefined };
|
|
97
|
+
expect(resolveUrlFromRoute(CONFIG, route)).toBe('myapp://settings/profile');
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it('returns null when a required param is missing', () => {
|
|
101
|
+
const route: IRoute<unknown> = { key: 'k', name: 'User', params: {} };
|
|
102
|
+
expect(resolveUrlFromRoute(CONFIG, route)).toBeNull();
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it('returns null for an unconfigured route name', () => {
|
|
106
|
+
const route: IRoute<unknown> = { key: 'k', name: 'Nowhere', params: undefined };
|
|
107
|
+
expect(resolveUrlFromRoute(CONFIG, route)).toBeNull();
|
|
108
|
+
});
|
|
109
|
+
});
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// The framework-agnostic half of what @react-navigation exposes as `navigation.addListener` /
|
|
2
|
+
// `useFocusEffect` / `useIsFocused` / `useNavigationState`: a plain pub/sub emitter, zero React.
|
|
3
|
+
// addListener is NOT React-specific there either - React's hooks are thin useEffect wrappers
|
|
4
|
+
// around exactly this subscribe/unsubscribe shape (confirmed against the 8.x docs: `const
|
|
5
|
+
// unsubscribe = navigation.addListener('focus', cb); return unsubscribe;` inside a bare
|
|
6
|
+
// `useEffect`). One emitter per route (created by the adapter, e.g. stack.ts's per-route
|
|
7
|
+
// `emitters` map) carries that route's own focus/blur/state lifecycle; every adapter's lifecycle
|
|
8
|
+
// hooks subscribe to it, matching this file's single responsibility split from `constants.ts`
|
|
9
|
+
// (which only names Fabric view/prop-key strings, not this JS-only event system).
|
|
10
|
+
//
|
|
11
|
+
// diffFocusedRoute below centralizes the "which route lost focus, which gained it" comparison
|
|
12
|
+
// that tabs.ts and drawer.ts independently reimplemented in all three adapters (each watching its
|
|
13
|
+
// own router state for the focused index/key changing, then manually emitting BLUR to the old key
|
|
14
|
+
// and FOCUS to the new one, plus an initial FOCUS seed on first mount) - the diff is pure and
|
|
15
|
+
// identical everywhere; only WHEN to run it differs per framework (a `useEffect` dependency array,
|
|
16
|
+
// a Vue `watch`, an idempotent-per-read Angular method), so that half stays adapter-owned.
|
|
17
|
+
|
|
18
|
+
import { dlog } from '@symbiote-native/engine';
|
|
19
|
+
|
|
20
|
+
export const NAVIGATION_EVENT_FOCUS = 'focus';
|
|
21
|
+
export const NAVIGATION_EVENT_BLUR = 'blur';
|
|
22
|
+
export const NAVIGATION_EVENT_STATE = 'state';
|
|
23
|
+
export const NAVIGATION_EVENT_BEFORE_REMOVE = 'beforeRemove';
|
|
24
|
+
|
|
25
|
+
export type INavigationEventName =
|
|
26
|
+
| typeof NAVIGATION_EVENT_FOCUS
|
|
27
|
+
| typeof NAVIGATION_EVENT_BLUR
|
|
28
|
+
| typeof NAVIGATION_EVENT_STATE
|
|
29
|
+
| typeof NAVIGATION_EVENT_BEFORE_REMOVE;
|
|
30
|
+
|
|
31
|
+
export type INavigationEventListener<TData = unknown> = (data: TData) => void;
|
|
32
|
+
|
|
33
|
+
export type INavigationEmitter = {
|
|
34
|
+
emit: (event: INavigationEventName, data?: unknown) => void;
|
|
35
|
+
addListener: (event: INavigationEventName, listener: INavigationEventListener) => () => void;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export function createNavigationEmitter(): INavigationEmitter {
|
|
39
|
+
const listenersByEvent = new Map<INavigationEventName, Set<INavigationEventListener>>();
|
|
40
|
+
|
|
41
|
+
function addListener(
|
|
42
|
+
event: INavigationEventName,
|
|
43
|
+
listener: INavigationEventListener,
|
|
44
|
+
): () => void {
|
|
45
|
+
let listeners = listenersByEvent.get(event);
|
|
46
|
+
if (!listeners) {
|
|
47
|
+
listeners = new Set();
|
|
48
|
+
listenersByEvent.set(event, listeners);
|
|
49
|
+
}
|
|
50
|
+
listeners.add(listener);
|
|
51
|
+
|
|
52
|
+
return () => {
|
|
53
|
+
listeners?.delete(listener);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function emit(event: INavigationEventName, data?: unknown): void {
|
|
58
|
+
const listeners = listenersByEvent.get(event);
|
|
59
|
+
// Investigation instrumentation (flicker-on-focus bug): every emission, whether or not a
|
|
60
|
+
// listener is attached, so the log stream shows if focus/blur ever fires with 0 subscribers
|
|
61
|
+
// (a silent no-op) vs racing an actual effect. Kept behind DEBUG, never removed.
|
|
62
|
+
dlog(
|
|
63
|
+
`Navigation emitter: emit "${event}" (${listeners?.size ?? 0} listener(s)) at t=${Date.now()}`,
|
|
64
|
+
);
|
|
65
|
+
if (!listeners) return;
|
|
66
|
+
for (const listener of listeners) listener(data);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return { emit, addListener };
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// The keys, if any, that should be blurred/focused when the focused route's key changes from
|
|
73
|
+
// `prevKey` to `nextKey` - a pure comparison, no emitter, no timing. Covers all three shapes every
|
|
74
|
+
// adapter's lifecycle trigger needs: first mount (`prevKey` undefined -> `focusKey` only, no
|
|
75
|
+
// blur), unmount/no-longer-focused (`nextKey` undefined -> `blurKey` only), an ordinary focus
|
|
76
|
+
// change (both), and a no-op re-run with the same key (neither field set, e.g. a setParams-only
|
|
77
|
+
// change that leaves the focused key untouched). The caller looks up (or lazily creates) each
|
|
78
|
+
// key's own emitter and calls `.emit(NAVIGATION_EVENT_BLUR)` / `.emit(NAVIGATION_EVENT_FOCUS)` -
|
|
79
|
+
// this function only decides WHICH keys, never WHEN or on WHICH emitter.
|
|
80
|
+
export type IFocusTransition = {
|
|
81
|
+
blurKey?: string;
|
|
82
|
+
focusKey?: string;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export function diffFocusedRoute(
|
|
86
|
+
prevKey: string | undefined,
|
|
87
|
+
nextKey: string | undefined,
|
|
88
|
+
): IFocusTransition {
|
|
89
|
+
if (prevKey === nextKey) return {};
|
|
90
|
+
const transition: IFocusTransition = {};
|
|
91
|
+
if (prevKey !== undefined) transition.blurKey = prevKey;
|
|
92
|
+
if (nextKey !== undefined) transition.focusKey = nextKey;
|
|
93
|
+
return transition;
|
|
94
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// Pure unit coverage for the framework-agnostic pub/sub emitter - zero React, so no fabric/mount
|
|
2
|
+
// scaffolding needed (mirrors navigator-state.test.ts's plain reducer coverage, once that lands).
|
|
3
|
+
|
|
4
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
5
|
+
import { NAVIGATION_EVENT_BLUR, NAVIGATION_EVENT_FOCUS, createNavigationEmitter } from './index';
|
|
6
|
+
|
|
7
|
+
describe('createNavigationEmitter', () => {
|
|
8
|
+
it('calls a listener registered for the emitted event', () => {
|
|
9
|
+
const emitter = createNavigationEmitter();
|
|
10
|
+
const listener = vi.fn();
|
|
11
|
+
emitter.addListener(NAVIGATION_EVENT_FOCUS, listener);
|
|
12
|
+
|
|
13
|
+
emitter.emit(NAVIGATION_EVENT_FOCUS, { some: 'payload' });
|
|
14
|
+
|
|
15
|
+
expect(listener).toHaveBeenCalledWith({ some: 'payload' });
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('does not call a listener registered for a different event', () => {
|
|
19
|
+
const emitter = createNavigationEmitter();
|
|
20
|
+
const listener = vi.fn();
|
|
21
|
+
emitter.addListener(NAVIGATION_EVENT_BLUR, listener);
|
|
22
|
+
|
|
23
|
+
emitter.emit(NAVIGATION_EVENT_FOCUS);
|
|
24
|
+
|
|
25
|
+
expect(listener).not.toHaveBeenCalled();
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('supports multiple listeners on the same event', () => {
|
|
29
|
+
const emitter = createNavigationEmitter();
|
|
30
|
+
const first = vi.fn();
|
|
31
|
+
const second = vi.fn();
|
|
32
|
+
emitter.addListener(NAVIGATION_EVENT_FOCUS, first);
|
|
33
|
+
emitter.addListener(NAVIGATION_EVENT_FOCUS, second);
|
|
34
|
+
|
|
35
|
+
emitter.emit(NAVIGATION_EVENT_FOCUS);
|
|
36
|
+
|
|
37
|
+
expect(first).toHaveBeenCalledTimes(1);
|
|
38
|
+
expect(second).toHaveBeenCalledTimes(1);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('stops calling a listener after its unsubscribe is invoked', () => {
|
|
42
|
+
const emitter = createNavigationEmitter();
|
|
43
|
+
const listener = vi.fn();
|
|
44
|
+
const unsubscribe = emitter.addListener(NAVIGATION_EVENT_FOCUS, listener);
|
|
45
|
+
|
|
46
|
+
unsubscribe();
|
|
47
|
+
emitter.emit(NAVIGATION_EVENT_FOCUS);
|
|
48
|
+
|
|
49
|
+
expect(listener).not.toHaveBeenCalled();
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('emitting an event with no listeners is a no-op', () => {
|
|
53
|
+
const emitter = createNavigationEmitter();
|
|
54
|
+
expect(() => emitter.emit(NAVIGATION_EVENT_FOCUS)).not.toThrow();
|
|
55
|
+
});
|
|
56
|
+
});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// Imperative navigator handles: framework-agnostic (scalars, `unknown`, plain function
|
|
2
|
+
// signatures over `INavigatorState`/`IDrawerScreenOptions` - no framework element, ref, or
|
|
3
|
+
// children in any field), so each shape is declared once here and every adapter re-exports it
|
|
4
|
+
// verbatim (see CLAUDE.md <prop_types_split_agnostic_vs_per_adapter>).
|
|
5
|
+
|
|
6
|
+
import type { INavigatorState } from '../navigator-state';
|
|
7
|
+
import type { IDrawerScreenOptions } from '../drawer-options';
|
|
8
|
+
|
|
9
|
+
export type INavigatorHandle = {
|
|
10
|
+
push: (name: string, params?: unknown) => void;
|
|
11
|
+
pop: (count?: number) => void;
|
|
12
|
+
popToTop: () => void;
|
|
13
|
+
popTo: (key: string) => void;
|
|
14
|
+
replace: (name: string, params?: unknown) => void;
|
|
15
|
+
setParams: (params: unknown, key?: string) => void;
|
|
16
|
+
reset: (state: INavigatorState) => void;
|
|
17
|
+
canGoBack: () => boolean;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type ITabNavigatorHandle = {
|
|
21
|
+
jumpTo: (name: string, params?: unknown) => void;
|
|
22
|
+
// (params, key) - same order as INavigatorHandle.setParams; key stays required (unlike Stack's
|
|
23
|
+
// optional key, which defaults to the focused route) since a tab must always be identified
|
|
24
|
+
// explicitly.
|
|
25
|
+
setParams: (params: unknown, key: string) => void;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type IDrawerNavigatorHandle = {
|
|
29
|
+
openDrawer: () => void;
|
|
30
|
+
closeDrawer: () => void;
|
|
31
|
+
toggleDrawer: () => void;
|
|
32
|
+
jumpTo: (name: string) => void;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// Keyed by route.key, mirroring @react-navigation/drawer's own `descriptors` prop shape - the
|
|
36
|
+
// options a caller's renderDrawerContent/drawerContent reads to label its menu entries (Drawer
|
|
37
|
+
// ships no built-in menu UI, matching react-native-drawer-layout's Drawer primitive).
|
|
38
|
+
export type IDrawerDescriptorMap = Record<
|
|
39
|
+
string,
|
|
40
|
+
{ options: IDrawerScreenOptions; navigation: IDrawerNavigatorHandle }
|
|
41
|
+
>;
|
|
42
|
+
|
|
43
|
+
// Every navigator kind a screen might be rendered under. useNavigation()/injectNavigation()
|
|
44
|
+
// return this union since they don't know which navigator mounted the calling component; the
|
|
45
|
+
// three guards below narrow it (used once, inside useStackNavigation/useTabNavigation/
|
|
46
|
+
// useDrawerNavigation and their Vue/Angular equivalents) so app code never writes the guard itself.
|
|
47
|
+
export type IAnyNavigatorHandle = INavigatorHandle | ITabNavigatorHandle | IDrawerNavigatorHandle;
|
|
48
|
+
|
|
49
|
+
export function isStackNavigatorHandle(handle: IAnyNavigatorHandle): handle is INavigatorHandle {
|
|
50
|
+
return 'push' in handle;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function isDrawerNavigatorHandle(
|
|
54
|
+
handle: IAnyNavigatorHandle,
|
|
55
|
+
): handle is IDrawerNavigatorHandle {
|
|
56
|
+
return 'openDrawer' in handle;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// jumpTo exists on both Tab and Drawer handles, so a Tab handle is a jumpTo-having handle that
|
|
60
|
+
// isn't a Drawer handle (Drawer's own openDrawer/closeDrawer/toggleDrawer rule it out).
|
|
61
|
+
export function isTabNavigatorHandle(handle: IAnyNavigatorHandle): handle is ITabNavigatorHandle {
|
|
62
|
+
return 'jumpTo' in handle && !isDrawerNavigatorHandle(handle);
|
|
63
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { isDrawerNavigatorHandle, isStackNavigatorHandle, isTabNavigatorHandle } from './index';
|
|
3
|
+
import type { IDrawerNavigatorHandle, INavigatorHandle, ITabNavigatorHandle } from './index';
|
|
4
|
+
|
|
5
|
+
const stackHandle: INavigatorHandle = {
|
|
6
|
+
push: () => {},
|
|
7
|
+
pop: () => {},
|
|
8
|
+
popToTop: () => {},
|
|
9
|
+
popTo: () => {},
|
|
10
|
+
replace: () => {},
|
|
11
|
+
setParams: () => {},
|
|
12
|
+
reset: () => {},
|
|
13
|
+
canGoBack: () => false,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const tabHandle: ITabNavigatorHandle = {
|
|
17
|
+
jumpTo: () => {},
|
|
18
|
+
setParams: () => {},
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const drawerHandle: IDrawerNavigatorHandle = {
|
|
22
|
+
openDrawer: () => {},
|
|
23
|
+
closeDrawer: () => {},
|
|
24
|
+
toggleDrawer: () => {},
|
|
25
|
+
jumpTo: () => {},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
describe('navigator handle guards', () => {
|
|
29
|
+
it('identifies a Stack handle by push and rules out Tab/Drawer', () => {
|
|
30
|
+
expect(isStackNavigatorHandle(stackHandle)).toBe(true);
|
|
31
|
+
expect(isTabNavigatorHandle(stackHandle)).toBe(false);
|
|
32
|
+
expect(isDrawerNavigatorHandle(stackHandle)).toBe(false);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('identifies a Tab handle by jumpTo without openDrawer', () => {
|
|
36
|
+
expect(isTabNavigatorHandle(tabHandle)).toBe(true);
|
|
37
|
+
expect(isStackNavigatorHandle(tabHandle)).toBe(false);
|
|
38
|
+
expect(isDrawerNavigatorHandle(tabHandle)).toBe(false);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('identifies a Drawer handle by openDrawer, even though it also has jumpTo', () => {
|
|
42
|
+
expect(isDrawerNavigatorHandle(drawerHandle)).toBe(true);
|
|
43
|
+
expect(isTabNavigatorHandle(drawerHandle)).toBe(false);
|
|
44
|
+
expect(isStackNavigatorHandle(drawerHandle)).toBe(false);
|
|
45
|
+
});
|
|
46
|
+
});
|