@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,514 @@
|
|
|
1
|
+
// Co-located React-driven test (ADR 0025) for the @symbiote-native/navigation React Stack. Proves
|
|
2
|
+
// the shared core drives React correctly against an INJECTED codegen-shaped ViewConfig (mirrors
|
|
3
|
+
// packages/slider/src/react/slider/slider.test.tsx): push/pop mount and unmount RNSScreen
|
|
4
|
+
// children with the right activityState, the header title reaches RNSScreenStackHeaderConfig,
|
|
5
|
+
// and the native onDismissed/onHeaderBackButtonClicked events drive a pop through the imperative
|
|
6
|
+
// handle. Stack is imported from './stack' (NOT the package barrel, '.') so the third-party
|
|
7
|
+
// native-spec side-effect (../register) never loads headless.
|
|
8
|
+
|
|
9
|
+
import { act, createElement, createRef } from 'react';
|
|
10
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
11
|
+
import { mount, unmount, setNativeViewConfigSource } from '@symbiote-native/react';
|
|
12
|
+
import type { INativeViewConfig } from '@symbiote-native/engine';
|
|
13
|
+
import { installFabric, type IFakeNode } from '@symbiote-native/test-utils';
|
|
14
|
+
import { Stack } from './index';
|
|
15
|
+
import type { INavigatorHandle } from './index';
|
|
16
|
+
import { useRoute } from '../hooks';
|
|
17
|
+
import type { INavigatorState, ISearchBarCommands } from '../../core';
|
|
18
|
+
|
|
19
|
+
const ROOT_TAG = 512;
|
|
20
|
+
const SCREEN_VIEW = 'RNSScreen';
|
|
21
|
+
const STACK_VIEW = 'RNSScreenStack';
|
|
22
|
+
const HEADER_CONFIG_VIEW = 'RNSScreenStackHeaderConfig';
|
|
23
|
+
const HEADER_SUBVIEW_VIEW = 'RNSScreenStackHeaderSubview';
|
|
24
|
+
const SEARCH_BAR_VIEW = 'RNSSearchBar';
|
|
25
|
+
|
|
26
|
+
function directEvent(registrationName: string) {
|
|
27
|
+
return { registrationName };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const RNS_SCREEN_VIEW_CONFIG = {
|
|
31
|
+
directEventTypes: {
|
|
32
|
+
topAppear: directEvent('onAppear'),
|
|
33
|
+
topDisappear: directEvent('onDisappear'),
|
|
34
|
+
topWillAppear: directEvent('onWillAppear'),
|
|
35
|
+
topWillDisappear: directEvent('onWillDisappear'),
|
|
36
|
+
topDismissed: directEvent('onDismissed'),
|
|
37
|
+
topHeaderBackButtonClicked: directEvent('onHeaderBackButtonClicked'),
|
|
38
|
+
},
|
|
39
|
+
validAttributes: {
|
|
40
|
+
screenId: true,
|
|
41
|
+
activityState: true,
|
|
42
|
+
gestureEnabled: true,
|
|
43
|
+
stackAnimation: true,
|
|
44
|
+
stackPresentation: true,
|
|
45
|
+
transitionDuration: true,
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const RNS_SCREEN_STACK_VIEW_CONFIG = {
|
|
50
|
+
directEventTypes: {
|
|
51
|
+
topFinishTransitioning: directEvent('onFinishTransitioning'),
|
|
52
|
+
},
|
|
53
|
+
validAttributes: {},
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const RNS_HEADER_CONFIG_VIEW_CONFIG = {
|
|
57
|
+
directEventTypes: {
|
|
58
|
+
topPressHeaderBarButtonItem: directEvent('onPressHeaderBarButtonItem'),
|
|
59
|
+
},
|
|
60
|
+
validAttributes: {
|
|
61
|
+
title: true,
|
|
62
|
+
hidden: true,
|
|
63
|
+
backTitle: true,
|
|
64
|
+
backTitleVisible: true,
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const RNS_SEARCH_BAR_VIEW_CONFIG = {
|
|
69
|
+
directEventTypes: {
|
|
70
|
+
topSearchFocus: directEvent('onSearchFocus'),
|
|
71
|
+
topSearchBlur: directEvent('onSearchBlur'),
|
|
72
|
+
topChangeText: directEvent('onChangeText'),
|
|
73
|
+
topSearchButtonPress: directEvent('onSearchButtonPress'),
|
|
74
|
+
topCancelButtonPress: directEvent('onCancelButtonPress'),
|
|
75
|
+
topClose: directEvent('onClose'),
|
|
76
|
+
topOpen: directEvent('onOpen'),
|
|
77
|
+
},
|
|
78
|
+
validAttributes: {
|
|
79
|
+
placeholder: true,
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const VIEW_CONFIGS: Record<string, INativeViewConfig> = {
|
|
84
|
+
[SCREEN_VIEW]: RNS_SCREEN_VIEW_CONFIG,
|
|
85
|
+
[STACK_VIEW]: RNS_SCREEN_STACK_VIEW_CONFIG,
|
|
86
|
+
[HEADER_CONFIG_VIEW]: RNS_HEADER_CONFIG_VIEW_CONFIG,
|
|
87
|
+
[SEARCH_BAR_VIEW]: RNS_SEARCH_BAR_VIEW_CONFIG,
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const fabric = installFabric();
|
|
91
|
+
setNativeViewConfigSource(name => VIEW_CONFIGS[name]);
|
|
92
|
+
|
|
93
|
+
beforeEach(() => fabric.reset());
|
|
94
|
+
afterEach(() => unmount(ROOT_TAG));
|
|
95
|
+
|
|
96
|
+
function findInTree(
|
|
97
|
+
predicate: (node: IFakeNode) => boolean,
|
|
98
|
+
nodes = fabric.committed,
|
|
99
|
+
): IFakeNode | undefined {
|
|
100
|
+
for (const node of nodes) {
|
|
101
|
+
if (predicate(node)) return node;
|
|
102
|
+
const child = findInTree(predicate, node.children);
|
|
103
|
+
if (child) return child;
|
|
104
|
+
}
|
|
105
|
+
return undefined;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function screenNodes(): IFakeNode[] {
|
|
109
|
+
const found: IFakeNode[] = [];
|
|
110
|
+
const collect = (nodes: readonly IFakeNode[]): void => {
|
|
111
|
+
for (const node of nodes) {
|
|
112
|
+
if (node.viewName === SCREEN_VIEW) found.push(node);
|
|
113
|
+
collect(node.children);
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
collect(fabric.committed);
|
|
117
|
+
return found;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function headerConfigOf(screen: IFakeNode): IFakeNode {
|
|
121
|
+
const header = screen.children.find(child => child.viewName === HEADER_CONFIG_VIEW);
|
|
122
|
+
if (!header) throw new Error('no header config child on screen');
|
|
123
|
+
return header;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function HomeScreen(): ReturnType<typeof createElement> {
|
|
127
|
+
return createElement('symbiote-text', {}, 'home');
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function DetailsScreen(): ReturnType<typeof createElement> {
|
|
131
|
+
return createElement('symbiote-text', {}, 'details');
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
describe('React Stack navigator', () => {
|
|
135
|
+
it('mounts only the initial route as an RNSScreen, focused', () => {
|
|
136
|
+
mount(
|
|
137
|
+
ROOT_TAG,
|
|
138
|
+
createElement(
|
|
139
|
+
Stack,
|
|
140
|
+
{ initialRouteName: 'Home' },
|
|
141
|
+
createElement(Stack.Screen, {
|
|
142
|
+
name: 'Home',
|
|
143
|
+
component: HomeScreen,
|
|
144
|
+
options: { title: 'Home' },
|
|
145
|
+
}),
|
|
146
|
+
createElement(Stack.Screen, { name: 'Details', component: DetailsScreen }),
|
|
147
|
+
),
|
|
148
|
+
);
|
|
149
|
+
const screens = screenNodes();
|
|
150
|
+
expect(screens).toHaveLength(1);
|
|
151
|
+
expect(screens[0].props.activityState).toBe(2);
|
|
152
|
+
expect(fabric.find(n => n.viewName === STACK_VIEW)).toBeDefined();
|
|
153
|
+
expect(headerConfigOf(screens[0]).props.title).toBe('Home');
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
it('push() mounts a second RNSScreen and keeps the first at activityState 2', () => {
|
|
157
|
+
const ref = createRef<INavigatorHandle>();
|
|
158
|
+
mount(
|
|
159
|
+
ROOT_TAG,
|
|
160
|
+
createElement(
|
|
161
|
+
Stack,
|
|
162
|
+
{ ref, initialRouteName: 'Home' },
|
|
163
|
+
createElement(Stack.Screen, { name: 'Home', component: HomeScreen }),
|
|
164
|
+
createElement(Stack.Screen, {
|
|
165
|
+
name: 'Details',
|
|
166
|
+
component: DetailsScreen,
|
|
167
|
+
options: { title: 'Details' },
|
|
168
|
+
}),
|
|
169
|
+
),
|
|
170
|
+
);
|
|
171
|
+
act(() => ref.current?.push('Details'));
|
|
172
|
+
const screens = screenNodes();
|
|
173
|
+
expect(screens).toHaveLength(2);
|
|
174
|
+
// Both stay FOCUSED (2): react-native-screens' native RNSScreen asserts an already-mounted
|
|
175
|
+
// NativeStack screen's activityState can never decrease, and @react-navigation/native-stack's
|
|
176
|
+
// real algorithm never demotes a route below the focused index to anything but 0 - see
|
|
177
|
+
// computeActivityState's comment in navigator-state.ts.
|
|
178
|
+
expect(screens[0].props.activityState).toBe(2);
|
|
179
|
+
expect(screens[1].props.activityState).toBe(2);
|
|
180
|
+
expect(headerConfigOf(screens[1]).props.title).toBe('Details');
|
|
181
|
+
expect(ref.current?.canGoBack()).toBe(true);
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
it('pop() unmounts back down to the previous route', () => {
|
|
185
|
+
const ref = createRef<INavigatorHandle>();
|
|
186
|
+
mount(
|
|
187
|
+
ROOT_TAG,
|
|
188
|
+
createElement(
|
|
189
|
+
Stack,
|
|
190
|
+
{ ref, initialRouteName: 'Home' },
|
|
191
|
+
createElement(Stack.Screen, { name: 'Home', component: HomeScreen }),
|
|
192
|
+
createElement(Stack.Screen, { name: 'Details', component: DetailsScreen }),
|
|
193
|
+
),
|
|
194
|
+
);
|
|
195
|
+
act(() => ref.current?.push('Details'));
|
|
196
|
+
expect(screenNodes()).toHaveLength(2);
|
|
197
|
+
act(() => ref.current?.pop());
|
|
198
|
+
expect(screenNodes()).toHaveLength(1);
|
|
199
|
+
expect(ref.current?.canGoBack()).toBe(false);
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
it('refuses to pop the last route', () => {
|
|
203
|
+
const ref = createRef<INavigatorHandle>();
|
|
204
|
+
mount(
|
|
205
|
+
ROOT_TAG,
|
|
206
|
+
createElement(
|
|
207
|
+
Stack,
|
|
208
|
+
{ ref, initialRouteName: 'Home' },
|
|
209
|
+
createElement(Stack.Screen, { name: 'Home', component: HomeScreen }),
|
|
210
|
+
),
|
|
211
|
+
);
|
|
212
|
+
act(() => ref.current?.pop());
|
|
213
|
+
expect(screenNodes()).toHaveLength(1);
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
it('drives a pop from the native onDismissed event (iOS swipe/interactive dismiss)', () => {
|
|
217
|
+
const ref = createRef<INavigatorHandle>();
|
|
218
|
+
mount(
|
|
219
|
+
ROOT_TAG,
|
|
220
|
+
createElement(
|
|
221
|
+
Stack,
|
|
222
|
+
{ ref, initialRouteName: 'Home' },
|
|
223
|
+
createElement(Stack.Screen, { name: 'Home', component: HomeScreen }),
|
|
224
|
+
createElement(Stack.Screen, { name: 'Details', component: DetailsScreen }),
|
|
225
|
+
),
|
|
226
|
+
);
|
|
227
|
+
act(() => ref.current?.push('Details'));
|
|
228
|
+
expect(screenNodes()).toHaveLength(2);
|
|
229
|
+
const top = screenNodes()[1];
|
|
230
|
+
act(() => fabric.fireEvent(top.instanceHandle, 'topDismissed', { dismissCount: 1 }));
|
|
231
|
+
expect(screenNodes()).toHaveLength(1);
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
it('drives a pop from the native onHeaderBackButtonClicked event', () => {
|
|
235
|
+
const ref = createRef<INavigatorHandle>();
|
|
236
|
+
mount(
|
|
237
|
+
ROOT_TAG,
|
|
238
|
+
createElement(
|
|
239
|
+
Stack,
|
|
240
|
+
{ ref, initialRouteName: 'Home' },
|
|
241
|
+
createElement(Stack.Screen, { name: 'Home', component: HomeScreen }),
|
|
242
|
+
createElement(Stack.Screen, { name: 'Details', component: DetailsScreen }),
|
|
243
|
+
),
|
|
244
|
+
);
|
|
245
|
+
act(() => ref.current?.push('Details'));
|
|
246
|
+
const top = screenNodes()[1];
|
|
247
|
+
act(() => fabric.fireEvent(top.instanceHandle, 'topHeaderBackButtonClicked', {}));
|
|
248
|
+
expect(screenNodes()).toHaveLength(1);
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
it('mounts the registered screen component as the RNSScreen content', () => {
|
|
252
|
+
mount(
|
|
253
|
+
ROOT_TAG,
|
|
254
|
+
createElement(
|
|
255
|
+
Stack,
|
|
256
|
+
{ initialRouteName: 'Home' },
|
|
257
|
+
createElement(Stack.Screen, { name: 'Home', component: HomeScreen }),
|
|
258
|
+
),
|
|
259
|
+
);
|
|
260
|
+
expect(findInTree(n => n.viewName === 'RCTRawText' && n.props.text === 'home')).toBeDefined();
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
it('exposes route.params to the screen component via useRoute() after navigation.push', () => {
|
|
264
|
+
let receivedParams: unknown;
|
|
265
|
+
function ParamsScreen(): ReturnType<typeof createElement> {
|
|
266
|
+
receivedParams = useRoute().params;
|
|
267
|
+
return createElement('symbiote-text', {}, 'params');
|
|
268
|
+
}
|
|
269
|
+
const ref = createRef<INavigatorHandle>();
|
|
270
|
+
mount(
|
|
271
|
+
ROOT_TAG,
|
|
272
|
+
createElement(
|
|
273
|
+
Stack,
|
|
274
|
+
{ ref, initialRouteName: 'Home' },
|
|
275
|
+
createElement(Stack.Screen, { name: 'Home', component: HomeScreen }),
|
|
276
|
+
createElement(Stack.Screen, { name: 'Details', component: ParamsScreen }),
|
|
277
|
+
),
|
|
278
|
+
);
|
|
279
|
+
act(() => ref.current?.push('Details', { id: 42 }));
|
|
280
|
+
expect(receivedParams).toEqual({ id: 42 });
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
it('setParams() merges onto the focused route without changing the stack shape', () => {
|
|
284
|
+
let receivedParams: unknown;
|
|
285
|
+
function ParamsScreen(): ReturnType<typeof createElement> {
|
|
286
|
+
receivedParams = useRoute().params;
|
|
287
|
+
return createElement('symbiote-text', {}, 'params');
|
|
288
|
+
}
|
|
289
|
+
const ref = createRef<INavigatorHandle>();
|
|
290
|
+
mount(
|
|
291
|
+
ROOT_TAG,
|
|
292
|
+
createElement(
|
|
293
|
+
Stack,
|
|
294
|
+
{ ref, initialRouteName: 'Home' },
|
|
295
|
+
createElement(Stack.Screen, { name: 'Home', component: HomeScreen }),
|
|
296
|
+
createElement(Stack.Screen, { name: 'Details', component: ParamsScreen }),
|
|
297
|
+
),
|
|
298
|
+
);
|
|
299
|
+
act(() => ref.current?.push('Details', { id: 1 }));
|
|
300
|
+
act(() => ref.current?.setParams({ id: 2 }));
|
|
301
|
+
expect(receivedParams).toEqual({ id: 2 });
|
|
302
|
+
expect(screenNodes()).toHaveLength(2);
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
it('setParams() targets a route by key when given, not just the focused one', () => {
|
|
306
|
+
let homeKey: string | undefined;
|
|
307
|
+
let homeParams: unknown;
|
|
308
|
+
function HomeTrackingScreen(): ReturnType<typeof createElement> {
|
|
309
|
+
const route = useRoute();
|
|
310
|
+
homeKey = route.key;
|
|
311
|
+
homeParams = route.params;
|
|
312
|
+
return createElement('symbiote-text', {}, 'home');
|
|
313
|
+
}
|
|
314
|
+
const ref = createRef<INavigatorHandle>();
|
|
315
|
+
mount(
|
|
316
|
+
ROOT_TAG,
|
|
317
|
+
createElement(
|
|
318
|
+
Stack,
|
|
319
|
+
{ ref, initialRouteName: 'Home' },
|
|
320
|
+
createElement(Stack.Screen, {
|
|
321
|
+
name: 'Home',
|
|
322
|
+
component: HomeTrackingScreen,
|
|
323
|
+
initialParams: { tab: 'feed' },
|
|
324
|
+
}),
|
|
325
|
+
createElement(Stack.Screen, { name: 'Details', component: DetailsScreen }),
|
|
326
|
+
),
|
|
327
|
+
);
|
|
328
|
+
act(() => ref.current?.push('Details'));
|
|
329
|
+
if (homeKey === undefined) throw new Error('home route key was never captured');
|
|
330
|
+
act(() => ref.current?.setParams({ tab: 'search' }, homeKey));
|
|
331
|
+
expect(homeParams).toEqual({ tab: 'search' });
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
it('reset() replaces the whole stack with the given state', () => {
|
|
335
|
+
const ref = createRef<INavigatorHandle>();
|
|
336
|
+
mount(
|
|
337
|
+
ROOT_TAG,
|
|
338
|
+
createElement(
|
|
339
|
+
Stack,
|
|
340
|
+
{ ref, initialRouteName: 'Home' },
|
|
341
|
+
createElement(Stack.Screen, { name: 'Home', component: HomeScreen }),
|
|
342
|
+
createElement(Stack.Screen, {
|
|
343
|
+
name: 'Details',
|
|
344
|
+
component: DetailsScreen,
|
|
345
|
+
options: { title: 'Details' },
|
|
346
|
+
}),
|
|
347
|
+
),
|
|
348
|
+
);
|
|
349
|
+
act(() => ref.current?.push('Details'));
|
|
350
|
+
expect(screenNodes()).toHaveLength(2);
|
|
351
|
+
|
|
352
|
+
const nextState: INavigatorState = {
|
|
353
|
+
routes: [{ key: 'reset-1', name: 'Details', params: { id: 7 } }],
|
|
354
|
+
};
|
|
355
|
+
act(() => ref.current?.reset(nextState));
|
|
356
|
+
|
|
357
|
+
const screens = screenNodes();
|
|
358
|
+
expect(screens).toHaveLength(1);
|
|
359
|
+
expect(screens[0].props.activityState).toBe(2);
|
|
360
|
+
expect(headerConfigOf(screens[0]).props.title).toBe('Details');
|
|
361
|
+
expect(ref.current?.canGoBack()).toBe(false);
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
it('nests an RNSSearchBar child, wrapped in an RNSScreenStackHeaderSubview, when headerSearchBarOptions is set', () => {
|
|
365
|
+
mount(
|
|
366
|
+
ROOT_TAG,
|
|
367
|
+
createElement(
|
|
368
|
+
Stack,
|
|
369
|
+
{ initialRouteName: 'Home' },
|
|
370
|
+
createElement(Stack.Screen, {
|
|
371
|
+
name: 'Home',
|
|
372
|
+
component: HomeScreen,
|
|
373
|
+
options: { headerSearchBarOptions: { placeholder: 'Search' } },
|
|
374
|
+
}),
|
|
375
|
+
),
|
|
376
|
+
);
|
|
377
|
+
const header = headerConfigOf(screenNodes()[0]);
|
|
378
|
+
expect(header.children).toHaveLength(1);
|
|
379
|
+
const subview = header.children[0];
|
|
380
|
+
expect(subview.viewName).toBe(HEADER_SUBVIEW_VIEW);
|
|
381
|
+
expect(subview.props.type).toBe('searchBar');
|
|
382
|
+
expect(subview.children).toHaveLength(1);
|
|
383
|
+
expect(subview.children[0].viewName).toBe(SEARCH_BAR_VIEW);
|
|
384
|
+
expect(subview.children[0].props.placeholder).toBe('Search');
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
it('forwards search bar text changes to the app-supplied onChangeText callback', () => {
|
|
388
|
+
let receivedText: string | undefined;
|
|
389
|
+
mount(
|
|
390
|
+
ROOT_TAG,
|
|
391
|
+
createElement(
|
|
392
|
+
Stack,
|
|
393
|
+
{ initialRouteName: 'Home' },
|
|
394
|
+
createElement(Stack.Screen, {
|
|
395
|
+
name: 'Home',
|
|
396
|
+
component: HomeScreen,
|
|
397
|
+
options: {
|
|
398
|
+
headerSearchBarOptions: {
|
|
399
|
+
placeholder: 'Search',
|
|
400
|
+
onChangeText: text => {
|
|
401
|
+
receivedText = text;
|
|
402
|
+
},
|
|
403
|
+
},
|
|
404
|
+
},
|
|
405
|
+
}),
|
|
406
|
+
),
|
|
407
|
+
);
|
|
408
|
+
const searchBar = headerConfigOf(screenNodes()[0]).children[0].children[0];
|
|
409
|
+
act(() => fabric.fireEvent(searchBar.instanceHandle, 'topChangeText', { text: 'asdf' }));
|
|
410
|
+
expect(receivedText).toBe('asdf');
|
|
411
|
+
});
|
|
412
|
+
|
|
413
|
+
it('forwards every other native search bar event to its app-supplied callback', () => {
|
|
414
|
+
const received: {
|
|
415
|
+
focus: number;
|
|
416
|
+
blur: number;
|
|
417
|
+
cancelButtonPress: number;
|
|
418
|
+
close: number;
|
|
419
|
+
open: number;
|
|
420
|
+
searchButtonPressText?: string;
|
|
421
|
+
} = { focus: 0, blur: 0, cancelButtonPress: 0, close: 0, open: 0 };
|
|
422
|
+
mount(
|
|
423
|
+
ROOT_TAG,
|
|
424
|
+
createElement(
|
|
425
|
+
Stack,
|
|
426
|
+
{ initialRouteName: 'Home' },
|
|
427
|
+
createElement(Stack.Screen, {
|
|
428
|
+
name: 'Home',
|
|
429
|
+
component: HomeScreen,
|
|
430
|
+
options: {
|
|
431
|
+
headerSearchBarOptions: {
|
|
432
|
+
placeholder: 'Search',
|
|
433
|
+
onFocus: () => received.focus++,
|
|
434
|
+
onBlur: () => received.blur++,
|
|
435
|
+
onCancelButtonPress: () => received.cancelButtonPress++,
|
|
436
|
+
onSearchButtonPress: text => {
|
|
437
|
+
received.searchButtonPressText = text;
|
|
438
|
+
},
|
|
439
|
+
onClose: () => received.close++,
|
|
440
|
+
onOpen: () => received.open++,
|
|
441
|
+
},
|
|
442
|
+
},
|
|
443
|
+
}),
|
|
444
|
+
),
|
|
445
|
+
);
|
|
446
|
+
const searchBar = headerConfigOf(screenNodes()[0]).children[0].children[0];
|
|
447
|
+
act(() => fabric.fireEvent(searchBar.instanceHandle, 'topSearchFocus', {}));
|
|
448
|
+
act(() => fabric.fireEvent(searchBar.instanceHandle, 'topSearchBlur', {}));
|
|
449
|
+
act(() => fabric.fireEvent(searchBar.instanceHandle, 'topCancelButtonPress', {}));
|
|
450
|
+
act(() => fabric.fireEvent(searchBar.instanceHandle, 'topSearchButtonPress', { text: 'qwer' }));
|
|
451
|
+
act(() => fabric.fireEvent(searchBar.instanceHandle, 'topClose', {}));
|
|
452
|
+
act(() => fabric.fireEvent(searchBar.instanceHandle, 'topOpen', {}));
|
|
453
|
+
expect(received).toEqual({
|
|
454
|
+
focus: 1,
|
|
455
|
+
blur: 1,
|
|
456
|
+
cancelButtonPress: 1,
|
|
457
|
+
close: 1,
|
|
458
|
+
open: 1,
|
|
459
|
+
searchButtonPressText: 'qwer',
|
|
460
|
+
});
|
|
461
|
+
});
|
|
462
|
+
|
|
463
|
+
it('drives imperative SearchBarCommands (focus/setText/…) through the app-supplied ref', () => {
|
|
464
|
+
const searchBarRef = createRef<ISearchBarCommands>();
|
|
465
|
+
mount(
|
|
466
|
+
ROOT_TAG,
|
|
467
|
+
createElement(
|
|
468
|
+
Stack,
|
|
469
|
+
{ initialRouteName: 'Home' },
|
|
470
|
+
createElement(Stack.Screen, {
|
|
471
|
+
name: 'Home',
|
|
472
|
+
component: HomeScreen,
|
|
473
|
+
options: { headerSearchBarOptions: { placeholder: 'Search', ref: searchBarRef } },
|
|
474
|
+
}),
|
|
475
|
+
),
|
|
476
|
+
);
|
|
477
|
+
const searchBar = headerConfigOf(screenNodes()[0]).children[0].children[0];
|
|
478
|
+
|
|
479
|
+
searchBarRef.current?.focus();
|
|
480
|
+
expect(fabric.commands.at(-1)).toMatchObject({ commandName: 'focus', args: [] });
|
|
481
|
+
expect(fabric.commands.at(-1)?.node.tag).toBe(searchBar.tag);
|
|
482
|
+
|
|
483
|
+
searchBarRef.current?.setText('preset');
|
|
484
|
+
expect(fabric.commands.at(-1)).toMatchObject({ commandName: 'setText', args: ['preset'] });
|
|
485
|
+
|
|
486
|
+
searchBarRef.current?.toggleCancelButton(false);
|
|
487
|
+
expect(fabric.commands.at(-1)).toMatchObject({
|
|
488
|
+
commandName: 'toggleCancelButton',
|
|
489
|
+
args: [false],
|
|
490
|
+
});
|
|
491
|
+
|
|
492
|
+
searchBarRef.current?.clearText();
|
|
493
|
+
expect(fabric.commands.at(-1)).toMatchObject({ commandName: 'clearText', args: [] });
|
|
494
|
+
|
|
495
|
+
searchBarRef.current?.cancelSearch();
|
|
496
|
+
expect(fabric.commands.at(-1)).toMatchObject({ commandName: 'cancelSearch', args: [] });
|
|
497
|
+
|
|
498
|
+
searchBarRef.current?.blur();
|
|
499
|
+
expect(fabric.commands.at(-1)).toMatchObject({ commandName: 'blur', args: [] });
|
|
500
|
+
});
|
|
501
|
+
|
|
502
|
+
it('renders the header config with zero children when there is no search bar', () => {
|
|
503
|
+
mount(
|
|
504
|
+
ROOT_TAG,
|
|
505
|
+
createElement(
|
|
506
|
+
Stack,
|
|
507
|
+
{ initialRouteName: 'Home' },
|
|
508
|
+
createElement(Stack.Screen, { name: 'Home', component: HomeScreen }),
|
|
509
|
+
),
|
|
510
|
+
);
|
|
511
|
+
const header = headerConfigOf(screenNodes()[0]);
|
|
512
|
+
expect(header.children).toHaveLength(0);
|
|
513
|
+
});
|
|
514
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Tab.Screen: a declarative marker, never rendered on its own - Tab reads its props via
|
|
2
|
+
// React.Children to build the static name -> {component, options} registry, then mounts the
|
|
3
|
+
// FOCUSED route's component itself. Mirrors react/screen.ts's Screen (Stack's twin) minus the
|
|
4
|
+
// stack-only concepts (no push/pop lifecycle events to wire); see CLAUDE.md
|
|
5
|
+
// <third_party_rn_packages_are_react_only> - this and Tab import nothing from react-native.
|
|
6
|
+
|
|
7
|
+
import type { FC, ReactElement } from 'react';
|
|
8
|
+
import type { IRoute, ITabOptions } from '../core';
|
|
9
|
+
import type { ITabNavigatorHandle } from '../core';
|
|
10
|
+
|
|
11
|
+
// The options resolver runs INSIDE Tab while it computes a screen's tab-bar options, closing over
|
|
12
|
+
// the live navigator handle - not the mounted screen component (that reads navigation/route via
|
|
13
|
+
// the hooks). See react/screen.ts's IScreenOptionsArgs for the same distinction.
|
|
14
|
+
export type ITabScreenOptionsArgs = {
|
|
15
|
+
route: IRoute<unknown>;
|
|
16
|
+
navigation: ITabNavigatorHandle;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type ITabScreenOptionsResolver = (args: ITabScreenOptionsArgs) => ITabOptions;
|
|
20
|
+
|
|
21
|
+
export type ITabScreenProps = {
|
|
22
|
+
name: string;
|
|
23
|
+
component: FC;
|
|
24
|
+
options?: ITabOptions | ITabScreenOptionsResolver;
|
|
25
|
+
initialParams?: unknown;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export function TabScreen(_props: ITabScreenProps): ReactElement | null {
|
|
29
|
+
return null;
|
|
30
|
+
}
|