@apexnative/navigation 1.0.0-alpha.5 → 1.0.0-alpha.7
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/ApexNavigation.podspec +2 -1
- package/CHANGELOG.md +32 -0
- package/README.md +1 -1
- package/android/CLAUDE.md +31 -20
- package/android/CORE.md +12 -8
- package/android/consumer-rules.pro +6 -0
- package/android/src/main/java/dev/apexnative/navigation/NavigationActivity.kt +36 -5
- package/android/src/main/java/dev/apexnative/navigation/options/BottomTabOptions.kt +1 -1
- package/android/src/main/java/dev/apexnative/navigation/options/BottomTabsOptions.kt +13 -8
- package/android/src/main/java/dev/apexnative/navigation/options/ButtonOptions.kt +1 -1
- package/android/src/main/java/dev/apexnative/navigation/options/LargeTitleOptions.kt +1 -1
- package/android/src/main/java/dev/apexnative/navigation/options/LayoutAnimation.kt +1 -1
- package/android/src/main/java/dev/apexnative/navigation/options/OptionKey.kt +18 -0
- package/android/src/main/java/dev/apexnative/navigation/options/OptionPaths.kt +91 -0
- package/android/src/main/java/dev/apexnative/navigation/options/SheetOptions.kt +7 -4
- package/android/src/main/java/dev/apexnative/navigation/options/TitleOptions.kt +2 -2
- package/android/src/main/java/dev/apexnative/navigation/options/TopBarAppearanceOptions.kt +1 -1
- package/android/src/main/java/dev/apexnative/navigation/options/TopBarOptions.kt +16 -7
- package/android/src/main/java/dev/apexnative/navigation/react/ContentHeights.kt +95 -0
- package/android/src/main/java/dev/apexnative/navigation/react/ContentMounts.kt +66 -0
- package/android/src/main/java/dev/apexnative/navigation/react/NavigationTurboModule.kt +7 -3
- package/android/src/main/java/dev/apexnative/navigation/react/OptionsCommands.kt +41 -3
- package/android/src/main/java/dev/apexnative/navigation/react/ReactView.kt +16 -1
- package/android/src/main/java/dev/apexnative/navigation/react/ReloadCoordinator.kt +0 -2
- package/android/src/main/java/dev/apexnative/navigation/react/ScreenEnvironment.kt +177 -0
- package/android/src/main/java/dev/apexnative/navigation/react/ScreenRegions.kt +12 -49
- package/android/src/main/java/dev/apexnative/navigation/react/ScrollEvents.kt +49 -128
- package/android/src/main/java/dev/apexnative/navigation/safearea/SafeAreaView.kt +6 -6
- package/android/src/main/java/dev/apexnative/navigation/slots/SlotScreenView.kt +27 -7
- package/android/src/main/java/dev/apexnative/navigation/slots/SlotView.kt +12 -1
- package/android/src/main/java/dev/apexnative/navigation/utils/MaterialTheme.kt +5 -6
- package/android/src/main/java/dev/apexnative/navigation/utils/SystemAnimations.kt +36 -0
- package/android/src/main/java/dev/apexnative/navigation/utils/ViewExtensions.kt +0 -13
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/arrangement/ArrangementController.kt +9 -7
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/bottomtabs/BottomTabsCollapseBehavior.kt +5 -3
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/bottomtabs/BottomTabsController.kt +13 -10
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/bottomtabs/CustomTabRowGeometry.kt +22 -0
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/bottomtabs/TabsRoom.kt +0 -5
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/component/ComponentViewController.kt +7 -8
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/component/ScreenSafeArea.kt +29 -11
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/externalcomponent/ExternalComponentViewController.kt +2 -6
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/modal/ModalCoordinator.kt +20 -2
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/modal/ModalSheet.kt +443 -58
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/modal/ModalViews.kt +33 -5
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/modal/SheetBack.kt +42 -0
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/modal/SheetStops.kt +60 -2
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/navigator/Navigator.kt +4 -0
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/parent/ParentController.kt +3 -6
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/sidemenu/SideMenuMotion.kt +8 -2
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/BackPreview.kt +32 -4
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/PreparedFrame.kt +3 -3
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/StackCommands.kt +2 -2
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/StackController.kt +50 -7
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/StackQueue.kt +15 -3
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/StackViews.kt +10 -4
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/fab/FabMotion.kt +142 -0
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/fab/FabPresenter.kt +215 -43
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/search/StackSearchPresenter.kt +25 -26
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/topbar/BarRowTransition.kt +3 -2
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/topbar/ButtonPlaces.kt +11 -5
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/topbar/TopBarPresenter.kt +36 -38
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/viewcontroller/ScrollEventListener.kt +6 -9
- package/android/src/main/java/dev/apexnative/navigation/views/animations/AnimationLayer.kt +73 -0
- package/android/src/main/java/dev/apexnative/navigation/views/animations/ValueInterpolation.kt +14 -0
- package/android/src/main/java/dev/apexnative/navigation/views/bottomtabs/BottomTabsLayout.kt +61 -2
- package/android/src/main/java/dev/apexnative/navigation/views/bottomtabs/CustomTabRow.kt +72 -10
- package/android/src/main/java/dev/apexnative/navigation/views/element/ElementTransitions.kt +129 -179
- package/android/src/main/java/dev/apexnative/navigation/views/element/TargetsWait.kt +8 -1
- package/android/src/main/java/dev/apexnative/navigation/views/element/TransitionLayer.kt +37 -112
- package/android/src/main/java/dev/apexnative/navigation/views/element/animators/ElementPictures.kt +67 -3
- package/android/src/main/java/dev/apexnative/navigation/views/element/animators/FlightGeometry.kt +346 -36
- package/android/src/main/java/dev/apexnative/navigation/views/element/animators/ImageMorph.kt +199 -0
- package/android/src/main/java/dev/apexnative/navigation/views/element/animators/SharedAnimatorFactory.kt +55 -42
- package/android/src/main/java/dev/apexnative/navigation/views/element/animators/TextMorph.kt +176 -0
- package/android/src/main/java/dev/apexnative/navigation/views/element/animators/ViewMorph.kt +108 -0
- package/android/src/main/java/dev/apexnative/navigation/views/stack/fab/FabCopy.kt +85 -0
- package/android/src/main/java/dev/apexnative/navigation/views/stack/fab/FabMenu.kt +13 -0
- package/android/src/main/java/dev/apexnative/navigation/views/stack/topbar/TitleBar.kt +5 -24
- package/android/src/main/java/dev/apexnative/navigation/views/stack/topbar/TopBar.kt +51 -34
- package/android/src/main/java/dev/apexnative/navigation/views/stack/topbar/titlebar/BarButtonComponentCell.kt +6 -6
- package/android/src/main/java/dev/apexnative/navigation/views/stack/topbar/titlebar/BarButtonView.kt +113 -0
- package/android/src/main/java/dev/apexnative/navigation/views/stack/topbar/titlebar/BarMenu.kt +219 -0
- package/android/src/main/java/dev/apexnative/navigation/views/stack/topbar/titlebar/ButtonBar.kt +121 -175
- package/android/src/main/java/dev/apexnative/navigation/views/stack/topbar/titlebar/ButtonMenus.kt +34 -64
- package/android/src/main/java/dev/apexnative/navigation/views/stack/topbar/titlebar/ButtonRow.kt +216 -0
- package/android/src/main/jni/ANNContentHeights.cpp +82 -0
- package/android/src/main/res/drawable/apex_navigation_ic_arrow_right.xml +14 -0
- package/android/src/main/res/layout/apex_navigation_menu_header.xml +19 -0
- package/android/src/main/res/layout/apex_navigation_menu_item.xml +68 -0
- package/android/src/main/res/values/styles.xml +1 -1
- package/android/src/main/res/values-night/styles.xml +1 -1
- package/cli/doctor/checks/app.js +16 -1
- package/cli/project.js +4 -0
- package/cli/setup/index.js +5 -0
- package/cli/setup/steps/metro.js +46 -0
- package/docs-md/architecture/native-screens.md +4 -0
- package/docs-md/architecture/theme-and-context.md +131 -12
- package/docs-md/architecture/transitions.md +46 -5
- package/docs-md/containers/modals.md +2 -0
- package/docs-md/containers/overlays.md +1 -1
- package/docs-md/containers/side-menu.md +1 -1
- package/docs-md/containers/tabs.md +2 -0
- package/docs-md/flows/bottom-sheets.md +4 -2
- package/docs-md/fundamentals/screens-and-props.md +9 -1
- package/docs-md/fundamentals/starting-the-app.md +1 -1
- package/docs-md/guides/cli.md +3 -1
- package/docs-md/help/glossary.md +2 -2
- package/docs-md/help/troubleshooting.md +22 -1
- package/docs-md/index.json +41 -1
- package/docs-md/migration/from-expo-router.md +1 -1
- package/docs-md/migration/from-react-native-navigation.md +1 -1
- package/docs-md/migration/from-react-navigation.md +2 -2
- package/docs-md/screen-ui/back-and-gestures.md +17 -1
- package/docs-md/screen-ui/bar-buttons.md +5 -5
- package/docs-md/screen-ui/search.md +1 -1
- package/docs-md/screen-ui/system-ui.md +16 -11
- package/docs-md/screen-ui/toolbar-and-fab.md +4 -2
- package/docs-md/screen-ui/top-bar.md +8 -4
- package/docs-md/start/installation.md +16 -1
- package/ios/Animations/ANNFrameDriver.h +55 -15
- package/ios/Animations/ANNFrameDriver.mm +216 -60
- package/ios/Animations/ANNTransitionAnimator.h +26 -5
- package/ios/Animations/ANNTransitionAnimator.mm +49 -3
- package/ios/Animations/ANNTransitionPlan.h +2 -2
- package/ios/Animations/ANNTransitionPlan.mm +10 -0
- package/ios/Animations/Elements/ANNElementFinder.h +2 -2
- package/ios/Animations/Elements/ANNElementFinder.mm +2 -2
- package/ios/Animations/Elements/ANNElementTransition.h +3 -3
- package/ios/Animations/Elements/ANNElementTransition.mm +2 -2
- package/ios/Animations/Elements/ANNSharedElementFlight.h +3 -3
- package/ios/Animations/Elements/ANNSharedElementFlight.mm +249 -45
- package/ios/Animations/Interpolators/ANNInterpolate.h +2 -30
- package/ios/Animations/Interpolators/ANNTransformParts.h +48 -0
- package/ios/Animations/Interpolators/ANNTransformParts.mm +507 -0
- package/ios/Animations/Interpolators/ANNViewTracks.h +9 -6
- package/ios/Animations/Interpolators/ANNViewTracks.mm +100 -30
- package/ios/CLAUDE.md +32 -22
- package/ios/CORE.md +25 -21
- package/ios/Contract/ANNCommandRunner.h +8 -7
- package/ios/Contract/ANNCommandRunner.mm +21 -27
- package/ios/Contract/ANNLayoutNode.h +3 -3
- package/ios/Contract/ANNLayoutReader.h +3 -3
- package/ios/Core/ANNAppDelegate.mm +0 -2
- package/ios/Core/ANNDeepLinkQueue.h +6 -5
- package/ios/Core/ANNDeepLinkQueue.mm +22 -10
- package/ios/Core/ANNJavaScriptCalls.h +11 -12
- package/ios/Core/ANNJavaScriptCalls.mm +7 -16
- package/ios/Core/ANNReloadCoordinator.mm +4 -8
- package/ios/Core/ANNSceneDelegate.mm +2 -2
- package/ios/Core/ApexNavigation+Internal.h +1 -1
- package/ios/Core/ApexNavigation.mm +6 -2
- package/ios/Layouts/Arrangement/ANNArrangementState.h +2 -17
- package/ios/Layouts/Arrangement/ANNArrangementState.mm +0 -38
- package/ios/Layouts/Arrangement/ANNArrangementViewController.mm +4 -4
- package/ios/Layouts/Root/ANNRootCoordinator.mm +45 -15
- package/ios/Layouts/Screen/ANNComponentViewController.h +2 -2
- package/ios/Layouts/Screen/ANNComponentViewController.mm +13 -23
- package/ios/Layouts/Screen/ANNPreviewInteraction.h +7 -4
- package/ios/Layouts/Screen/ANNPreviewInteraction.mm +72 -10
- package/ios/Layouts/Screen/ANNScreenEnvironment.h +63 -0
- package/ios/Layouts/Screen/ANNScreenEnvironment.mm +181 -0
- package/ios/Layouts/Screen/ANNScreenRegions.h +3 -18
- package/ios/Layouts/Screen/ANNScreenRegions.mm +0 -38
- package/ios/Layouts/Screen/ANNScreenSafeArea.h +4 -9
- package/ios/Layouts/Screen/ANNScreenSafeArea.mm +14 -16
- package/ios/Layouts/Stack/ANNPreviewPush.h +7 -6
- package/ios/Layouts/Stack/ANNPreviewPush.mm +57 -5
- package/ios/Layouts/Stack/ANNStackAnimatingDelegate.h +11 -2
- package/ios/Layouts/Stack/ANNStackAnimatingDelegate.mm +14 -7
- package/ios/Layouts/Stack/ANNStackController.h +8 -0
- package/ios/Layouts/Stack/ANNStackController.mm +153 -11
- package/ios/Layouts/Stack/ANNSwipePopInteraction.h +26 -0
- package/ios/Layouts/Stack/ANNSwipePopInteraction.mm +185 -0
- package/ios/Layouts/Stack/InteractivePopGestureDelegate.mm +28 -4
- package/ios/Layouts/Tabs/ANNBottomTabsAccessoryView.h +12 -1
- package/ios/Layouts/Tabs/ANNBottomTabsAccessoryView.mm +23 -0
- package/ios/Layouts/Tabs/ANNBottomTabsController.mm +2 -1
- package/ios/Layouts/Tabs/ANNBottomTabsCustomRow.mm +8 -3
- package/ios/Layouts/Tabs/ANNBottomTabsPresenter.h +4 -0
- package/ios/Layouts/Tabs/ANNBottomTabsPresenter.mm +123 -36
- package/ios/Layouts/Tabs/ANNTabsDesign.h +6 -5
- package/ios/Layouts/Tabs/ANNTabsDesign.mm +9 -1
- package/ios/Layouts/Tabs/UITabBar+utils.h +5 -5
- package/ios/Layouts/Tabs/UITabBar+utils.mm +32 -13
- package/ios/Options/ANNAnimationOptions.h +2 -1
- package/ios/Options/ANNAnimationOptions.mm +1 -1
- package/ios/Options/ANNBottomTabsOptions.h +2 -0
- package/ios/Options/ANNBottomTabsOptions.mm +1 -0
- package/ios/Options/ANNOptions.h +25 -0
- package/ios/Options/ANNOptions.mm +157 -1
- package/ios/Options/ANNOptionsReader.mm +108 -0
- package/ios/Options/ANNStackPopAnimationOptions.h +13 -0
- package/ios/Options/ANNStackPopAnimationOptions.mm +11 -0
- package/ios/Options/Params/ANNParam.h +15 -0
- package/ios/Options/Params/ANNParam.mm +61 -0
- package/ios/Options/Params/Color.h +3 -0
- package/ios/Options/Params/Color.mm +21 -0
- package/ios/Options/Params/ColorParser.h +4 -3
- package/ios/Options/Params/ColorParser.mm +22 -4
- package/ios/Options/Params/Image.h +4 -0
- package/ios/Options/Params/Image.mm +20 -0
- package/ios/React/ANNReactView.mm +6 -25
- package/ios/React/ANNSafeAreaViewComponentView.mm +26 -15
- package/ios/React/ANNSurfaceHostingView.h +14 -0
- package/ios/React/ANNSurfaceHostingView.mm +144 -1
- package/ios/React/Slots/ANNSlotScreenView.mm +8 -2
- package/ios/TopBar/ANNBackButtonPresenter.mm +6 -5
- package/ios/TopBar/ANNBarAppearance.h +2 -1
- package/ios/TopBar/ANNBarAppearance.mm +111 -30
- package/ios/TopBar/ANNBarBackgroundComponent.mm +16 -0
- package/ios/TopBar/ANNBarButtonComponentView.h +4 -4
- package/ios/TopBar/ANNBarButtonComponentView.mm +1 -1
- package/ios/TopBar/ANNBarButtons.h +5 -3
- package/ios/TopBar/ANNBarButtons.mm +186 -17
- package/ios/TopBar/ANNLargeTitlePresenter.mm +24 -4
- package/ios/TopBar/ANNMainList.h +3 -0
- package/ios/TopBar/ANNMainList.mm +4 -0
- package/ios/TopBar/ANNScrollEdgeEffects.h +22 -6
- package/ios/TopBar/ANNScrollEdgeEffects.mm +123 -16
- package/ios/TopBar/ANNSearchPresenter.mm +2 -2
- package/ios/TopBar/ANNSearchResultsViewController.mm +5 -5
- package/ios/TopBar/ANNTopBarPresenter.h +3 -2
- package/ios/TopBar/ANNTopBarPresenter.mm +95 -22
- package/ios/TurboModules/ANNTurboModule.mm +66 -16
- package/ios/cpp/react/renderer/components/ApexNavigationSpec/ANNSlotState.cpp +20 -0
- package/ios/cpp/react/renderer/components/ApexNavigationSpec/ANNSlotState.h +5 -14
- package/lib/module/ARCHITECTURE.md +17 -7
- package/lib/module/adapters/NativeANNTurboModule.js.map +1 -1
- package/lib/module/api/app/AppRegistry.js +14 -2
- package/lib/module/api/app/AppRegistry.js.map +1 -1
- package/lib/module/api/app/createNavigation.js +188 -66
- package/lib/module/api/app/createNavigation.js.map +1 -1
- package/lib/module/api/events/navigationEvents.js +6 -2
- package/lib/module/api/events/navigationEvents.js.map +1 -1
- package/lib/module/api/hooks/useSafeAreaInsets.js +4 -3
- package/lib/module/api/hooks/useSafeAreaInsets.js.map +1 -1
- package/lib/module/api/linking/linking.js +11 -0
- package/lib/module/api/linking/linking.js.map +1 -1
- package/lib/module/api/options/OptionsChain.js +2 -2
- package/lib/module/api/screens/defineScreen.js +45 -3
- package/lib/module/api/screens/defineScreen.js.map +1 -1
- package/lib/module/api/screens/nativeScreens.js +31 -6
- package/lib/module/api/screens/nativeScreens.js.map +1 -1
- package/lib/module/api/screens/registerScreens.js +172 -35
- package/lib/module/api/screens/registerScreens.js.map +1 -1
- package/lib/module/api/theme/theme.js +5 -0
- package/lib/module/api/theme/theme.js.map +1 -1
- package/lib/module/engine/commands.js +42 -2
- package/lib/module/engine/commands.js.map +1 -1
- package/lib/module/engine/layout.js +7 -2
- package/lib/module/engine/layout.js.map +1 -1
- package/lib/module/engine/nativeScreens.js +9 -0
- package/lib/module/engine/nativeScreens.js.map +1 -1
- package/lib/module/engine/options.js +5 -4
- package/lib/module/engine/options.js.map +1 -1
- package/lib/module/engine/optionsChange.js +102 -0
- package/lib/module/engine/optionsChange.js.map +1 -0
- package/lib/module/engine/refresh.js +85 -0
- package/lib/module/engine/refresh.js.map +1 -0
- package/lib/module/engine/rememberedOptions.js +60 -0
- package/lib/module/engine/rememberedOptions.js.map +1 -1
- package/lib/module/engine/screens.js +55 -4
- package/lib/module/engine/screens.js.map +1 -1
- package/lib/typescript/adapters/NativeANNTurboModule.d.ts +7 -0
- package/lib/typescript/adapters/NativeANNTurboModule.d.ts.map +1 -1
- package/lib/typescript/api/app/AppRegistry.d.ts.map +1 -1
- package/lib/typescript/api/app/createNavigation.d.ts +8 -3
- package/lib/typescript/api/app/createNavigation.d.ts.map +1 -1
- package/lib/typescript/api/events/navigationEvents.d.ts +2 -2
- package/lib/typescript/api/events/navigationEvents.d.ts.map +1 -1
- package/lib/typescript/api/hooks/useSafeAreaInsets.d.ts +4 -3
- package/lib/typescript/api/hooks/useSafeAreaInsets.d.ts.map +1 -1
- package/lib/typescript/api/index.d.ts +1 -1
- package/lib/typescript/api/index.d.ts.map +1 -1
- package/lib/typescript/api/linking/linking.d.ts +8 -0
- package/lib/typescript/api/linking/linking.d.ts.map +1 -1
- package/lib/typescript/api/options/OptionsChain.d.ts +2 -2
- package/lib/typescript/api/screens/defineScreen.d.ts +23 -4
- package/lib/typescript/api/screens/defineScreen.d.ts.map +1 -1
- package/lib/typescript/api/screens/nativeScreens.d.ts +8 -1
- package/lib/typescript/api/screens/nativeScreens.d.ts.map +1 -1
- package/lib/typescript/api/screens/registerScreens.d.ts.map +1 -1
- package/lib/typescript/api/theme/theme.d.ts +2 -0
- package/lib/typescript/api/theme/theme.d.ts.map +1 -1
- package/lib/typescript/engine/commands.d.ts +5 -0
- package/lib/typescript/engine/commands.d.ts.map +1 -1
- package/lib/typescript/engine/layout.d.ts.map +1 -1
- package/lib/typescript/engine/nativeScreens.d.ts +5 -0
- package/lib/typescript/engine/nativeScreens.d.ts.map +1 -1
- package/lib/typescript/engine/optionsChange.d.ts +28 -0
- package/lib/typescript/engine/optionsChange.d.ts.map +1 -0
- package/lib/typescript/engine/refresh.d.ts +35 -0
- package/lib/typescript/engine/refresh.d.ts.map +1 -0
- package/lib/typescript/engine/rememberedOptions.d.ts +13 -0
- package/lib/typescript/engine/rememberedOptions.d.ts.map +1 -1
- package/lib/typescript/engine/screens.d.ts +27 -6
- package/lib/typescript/engine/screens.d.ts.map +1 -1
- package/lib/typescript/interfaces/ComponentEvents.d.ts +2 -2
- package/lib/typescript/interfaces/options/animations.d.ts +44 -14
- package/lib/typescript/interfaces/options/animations.d.ts.map +1 -1
- package/lib/typescript/interfaces/options/bottomTabs.d.ts +19 -6
- package/lib/typescript/interfaces/options/bottomTabs.d.ts.map +1 -1
- package/lib/typescript/interfaces/options/buttons.d.ts +10 -10
- package/lib/typescript/interfaces/options/modals.d.ts +6 -7
- package/lib/typescript/interfaces/options/modals.d.ts.map +1 -1
- package/lib/typescript/interfaces/options/stack.d.ts +8 -3
- package/lib/typescript/interfaces/options/stack.d.ts.map +1 -1
- package/lib/typescript/interfaces/options/system.d.ts +8 -5
- package/lib/typescript/interfaces/options/system.d.ts.map +1 -1
- package/lib/typescript/interfaces/options/toolbar.d.ts +2 -2
- package/lib/typescript/interfaces/options/topBar.d.ts +46 -29
- package/lib/typescript/interfaces/options/topBar.d.ts.map +1 -1
- package/metro/acceptPlugin.js +57 -0
- package/metro/babelTransformer.js +45 -0
- package/metro/index.js +36 -0
- package/package.json +3 -1
- package/src/ARCHITECTURE.md +17 -7
- package/src/adapters/NativeANNTurboModule.ts +7 -0
- package/src/api/app/AppRegistry.ts +16 -2
- package/src/api/app/createNavigation.ts +201 -69
- package/src/api/events/navigationEvents.ts +9 -3
- package/src/api/hooks/useSafeAreaInsets.ts +4 -3
- package/src/api/index.ts +1 -0
- package/src/api/linking/linking.ts +22 -1
- package/src/api/options/OptionsChain.ts +2 -2
- package/src/api/screens/defineScreen.ts +49 -5
- package/src/api/screens/nativeScreens.ts +40 -4
- package/src/api/screens/registerScreens.tsx +170 -42
- package/src/api/theme/theme.ts +5 -0
- package/src/engine/commands.ts +51 -6
- package/src/engine/layout.ts +11 -2
- package/src/engine/nativeScreens.ts +10 -1
- package/src/engine/options.ts +6 -8
- package/src/engine/optionsChange.ts +107 -0
- package/src/engine/refresh.ts +97 -0
- package/src/engine/rememberedOptions.ts +70 -0
- package/src/engine/screens.tsx +53 -8
- package/src/interfaces/ComponentEvents.ts +2 -2
- package/src/interfaces/options/animations.ts +44 -14
- package/src/interfaces/options/bottomTabs.ts +19 -6
- package/src/interfaces/options/buttons.ts +10 -10
- package/src/interfaces/options/modals.ts +6 -7
- package/src/interfaces/options/stack.ts +8 -3
- package/src/interfaces/options/system.ts +8 -5
- package/src/interfaces/options/toolbar.ts +2 -2
- package/src/interfaces/options/topBar.ts +46 -29
- package/android/src/main/java/dev/apexnative/navigation/react/ArrangementStates.kt +0 -42
- package/android/src/main/java/dev/apexnative/navigation/react/ScreenInsets.kt +0 -70
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/bottomtabs/CustomTabRowPlacer.kt +0 -223
- package/android/src/main/java/dev/apexnative/navigation/views/element/ElementStub.kt +0 -31
- package/android/src/main/java/dev/apexnative/navigation/views/element/animators/ImageMatrixAnimator.kt +0 -136
- package/android/src/main/java/dev/apexnative/navigation/views/element/animators/PlainViewAnimator.kt +0 -86
- package/android/src/main/java/dev/apexnative/navigation/views/element/animators/PropertyAnimatorCreator.kt +0 -33
- package/android/src/main/java/dev/apexnative/navigation/views/element/animators/ReactImageAnimator.kt +0 -64
- package/android/src/main/java/dev/apexnative/navigation/views/element/animators/TextChangeAnimator.kt +0 -177
- package/android/src/main/java/dev/apexnative/navigation/views/element/animators/ViewChangeAnimator.kt +0 -137
- package/ios/Layouts/Screen/ANNScreenInsets.h +0 -30
- package/ios/Layouts/Screen/ANNScreenInsets.mm +0 -70
|
@@ -43,7 +43,7 @@ export interface OptionsTopBarTitleDocument {
|
|
|
43
43
|
export interface OptionsTopBarTitle {
|
|
44
44
|
/**
|
|
45
45
|
* The text of the title. Setting it removes a React title. On iOS it is the title of the screen's navigation item,
|
|
46
|
-
* the label the system shows on the next screen's back button
|
|
46
|
+
* the label the system shows on the next screen's back button without the glass design, and what Rename edits. On Android it
|
|
47
47
|
* is one line cut with an ellipsis, and also the text of the large title; a title component set together with the
|
|
48
48
|
* text drops the text and the subtitle (with a warning in development).
|
|
49
49
|
*/
|
|
@@ -87,9 +87,9 @@ export interface OptionsTopBarTitle {
|
|
|
87
87
|
*/
|
|
88
88
|
document?: OptionsTopBarTitleDocument;
|
|
89
89
|
/**
|
|
90
|
-
* (iOS 26
|
|
90
|
+
* (iOS 26+, glass design) Puts the title on a Liquid Glass capsule like the buttons: `'regular'` or `'clear'`; `'none'` and any
|
|
91
91
|
* other value mean no capsule. A text title and the subtitle are two lines on the capsule; a component title sits on
|
|
92
|
-
* it as it is, the capsule taking its size.
|
|
92
|
+
* it as it is, the capsule taking its size. Without the glass design (see `UIDesignRequiresCompatibility`) and on Android it does nothing.
|
|
93
93
|
*/
|
|
94
94
|
glass?: 'regular' | 'clear' | 'none';
|
|
95
95
|
/** (Android) The height of the row of title and buttons, in dp. By default 64, regardless of `topBar.height`. */
|
|
@@ -110,15 +110,15 @@ export interface OptionsTopBarTitle {
|
|
|
110
110
|
/** The subtitle: a second line under the title. */
|
|
111
111
|
export interface OptionsTopBarSubtitle {
|
|
112
112
|
/**
|
|
113
|
-
* The text of the second line. An empty text removes it.
|
|
114
|
-
* large title and the collapsed bar, and on the capsule when the title has `glass`; a React title hides it.
|
|
115
|
-
*
|
|
113
|
+
* The text of the second line. An empty text removes it. With the glass design (iOS 26+, see `UIDesignRequiresCompatibility`) it is the system subtitle, under the title, the
|
|
114
|
+
* large title and the collapsed bar, and on the capsule when the title has `glass`; a React title hides it. Without
|
|
115
|
+
* it, it makes a two-line title view, only without a large title or a React title. On Android it is the line under
|
|
116
116
|
* the title, hidden when empty and dropped when the title is a component.
|
|
117
117
|
*/
|
|
118
118
|
text?: string;
|
|
119
119
|
/**
|
|
120
|
-
* The size of the font.
|
|
121
|
-
* font;
|
|
120
|
+
* The size of the font. With the glass design only what is set goes to the system subtitle, and any font option sets the whole
|
|
121
|
+
* font; without it the size is 12. On Android it is in sp, 14 by default.
|
|
122
122
|
*/
|
|
123
123
|
fontSize?: number;
|
|
124
124
|
/** The color of the subtitle. On Android the theme's on-surface-variant color by default. */
|
|
@@ -168,14 +168,14 @@ export interface OptionsTopBarBackButton {
|
|
|
168
168
|
*/
|
|
169
169
|
visible?: boolean;
|
|
170
170
|
/**
|
|
171
|
-
* (iOS) The text of the back button.
|
|
172
|
-
* the screen below is never shown;
|
|
171
|
+
* (iOS) The text of the back button. With the glass design (iOS 26+, see `UIDesignRequiresCompatibility`) the system button without it is an arrow alone,
|
|
172
|
+
* since the title of the screen below is never shown; without it, it is that title while it fits. It is set on the screen below, as
|
|
173
173
|
* its back button title.
|
|
174
174
|
*/
|
|
175
175
|
title?: string;
|
|
176
176
|
/**
|
|
177
177
|
* (iOS) `true` shows the title of the screen below (or `title`), `false` shows an arrow alone (the minimal mode).
|
|
178
|
-
* Without it the system decides;
|
|
178
|
+
* Without it the system decides; with the glass design that is the arrow.
|
|
179
179
|
*/
|
|
180
180
|
showTitle?: boolean;
|
|
181
181
|
/**
|
|
@@ -198,7 +198,7 @@ export interface OptionsTopBarBackButton {
|
|
|
198
198
|
/**
|
|
199
199
|
* A shape behind the icon, as for a button. It takes effect with a `color` of the shape. On iOS the icon (the
|
|
200
200
|
* chevron by default) is drawn on it and the back button becomes an own button that keeps the history menu unless
|
|
201
|
-
* `enableMenu` is `false`; without a capsule
|
|
201
|
+
* `enableMenu` is `false`; without a capsule with the glass design by default. On Android the arrow sits on the shape.
|
|
202
202
|
*/
|
|
203
203
|
iconBackground?: IconBackgroundOptions;
|
|
204
204
|
/**
|
|
@@ -219,7 +219,7 @@ export interface OptionsTopBarBackButton {
|
|
|
219
219
|
*/
|
|
220
220
|
displayMode?: 'default' | 'generic' | 'minimal';
|
|
221
221
|
/**
|
|
222
|
-
* (iOS 26
|
|
222
|
+
* (iOS 26+, glass design) Whether the Liquid Glass capsule under the back button is hidden. It works only for an own button with
|
|
223
223
|
* an `iconBackground`, where the shape is already drawn into the icon; the system button ignores it.
|
|
224
224
|
* @default true
|
|
225
225
|
*/
|
|
@@ -235,9 +235,9 @@ export interface OptionsTopBarBackButton {
|
|
|
235
235
|
/** The background of the bar: a color, a component, translucency and blur. */
|
|
236
236
|
export interface OptionsTopBarBackground {
|
|
237
237
|
/**
|
|
238
|
-
* The color of the bar. On iOS it fills both the standard look and the one at the scroll edge;
|
|
239
|
-
* then solid in this color instead of glass. A transparent color makes a transparent bar. It beats `blur` and
|
|
240
|
-
* `translucent`. With a large title
|
|
238
|
+
* The color of the bar. On iOS it fills both the standard look and the one at the scroll edge; with the glass design the bar is
|
|
239
|
+
* then solid in this color instead of glass; without it (`UIDesignRequiresCompatibility`) it is the opaque bar of before iOS 26. A transparent color makes a transparent bar. It beats `blur` and
|
|
240
|
+
* `translucent`. With a large title and the glass design the color is drawn into the list under the title, and the collapsed bar
|
|
241
241
|
* paints itself. On Android it is the background of the bar with the status bar strip, by default the theme's
|
|
242
242
|
* surface color, changing at once on push and pop. Together with `component` the color lies under the component.
|
|
243
243
|
*/
|
|
@@ -256,8 +256,8 @@ export interface OptionsTopBarBackground {
|
|
|
256
256
|
*/
|
|
257
257
|
component?: OptionsTopBarBackgroundComponent;
|
|
258
258
|
/**
|
|
259
|
-
* (iOS) Whether content shows through the bar. By default `true`
|
|
260
|
-
* the bar is glass
|
|
259
|
+
* (iOS) Whether content shows through the bar. By default `true` with the glass design (iOS 26+, see `UIDesignRequiresCompatibility`) and `false` without it. With `true`
|
|
260
|
+
* the bar is glass with the glass design and the system translucent bar without it; with `false` it is solid in the system color.
|
|
261
261
|
* `color` and `blur` beat it. Only an explicit `true` puts the screen under the bar.
|
|
262
262
|
*/
|
|
263
263
|
translucent?: boolean;
|
|
@@ -289,7 +289,7 @@ export interface OptionsTopBarBackgroundComponent {
|
|
|
289
289
|
export interface OptionsTopBarScrollEdgeAppearanceTitle {
|
|
290
290
|
/** The size of the font, handled like `topBar.title.fontSize`. */
|
|
291
291
|
fontSize?: number;
|
|
292
|
-
/** The color of the title at the edge.
|
|
292
|
+
/** The color of the title at the edge. With the glass design it is fixed during a push, like the usual title color. */
|
|
293
293
|
color?: Color;
|
|
294
294
|
/** The font family, handled like `topBar.title.fontFamily`. */
|
|
295
295
|
fontFamily?: FontFamily;
|
|
@@ -313,7 +313,7 @@ export interface OptionsTopBarScrollEdgeAppearanceBackground {
|
|
|
313
313
|
}
|
|
314
314
|
/**
|
|
315
315
|
* (iOS) How the bar looks while the list is at its top edge. Without `active` the edge looks as the usual bar, except
|
|
316
|
-
* for the transparency under a large title
|
|
316
|
+
* for the transparency under a large title with the glass design; the title and the border at the edge still come from the fields
|
|
317
317
|
* here or from the usual ones. Android doesn't read it.
|
|
318
318
|
*/
|
|
319
319
|
export interface OptionsTopBarScrollEdgeAppearance {
|
|
@@ -323,7 +323,7 @@ export interface OptionsTopBarScrollEdgeAppearance {
|
|
|
323
323
|
background?: OptionsTopBarScrollEdgeAppearanceBackground;
|
|
324
324
|
/**
|
|
325
325
|
* Whether the bar has a background of its own at the edge (`background`). With it the edge isn't made transparent
|
|
326
|
-
* under a large title, and
|
|
326
|
+
* under a large title, and with the glass design an opaque color covers the large title. A change by `mergeOptions` applies at
|
|
327
327
|
* once.
|
|
328
328
|
* @default false
|
|
329
329
|
*/
|
|
@@ -358,7 +358,7 @@ export interface OptionsTopBarLargeTitle {
|
|
|
358
358
|
* Whether the large title collapses into the bar as the list scrolls. With `false` on iOS the bar follows an empty
|
|
359
359
|
* scroll view instead of the list, so the title stays as at the top of the list; under the row it then needs a
|
|
360
360
|
* background (`background.color`, else a system blur), and `searchBar.hideOnScroll` doesn't work. On Android `false`
|
|
361
|
-
* leaves the bar as it is and stops listening to the list.
|
|
361
|
+
* leaves the bar as it is and stops listening to the list. With the glass design in a right-to-left layout nothing collapses.
|
|
362
362
|
* @default true
|
|
363
363
|
*/
|
|
364
364
|
collapseOnScroll?: boolean;
|
|
@@ -616,7 +616,7 @@ export interface OptionsTopBar {
|
|
|
616
616
|
/**
|
|
617
617
|
* The shape color behind the icons of the left buttons that have an `icon` image and no `iconBackground.color`; the
|
|
618
618
|
* size and corners come from the button's `iconBackground`, or the icon's size without corners. On iOS only image
|
|
619
|
-
* buttons, not SF Symbols, and without a capsule
|
|
619
|
+
* buttons, not SF Symbols, and without a capsule with the glass design. A color sent by `mergeOptions` repaints all the side's
|
|
620
620
|
* image buttons, those with their own shape color too.
|
|
621
621
|
*/
|
|
622
622
|
leftButtonBackgroundColor?: Color;
|
|
@@ -633,6 +633,20 @@ export interface OptionsTopBar {
|
|
|
633
633
|
centerButtonColor?: Color;
|
|
634
634
|
/** (iOS 16+) The color of the disabled center buttons that have no `disabledColor` of their own. */
|
|
635
635
|
centerButtonDisabledColor?: Color;
|
|
636
|
+
/**
|
|
637
|
+
* (Android) The background of the bar's menus: "⋮" and the menus of the buttons, their submenus too. Without it the
|
|
638
|
+
* bar's color (`background.color`, else the theme's surface), unless the bar lets something through; then the
|
|
639
|
+
* theme's surface container color. It follows light and dark mode; an open menu closes as the mode switches. iOS
|
|
640
|
+
* draws its system menus in the system's colors.
|
|
641
|
+
*/
|
|
642
|
+
menuBackgroundColor?: Color;
|
|
643
|
+
/**
|
|
644
|
+
* (Android) The color of the text and the icons of the items of the bar's menus, and of the titles of their
|
|
645
|
+
* submenus. Without it the title's color (`title.color`) when the menu takes the bar's color, else the theme's
|
|
646
|
+
* colors. A destructive item stays red, and a button moved into "⋮" keeps its own color or the side's
|
|
647
|
+
* (`rightButtonColor`). A disabled item is dimmed. An open menu closes when either menu color is merged.
|
|
648
|
+
*/
|
|
649
|
+
menuTextColor?: Color;
|
|
636
650
|
/**
|
|
637
651
|
* Whether the content of the screen goes under the bar, starting at the top of the screen. The screen goes under the
|
|
638
652
|
* bar by itself in some cases (a large title that may show, `hideOnScroll`, a hidden bar, an explicit translucent
|
|
@@ -790,12 +804,15 @@ export interface OptionsScrollEdge {
|
|
|
790
804
|
}
|
|
791
805
|
/**
|
|
792
806
|
* (iOS 26+) The scroll edge effect of the scroll views of a screen: how the content fades or blurs where it scrolls
|
|
793
|
-
* under a bar. The scroll views draw it, and only where content goes under a bar.
|
|
794
|
-
*
|
|
795
|
-
* `
|
|
796
|
-
*
|
|
797
|
-
*
|
|
798
|
-
*
|
|
807
|
+
* under a bar. The scroll views draw it, and only where content goes under a bar. When the screen appears, it applies
|
|
808
|
+
* to the vertical lists and text views (a multi-line `TextInput`) in the view of the screen, except in hidden views
|
|
809
|
+
* (`display: none`). A list inside another vertical list gets none (UIKit draws no edge effect there); a scroll view
|
|
810
|
+
* that doesn't scroll vertically, like a pager, is searched for its lists. A list nested very deep in the screen's
|
|
811
|
+
* views may not get it. After React mounts, the main list of the screen gets it; a list mounted later gets it at the
|
|
812
|
+
* next appearance, or at a `mergeOptions` of `scrollEdgeEffect` or of the bar's background. The lists get the system
|
|
813
|
+
* effect back when the screen leaves or is destroyed, and a list React removes from the screen gets it back too. Under
|
|
814
|
+
* a bar with `background.color` or `background.component` there is no effect at the top unless the screen sets one for
|
|
815
|
+
* the top or for all edges. Before iOS 26 and on Android it does nothing.
|
|
799
816
|
*/
|
|
800
817
|
export interface OptionsScrollEdgeEffect {
|
|
801
818
|
/** Whether the effect is hidden on all four edges. The value of an edge beats it. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"topBar.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/options/topBar.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,mBAAmB,EACnB,uBAAuB,EACxB,MAAM,cAAW,CAAC;AACnB,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAU,CAAC;AAExF;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;;;OAIG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb;;;;;OAKG;IACH,SAAS,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IAC9B,4FAA4F;IAC5F,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,uDAAuD;AACvD,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAC;CACb;AAED,iHAAiH;AACjH,MAAM,WAAW,kBAAkB;IACjC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MA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;IAC5F,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,+EAA+E;AAC/E,MAAM,WAAW,sCAAsC;IACrD,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,
|
|
1
|
+
{"version":3,"file":"topBar.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/options/topBar.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,mBAAmB,EACnB,uBAAuB,EACxB,MAAM,cAAW,CAAC;AACnB,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAU,CAAC;AAExF;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;;;OAIG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb;;;;;OAKG;IACH,SAAS,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IAC9B,4FAA4F;IAC5F,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,uDAAuD;AACvD,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAC;CACb;AAED,iHAAiH;AACjH,MAAM,WAAW,kBAAkB;IACjC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6GAA6G;IAC7G,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,sEAAsE;IACtE,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,8BAA8B;IAC9B,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,yDAAyD;IACzD,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB;;;;OAIG;I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|
+
|
|
4
|
+
// A Babel plugin, development only: a module that imports `createNavigation` from the navigation accepts its own updates
|
|
5
|
+
// (`module.hot.accept()`). Metro then runs it again when it or a module only it imports changes, instead of reloading
|
|
6
|
+
// the app, and the navigation gives the new config to the app that runs.
|
|
7
|
+
|
|
8
|
+
const PACKAGE = '@apexnative/navigation';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @param {{ template: { statement: { ast: (strings: TemplateStringsArray) => unknown } } }} babel
|
|
12
|
+
*/
|
|
13
|
+
function acceptPlugin({ template }) {
|
|
14
|
+
return {
|
|
15
|
+
name: 'apexnative-navigation-accept',
|
|
16
|
+
visitor: {
|
|
17
|
+
Program: {
|
|
18
|
+
/**
|
|
19
|
+
* Read on entering, before the other plugins turn the imports into requires.
|
|
20
|
+
* @param {{ node: { body: ImportNode[] } }} path
|
|
21
|
+
* @param {{ makesApp?: boolean }} state
|
|
22
|
+
*/
|
|
23
|
+
enter(path, state) {
|
|
24
|
+
state.makesApp = path.node.body.some(importsCreateNavigation);
|
|
25
|
+
},
|
|
26
|
+
/**
|
|
27
|
+
* @param {{ pushContainer: (key: string, node: unknown) => void }} path
|
|
28
|
+
* @param {{ makesApp?: boolean }} state
|
|
29
|
+
*/
|
|
30
|
+
exit(path, state) {
|
|
31
|
+
if (!state.makesApp) return;
|
|
32
|
+
path.pushContainer(
|
|
33
|
+
'body',
|
|
34
|
+
template.statement.ast`if (module.hot) { module.hot.accept(); }`
|
|
35
|
+
);
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @typedef {{ type: string, source?: { value: string },
|
|
44
|
+
* specifiers?: { type: string, imported?: { name?: string, value?: string } }[] }} ImportNode
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
/** @param {ImportNode} node */
|
|
48
|
+
function importsCreateNavigation(node) {
|
|
49
|
+
if (node.type !== 'ImportDeclaration' || node.source?.value !== PACKAGE) return false;
|
|
50
|
+
return (node.specifiers ?? []).some(
|
|
51
|
+
(specifier) =>
|
|
52
|
+
specifier.type === 'ImportSpecifier' &&
|
|
53
|
+
(specifier.imported?.name ?? specifier.imported?.value) === 'createNavigation'
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
module.exports = acceptPlugin;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
// The navigation's Babel transformer: the app's own transformer with two changes, in development only.
|
|
5
|
+
//
|
|
6
|
+
// - React Native's transformer adds React Refresh's Babel plugin only when Metro's options say `hot`, and Metro gives
|
|
7
|
+
// them no `hot` any more. Without the plugin React Refresh knows only what a module exports: a component of a screen
|
|
8
|
+
// file that it doesn't export loses its state at every edit. The option goes in again here.
|
|
9
|
+
// - A module that makes the app (`createNavigation`) accepts its own updates, so an edit of the screens map, or of a
|
|
10
|
+
// module only it imports, runs it again instead of reloading the app; the app that runs takes the new config.
|
|
11
|
+
|
|
12
|
+
const accept = require('./acceptPlugin');
|
|
13
|
+
|
|
14
|
+
const upstreamPath = process.env.APEX_NAVIGATION_BABEL_TRANSFORMER;
|
|
15
|
+
if (!upstreamPath) {
|
|
16
|
+
throw new Error(
|
|
17
|
+
"[navigation] The navigation's Babel transformer runs only through withApexNavigation in metro.config.js"
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
/** @type {{ transform: (args: TransformArgs) => unknown, getCacheKey?: () => string }} */
|
|
21
|
+
const upstream = require(upstreamPath);
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @typedef {{ filename: string, options: { dev: boolean, hot?: boolean }, plugins?: unknown[], src: string }}
|
|
25
|
+
* TransformArgs
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/** @param {TransformArgs} args */
|
|
29
|
+
function transform(args) {
|
|
30
|
+
const { filename, options } = args;
|
|
31
|
+
if (!options.dev) return upstream.transform(args);
|
|
32
|
+
const own = !filename.includes('node_modules');
|
|
33
|
+
return upstream.transform({
|
|
34
|
+
...args,
|
|
35
|
+
options: { ...options, hot: true },
|
|
36
|
+
plugins: own ? [...(args.plugins ?? []), accept] : args.plugins,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// The cache of transformed files changes with this transformer, not only with the one it goes in front of.
|
|
41
|
+
function getCacheKey() {
|
|
42
|
+
return `apexnative-navigation-1:${upstream.getCacheKey?.() ?? ''}`;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
module.exports = { ...upstream, transform, getCacheKey };
|
package/metro/index.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
// The Metro setup of the navigation, for the app's metro.config.js:
|
|
5
|
+
//
|
|
6
|
+
// const { withApexNavigation } = require('@apexnative/navigation/metro');
|
|
7
|
+
// module.exports = withApexNavigation(mergeConfig(getDefaultConfig(__dirname), config));
|
|
8
|
+
//
|
|
9
|
+
// It puts the navigation's Babel transformer in front of the app's own (React Native's, or the one the app set), so an
|
|
10
|
+
// edit in development updates the app by Fast Refresh instead of reloading it.
|
|
11
|
+
|
|
12
|
+
const path = require('node:path');
|
|
13
|
+
|
|
14
|
+
/** The variable that tells the navigation's transformer which transformer it goes in front of. */
|
|
15
|
+
const UPSTREAM = 'APEX_NAVIGATION_BABEL_TRANSFORMER';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The app's Metro config with the navigation's Babel transformer in front of the one it had. Metro starts its
|
|
19
|
+
* transform workers after it read the config, so they find the transformer the app had through the environment.
|
|
20
|
+
* @template {{ projectRoot?: string, transformer?: { babelTransformerPath?: string } }} Config
|
|
21
|
+
* @param {Config} config
|
|
22
|
+
* @returns {Config}
|
|
23
|
+
*/
|
|
24
|
+
function withApexNavigation(config) {
|
|
25
|
+
const transformer = config.transformer ?? {};
|
|
26
|
+
const own = require.resolve('./babelTransformer');
|
|
27
|
+
if (transformer.babelTransformerPath === own) return config;
|
|
28
|
+
process.env[UPSTREAM] =
|
|
29
|
+
transformer.babelTransformerPath ??
|
|
30
|
+
require.resolve('@react-native/metro-babel-transformer', {
|
|
31
|
+
paths: [config.projectRoot ?? process.cwd(), path.join(__dirname, '..')],
|
|
32
|
+
});
|
|
33
|
+
return { ...config, transformer: { ...transformer, babelTransformerPath: own } };
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
module.exports = { withApexNavigation, UPSTREAM };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apexnative/navigation",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.7",
|
|
4
4
|
"description": "Native navigation for React Native: platform stacks, tabs, modals and side menus on iOS, iPadOS and Android",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"types": "./lib/typescript/index.d.ts",
|
|
32
32
|
"default": "./lib/module/index.js"
|
|
33
33
|
},
|
|
34
|
+
"./metro": "./metro/index.js",
|
|
34
35
|
"./package.json": "./package.json"
|
|
35
36
|
},
|
|
36
37
|
"files": [
|
|
@@ -39,6 +40,7 @@
|
|
|
39
40
|
"android",
|
|
40
41
|
"ios",
|
|
41
42
|
"cli",
|
|
43
|
+
"metro",
|
|
42
44
|
"CHANGELOG.md",
|
|
43
45
|
"docs-md",
|
|
44
46
|
"*.podspec",
|
package/src/ARCHITECTURE.md
CHANGED
|
@@ -89,8 +89,8 @@ form of `src/api/events/navigationEvents.ts`. Everything in `src/engine` is inte
|
|
|
89
89
|
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
90
90
|
| `native.ts` | `commands`: the TurboModule (`src/adapters/NativeANNTurboModule.ts`). `onNativeEvent(name, listener)`: one native event, `ANN.<name>`. iOS sends events through `ANNTurboEventEmitter`; Android without a module. `getLaunchLink()`: the URL that launched the native side, null without the native side (Jest). `getStartInfo()`: `{ coldStart, splashLogo, arrangements }`, asked once; without the native side a cold start without a logo and without arrangements. |
|
|
91
91
|
| `layout.ts` | `toNativeLayout(layout)`: a `LayoutNode`, `{ id, type, data: { name, options, passProps?, functions?, key?, columns? }, children }`. For a screen, in this order: a name that shows a pair becomes an `Arrangement` node (see Pairs, regions and the hinge), an unknown name fails, its id, its own options under those of the show, the press handlers of its buttons taken out; then a native screen goes as an external component (`showNativeScreen`), a React screen with its `key`, its props kept here, as a slot in one tree. |
|
|
92
|
-
| `options.ts` | `toNativeOptions(options, owner)`: colors (iOS: a number, `
|
|
93
|
-
| `commands.ts` | `setRoot`, `push`, `pop`, `popTo`, `popToRoot`, `setStackRoot`, `showInColumn`, `setColumnShown`, `showModal`, `dismissModal`, `dismissAllModals`, `showOverlay`, `dismissOverlay`, `dismissAllOverlays`, `mergeOptions`, `setDefaultOptions`. One that shows screens waits for lazy ones (`afterLoading`), checks the ids (`checkIds`), notes the places and waits for the hooks of native screens (`whenNativeScreensReady`). On Android, in one tree, a push goes through `preparePush` first (see One command). |
|
|
92
|
+
| `options.ts` | `toNativeOptions(options, owner)`: colors (iOS: a number, `{ light, dark }` or `'NoColor'`; Android: always `{ light, dark }`), images (`require` resolved), components in options (`componentId`, their props kept here; without an `id` of their own, `<owner>/<place>/<name>`, e.g. `Component12/topBar.title/Clock`, a list item by its id where it has one (`topBar.rightButtons[Save]`), the same on every `mergeOptions` of the node, so the native side keeps the mounted root), the props of buttons with a component, the roots of the bar buttons' components (`*Buttons`, the toolbar's `buttons`) remembered. Options come in their own form only. |
|
|
93
|
+
| `commands.ts` | `setRoot`, `push`, `pop`, `popTo`, `popToRoot`, `setStackRoot`, `showInColumn`, `setColumnShown`, `showModal`, `dismissModal`, `dismissAllModals`, `showOverlay`, `dismissOverlay`, `dismissAllOverlays`, `mergeOptions`, `clearOptions` (Fast Refresh, development), `setDefaultOptions`. One that shows screens waits for lazy ones (`afterLoading`), checks the ids (`checkIds`), notes the places and waits for the hooks of native screens (`whenNativeScreensReady`). On Android, in one tree, a push goes through `preparePush` first (see One command). |
|
|
94
94
|
| `screens.tsx` | The screens by name: a React component with its options, `key`, `load` (a lazy screen) and `arrangement` (its pair, if it has a secondary), a native screen (`nativeName`, the controller of its `useProps`, `arrangement`), or a pair entry of `defineArrangement` (`pair`). `arrangementOf(name)`: the pair a name shows; `checkArrangements` at registration, `checkArrangement` when a lazy screen's pair shows. `loadScreens`/`afterLoading`: a command goes once its lazy screens loaded, at once when none waits. A React screen is registered with `AppRegistry` as a root (`screenRoot`) that renders it with the props left for its id. After a JavaScript reload React Native starts the old roots again under the new screens' ids: a root that unmounts while another root of the id is mounted leaves the screen alone. The props of a component the library named in options go with its node, not with a root (several roots may show one default). |
|
|
95
95
|
| `nativeScreens.ts` | The native screens shown, by id. Data props go as JSON (`passProps`); functions stay here, their names in `data.functions`, and the native side calls them (`ANN.NativeScreenCall`, answered with `resolveNativeScreenCall`). With `useProps`: the hidden host runs the hook (`startHost`, 5 s to start), the command waits for its first result, later changes go with `updateNativeScreenProps`. `ANN.NativeScreenReleased` forgets one. |
|
|
96
96
|
| `props.ts` | The props of screens and of components in options, by id: a command puts them here before the native side creates the view; React Native passes a root only its id. Also which roots are the components of bar buttons (`isButtonRoot`): on iOS their wrapper centers the content in the slot. |
|
|
@@ -99,6 +99,8 @@ form of `src/api/events/navigationEvents.ts`. Everything in `src/engine` is inte
|
|
|
99
99
|
| `buttons.ts` | The `onPress` handlers of the buttons of each screen and of their menu items, called on `NavigationButtonPressed`; the API gives the event its form (`setPressEvent`). |
|
|
100
100
|
| `tabs.ts` | The press handlers of `Tab().onPress()`: they come with the tabs' layout, stay under the id the tabs are shown with, and go once every React screen shown in the tabs (pushed ones too) unmounted. |
|
|
101
101
|
| `slots.ts` | One tree (`appProvider`): `slotName` sends a React screen as `slot:<name>`, the native side gives it an empty container, and the slot with its id in `SlotHost` renders it. `withSlots` takes back the slots of a failed command; `ANN.SlotDestroyed` removes one. For a push on Android: `holdSlot` (nothing renders until the native side laid the screen out), `showSlot` (at its `SlotFrame`; resolves once React committed it, `slotCommitted`), `preparedPadding` (the first padding of its safe area view). |
|
|
102
|
+
| `refresh.ts` | Development only. Fast Refresh runs an edited module again and every export is a new function; `familyOf` and the newest-version lookup read React Refresh's family of a component (Metro registers each export under its module and name), so what the library keeps of a screen (options, `key`, `arrangement`) follows an edit without a reload. Nothing in a release build. |
|
|
103
|
+
| `optionsChange.ts` | `optionsChange(previous, next)`: what an edit of a screen's options changes: the options to merge (objects compare key by key, arrays and other values as a whole, functions by source) and the paths taken out, which go to the native `clearOptions`. |
|
|
102
104
|
| `launchState.ts` | The last root and default options: Android destroys the activity while JavaScript lives on and sends `AppLaunched` again; the app sets them again. |
|
|
103
105
|
| `backListeners.ts` | Android: wraps `BackHandler.addEventListener` at the launch to count the listeners, and tells the native side whether there is one (`setBackListeners`): the navigation takes the back button only while it can go back or JavaScript listens. A listener added before the launch isn't counted. |
|
|
104
106
|
| `reactMeasures.ts` | Development only: every command that shows or closes screens drops React's `performance.measure` entries of component renders (named after the component with U+200B in front). React Native keeps them without a limit, and a long session ran out of memory; the app's own measures stay. |
|
|
@@ -136,6 +138,10 @@ form of `src/api/events/navigationEvents.ts`. Everything in `src/engine` is inte
|
|
|
136
138
|
`launchState.root`, as it was passed (functions in props included), is set again. Then, with `linking`, the new
|
|
137
139
|
activity's link runs as in a running app (`linksRelaunched`).
|
|
138
140
|
|
|
141
|
+
## Hot update
|
|
142
|
+
|
|
143
|
+
`@apexnative/navigation/metro` (`withApexNavigation`) wraps the Metro config: it applies React Refresh's Babel plugin that React Native 0.87's transformer skips, and makes the module that imports `createNavigation` accept hot updates. When that module runs again, `createNavigation` meets a running navigation and updates it instead of starting: the screens (`registerScreens` again; a defined screen's options through `optionsChange` become `mergeOptions` and `clearOptions` on the screens that show; `key` and `arrangement` apply from the next show), the default options when `theme` or `options` changed, the roots, the listeners and the link routes. What only the start reads (the first root, `willMount`, the splash, the context) isn't run again. `defineScreen` returns the component, so a file that exports only screens is a Fast Refresh boundary; a native screen's component runs its `useProps`, and a change of its native name or of having `useProps` restarts the app.
|
|
144
|
+
|
|
139
145
|
## Links
|
|
140
146
|
|
|
141
147
|
`linking` of `createNavigation` (`src/api/linking/`) turns URLs into commands; the native side keeps no routes.
|
|
@@ -248,15 +254,19 @@ name and on one id for two screens.
|
|
|
248
254
|
|
|
249
255
|
`usePreview(nativeID, { screen, props, actions })` works on iOS only. It arms a `pushPreview` from its screen: a push
|
|
250
256
|
with an id of its own (`Preview14`) and a `preview` option (`nativeID`, `commit`, the menu without its handlers, a
|
|
251
|
-
size). The native side
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
257
|
+
size). The native side makes the screen's node at once and gives the view with that `nativeID` a context menu that
|
|
258
|
+
previews it; a React screen gets its own root and renders when a press starts (the menu's configuration call, about
|
|
259
|
+
0.5 s before the preview), so a hundred previews hold no rendered screens until one is pressed. A screen of the one
|
|
260
|
+
tree (`appProvider`) and a native screen render at once. A tap on the preview pushes the screen, the push resolves, and
|
|
261
|
+
the hook arms the next one. A press of a menu item comes as `buttonPressed` of the preview's id, and the hook calls its
|
|
262
|
+
`onPress`. A preview that goes without being shown rejects its push, which the hook ignores. One that goes before its
|
|
263
|
+
first press never mounted a root, so the engine forgets what the push noted for it (`forgetUnmountedPreview` in
|
|
264
|
+
`src/engine/commands.ts`, after 1 s, unless a root of it mounted by then).
|
|
255
265
|
|
|
256
266
|
## The native side's contract
|
|
257
267
|
|
|
258
268
|
- Commands: the methods of `ANNTurboModule` (`src/adapters/NativeANNTurboModule.ts`), with the JSON above: those of
|
|
259
|
-
`commands.ts`, each but `mergeOptions` and `setDefaultOptions` with a command id and a promise. A command that changed
|
|
269
|
+
`commands.ts`, each but `mergeOptions`, `clearOptions` and `setDefaultOptions` with a command id and a promise. A command that changed
|
|
260
270
|
what the user sees sends `ANN.NavigationStateChanged` right before its promise resolves, so `getState()` after
|
|
261
271
|
`await` shows its result and the next command acts from there. Besides them: `setBackListeners` (Android: whether
|
|
262
272
|
JavaScript has `BackHandler` listeners; iOS does nothing), `preparePush` and `cancelPreparedPush` (Android, one
|
|
@@ -14,6 +14,13 @@ export interface Spec extends TurboModule {
|
|
|
14
14
|
setDefaultOptions(options: CodegenTypes.UnsafeObject): void;
|
|
15
15
|
/** Merges options into the layout with the id and applies them to what shows; an unknown id does nothing. */
|
|
16
16
|
mergeOptions(componentId: string, options: CodegenTypes.UnsafeObject): void;
|
|
17
|
+
/**
|
|
18
|
+
* (Development) Takes the options at the paths (`topBar.subtitle`, a group's path for the whole group) out of the own
|
|
19
|
+
* options of the layout with the id, so it shows what the layouts around it and the defaults give there, and applies
|
|
20
|
+
* the result to what shows as `setDefaultOptions` does. An unknown id or path does nothing. Fast Refresh sends it
|
|
21
|
+
* for the options an edit took out of a screen that shows.
|
|
22
|
+
*/
|
|
23
|
+
clearOptions(componentId: string, paths: ReadonlyArray<string>): void;
|
|
17
24
|
/** Pushes a layout over the screen in its stack; resolves with the id of the screen that shows (of a pair: its id). */
|
|
18
25
|
push(commandId: string, componentId: string, layout: CodegenTypes.UnsafeObject): Promise<string>;
|
|
19
26
|
/**
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { AppRegistry as ReactNativeAppRegistry } from 'react-native';
|
|
2
2
|
import { onNativeEvent } from '../../engine/native';
|
|
3
|
+
import { familyOf } from '../../engine/refresh';
|
|
3
4
|
import { SLOT_HOST_MODULE } from '../../engine/slots';
|
|
4
5
|
import { SlotHost } from '../slots/SlotHost';
|
|
5
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
isNavigationApp,
|
|
8
|
+
type NavigationApp,
|
|
9
|
+
noteReplacingApp,
|
|
10
|
+
startApp,
|
|
11
|
+
} from './createNavigation';
|
|
6
12
|
|
|
7
13
|
type NavigationAppProvider = () => NavigationApp<any, any>;
|
|
8
14
|
|
|
@@ -35,7 +41,15 @@ function registerComponent(
|
|
|
35
41
|
navigation: NavigationApp<any, any> | NavigationAppProvider
|
|
36
42
|
): string {
|
|
37
43
|
if (__DEV__ && registered) {
|
|
38
|
-
|
|
44
|
+
// The entry file running again after an edit (Fast Refresh) registers its new version of the same app under the
|
|
45
|
+
// same name; Metro puts one it exports in the family of the old one once the file ran.
|
|
46
|
+
if (key === appKey) noteReplacingApp(navigation);
|
|
47
|
+
const before = { key: appKey, app: registered };
|
|
48
|
+
Promise.resolve().then(() => {
|
|
49
|
+
const family = familyOf(before.app);
|
|
50
|
+
if (key === before.key || (family && family === familyOf(navigation))) return;
|
|
51
|
+
console.warn(`[navigation] '${key}' replaces the app registered as '${before.key}'`);
|
|
52
|
+
});
|
|
39
53
|
}
|
|
40
54
|
appKey = key;
|
|
41
55
|
registered = navigation;
|