@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,451 @@
|
|
|
1
|
+
// Co-located Vue-driven pipeline test, the Vue twin of react/drawer.test.tsx. Unlike Stack (real
|
|
2
|
+
// native RNSScreen views) and Tab (a pure-JS tab bar), Drawer additionally drives a real
|
|
3
|
+
// PanResponder + Animated.timing gesture, so this file borrows the fake-touch-event technique
|
|
4
|
+
// (topTouchStart/topTouchMove/topTouchEnd with pageX/identifier/target) to prove an edge-swipe
|
|
5
|
+
// actually opens/closes the drawer, plus a rAF polyfill (every openDrawer/closeDrawer/
|
|
6
|
+
// toggleDrawer call and a gesture release schedules a real requestAnimationFrame via
|
|
7
|
+
// Animated.timing, which is not a Node global). Drawer is imported from './index' (NOT the
|
|
8
|
+
// package barrel) so the third-party native-spec side-effect (../register) never loads headless -
|
|
9
|
+
// matching stack.test.ts/tabs.test.ts, even though Drawer itself needs no injected ViewConfig
|
|
10
|
+
// (PanResponder + Animated are pure JS, like Tab's bar).
|
|
11
|
+
|
|
12
|
+
import { defineComponent, h, ref } from '@vue/runtime-core';
|
|
13
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
14
|
+
import { mount, unmount, Dimensions } from '@symbiote-native/vue';
|
|
15
|
+
import { installFabric, type IFakeNode } from '@symbiote-native/test-utils';
|
|
16
|
+
import { Drawer } from './index';
|
|
17
|
+
import type { IDrawerNavigatorHandle } from './index';
|
|
18
|
+
import { useFocusEffect, useIsFocused, useNavigation, useRoute } from '../composables';
|
|
19
|
+
|
|
20
|
+
const ROOT_TAG = 4704;
|
|
21
|
+
const TOUCH_START = 'topTouchStart';
|
|
22
|
+
const TOUCH_MOVE = 'topTouchMove';
|
|
23
|
+
const TOUCH_END = 'topTouchEnd';
|
|
24
|
+
const TOUCH_ID = 1;
|
|
25
|
+
|
|
26
|
+
// Drawer reads the screen width off useWindowDimensions() to resolve the swipe edge zone
|
|
27
|
+
// (isSwipeStartInEdge) - headless has no DeviceInfo native module, so seed a concrete width once;
|
|
28
|
+
// every mount in this file reads this same cached value (Dimensions is a module-level singleton).
|
|
29
|
+
Dimensions.set({ window: { width: 375, height: 812, scale: 1, fontScale: 1 } });
|
|
30
|
+
|
|
31
|
+
// rAF is not a Node global; Animated.timing (driven by every openDrawer/closeDrawer/toggleDrawer
|
|
32
|
+
// call and by a gesture release) reads it at .start() time.
|
|
33
|
+
let frameClock = 0;
|
|
34
|
+
const pendingFrames = new Map<number, (time: number) => void>();
|
|
35
|
+
let nextFrameId = 1;
|
|
36
|
+
|
|
37
|
+
function installRequestAnimationFrame(): void {
|
|
38
|
+
Object.assign(globalThis, {
|
|
39
|
+
requestAnimationFrame(callback: (time: number) => void): number {
|
|
40
|
+
const id = nextFrameId++;
|
|
41
|
+
pendingFrames.set(id, callback);
|
|
42
|
+
setTimeout(() => {
|
|
43
|
+
const cb = pendingFrames.get(id);
|
|
44
|
+
if (cb !== undefined) {
|
|
45
|
+
pendingFrames.delete(id);
|
|
46
|
+
frameClock += 16;
|
|
47
|
+
cb(frameClock);
|
|
48
|
+
}
|
|
49
|
+
}, 0);
|
|
50
|
+
return id;
|
|
51
|
+
},
|
|
52
|
+
cancelAnimationFrame(id: number): void {
|
|
53
|
+
pendingFrames.delete(id);
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const fabric = installFabric();
|
|
59
|
+
const tick = (): Promise<void> => new Promise(resolve => setTimeout(resolve, 0));
|
|
60
|
+
|
|
61
|
+
beforeEach(() => {
|
|
62
|
+
fabric.reset();
|
|
63
|
+
frameClock = 0;
|
|
64
|
+
pendingFrames.clear();
|
|
65
|
+
nextFrameId = 1;
|
|
66
|
+
installRequestAnimationFrame();
|
|
67
|
+
});
|
|
68
|
+
afterEach(() => {
|
|
69
|
+
unmount(ROOT_TAG);
|
|
70
|
+
Reflect.deleteProperty(globalThis, 'requestAnimationFrame');
|
|
71
|
+
Reflect.deleteProperty(globalThis, 'cancelAnimationFrame');
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
function HomeScreen() {
|
|
75
|
+
return h('symbiote-text', {}, 'home');
|
|
76
|
+
}
|
|
77
|
+
function ProfileScreen() {
|
|
78
|
+
return h('symbiote-text', {}, 'profile');
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function findAllText(nodes: readonly IFakeNode[]): string[] {
|
|
82
|
+
const found: string[] = [];
|
|
83
|
+
const collect = (list: readonly IFakeNode[]): void => {
|
|
84
|
+
for (const node of list) {
|
|
85
|
+
if (node.viewName === 'RCTRawText' && typeof node.props.text === 'string') {
|
|
86
|
+
found.push(node.props.text);
|
|
87
|
+
}
|
|
88
|
+
collect(node.children);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
collect(nodes);
|
|
92
|
+
return found;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Drawer's own root view (holds panResponder.panHandlers) - first child under the AppContainer.
|
|
96
|
+
function drawerRoot(): IFakeNode {
|
|
97
|
+
return fabric.appRoot().children[0];
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Default drawerType ('front') paints [content, overlay, panel] in that sibling order
|
|
101
|
+
// (render-drawer.ts's drawerChildOrder) - the overlay's pointerEvents prop ('auto' while open,
|
|
102
|
+
// 'none' while closed) is the one stable, non-animated signal of state.isOpen this file reads,
|
|
103
|
+
// since the slide/opacity transforms themselves are driven by a real (unawaited) Animated.timing.
|
|
104
|
+
function overlayNode(): IFakeNode {
|
|
105
|
+
const overlay = drawerRoot().children[1];
|
|
106
|
+
if (!overlay) throw new Error('no overlay child committed');
|
|
107
|
+
return overlay;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function isOpenByOverlay(): boolean {
|
|
111
|
+
return overlayNode().props.pointerEvents === 'auto';
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
type ITouchFrame = { x: number; y: number; t: number };
|
|
115
|
+
|
|
116
|
+
function swipe(path: readonly ITouchFrame[]): void {
|
|
117
|
+
const node = drawerRoot();
|
|
118
|
+
const handle = node.instanceHandle;
|
|
119
|
+
const tag = node.tag;
|
|
120
|
+
const point = (frame: ITouchFrame) => ({
|
|
121
|
+
identifier: TOUCH_ID,
|
|
122
|
+
pageX: frame.x,
|
|
123
|
+
pageY: frame.y,
|
|
124
|
+
timestamp: frame.t,
|
|
125
|
+
target: handle,
|
|
126
|
+
});
|
|
127
|
+
const fire = (type: string, frame: ITouchFrame): void => {
|
|
128
|
+
const touch = point(frame);
|
|
129
|
+
fabric.fireEvent(handle, type, {
|
|
130
|
+
touches: type === TOUCH_END ? [] : [touch],
|
|
131
|
+
changedTouches: [touch],
|
|
132
|
+
target: tag,
|
|
133
|
+
timestamp: frame.t,
|
|
134
|
+
});
|
|
135
|
+
};
|
|
136
|
+
const [start, ...rest] = path;
|
|
137
|
+
fire(TOUCH_START, start);
|
|
138
|
+
rest.forEach((frame, i) => fire(i === rest.length - 1 ? TOUCH_END : TOUCH_MOVE, frame));
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const OPEN_SWIPE: readonly ITouchFrame[] = [
|
|
142
|
+
{ x: 10, y: 400, t: 1_000 },
|
|
143
|
+
{ x: 130, y: 400, t: 1_050 },
|
|
144
|
+
{ x: 130, y: 400, t: 1_060 },
|
|
145
|
+
];
|
|
146
|
+
|
|
147
|
+
const UNDER_THRESHOLD_SWIPE: readonly ITouchFrame[] = [
|
|
148
|
+
{ x: 10, y: 400, t: 1_000 },
|
|
149
|
+
{ x: 30, y: 400, t: 1_100 },
|
|
150
|
+
{ x: 30, y: 400, t: 1_110 },
|
|
151
|
+
];
|
|
152
|
+
|
|
153
|
+
const MID_SCREEN_SWIPE: readonly ITouchFrame[] = [
|
|
154
|
+
{ x: 180, y: 400, t: 1_000 },
|
|
155
|
+
{ x: 300, y: 400, t: 1_050 },
|
|
156
|
+
{ x: 300, y: 400, t: 1_060 },
|
|
157
|
+
];
|
|
158
|
+
|
|
159
|
+
const RIGHT_EDGE_OPEN_SWIPE: readonly ITouchFrame[] = [
|
|
160
|
+
{ x: 360, y: 400, t: 1_000 },
|
|
161
|
+
{ x: 240, y: 400, t: 1_050 },
|
|
162
|
+
{ x: 240, y: 400, t: 1_060 },
|
|
163
|
+
];
|
|
164
|
+
|
|
165
|
+
function mountDrawer(
|
|
166
|
+
handleRef: ReturnType<typeof ref<IDrawerNavigatorHandle | null>>,
|
|
167
|
+
props: Record<string, unknown>,
|
|
168
|
+
children: unknown[],
|
|
169
|
+
) {
|
|
170
|
+
mount(
|
|
171
|
+
ROOT_TAG,
|
|
172
|
+
defineComponent({
|
|
173
|
+
setup: () => () =>
|
|
174
|
+
h(Drawer, { ref: handleRef, initialRouteName: 'Home', ...props }, () => children),
|
|
175
|
+
}),
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
describe('Vue Drawer navigator', () => {
|
|
180
|
+
it("mounts only the focused route's content, drawer closed", async () => {
|
|
181
|
+
mount(
|
|
182
|
+
ROOT_TAG,
|
|
183
|
+
defineComponent({
|
|
184
|
+
setup: () => () =>
|
|
185
|
+
h(Drawer, { initialRouteName: 'Home' }, () => [
|
|
186
|
+
h(Drawer.Screen, { name: 'Home', component: HomeScreen }),
|
|
187
|
+
h(Drawer.Screen, { name: 'Profile', component: ProfileScreen }),
|
|
188
|
+
]),
|
|
189
|
+
}),
|
|
190
|
+
);
|
|
191
|
+
await tick();
|
|
192
|
+
expect(findAllText(fabric.committed)).toContain('home');
|
|
193
|
+
expect(findAllText(fabric.committed)).not.toContain('profile');
|
|
194
|
+
expect(isOpenByOverlay()).toBe(false);
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
it('openDrawer() opens the drawer', async () => {
|
|
198
|
+
const handleRef = ref<IDrawerNavigatorHandle | null>(null);
|
|
199
|
+
mountDrawer(handleRef, {}, [
|
|
200
|
+
h(Drawer.Screen, { name: 'Home', component: HomeScreen }),
|
|
201
|
+
h(Drawer.Screen, { name: 'Profile', component: ProfileScreen }),
|
|
202
|
+
]);
|
|
203
|
+
await tick();
|
|
204
|
+
handleRef.value?.openDrawer();
|
|
205
|
+
await tick();
|
|
206
|
+
expect(isOpenByOverlay()).toBe(true);
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
it('closeDrawer() closes an open drawer', async () => {
|
|
210
|
+
const handleRef = ref<IDrawerNavigatorHandle | null>(null);
|
|
211
|
+
mountDrawer(handleRef, {}, [
|
|
212
|
+
h(Drawer.Screen, { name: 'Home', component: HomeScreen }),
|
|
213
|
+
h(Drawer.Screen, { name: 'Profile', component: ProfileScreen }),
|
|
214
|
+
]);
|
|
215
|
+
await tick();
|
|
216
|
+
handleRef.value?.openDrawer();
|
|
217
|
+
await tick();
|
|
218
|
+
handleRef.value?.closeDrawer();
|
|
219
|
+
await tick();
|
|
220
|
+
expect(isOpenByOverlay()).toBe(false);
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
it('toggleDrawer() flips open/closed across two calls', async () => {
|
|
224
|
+
const handleRef = ref<IDrawerNavigatorHandle | null>(null);
|
|
225
|
+
mountDrawer(handleRef, {}, [
|
|
226
|
+
h(Drawer.Screen, { name: 'Home', component: HomeScreen }),
|
|
227
|
+
h(Drawer.Screen, { name: 'Profile', component: ProfileScreen }),
|
|
228
|
+
]);
|
|
229
|
+
await tick();
|
|
230
|
+
handleRef.value?.toggleDrawer();
|
|
231
|
+
await tick();
|
|
232
|
+
expect(isOpenByOverlay()).toBe(true);
|
|
233
|
+
handleRef.value?.toggleDrawer();
|
|
234
|
+
await tick();
|
|
235
|
+
expect(isOpenByOverlay()).toBe(false);
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
it('jumpTo() switches the focused screen content while closed', async () => {
|
|
239
|
+
const handleRef = ref<IDrawerNavigatorHandle | null>(null);
|
|
240
|
+
mountDrawer(handleRef, {}, [
|
|
241
|
+
h(Drawer.Screen, { name: 'Home', component: HomeScreen }),
|
|
242
|
+
h(Drawer.Screen, { name: 'Profile', component: ProfileScreen }),
|
|
243
|
+
]);
|
|
244
|
+
await tick();
|
|
245
|
+
handleRef.value?.jumpTo('Profile');
|
|
246
|
+
await tick();
|
|
247
|
+
expect(findAllText(fabric.committed)).toContain('profile');
|
|
248
|
+
expect(findAllText(fabric.committed)).not.toContain('home');
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
it('jumpTo() to an unknown route name is a no-op', async () => {
|
|
252
|
+
const handleRef = ref<IDrawerNavigatorHandle | null>(null);
|
|
253
|
+
mountDrawer(handleRef, {}, [
|
|
254
|
+
h(Drawer.Screen, { name: 'Home', component: HomeScreen }),
|
|
255
|
+
h(Drawer.Screen, { name: 'Profile', component: ProfileScreen }),
|
|
256
|
+
]);
|
|
257
|
+
await tick();
|
|
258
|
+
handleRef.value?.jumpTo('Nowhere');
|
|
259
|
+
await tick();
|
|
260
|
+
expect(findAllText(fabric.committed)).toContain('home');
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
it('jumpTo() closes an already-open drawer', async () => {
|
|
264
|
+
const handleRef = ref<IDrawerNavigatorHandle | null>(null);
|
|
265
|
+
mountDrawer(handleRef, {}, [
|
|
266
|
+
h(Drawer.Screen, { name: 'Home', component: HomeScreen }),
|
|
267
|
+
h(Drawer.Screen, { name: 'Profile', component: ProfileScreen }),
|
|
268
|
+
]);
|
|
269
|
+
await tick();
|
|
270
|
+
handleRef.value?.openDrawer();
|
|
271
|
+
await tick();
|
|
272
|
+
expect(isOpenByOverlay()).toBe(true);
|
|
273
|
+
handleRef.value?.jumpTo('Profile');
|
|
274
|
+
await tick();
|
|
275
|
+
expect(isOpenByOverlay()).toBe(false);
|
|
276
|
+
expect(findAllText(fabric.committed)).toContain('profile');
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
it('a valid edge-swipe opens the drawer', async () => {
|
|
280
|
+
mount(
|
|
281
|
+
ROOT_TAG,
|
|
282
|
+
defineComponent({
|
|
283
|
+
setup: () => () =>
|
|
284
|
+
h(Drawer, { initialRouteName: 'Home' }, () => [
|
|
285
|
+
h(Drawer.Screen, { name: 'Home', component: HomeScreen }),
|
|
286
|
+
h(Drawer.Screen, { name: 'Profile', component: ProfileScreen }),
|
|
287
|
+
]),
|
|
288
|
+
}),
|
|
289
|
+
);
|
|
290
|
+
await tick();
|
|
291
|
+
expect(isOpenByOverlay()).toBe(false);
|
|
292
|
+
swipe(OPEN_SWIPE);
|
|
293
|
+
await tick();
|
|
294
|
+
expect(isOpenByOverlay()).toBe(true);
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
it('a swipe that clears neither the distance nor velocity threshold snaps back closed', async () => {
|
|
298
|
+
mount(
|
|
299
|
+
ROOT_TAG,
|
|
300
|
+
defineComponent({
|
|
301
|
+
setup: () => () =>
|
|
302
|
+
h(Drawer, { initialRouteName: 'Home' }, () => [
|
|
303
|
+
h(Drawer.Screen, { name: 'Home', component: HomeScreen }),
|
|
304
|
+
h(Drawer.Screen, { name: 'Profile', component: ProfileScreen }),
|
|
305
|
+
]),
|
|
306
|
+
}),
|
|
307
|
+
);
|
|
308
|
+
await tick();
|
|
309
|
+
swipe(UNDER_THRESHOLD_SWIPE);
|
|
310
|
+
await tick();
|
|
311
|
+
expect(isOpenByOverlay()).toBe(false);
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
it('swipeEnabled: false suppresses the gesture entirely', async () => {
|
|
315
|
+
mount(
|
|
316
|
+
ROOT_TAG,
|
|
317
|
+
defineComponent({
|
|
318
|
+
setup: () => () =>
|
|
319
|
+
h(Drawer, { initialRouteName: 'Home', swipeEnabled: false }, () => [
|
|
320
|
+
h(Drawer.Screen, { name: 'Home', component: HomeScreen }),
|
|
321
|
+
h(Drawer.Screen, { name: 'Profile', component: ProfileScreen }),
|
|
322
|
+
]),
|
|
323
|
+
}),
|
|
324
|
+
);
|
|
325
|
+
await tick();
|
|
326
|
+
swipe(OPEN_SWIPE);
|
|
327
|
+
await tick();
|
|
328
|
+
expect(isOpenByOverlay()).toBe(false);
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
it('a swipe starting outside the edge zone does not open a left-positioned drawer', async () => {
|
|
332
|
+
mount(
|
|
333
|
+
ROOT_TAG,
|
|
334
|
+
defineComponent({
|
|
335
|
+
setup: () => () =>
|
|
336
|
+
h(Drawer, { initialRouteName: 'Home' }, () => [
|
|
337
|
+
h(Drawer.Screen, { name: 'Home', component: HomeScreen }),
|
|
338
|
+
h(Drawer.Screen, { name: 'Profile', component: ProfileScreen }),
|
|
339
|
+
]),
|
|
340
|
+
}),
|
|
341
|
+
);
|
|
342
|
+
await tick();
|
|
343
|
+
swipe(MID_SCREEN_SWIPE);
|
|
344
|
+
await tick();
|
|
345
|
+
expect(isOpenByOverlay()).toBe(false);
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
it('a valid edge-swipe opens a right-positioned drawer', async () => {
|
|
349
|
+
mount(
|
|
350
|
+
ROOT_TAG,
|
|
351
|
+
defineComponent({
|
|
352
|
+
setup: () => () =>
|
|
353
|
+
h(Drawer, { initialRouteName: 'Home', drawerPosition: 'right' }, () => [
|
|
354
|
+
h(Drawer.Screen, { name: 'Home', component: HomeScreen }),
|
|
355
|
+
h(Drawer.Screen, { name: 'Profile', component: ProfileScreen }),
|
|
356
|
+
]),
|
|
357
|
+
}),
|
|
358
|
+
);
|
|
359
|
+
await tick();
|
|
360
|
+
expect(isOpenByOverlay()).toBe(false);
|
|
361
|
+
swipe(RIGHT_EDGE_OPEN_SWIPE);
|
|
362
|
+
await tick();
|
|
363
|
+
expect(isOpenByOverlay()).toBe(true);
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
it('a kebab-case drawer-position attr (as a compiled SFC template emits) resolves to right, not the left default', async () => {
|
|
367
|
+
mount(
|
|
368
|
+
ROOT_TAG,
|
|
369
|
+
defineComponent({
|
|
370
|
+
setup: () => () =>
|
|
371
|
+
// Passed as a literal 'drawer-position' key, not 'drawerPosition' - mirroring what a
|
|
372
|
+
// template's `:drawer-position="right"` binding actually lands in $attrs as (Vue never
|
|
373
|
+
// camelCases attrs). Without normalizeVueAttrs, currentOptions() would read
|
|
374
|
+
// attrs.drawerPosition as undefined and fall back to the 'left' default, so the swipe
|
|
375
|
+
// below (which only opens a RIGHT-positioned drawer) would stay closed.
|
|
376
|
+
h(Drawer, { initialRouteName: 'Home', 'drawer-position': 'right' }, () => [
|
|
377
|
+
h(Drawer.Screen, { name: 'Home', component: HomeScreen }),
|
|
378
|
+
h(Drawer.Screen, { name: 'Profile', component: ProfileScreen }),
|
|
379
|
+
]),
|
|
380
|
+
}),
|
|
381
|
+
);
|
|
382
|
+
await tick();
|
|
383
|
+
expect(isOpenByOverlay()).toBe(false);
|
|
384
|
+
swipe(RIGHT_EDGE_OPEN_SWIPE);
|
|
385
|
+
await tick();
|
|
386
|
+
expect(isOpenByOverlay()).toBe(true);
|
|
387
|
+
});
|
|
388
|
+
|
|
389
|
+
it('useNavigation()/useRoute() are usable inside a Drawer screen, and useIsFocused() reflects the focused route', async () => {
|
|
390
|
+
let homeIsFocused: boolean | undefined;
|
|
391
|
+
let homeRouteName: string | undefined;
|
|
392
|
+
let profileIsFocused: boolean | undefined;
|
|
393
|
+
|
|
394
|
+
// Plain functions used as `component:` are stateless functional components - see tabs.test.ts's
|
|
395
|
+
// matching comment; a screen calling a composable needs a real setup-based defineComponent.
|
|
396
|
+
const TrackedHomeScreen = defineComponent(() => {
|
|
397
|
+
const navigation = useNavigation();
|
|
398
|
+
const isFocused = useIsFocused();
|
|
399
|
+
const route = useRoute();
|
|
400
|
+
expect(typeof navigation.value.jumpTo).toBe('function');
|
|
401
|
+
return () => {
|
|
402
|
+
homeIsFocused = isFocused.value;
|
|
403
|
+
homeRouteName = route.value.name;
|
|
404
|
+
return h('symbiote-text', {}, 'home');
|
|
405
|
+
};
|
|
406
|
+
});
|
|
407
|
+
const TrackedProfileScreen = defineComponent(() => {
|
|
408
|
+
const isFocused = useIsFocused();
|
|
409
|
+
return () => {
|
|
410
|
+
profileIsFocused = isFocused.value;
|
|
411
|
+
return h('symbiote-text', {}, 'profile');
|
|
412
|
+
};
|
|
413
|
+
});
|
|
414
|
+
|
|
415
|
+
const handleRef = ref<IDrawerNavigatorHandle | null>(null);
|
|
416
|
+
mountDrawer(handleRef, {}, [
|
|
417
|
+
h(Drawer.Screen, { name: 'Home', component: TrackedHomeScreen }),
|
|
418
|
+
h(Drawer.Screen, { name: 'Profile', component: TrackedProfileScreen }),
|
|
419
|
+
]);
|
|
420
|
+
await tick();
|
|
421
|
+
expect(homeIsFocused).toBe(true);
|
|
422
|
+
expect(homeRouteName).toBe('Home');
|
|
423
|
+
|
|
424
|
+
handleRef.value?.jumpTo('Profile');
|
|
425
|
+
await tick();
|
|
426
|
+
expect(profileIsFocused).toBe(true);
|
|
427
|
+
});
|
|
428
|
+
|
|
429
|
+
it('useFocusEffect runs on Drawer focus and its cleanup once jumpTo moves focus away', async () => {
|
|
430
|
+
const events: string[] = [];
|
|
431
|
+
const TrackedHomeScreen = defineComponent(() => {
|
|
432
|
+
useFocusEffect(() => {
|
|
433
|
+
events.push('effect');
|
|
434
|
+
return () => events.push('cleanup');
|
|
435
|
+
});
|
|
436
|
+
return () => h('symbiote-text', {}, 'home');
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
const handleRef = ref<IDrawerNavigatorHandle | null>(null);
|
|
440
|
+
mountDrawer(handleRef, {}, [
|
|
441
|
+
h(Drawer.Screen, { name: 'Home', component: TrackedHomeScreen }),
|
|
442
|
+
h(Drawer.Screen, { name: 'Profile', component: ProfileScreen }),
|
|
443
|
+
]);
|
|
444
|
+
await tick();
|
|
445
|
+
expect(events).toEqual(['effect']);
|
|
446
|
+
|
|
447
|
+
handleRef.value?.jumpTo('Profile');
|
|
448
|
+
await tick();
|
|
449
|
+
expect(events).toEqual(['effect', 'cleanup']);
|
|
450
|
+
});
|
|
451
|
+
});
|