@apexnative/navigation 1.0.0-alpha.3 → 1.0.0-alpha.5
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/CHANGELOG.md +22 -0
- package/android/CLAUDE.md +26 -9
- package/android/CORE.md +32 -17
- package/android/RECIPES.md +9 -3
- package/android/src/main/java/dev/apexnative/navigation/NavigationActivity.kt +25 -9
- package/android/src/main/java/dev/apexnative/navigation/NavigationApplication.kt +34 -13
- package/android/src/main/java/dev/apexnative/navigation/layout/LayoutChecks.kt +5 -1
- package/android/src/main/java/dev/apexnative/navigation/layout/LayoutNode.kt +6 -2
- package/android/src/main/java/dev/apexnative/navigation/nativescreen/NativeScreenContext.kt +2 -2
- package/android/src/main/java/dev/apexnative/navigation/options/AnimationsOptions.kt +2 -2
- package/android/src/main/java/dev/apexnative/navigation/options/ButtonMenuOptions.kt +2 -2
- package/android/src/main/java/dev/apexnative/navigation/options/ButtonOptions.kt +2 -2
- package/android/src/main/java/dev/apexnative/navigation/options/HardwareBackButtonOptions.kt +9 -1
- package/android/src/main/java/dev/apexnative/navigation/options/OptionsCache.kt +8 -4
- package/android/src/main/java/dev/apexnative/navigation/options/StackAnimationOptions.kt +40 -2
- package/android/src/main/java/dev/apexnative/navigation/options/UserChoices.kt +159 -0
- package/android/src/main/java/dev/apexnative/navigation/react/ArrangementStates.kt +6 -6
- package/android/src/main/java/dev/apexnative/navigation/react/CommandAnswer.kt +29 -36
- package/android/src/main/java/dev/apexnative/navigation/react/CommandContract.kt +59 -0
- package/android/src/main/java/dev/apexnative/navigation/react/Hinge.kt +33 -22
- package/android/src/main/java/dev/apexnative/navigation/react/NavigationTurboModule.kt +5 -4
- package/android/src/main/java/dev/apexnative/navigation/react/PendingCalls.kt +48 -0
- package/android/src/main/java/dev/apexnative/navigation/react/ReactView.kt +39 -20
- package/android/src/main/java/dev/apexnative/navigation/react/ReloadCoordinator.kt +7 -4
- package/android/src/main/java/dev/apexnative/navigation/react/ScreenInsets.kt +6 -6
- package/android/src/main/java/dev/apexnative/navigation/react/ScreenRegions.kt +10 -5
- package/android/src/main/java/dev/apexnative/navigation/react/events/AppearanceDispatcher.kt +47 -46
- package/android/src/main/java/dev/apexnative/navigation/react/events/EventEmitter.kt +34 -7
- package/android/src/main/java/dev/apexnative/navigation/react/events/NavigationState.kt +154 -0
- package/android/src/main/java/dev/apexnative/navigation/safearea/SafeAreaView.kt +6 -4
- package/android/src/main/java/dev/apexnative/navigation/slots/SlotContainers.kt +10 -7
- package/android/src/main/java/dev/apexnative/navigation/slots/SlotScreenView.kt +12 -12
- package/android/src/main/java/dev/apexnative/navigation/slots/SlotView.kt +4 -3
- package/android/src/main/java/dev/apexnative/navigation/slots/SlotViews.kt +40 -0
- package/android/src/main/java/dev/apexnative/navigation/utils/ImageKey.kt +66 -0
- package/android/src/main/java/dev/apexnative/navigation/utils/ImageLoader.kt +7 -89
- package/android/src/main/java/dev/apexnative/navigation/utils/ImageRequests.kt +76 -0
- package/android/src/main/java/dev/apexnative/navigation/utils/OptionImages.kt +262 -0
- package/android/src/main/java/dev/apexnative/navigation/utils/ViewController.kt +3 -1
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/arrangement/ArrangementController.kt +3 -2
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/bottomtabs/AppliedTabCalls.kt +49 -0
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/bottomtabs/BottomTabsController.kt +25 -17
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/bottomtabs/BottomTabsPresenter.kt +25 -24
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/component/ComponentViewController.kt +6 -2
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/component/ContentReadiness.kt +2 -2
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/component/RenderWait.kt +27 -7
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/component/ScreenReadiness.kt +103 -56
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/modal/ModalCoordinator.kt +5 -5
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/navigator/BackCallbackCheck.kt +50 -0
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/navigator/BackCallbackState.kt +45 -14
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/navigator/Navigator.kt +25 -8
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/navigator/RootCoordinator.kt +8 -5
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/overlay/OverlayCoordinator.kt +8 -8
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/parent/Capabilities.kt +11 -4
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/sidemenu/SideMenuController.kt +1 -1
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/splitview/SplitPanes.kt +23 -0
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/splitview/SplitViewController.kt +61 -15
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/StackCommands.kt +28 -18
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/StackController.kt +25 -12
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/StackDisplay.kt +2 -1
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/StackQueue.kt +85 -29
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/StackViews.kt +2 -2
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/fab/FabPresenter.kt +7 -5
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/search/ScreenSearch.kt +3 -5
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/search/StackSearchPresenter.kt +5 -8
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/topbar/BarComponents.kt +5 -51
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/topbar/MenuChecks.kt +13 -56
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/topbar/TopBarPresenter.kt +14 -11
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/viewcontroller/ViewController.kt +56 -21
- package/android/src/main/java/dev/apexnative/navigation/views/bottomtabs/BottomTabs.kt +4 -2
- package/android/src/main/java/dev/apexnative/navigation/views/bottomtabs/CustomBottomTabItemView.kt +0 -5
- package/android/src/main/java/dev/apexnative/navigation/views/stack/fab/Fab.kt +14 -10
- package/cli/doctor/checks/app.js +61 -13
- package/cli/doctor/checks/splash.js +4 -22
- package/cli/migrate/native.js +18 -0
- package/cli/setup/source.js +2 -1
- package/cli/setup/steps/mainApplication.js +134 -19
- package/cli/splash/index.js +3 -1
- package/docs-md/architecture/transitions.md +6 -7
- package/docs-md/containers/modals.md +2 -2
- package/docs-md/guides/cli.md +1 -2
- package/docs-md/help/glossary.md +1 -1
- package/docs-md/help/troubleshooting.md +22 -5
- package/docs-md/index.json +4 -0
- package/docs-md/migration/from-react-native-navigation.md +8 -2
- package/docs-md/screen-ui/back-and-gestures.md +24 -2
- package/docs-md/start/installation.md +4 -2
- package/ios/CLAUDE.md +17 -5
- package/ios/CORE.md +18 -13
- package/ios/Contract/ANNCommandAnswer.h +9 -2
- package/ios/Contract/ANNCommandAnswer.mm +28 -30
- package/ios/Contract/ANNCommandContract.h +15 -0
- package/ios/Contract/ANNCommandContract.mm +78 -0
- package/ios/Core/ANNAppearanceDispatcher.h +5 -4
- package/ios/Core/ANNAppearanceDispatcher.mm +12 -1
- package/ios/Core/ANNErrorHandler.h +1 -1
- package/ios/Core/ANNErrorHandler.mm +3 -1
- package/ios/Core/ANNEventEmitter.h +1 -1
- package/ios/Core/ANNEventEmitter.mm +2 -2
- package/ios/Core/ANNJavaScriptCalls.h +34 -0
- package/ios/Core/ANNJavaScriptCalls.mm +61 -0
- package/ios/Core/ANNNavigationState.h +7 -5
- package/ios/Core/ANNNavigationState.mm +8 -7
- package/ios/Core/ANNNodeHelper.h +32 -12
- package/ios/Core/ANNNodeHelper.mm +100 -3
- package/ios/Core/ANNRenderWait.h +15 -1
- package/ios/Core/ANNRenderWait.mm +119 -17
- package/ios/Core/UIViewController+LayoutProtocol.h +9 -2
- package/ios/Core/UIViewController+LayoutProtocol.mm +8 -0
- package/ios/Layouts/Modal/ANNModalCoordinator.h +1 -1
- package/ios/Layouts/Modal/ANNModalCoordinator.mm +55 -14
- package/ios/Layouts/Root/ANNSplashViewController.h +5 -3
- package/ios/Layouts/Root/ANNSplashViewController.mm +147 -0
- package/ios/Layouts/Screen/ANNComponentViewController.h +8 -0
- package/ios/Layouts/Screen/ANNComponentViewController.mm +32 -5
- package/ios/Layouts/Screen/ANNScreenPlace.h +41 -0
- package/ios/Layouts/Screen/ANNScreenPlace.mm +175 -0
- package/ios/Layouts/SplitView/ANNSplitViewCommands.h +3 -2
- package/ios/Layouts/SplitView/ANNSplitViewCommands.mm +105 -39
- package/ios/Layouts/SplitView/ANNSplitViewController.mm +4 -2
- package/ios/Layouts/Stack/ANNPreviewPush.h +5 -5
- package/ios/Layouts/Stack/ANNPreviewPush.mm +85 -22
- package/ios/Layouts/Stack/ANNStackCommands.mm +1 -0
- package/ios/Layouts/Stack/ANNStackController.mm +26 -3
- package/ios/Layouts/Stack/ANNStackQueue.h +3 -1
- package/ios/Layouts/Stack/ANNStackQueue.mm +56 -43
- package/ios/Layouts/Stack/UINavigationController+ANNCommands.h +4 -2
- package/ios/Layouts/Stack/UINavigationController+ANNCommands.mm +2 -3
- package/ios/Layouts/Tabs/ANNBottomTabItemBuilder.h +4 -0
- package/ios/Layouts/Tabs/ANNBottomTabItemBuilder.mm +11 -0
- package/ios/Layouts/Tabs/ANNBottomTabsController.mm +13 -5
- package/ios/Layouts/Tabs/ANNBottomTabsPresenter.h +2 -2
- package/ios/Layouts/Tabs/ANNBottomTabsPresenter.mm +109 -7
- package/ios/Options/ANNOptionsCache.h +7 -6
- package/ios/Options/ANNSearchBarOptions.h +4 -3
- package/ios/Options/ANNUserChoice.h +57 -0
- package/ios/Options/ANNUserChoice.mm +44 -0
- package/ios/Options/Params/ANNImageSource.h +61 -0
- package/ios/Options/Params/ANNImageSource.mm +101 -0
- package/ios/Options/Params/ANNOptionImages.h +37 -0
- package/ios/Options/Params/ANNOptionImages.mm +284 -0
- package/ios/Options/Params/Image.h +11 -2
- package/ios/Options/Params/Image.mm +15 -2
- package/ios/Options/Params/ImageParser.h +5 -5
- package/ios/Options/Params/ImageParser.mm +28 -46
- package/ios/Public/ApexNavigation/ApexNavigation.h +1 -1
- package/ios/RECIPES.md +11 -5
- package/ios/React/Slots/ANNSlotComponentView.mm +24 -17
- package/ios/React/Slots/ANNSlotContainers.h +14 -6
- package/ios/React/Slots/ANNSlotContainers.mm +75 -2
- package/ios/TopBar/ANNBarButtons.h +9 -5
- package/ios/TopBar/ANNBarButtons.mm +211 -63
- package/ios/TopBar/ANNIconButtonImage.h +1 -0
- package/ios/TopBar/ANNIconButtonImage.mm +34 -1
- package/ios/TopBar/ANNLargeTitlePresenter.h +13 -0
- package/ios/TopBar/ANNLargeTitlePresenter.mm +26 -3
- package/ios/TopBar/ANNSearchPresenter.mm +170 -19
- package/ios/TopBar/ANNTopBarPresenter.h +5 -0
- package/ios/TopBar/ANNTopBarPresenter.mm +60 -11
- package/ios/TurboModules/ANNTurboModule.mm +39 -21
- package/lib/module/ARCHITECTURE.md +18 -18
- package/lib/module/adapters/NativeANNTurboModule.js.map +1 -1
- package/lib/module/api/commands/commands.js +54 -6
- package/lib/module/api/commands/commands.js.map +1 -1
- package/lib/module/api/navigation.js.map +1 -1
- package/lib/module/engine/commands.js +9 -7
- package/lib/module/engine/commands.js.map +1 -1
- package/lib/module/engine/layout.js +13 -9
- package/lib/module/engine/layout.js.map +1 -1
- package/lib/module/engine/options.js +44 -11
- package/lib/module/engine/options.js.map +1 -1
- package/lib/module/engine/places.js +52 -7
- package/lib/module/engine/places.js.map +1 -1
- package/lib/module/engine/props.js +30 -1
- package/lib/module/engine/props.js.map +1 -1
- package/lib/module/engine/rememberedOptions.js +1 -1
- package/lib/module/engine/rememberedOptions.js.map +1 -1
- package/lib/module/engine/screens.js +22 -12
- package/lib/module/engine/screens.js.map +1 -1
- package/lib/module/interfaces/contract/commands.json +101 -0
- package/lib/typescript/adapters/NativeANNTurboModule.d.ts +5 -2
- package/lib/typescript/adapters/NativeANNTurboModule.d.ts.map +1 -1
- package/lib/typescript/api/commands/commands.d.ts.map +1 -1
- package/lib/typescript/api/commands/presentation.d.ts +4 -3
- package/lib/typescript/api/commands/presentation.d.ts.map +1 -1
- package/lib/typescript/api/events/navigationEvents.d.ts +1 -1
- package/lib/typescript/api/events/navigationEvents.d.ts.map +1 -1
- package/lib/typescript/api/hooks/useNavigation.d.ts +1 -1
- package/lib/typescript/api/hooks/useNavigation.d.ts.map +1 -1
- package/lib/typescript/api/navigation.d.ts +4 -1
- package/lib/typescript/api/navigation.d.ts.map +1 -1
- package/lib/typescript/engine/commands.d.ts.map +1 -1
- package/lib/typescript/engine/options.d.ts +5 -2
- package/lib/typescript/engine/options.d.ts.map +1 -1
- package/lib/typescript/engine/places.d.ts +7 -2
- package/lib/typescript/engine/places.d.ts.map +1 -1
- package/lib/typescript/engine/props.d.ts +8 -1
- package/lib/typescript/engine/props.d.ts.map +1 -1
- package/lib/typescript/engine/rememberedOptions.d.ts.map +1 -1
- package/lib/typescript/engine/screens.d.ts.map +1 -1
- package/lib/typescript/interfaces/ComponentEvents.d.ts +2 -2
- package/lib/typescript/interfaces/ComponentEvents.d.ts.map +1 -1
- package/lib/typescript/interfaces/Events.d.ts +19 -10
- package/lib/typescript/interfaces/Events.d.ts.map +1 -1
- package/lib/typescript/interfaces/Options.d.ts +1 -1
- package/lib/typescript/interfaces/Options.d.ts.map +1 -1
- package/lib/typescript/interfaces/options/animations.d.ts +23 -4
- package/lib/typescript/interfaces/options/animations.d.ts.map +1 -1
- package/lib/typescript/interfaces/options/buttons.d.ts +13 -5
- package/lib/typescript/interfaces/options/buttons.d.ts.map +1 -1
- package/lib/typescript/interfaces/options/stack.d.ts +9 -0
- package/lib/typescript/interfaces/options/stack.d.ts.map +1 -1
- package/lib/typescript/interfaces/options/topBar.d.ts +22 -9
- package/lib/typescript/interfaces/options/topBar.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/ARCHITECTURE.md +18 -18
- package/src/adapters/NativeANNTurboModule.ts +5 -2
- package/src/api/commands/commands.ts +48 -7
- package/src/api/commands/presentation.ts +4 -3
- package/src/api/events/navigationEvents.ts +1 -1
- package/src/api/hooks/useNavigation.ts +1 -1
- package/src/api/navigation.ts +4 -1
- package/src/engine/commands.ts +19 -7
- package/src/engine/layout.ts +16 -9
- package/src/engine/options.ts +39 -11
- package/src/engine/places.ts +65 -7
- package/src/engine/props.ts +30 -1
- package/src/engine/rememberedOptions.ts +4 -1
- package/src/engine/screens.tsx +23 -13
- package/src/interfaces/ComponentEvents.ts +2 -2
- package/src/interfaces/Events.ts +19 -10
- package/src/interfaces/Options.ts +1 -0
- package/src/interfaces/contract/commands.json +101 -0
- package/src/interfaces/options/animations.ts +24 -4
- package/src/interfaces/options/buttons.ts +13 -5
- package/src/interfaces/options/stack.ts +9 -0
- package/src/interfaces/options/topBar.ts +22 -9
- package/android/src/main/java/dev/apexnative/navigation/react/events/NavigationStateReporter.kt +0 -62
- package/android/src/main/java/dev/apexnative/navigation/react/events/StateHold.kt +0 -62
|
@@ -25,6 +25,15 @@ export interface HardwareBackButtonOptions {
|
|
|
25
25
|
* @internal
|
|
26
26
|
*/
|
|
27
27
|
dismissModalOnPress?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* (Android) Whether back on the first screen of the app, with nothing left to go back to, plays the system's
|
|
30
|
+
* animation of going home. The system decides it as the gesture starts, so with `false` the navigation keeps the
|
|
31
|
+
* back on that screen too: the gesture shows no animation, and on release the press goes to `BackHandler` listeners,
|
|
32
|
+
* then to the activity's own back (`invokeDefaultOnBackPressed` of the app's activity, such as `moveTaskToBack`).
|
|
33
|
+
* Read from the screen back acts on; set it in the default options for the whole app. iOS ignores it.
|
|
34
|
+
* @default true
|
|
35
|
+
*/
|
|
36
|
+
systemAnimation?: boolean;
|
|
28
37
|
}
|
|
29
38
|
/**
|
|
30
39
|
* (Android) A floating action button over the screen, or an entry of its menu. The button shows while its screen is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stack.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/options/stack.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,aAAU,CAAC;AAErD;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACxC;;;;;;;OAOG;IACH,iBAAiB,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,UAAU,CAAC;IAClD;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"stack.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/options/stack.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,aAAU,CAAC;AAErD;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACxC;;;;;;;OAOG;IACH,iBAAiB,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,UAAU,CAAC;IAClD;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB;;;;OAIG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,KAAK,CAAC;IACxB;;;OAGG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC;IACnB,kHAAkH;IAClH,WAAW,CAAC,EAAE,KAAK,CAAC;IACpB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB;;;OAGG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC;IAClB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACrC;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;IACvB;;;;OAIG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC;CACpB"}
|
|
@@ -6,7 +6,11 @@ import type { Color, FontFamily, FontStyle, FontWeight, ImageResource } from './
|
|
|
6
6
|
* `name` replaces it.
|
|
7
7
|
*/
|
|
8
8
|
export interface OptionsTopBarTitleComponent {
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* The id of the component. Without it, the library gives one made of the screen, the component's place in the
|
|
11
|
+
* options and its `name`: it stays the same for every `mergeOptions` of the screen, so the mounted component stays
|
|
12
|
+
* and only its props change. The same `name` and `id` mean the same component.
|
|
13
|
+
*/
|
|
10
14
|
id?: string;
|
|
11
15
|
/** The name of the registered component. */
|
|
12
16
|
name: string;
|
|
@@ -265,7 +269,11 @@ export interface OptionsTopBarBackground {
|
|
|
265
269
|
}
|
|
266
270
|
/** The React component that is the background of the bar. */
|
|
267
271
|
export interface OptionsTopBarBackgroundComponent {
|
|
268
|
-
/**
|
|
272
|
+
/**
|
|
273
|
+
* The id of the component. Without it, the library gives one made of the screen, the component's place in the
|
|
274
|
+
* options and its `name`: it stays the same for every `mergeOptions` of the screen, so the mounted component stays
|
|
275
|
+
* and only its props change. The same `name` and `id` mean the same component.
|
|
276
|
+
*/
|
|
269
277
|
id?: string;
|
|
270
278
|
/** The name of the registered component. */
|
|
271
279
|
name: string;
|
|
@@ -413,7 +421,11 @@ export interface OptionsSearchBarSuggestion {
|
|
|
413
421
|
* component; a different `id` or `name` replaces the component, and so the search.
|
|
414
422
|
*/
|
|
415
423
|
export interface OptionsSearchBarResultsComponent {
|
|
416
|
-
/**
|
|
424
|
+
/**
|
|
425
|
+
* The id of the component. Without it, the library gives one made of the screen, the component's place in the
|
|
426
|
+
* options and its `name`: it stays the same for every `mergeOptions` of the screen, so the mounted component stays
|
|
427
|
+
* and only its props change. The same `name` and `id` mean the same component.
|
|
428
|
+
*/
|
|
417
429
|
id?: string;
|
|
418
430
|
/** The name of the registered component. */
|
|
419
431
|
name: string;
|
|
@@ -498,8 +510,9 @@ export interface OptionsSearchBar {
|
|
|
498
510
|
*/
|
|
499
511
|
scopes?: OptionsSearchBarScope[];
|
|
500
512
|
/**
|
|
501
|
-
* The id of the selected scope; without it, or with an unknown id, the first. The user's pick
|
|
502
|
-
*
|
|
513
|
+
* The id of the selected scope; without it, or with an unknown id, the first. The user's pick stays with the screen,
|
|
514
|
+
* after coming back, through a `mergeOptions` that sends the same value again and `setDefaultOptions`. A
|
|
515
|
+
* `mergeOptions` into the screen with another value switches the scope without an event.
|
|
503
516
|
*/
|
|
504
517
|
selectedScope?: string;
|
|
505
518
|
/**
|
|
@@ -511,15 +524,15 @@ export interface OptionsSearchBar {
|
|
|
511
524
|
scopeBarActivation?: 'automatic' | 'onTextEntry' | 'onSearchActivation';
|
|
512
525
|
/**
|
|
513
526
|
* (iOS) Tokens in front of the text of the field. The search events carry the ids of the tokens in the field as
|
|
514
|
-
* `tokens`; deleting a token sends a search-updated event, and the deleted
|
|
515
|
-
*
|
|
527
|
+
* `tokens`; deleting a token sends a search-updated event, and what the user deleted (or brought back with Undo)
|
|
528
|
+
* stays with the screen until a `mergeOptions` gives other tokens. Closing the search clears the field and its tokens. An empty list removes
|
|
516
529
|
* them all.
|
|
517
530
|
*/
|
|
518
531
|
tokens?: OptionsSearchBarToken[];
|
|
519
532
|
/**
|
|
520
533
|
* (iOS 16+, Android) The suggestions shown while searching. Picking one sends a suggestion-picked event with its id
|
|
521
|
-
* to the screen; the text stays and the list goes. They also go when the user types on
|
|
522
|
-
*
|
|
534
|
+
* to the screen; the text stays and the list goes. They also go when the user types on; the list a `mergeOptions`
|
|
535
|
+
* gives shows again, the same one too, usually on a search-updated event. An empty list removes them.
|
|
523
536
|
*/
|
|
524
537
|
suggestions?: OptionsSearchBarSuggestion[];
|
|
525
538
|
/**
|
|
@@ -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
|
|
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,CAA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IACjB;;;OAGG;IACH,KAAK,CAAC,EAAE,qBAAqB,CAAC;IAC9B,qDAAqD;IACrD,GAAG,CAAC,EAAE,iBAAiB,CAAC;IACxB,wDAAwD;IACxD,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,sDAAsD;IACtD,IAAI,CAAC,EAAE,iBAAiB,CAAC;IACzB,uDAAuD;IACvD,KAAK,CAAC,EAAE,iBAAiB,CAAC;CAC3B"}
|
package/package.json
CHANGED
package/src/ARCHITECTURE.md
CHANGED
|
@@ -85,24 +85,24 @@ form of `src/api/events/navigationEvents.ts`. Everything in `src/engine` is inte
|
|
|
85
85
|
|
|
86
86
|
## `src/engine` — the engine
|
|
87
87
|
|
|
88
|
-
| Module | What it does
|
|
89
|
-
| --------------------------- |
|
|
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
|
-
| `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)`: colors (iOS: a number, `DynamicColorIOS` or `'NoColor'`; Android: `{ light, dark }`), images (`require` resolved), components in options (`componentId`, their props kept here), 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`, `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
|
-
| `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:
|
|
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
|
-
| `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.
|
|
97
|
-
| `events.ts` | `toScreenEvent(event)`: an event of a screen as `listeners`, `navigation.on`, the screen hooks and `onPress` get it: the screen as `screen: { id, name }`, without the fields of the native side.
|
|
98
|
-
| `places.ts` | Where each screen is, noted as the commands build their layouts: the root, a modal or an overlay, its stack and its index there, its side menu, its pair (`arrangement`: the pair's id and its placement; `alone` for a primary shown without one, `noteAlone`). The column of a split view each stack shows (`columnOf`, `stackOfColumn`), and whether a split view's columns show as one stack (`ANN.SplitViewColumnsStacked`, `listenToSplitViews`): `showInColumn` notes its screen first in the column's stack, or over the screen that asks in the compact column, and the first screen of a column over the one before it can pop (`coversColumn`). `canPop`, `canDismiss`, `dismiss` and `placeFor` read it at once; `isGone` knows the last screens that went.
|
|
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
|
-
| `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
|
-
| `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
|
-
| `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
|
-
| `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
|
-
| `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.
|
|
105
|
-
| `ids.ts`, `mergeOptions.ts` | `nextId` and the merge of options; see Ids and Options in layers.
|
|
88
|
+
| Module | What it does |
|
|
89
|
+
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
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
|
+
| `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, `DynamicColorIOS` or `'NoColor'`; Android: `{ 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`, `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
|
+
| `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
|
+
| `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
|
+
| `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. |
|
|
97
|
+
| `events.ts` | `toScreenEvent(event)`: an event of a screen as `listeners`, `navigation.on`, the screen hooks and `onPress` get it: the screen as `screen: { id, name }`, without the fields of the native side. |
|
|
98
|
+
| `places.ts` | Where each screen is, noted as the commands build their layouts: the root, a modal or an overlay, its stack and its index there, its side menu, its pair (`arrangement`: the pair's id and its placement; `alone` for a primary shown without one, `noteAlone`). The column of a split view each stack shows (`columnOf`, `stackOfColumn`), and whether a split view's columns show as one stack (`ANN.SplitViewColumnsStacked`, `listenToSplitViews`): `showInColumn` notes its screen first in the column's stack, or over the screen that asks in the compact column, and the first screen of a column over the one before it can pop (`coversColumn`). `canPop`, `canDismiss`, `dismiss` and `placeFor` read it at once; `isGone` knows the last screens that went. It also notes the layouts each screen shows in (`layoutsOf`): a layout whose last screen went is gone, and so are the props of the components named in its options. |
|
|
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
|
+
| `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
|
+
| `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
|
+
| `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
|
+
| `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
|
+
| `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. |
|
|
105
|
+
| `ids.ts`, `mergeOptions.ts` | `nextId` and the merge of options; see Ids and Options in layers. |
|
|
106
106
|
|
|
107
107
|
## The start of the app
|
|
108
108
|
|
|
@@ -14,7 +14,7 @@ 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
|
-
/** Pushes a layout over the screen in its stack; resolves with the id of the screen that shows. */
|
|
17
|
+
/** Pushes a layout over the screen in its stack; resolves with the id of the screen that shows (of a pair: its id). */
|
|
18
18
|
push(commandId: string, componentId: string, layout: CodegenTypes.UnsafeObject): Promise<string>;
|
|
19
19
|
/**
|
|
20
20
|
* (Android, one React tree) Lays the screen of a coming push out in its stack before React renders it, and resolves
|
|
@@ -67,7 +67,10 @@ export interface Spec extends TurboModule {
|
|
|
67
67
|
column: string,
|
|
68
68
|
layout: CodegenTypes.UnsafeObject
|
|
69
69
|
): Promise<string>;
|
|
70
|
-
/**
|
|
70
|
+
/**
|
|
71
|
+
* Shows or hides a column of the screen's split view; resolves once the columns stopped moving, with nothing (on
|
|
72
|
+
* Android `null`).
|
|
73
|
+
*/
|
|
71
74
|
setColumnShown(
|
|
72
75
|
commandId: string,
|
|
73
76
|
componentId: string,
|
|
@@ -19,7 +19,7 @@ import { stackChild, type StackEntry } from '../layout/Stack';
|
|
|
19
19
|
import { badgeText } from '../layout/Tabs';
|
|
20
20
|
import { mergeOptions } from '../../engine/mergeOptions';
|
|
21
21
|
import { buildScreenOptions, type ScreenOptionsInput } from '../screens/defineScreen';
|
|
22
|
-
import { coversColumn, placeOf } from '../../engine/places';
|
|
22
|
+
import { coversColumn, firstScreenOf, placeOf, type ScreenPlace } from '../../engine/places';
|
|
23
23
|
import { command, placeFor } from './errors';
|
|
24
24
|
import type { ColumnConfig, ModalConfig, OverlayConfig, PushConfig } from './presentation';
|
|
25
25
|
import { defined, modalAnimations, pushAnimations } from './transitions';
|
|
@@ -30,6 +30,10 @@ const CLOSE_BUTTON = 'CloseButton';
|
|
|
30
30
|
// The modals shown by `showModal`, for the ids of their first screens.
|
|
31
31
|
let modals = 0;
|
|
32
32
|
|
|
33
|
+
// The stacks of the modals shown with a close button, by id: `setStack` and `replace` there give it to the new first
|
|
34
|
+
// screen. A stack's id is its modal's layer.
|
|
35
|
+
const closeButtonStacks = new Set<string>();
|
|
36
|
+
|
|
33
37
|
// The settings of a command with the props of the screen it shows.
|
|
34
38
|
type WithProps<Config> = Config & { props?: object };
|
|
35
39
|
|
|
@@ -115,7 +119,19 @@ export function popToRoot(fromId: string): Promise<string> {
|
|
|
115
119
|
export function setStack(fromId: string, entries: StackEntry[]): Promise<string> {
|
|
116
120
|
return command('setStack', () => {
|
|
117
121
|
placeFor('setStack', fromId, { stack: true });
|
|
118
|
-
|
|
122
|
+
const children = entries.map(stackChild);
|
|
123
|
+
const first = children[0]?.component;
|
|
124
|
+
if (!first || !hasCloseButton(placeOf(fromId))) {
|
|
125
|
+
return withSlots(() => engine.setStackRoot(fromId, children));
|
|
126
|
+
}
|
|
127
|
+
return afterLoading([first.name], () => {
|
|
128
|
+
// The screen's own buttons stay after the close button: the options of the layout replace them.
|
|
129
|
+
const id = first.id ?? nextId('Component');
|
|
130
|
+
const own = screenOptions(first.name, first.passProps ?? {});
|
|
131
|
+
const options = withCloseButton(mergeOptions(own, first.options ?? {}), id);
|
|
132
|
+
const withButton = { component: { ...first, id, options } };
|
|
133
|
+
return withSlots(() => engine.setStackRoot(fromId, [withButton, ...children.slice(1)]));
|
|
134
|
+
});
|
|
119
135
|
});
|
|
120
136
|
}
|
|
121
137
|
|
|
@@ -133,11 +149,12 @@ export function replace(
|
|
|
133
149
|
return afterLoading([name], () => {
|
|
134
150
|
const { props } = config;
|
|
135
151
|
const base = getActiveApp()?.presentation?.push;
|
|
136
|
-
const
|
|
152
|
+
const id = nextId('Component');
|
|
153
|
+
let options = showOptions(name, props, AS_PUSH, base?.options, config.options, {
|
|
137
154
|
app: pushAnimations(base?.transition),
|
|
138
155
|
call: pushAnimations(config.transition),
|
|
139
156
|
});
|
|
140
|
-
|
|
157
|
+
if (hasCloseButton(placeOf(fromId))) options = withCloseButton(options, id);
|
|
141
158
|
return withSlots(() =>
|
|
142
159
|
engine.setStackRoot(fromId, [screenLayout(name, props, options, id)])
|
|
143
160
|
).then(() => id);
|
|
@@ -192,16 +209,25 @@ function showModalNow(name: string, config: WithProps<ModalConfig>): Promise<str
|
|
|
192
209
|
app: modalAnimations(base.transition),
|
|
193
210
|
call: modalAnimations(call.transition),
|
|
194
211
|
});
|
|
195
|
-
|
|
212
|
+
// The stack gets its id here, so that the commands in it later know the modal had a close button.
|
|
213
|
+
const stackId = nextId('Stack');
|
|
214
|
+
const closeButton = settings.closeButton && settings.stack !== false;
|
|
215
|
+
if (closeButton) {
|
|
196
216
|
options = withCloseButton(options, screenId);
|
|
217
|
+
closeButtonStacks.add(stackId);
|
|
218
|
+
forgetWithStack(stackId, screenId);
|
|
219
|
+
}
|
|
197
220
|
if (call.onDismiss) whenScreenUnmounts(screenId, call.onDismiss);
|
|
198
221
|
const screen = screenLayout(name, props, options, screenId);
|
|
199
222
|
const presentation = presentationOptions(settings);
|
|
200
223
|
const layout: Layout =
|
|
201
224
|
settings.stack === false
|
|
202
225
|
? mergeLayoutOptions(screen, presentation)
|
|
203
|
-
: { stack: { children: [screen], options: presentation } };
|
|
204
|
-
|
|
226
|
+
: { stack: { id: stackId, children: [screen], options: presentation } };
|
|
227
|
+
const shown = withSlots(() => engine.showModal(layout));
|
|
228
|
+
// A modal that never showed has no stack to remember.
|
|
229
|
+
if (closeButton) shown.catch(() => closeButtonStacks.delete(stackId));
|
|
230
|
+
return shown;
|
|
205
231
|
}
|
|
206
232
|
|
|
207
233
|
export function dismissModal(modalId: string): Promise<string> {
|
|
@@ -340,6 +366,21 @@ export function holdLeave(screenId: string, onAttempt: () => void): () => void {
|
|
|
340
366
|
};
|
|
341
367
|
}
|
|
342
368
|
|
|
369
|
+
// Whether a screen is in the stack of a modal shown with a close button: the modal's own stack, not one in it.
|
|
370
|
+
function hasCloseButton(place: ScreenPlace | undefined): boolean {
|
|
371
|
+
return place?.stack != null && place.stack === place.layer && closeButtonStacks.has(place.stack);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
// The stack of a modal is gone with its last first screen: one that unmounts with no other first screen noted after
|
|
375
|
+
// it (`setStack`, `replace` note theirs before the old one goes).
|
|
376
|
+
function forgetWithStack(stackId: string, screenId: string): void {
|
|
377
|
+
whenScreenUnmounts(screenId, () => {
|
|
378
|
+
const next = firstScreenOf(stackId);
|
|
379
|
+
if (next) forgetWithStack(stackId, next);
|
|
380
|
+
else closeButtonStacks.delete(stackId);
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
|
|
343
384
|
/** The options with a close button first at the leading edge, which dismisses the modal of the screen. */
|
|
344
385
|
function withCloseButton(options: Options, screenId: string): Options {
|
|
345
386
|
const close: NavigationButton = {
|
|
@@ -43,12 +43,13 @@ export interface ModalConfig {
|
|
|
43
43
|
stack?: boolean;
|
|
44
44
|
/**
|
|
45
45
|
* A close button at the leading edge of the modal's first screen, which dismisses the modal: the system one on iOS,
|
|
46
|
-
* an icon on Android. Its id and testID are `CloseButton`. Needs the stack.
|
|
46
|
+
* an icon on Android. Its id and testID are `CloseButton`. Needs the stack. A new first screen of that stack, from
|
|
47
|
+
* `setStack` or `replace`, gets it too.
|
|
47
48
|
*/
|
|
48
49
|
closeButton?: boolean;
|
|
49
50
|
/**
|
|
50
|
-
* Called once the modal is gone, whatever dismissed it: a command, a swipe, a new root. `setStack`
|
|
51
|
-
* modal
|
|
51
|
+
* Called once the modal is gone, whatever dismissed it: a command, a swipe, a new root. `setStack` and `replace`
|
|
52
|
+
* inside the modal replace its first screen, and call it too.
|
|
52
53
|
*/
|
|
53
54
|
onDismiss?: () => void;
|
|
54
55
|
/**
|
|
@@ -48,7 +48,7 @@ export interface NavigationEvents {
|
|
|
48
48
|
searchCancelled: ScreenEventOf<SearchBarCancelPressedEvent>;
|
|
49
49
|
/** #### (iOS 16+, Android) The user picked a suggestion of `searchBar.suggestions`; the text stays. */
|
|
50
50
|
searchSuggestionPicked: ScreenEventOf<NativeSearchSuggestionPickedEvent>;
|
|
51
|
-
/**
|
|
51
|
+
/** The user dragged a sheet to another detent. */
|
|
52
52
|
sheetDetentChanged: ScreenEventOf<NativeSheetDetentChangedEvent>;
|
|
53
53
|
/** #### (iOS specific) */
|
|
54
54
|
splitViewDisplayModeChanged: NativeSplitViewDisplayModeChangedEvent;
|
|
@@ -22,7 +22,7 @@ import type { ScreenName, ShowArgs } from '../types';
|
|
|
22
22
|
interface ScreenCommands {
|
|
23
23
|
/** The screen the commands act from. */
|
|
24
24
|
readonly screen: ScreenInfo;
|
|
25
|
-
/** Shows a screen over this one in its stack; resolves with the id of the screen shown. */
|
|
25
|
+
/** Shows a screen over this one in its stack; resolves with the id of the screen shown (for a pair, the pair's id). */
|
|
26
26
|
push<Name extends ScreenName>(name: Name, ...args: ShowArgs<Name, PushConfig>): Promise<string>;
|
|
27
27
|
/**
|
|
28
28
|
* Goes back to the screen before this one in its stack. The first screen of a split view column shown over the list
|
package/src/api/navigation.ts
CHANGED
|
@@ -55,7 +55,10 @@ export interface AppNavigation {
|
|
|
55
55
|
switchTo<const Layout extends Exclude<RootLayout, string>>(
|
|
56
56
|
layout: Layout & NoInfer<CheckedScreens<UsesOfRoot<Layout>, RegisteredScreens>>
|
|
57
57
|
): Promise<void>;
|
|
58
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* Shows a screen in the stack of the screen the user sees; resolves with the id of the screen shown (for a pair, the
|
|
60
|
+
* pair's id).
|
|
61
|
+
*/
|
|
59
62
|
push<Name extends ScreenName>(name: Name, ...args: ShowArgs<Name, PushConfig>): Promise<string>;
|
|
60
63
|
/** Goes back in the stack of the screen the user sees; see `useNavigation().pop`. */
|
|
61
64
|
pop(): Promise<string>;
|
package/src/engine/commands.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { whenNativeScreensReady } from './nativeScreens';
|
|
|
9
9
|
import { commands as native } from './native';
|
|
10
10
|
import { toNativeOptions } from './options';
|
|
11
11
|
import { dropReactRenderMeasures } from './reactMeasures';
|
|
12
|
-
import { columnOf, forgetPlace, notePlaces, placeOf, stackOfColumn } from './places';
|
|
12
|
+
import { columnOf, forgetPlace, layoutsOf, notePlaces, placeOf, stackOfColumn } from './places';
|
|
13
13
|
import { forgetProps } from './props';
|
|
14
14
|
import {
|
|
15
15
|
forgetMergedOptions,
|
|
@@ -122,7 +122,7 @@ export function setRoot(root: LayoutRoot): Promise<string> {
|
|
|
122
122
|
|
|
123
123
|
export function setDefaultOptions(options: Options): void {
|
|
124
124
|
rememberDefaultOptions(options);
|
|
125
|
-
native.setDefaultOptions(toNativeOptions(options));
|
|
125
|
+
native.setDefaultOptions(toNativeOptions(options, 'defaultOptions'));
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
// The show commands that wait in JS, by number: for lazy screens to load, for the first props of native screens, for a
|
|
@@ -141,7 +141,7 @@ const preparedScreens = new Set<string>();
|
|
|
141
141
|
* engine remembers them by the node's id, so the root set again for a new launch of the native side shows them too.
|
|
142
142
|
*/
|
|
143
143
|
export function mergeOptions(componentId: string, options: Options): void {
|
|
144
|
-
const nativeOptions = toNativeOptions(options);
|
|
144
|
+
const nativeOptions = toNativeOptions(options, componentId);
|
|
145
145
|
const send = () => {
|
|
146
146
|
rememberMergedOptions(componentId, options);
|
|
147
147
|
native.mergeOptions(componentId, nativeOptions);
|
|
@@ -225,7 +225,8 @@ export function push(
|
|
|
225
225
|
from?.stack ?? null,
|
|
226
226
|
(from?.index ?? 0) + 1,
|
|
227
227
|
from?.menu,
|
|
228
|
-
from?.layer
|
|
228
|
+
from?.layer,
|
|
229
|
+
layoutsOf(componentId)
|
|
229
230
|
);
|
|
230
231
|
return whenNativeScreensReady([node], () =>
|
|
231
232
|
sendPush(commandId, componentId, node, prepares, wanted, goneOut).then((shownId) => {
|
|
@@ -363,7 +364,8 @@ export function setStackRoot(componentId: string, children: Layout[]): Promise<s
|
|
|
363
364
|
from?.stack ?? null,
|
|
364
365
|
index,
|
|
365
366
|
from?.menu,
|
|
366
|
-
from?.layer
|
|
367
|
+
from?.layer,
|
|
368
|
+
layoutsOf(componentId)
|
|
367
369
|
)
|
|
368
370
|
);
|
|
369
371
|
return whenNativeScreensReady(nodes, () =>
|
|
@@ -383,7 +385,17 @@ export function showInColumn(componentId: string, column: string, layout: Layout
|
|
|
383
385
|
showScreensFrom(componentId, node);
|
|
384
386
|
const from = placeOf(componentId);
|
|
385
387
|
const at = columnPlace(componentId, column);
|
|
386
|
-
|
|
388
|
+
// In the split view of the screen it comes from, and in the column's stack.
|
|
389
|
+
const within = at.stack ? [...layoutsOf(componentId), at.stack] : layoutsOf(componentId);
|
|
390
|
+
notePlaces(
|
|
391
|
+
node,
|
|
392
|
+
from?.container ?? 'root',
|
|
393
|
+
at.stack,
|
|
394
|
+
at.index,
|
|
395
|
+
from?.menu,
|
|
396
|
+
from?.layer,
|
|
397
|
+
within
|
|
398
|
+
);
|
|
387
399
|
return whenNativeScreensReady([node], () =>
|
|
388
400
|
inOrder(() =>
|
|
389
401
|
sendShow(goneOut, () => native.showInColumn(commandId, componentId, column, node))
|
|
@@ -431,7 +443,7 @@ export function dismissModal(componentId: string, options?: Options): Promise<st
|
|
|
431
443
|
dropReactRenderMeasures();
|
|
432
444
|
const commandId = nextId('dismissModal');
|
|
433
445
|
return inOrder(() =>
|
|
434
|
-
native.dismissModal(commandId, componentId, options && toNativeOptions(options))
|
|
446
|
+
native.dismissModal(commandId, componentId, options && toNativeOptions(options, componentId))
|
|
435
447
|
);
|
|
436
448
|
}
|
|
437
449
|
|
package/src/engine/layout.ts
CHANGED
|
@@ -122,7 +122,7 @@ function screen(component: LayoutComponent, inPair = false, keyed = !inPair): La
|
|
|
122
122
|
type: 'Component',
|
|
123
123
|
data: {
|
|
124
124
|
name: rendersInSlot(name) ? slotName(id, name) : name,
|
|
125
|
-
options: toNativeOptions(options),
|
|
125
|
+
options: toNativeOptions(options, id),
|
|
126
126
|
...(key !== undefined && { key }),
|
|
127
127
|
},
|
|
128
128
|
children: [],
|
|
@@ -167,12 +167,13 @@ function arrangement(
|
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
function external(component: ExternalComponent): LayoutNode {
|
|
170
|
+
const id = component.id || nextId('ExternalComponent');
|
|
170
171
|
return {
|
|
171
|
-
id
|
|
172
|
+
id,
|
|
172
173
|
type: 'ExternalComponent',
|
|
173
174
|
data: {
|
|
174
175
|
name: String(component.name),
|
|
175
|
-
options: toNativeOptions(component.options),
|
|
176
|
+
options: toNativeOptions(component.options, id),
|
|
176
177
|
passProps: component.passProps,
|
|
177
178
|
},
|
|
178
179
|
children: [],
|
|
@@ -185,10 +186,11 @@ function parent(
|
|
|
185
186
|
options: Options | undefined,
|
|
186
187
|
children: Layout[] = []
|
|
187
188
|
): LayoutNode {
|
|
189
|
+
const nodeId = id || nextId(type);
|
|
188
190
|
return {
|
|
189
|
-
id:
|
|
191
|
+
id: nodeId,
|
|
190
192
|
type,
|
|
191
|
-
data: { options: toNativeOptions(options) },
|
|
193
|
+
data: { options: toNativeOptions(options, nodeId) },
|
|
192
194
|
children: children.map(toNativeLayout),
|
|
193
195
|
};
|
|
194
196
|
}
|
|
@@ -213,10 +215,11 @@ function sideMenu(menu: LayoutSideMenu): LayoutNode {
|
|
|
213
215
|
data: {},
|
|
214
216
|
children: [toNativeLayout(content)],
|
|
215
217
|
});
|
|
218
|
+
const id = menu.id || nextId('SideMenuRoot');
|
|
216
219
|
return {
|
|
217
|
-
id
|
|
220
|
+
id,
|
|
218
221
|
type: 'SideMenuRoot',
|
|
219
|
-
data: { options: toNativeOptions(menu.options) },
|
|
222
|
+
data: { options: toNativeOptions(menu.options, id) },
|
|
220
223
|
children: [
|
|
221
224
|
...(menu.left ? [side('SideMenuLeft', menu.left)] : []),
|
|
222
225
|
side('SideMenuCenter', menu.center),
|
|
@@ -238,10 +241,14 @@ function splitView(split: LayoutSplitView): LayoutNode {
|
|
|
238
241
|
] as [string, Layout | undefined][]
|
|
239
242
|
).filter((column): column is [string, Layout] => column[1] !== undefined);
|
|
240
243
|
const present = split.master && split.detail ? columns : [];
|
|
244
|
+
const id = split.id || nextId('SplitView');
|
|
241
245
|
return {
|
|
242
|
-
id
|
|
246
|
+
id,
|
|
243
247
|
type: 'SplitView',
|
|
244
|
-
data: {
|
|
248
|
+
data: {
|
|
249
|
+
options: toNativeOptions(split.options, id),
|
|
250
|
+
columns: present.map(([column]) => column),
|
|
251
|
+
},
|
|
245
252
|
children: present.map(([, content]) => toNativeLayout(content)),
|
|
246
253
|
};
|
|
247
254
|
}
|