@apexnative/navigation 1.0.0-alpha.5 → 1.0.0-alpha.6
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 +25 -0
- package/README.md +1 -1
- package/android/CLAUDE.md +14 -12
- package/android/CORE.md +9 -6
- package/android/src/main/java/dev/apexnative/navigation/NavigationActivity.kt +36 -5
- package/android/src/main/java/dev/apexnative/navigation/options/BottomTabsOptions.kt +13 -8
- package/android/src/main/java/dev/apexnative/navigation/react/NavigationTurboModule.kt +3 -3
- 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/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 +119 -8
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/modal/ModalViews.kt +7 -0
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/modal/SheetBack.kt +42 -0
- 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/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 +4 -0
- package/android/src/main/java/dev/apexnative/navigation/viewcontrollers/stack/StackViews.kt +3 -0
- 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 +9 -2
- package/android/src/main/java/dev/apexnative/navigation/views/element/animators/ElementPictures.kt +11 -0
- package/android/src/main/java/dev/apexnative/navigation/views/element/animators/FlightGeometry.kt +318 -25
- package/android/src/main/java/dev/apexnative/navigation/views/element/animators/ImageMatrixAnimator.kt +18 -20
- package/android/src/main/java/dev/apexnative/navigation/views/element/animators/PlainViewAnimator.kt +17 -25
- package/android/src/main/java/dev/apexnative/navigation/views/element/animators/ReactImageAnimator.kt +15 -22
- package/android/src/main/java/dev/apexnative/navigation/views/element/animators/SharedAnimatorFactory.kt +12 -9
- package/android/src/main/java/dev/apexnative/navigation/views/element/animators/TextChangeAnimator.kt +84 -35
- package/android/src/main/java/dev/apexnative/navigation/views/element/animators/ViewChangeAnimator.kt +49 -40
- package/docs-md/architecture/transitions.md +4 -2
- 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 +1 -1
- package/docs-md/fundamentals/starting-the-app.md +1 -1
- package/docs-md/help/glossary.md +2 -2
- package/docs-md/help/troubleshooting.md +21 -0
- package/docs-md/index.json +12 -0
- 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 +14 -0
- package/docs-md/screen-ui/bar-buttons.md +4 -4
- 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 +2 -2
- package/docs-md/screen-ui/top-bar.md +8 -4
- package/ios/Animations/ANNFrameDriver.mm +2 -0
- package/ios/Animations/Elements/ANNSharedElementFlight.mm +70 -4
- 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 +6 -4
- package/ios/Animations/Interpolators/ANNViewTracks.mm +49 -9
- package/ios/CLAUDE.md +17 -15
- package/ios/CORE.md +24 -20
- 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/ANNJavaScriptCalls.h +11 -12
- package/ios/Core/ANNJavaScriptCalls.mm +7 -16
- package/ios/Core/ANNReloadCoordinator.mm +4 -8
- package/ios/Core/ApexNavigation+Internal.h +1 -1
- 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/Screen/ANNComponentViewController.h +2 -2
- package/ios/Layouts/Screen/ANNComponentViewController.mm +9 -22
- 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/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/ANNBottomTabsOptions.h +2 -0
- package/ios/Options/ANNBottomTabsOptions.mm +1 -0
- package/ios/Options/ANNOptions.h +18 -0
- package/ios/Options/ANNOptions.mm +112 -1
- package/ios/Options/ANNOptionsReader.mm +110 -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/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 +6 -0
- package/ios/React/ANNSurfaceHostingView.mm +116 -0
- 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 +20 -16
- package/lib/module/ARCHITECTURE.md +8 -4
- package/lib/module/api/hooks/useSafeAreaInsets.js +4 -3
- package/lib/module/api/hooks/useSafeAreaInsets.js.map +1 -1
- package/lib/module/api/options/OptionsChain.js +2 -2
- package/lib/module/engine/commands.js +21 -1
- package/lib/module/engine/commands.js.map +1 -1
- package/lib/module/engine/screens.js +29 -4
- package/lib/module/engine/screens.js.map +1 -1
- package/lib/typescript/api/app/createNavigation.d.ts +3 -3
- 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/options/OptionsChain.d.ts +2 -2
- package/lib/typescript/engine/commands.d.ts.map +1 -1
- package/lib/typescript/engine/screens.d.ts +20 -6
- package/lib/typescript/engine/screens.d.ts.map +1 -1
- package/lib/typescript/interfaces/options/animations.d.ts +12 -7
- package/lib/typescript/interfaces/options/animations.d.ts.map +1 -1
- package/lib/typescript/interfaces/options/bottomTabs.d.ts +18 -5
- package/lib/typescript/interfaces/options/bottomTabs.d.ts.map +1 -1
- package/lib/typescript/interfaces/options/buttons.d.ts +8 -8
- 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 +32 -29
- package/lib/typescript/interfaces/options/topBar.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/ARCHITECTURE.md +8 -4
- package/src/api/app/createNavigation.ts +3 -3
- package/src/api/hooks/useSafeAreaInsets.ts +4 -3
- package/src/api/options/OptionsChain.ts +2 -2
- package/src/engine/commands.ts +30 -6
- package/src/engine/screens.tsx +29 -8
- package/src/interfaces/options/animations.ts +12 -7
- package/src/interfaces/options/bottomTabs.ts +18 -5
- package/src/interfaces/options/buttons.ts +8 -8
- package/src/interfaces/options/system.ts +8 -5
- package/src/interfaces/options/toolbar.ts +2 -2
- package/src/interfaces/options/topBar.ts +32 -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/ios/Layouts/Screen/ANNScreenInsets.h +0 -30
- package/ios/Layouts/Screen/ANNScreenInsets.mm +0 -70
package/src/ARCHITECTURE.md
CHANGED
|
@@ -248,10 +248,14 @@ name and on one id for two screens.
|
|
|
248
248
|
|
|
249
249
|
`usePreview(nativeID, { screen, props, actions })` works on iOS only. It arms a `pushPreview` from its screen: a push
|
|
250
250
|
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
|
-
|
|
251
|
+
size). The native side makes the screen's node at once and gives the view with that `nativeID` a context menu that
|
|
252
|
+
previews it; a React screen gets its own root and renders when a press starts (the menu's configuration call, about
|
|
253
|
+
0.5 s before the preview), so a hundred previews hold no rendered screens until one is pressed. A screen of the one
|
|
254
|
+
tree (`appProvider`) and a native screen render at once. A tap on the preview pushes the screen, the push resolves, and
|
|
255
|
+
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
|
|
256
|
+
`onPress`. A preview that goes without being shown rejects its push, which the hook ignores. One that goes before its
|
|
257
|
+
first press never mounted a root, so the engine forgets what the push noted for it (`forgetUnmountedPreview` in
|
|
258
|
+
`src/engine/commands.ts`, after 1 s, unless a root of it mounted by then).
|
|
255
259
|
|
|
256
260
|
## The native side's contract
|
|
257
261
|
|
|
@@ -151,9 +151,9 @@ interface BaseConfig<
|
|
|
151
151
|
/** The look of the navigation: colors of the bars, tabs and backgrounds; `navigation.setTheme` changes it. */
|
|
152
152
|
theme?: NavigationTheme;
|
|
153
153
|
/**
|
|
154
|
-
* The edges on which every screen keeps its content out of its safe area. Without it:
|
|
155
|
-
*
|
|
156
|
-
* in its options.
|
|
154
|
+
* The edges on which every screen keeps its content out of its safe area. Without it: the top and the sides, but
|
|
155
|
+
* those where the content goes under a bar (`layout.safeAreaEdges`); the bottom is free and a list keeps clear of it
|
|
156
|
+
* with `useSafeAreaInsets()`. A screen gives its own with `safeArea(...)` in its options.
|
|
157
157
|
*/
|
|
158
158
|
safeArea?: { edges: SafeAreaEdge[] };
|
|
159
159
|
/** (iOS) The app's window, behind the screens: seen around a modal as it comes in. */
|
|
@@ -5,13 +5,14 @@ import { useScreen } from './screenHooks';
|
|
|
5
5
|
/**
|
|
6
6
|
* How much of this screen's content the bars and the system still cover on each side, past what the screen keeps its
|
|
7
7
|
* content off itself (`layout.safeAreaEdges`): 0 on an edge the screen pads, the whole inset on an edge its content goes
|
|
8
|
-
* under —
|
|
9
|
-
*
|
|
8
|
+
* under — the bottom by default (the home indicator, the navigation bar, a tab bar or toolbar the screen goes under),
|
|
9
|
+
* under a top bar, under the vertical bar at the side of iPhone Duo, every edge with `safeAreaEdges: []`. A list adds
|
|
10
|
+
* exactly this to its own padding. The native side measures every screen on its own, also the screens of
|
|
10
11
|
* `appProvider`.
|
|
11
12
|
*
|
|
12
13
|
* @example
|
|
13
14
|
* const insets = useSafeAreaInsets();
|
|
14
|
-
* <ScrollView contentContainerStyle={{
|
|
15
|
+
* <ScrollView contentContainerStyle={{ paddingBottom: 16 + insets.bottom }} />
|
|
15
16
|
*/
|
|
16
17
|
export function useSafeAreaInsets(): EdgeInsets {
|
|
17
18
|
const { id } = useScreen();
|
|
@@ -68,8 +68,8 @@ export abstract class OptionsChain {
|
|
|
68
68
|
|
|
69
69
|
/**
|
|
70
70
|
* The edges on which the screen keeps its content out of its safe area (bars, status bar, home indicator, cutout);
|
|
71
|
-
* none with no edge. Without it:
|
|
72
|
-
* a
|
|
71
|
+
* none with no edge. Without it: the top and the sides, but those where the content goes under a bar; the bottom is
|
|
72
|
+
* free, and a list keeps clear of it with `useSafeAreaInsets()`. A large title leaves the top out by itself.
|
|
73
73
|
*/
|
|
74
74
|
safeArea(...edges: SafeAreaEdge[]): this {
|
|
75
75
|
return this.layout({ safeAreaEdges: edges });
|
package/src/engine/commands.ts
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
rootGoesOut,
|
|
18
18
|
sentRoot,
|
|
19
19
|
} from './rememberedOptions';
|
|
20
|
-
import { afterLoading } from './screens';
|
|
20
|
+
import { afterLoading, hasRoot, isReactScreen } from './screens';
|
|
21
21
|
import { holdSlot, isSlotName, removeSlots, showSlot, type SlotFrame } from './slots';
|
|
22
22
|
import { forgetTabsScreen, showScreensFrom } from './tabs';
|
|
23
23
|
|
|
@@ -229,16 +229,40 @@ export function push(
|
|
|
229
229
|
layoutsOf(componentId)
|
|
230
230
|
);
|
|
231
231
|
return whenNativeScreensReady([node], () =>
|
|
232
|
-
sendPush(commandId, componentId, node, prepares, wanted, goneOut).then(
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
232
|
+
sendPush(commandId, componentId, node, prepares, wanted, goneOut).then(
|
|
233
|
+
(shownId) => {
|
|
234
|
+
// A screen with a key went back to the one with the same key: the new screen never shows.
|
|
235
|
+
if (shownId !== node.id) forgetNeverShown(node.id);
|
|
236
|
+
return shownId;
|
|
237
|
+
},
|
|
238
|
+
(error: unknown) => {
|
|
239
|
+
if (rendersAtPress(node)) forgetUnmountedPreview(node.id);
|
|
240
|
+
throw error;
|
|
241
|
+
}
|
|
242
|
+
)
|
|
237
243
|
);
|
|
238
244
|
})
|
|
239
245
|
);
|
|
240
246
|
}
|
|
241
247
|
|
|
248
|
+
// A preview's React screen with a root of its own renders only once the view is pressed (iOS): one whose preview went
|
|
249
|
+
// before that never mounts. A screen of the one tree mounts with its slot, a native screen has no root.
|
|
250
|
+
function rendersAtPress(node: LayoutNode): boolean {
|
|
251
|
+
return node.data.options?.preview?.nativeID !== undefined && isReactScreen(node.data.name ?? '');
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// A root started at a press that came just before the preview went can reach JavaScript after its push failed: without
|
|
255
|
+
// its props it would render the screen with none. Its notes go after this time, when no root of it has mounted by
|
|
256
|
+
// then; one that has clears them as it unmounts.
|
|
257
|
+
const PREVIEW_FORGET_DELAY = 1000;
|
|
258
|
+
|
|
259
|
+
function forgetUnmountedPreview(screenId: string): void {
|
|
260
|
+
if (hasRoot(screenId)) return;
|
|
261
|
+
setTimeout(() => {
|
|
262
|
+
if (!hasRoot(screenId)) forgetNeverShown(screenId);
|
|
263
|
+
}, PREVIEW_FORGET_DELAY);
|
|
264
|
+
}
|
|
265
|
+
|
|
242
266
|
// Everything a push noted for a screen that never mounts, which an unmount would clear.
|
|
243
267
|
function forgetNeverShown(screenId: string): void {
|
|
244
268
|
forgetProps(screenId);
|
package/src/engine/screens.tsx
CHANGED
|
@@ -52,8 +52,15 @@ export type EngineScreen =
|
|
|
52
52
|
/** What the root of a React screen renders: the screen's id, and the props the command gave it. */
|
|
53
53
|
export type ScreenRootProps = { componentId: string } & Record<string, unknown>;
|
|
54
54
|
|
|
55
|
+
/**
|
|
56
|
+
* What React Native gives the root of a React screen: the screen's id, its root tag (none in a slot of the app's one
|
|
57
|
+
* tree), and the props the native side gives that root, a tab cell's `tabIndex`, `selected`, `badge`, `dot` and
|
|
58
|
+
* `dotColor`.
|
|
59
|
+
*/
|
|
60
|
+
export type NativeRootProps = { componentId: string; rootTag?: number } & Record<string, unknown>;
|
|
61
|
+
|
|
55
62
|
const screens = new Map<string, EngineScreen>();
|
|
56
|
-
const roots = new Map<string, ComponentType<
|
|
63
|
+
const roots = new Map<string, ComponentType<NativeRootProps>>();
|
|
57
64
|
let unmounted: ((screenId: string) => void) | undefined;
|
|
58
65
|
// The React roots mounted under each id, by their root tags. One id can have several: after a JavaScript reload React
|
|
59
66
|
// Native starts the roots of the old screens again in the new runtime, under the ids the new screens get too, and
|
|
@@ -62,6 +69,11 @@ let unmounted: ((screenId: string) => void) | undefined;
|
|
|
62
69
|
// has no tag: while the one tree shows a screen with the id, no root of that id lets it go.
|
|
63
70
|
const owners = new Map<string, Set<number>>();
|
|
64
71
|
|
|
72
|
+
/** Whether a React root of the screen with the id is mounted now (a slot of the app's one tree doesn't count). */
|
|
73
|
+
export function hasRoot(componentId: string): boolean {
|
|
74
|
+
return owners.has(componentId);
|
|
75
|
+
}
|
|
76
|
+
|
|
65
77
|
/** What runs when the root of a screen unmounts: the screen is gone. */
|
|
66
78
|
export function onScreenUnmounted(listener: (screenId: string) => void): void {
|
|
67
79
|
unmounted = listener;
|
|
@@ -193,20 +205,29 @@ export function isReactScreen(name: string): boolean {
|
|
|
193
205
|
return screen !== undefined && 'component' in screen;
|
|
194
206
|
}
|
|
195
207
|
|
|
208
|
+
/**
|
|
209
|
+
* The props a screen's component renders with: those a command left under its id ([stored]), the props the native side
|
|
210
|
+
* gave its root over them ([root]: a tab cell's state, which the docs promise arrives on top of `passProps`), and its
|
|
211
|
+
* id. The root tag stays with the root.
|
|
212
|
+
*/
|
|
213
|
+
export function screenProps(stored: object, root: NativeRootProps): ScreenRootProps {
|
|
214
|
+
const props: ScreenRootProps = { ...stored, ...root, componentId: root.componentId };
|
|
215
|
+
delete props.rootTag;
|
|
216
|
+
return props;
|
|
217
|
+
}
|
|
218
|
+
|
|
196
219
|
/**
|
|
197
220
|
* The root a React screen runs in: the screen with the props a command left for it under its id, and the new ones when
|
|
198
|
-
* options give its id new props
|
|
199
|
-
*
|
|
221
|
+
* options give its id new props, under the props the native side gives the root ([screenProps]). The slot of the app's
|
|
222
|
+
* one tree renders the same root.
|
|
200
223
|
*/
|
|
201
|
-
export function screenRoot(
|
|
202
|
-
name: string
|
|
203
|
-
): ComponentType<{ componentId: string; rootTag?: number }> | undefined {
|
|
224
|
+
export function screenRoot(name: string): ComponentType<NativeRootProps> | undefined {
|
|
204
225
|
const screen = screens.get(name);
|
|
205
226
|
if (!screen || !('component' in screen)) return undefined;
|
|
206
227
|
let root = roots.get(name);
|
|
207
228
|
if (!root) {
|
|
208
229
|
const Screen = screen.component();
|
|
209
|
-
root = function ScreenRoot(rootProps:
|
|
230
|
+
root = function ScreenRoot(rootProps: NativeRootProps) {
|
|
210
231
|
// In the app's one tree the slot renders the root, without a tag of its own.
|
|
211
232
|
const { componentId, rootTag } = rootProps;
|
|
212
233
|
const watch = useCallback(
|
|
@@ -240,7 +261,7 @@ export function screenRoot(
|
|
|
240
261
|
unmounted?.(componentId);
|
|
241
262
|
};
|
|
242
263
|
}, [componentId, rootTag]);
|
|
243
|
-
return <Screen {...props
|
|
264
|
+
return <Screen {...screenProps(props, rootProps)} />;
|
|
244
265
|
};
|
|
245
266
|
root.displayName = `ScreenRoot(${name})`;
|
|
246
267
|
roots.set(name, root);
|
|
@@ -258,10 +258,12 @@ export type ElementAnimation = AppearingElementAnimation | DisappearingElementAn
|
|
|
258
258
|
* the way (an error in its animation) is skipped too, with a warning in the log: it shows and hides with its screen,
|
|
259
259
|
* and the transition and its command go on. Without an animation of the screens of its own, the screen that comes fades
|
|
260
260
|
* in (or the one that goes fades out) in 300 ms around the elements. When the transition ends or is cancelled, the
|
|
261
|
-
* element gets its own values back.
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
*
|
|
261
|
+
* element gets its own values back. The element's own `transform` counts: a property that doesn't animate keeps the
|
|
262
|
+
* element's value, and a missing end is that value (a turn read from −180° to 180°, as React Native draws it). `x`
|
|
263
|
+
* and `y` are the position in the parent of the element on both platforms. As on a side of a screen, don't set `x`
|
|
264
|
+
* with `translationX` or `y` with `translationY` on one element: the translation plays and the position doesn't.
|
|
265
|
+
* (Android) A view whose parent is a React view with `removeClippedSubviews` turned on, such as a child of a clipping
|
|
266
|
+
* list, is not moved: it counts as not found.
|
|
265
267
|
*/
|
|
266
268
|
export interface ElementTransition {
|
|
267
269
|
/** The `nativeID` of the view to animate. */
|
|
@@ -295,9 +297,12 @@ export interface ElementTransition {
|
|
|
295
297
|
* warning in the log: its views show and hide with their screens, and the transition and its command go on. (iOS) So is
|
|
296
298
|
* a pair with a view without a size, or one whose picture can't be taken. Without an animation of the screens of its
|
|
297
299
|
* own, the screen that comes fades in (or the one that goes fades out) in 300 ms around the pair. Text keeps its
|
|
298
|
-
* proportions and changes its picture within a quarter of the flight.
|
|
299
|
-
*
|
|
300
|
-
* `
|
|
300
|
+
* proportions and changes its picture within a quarter of the flight. A view turned or scaled by its own `transform` or
|
|
301
|
+
* by a parent's flies from where it shows, and its angle goes to the other view's along the shorter arc. The angle is
|
|
302
|
+
* the one React Native draws, from −180° to 180°: `rotate: '270deg'` turns back a quarter, and no pair spins a full
|
|
303
|
+
* turn. (Android) A picture that doesn't load within a second drops out of the transition, and so does a pair with a
|
|
304
|
+
* view whose parent is a React view with `removeClippedSubviews` turned on: it counts as not found. A skew and a tilt
|
|
305
|
+
* (`skewX`, `rotateX`, …) don't fly: the view flies without them and has them again at the end.
|
|
301
306
|
*/
|
|
302
307
|
export interface SharedElementTransition {
|
|
303
308
|
/** The `nativeID` of the view on the screen that goes. */
|
|
@@ -73,8 +73,10 @@ export interface OptionsBottomTabsAccessoryComponent {
|
|
|
73
73
|
/**
|
|
74
74
|
* (iOS 26+) The accessory above the tab bar, like the mini player of a music app. The system sizes it (48 points high)
|
|
75
75
|
* and the component fills that size. It is placed above the bar, or beside the bar when the bar is minimized; on an
|
|
76
|
-
* iPad with the bar at the top it sits at the bottom over the full width, always above the bar.
|
|
77
|
-
*
|
|
76
|
+
* iPad with the bar at the top it sits at the bottom over the full width, always above the bar. A hidden accessory
|
|
77
|
+
* (`visible: false`, or no name) keeps its React root and its state, and shows again with them. When another accessory
|
|
78
|
+
* (another `componentId`) shows, the replaced one stops once it has left the window and its state is gone. The last
|
|
79
|
+
* accessory stops together with the tabs. Android has no accessory.
|
|
78
80
|
*/
|
|
79
81
|
export interface OptionsBottomTabsAccessory {
|
|
80
82
|
/**
|
|
@@ -155,6 +157,16 @@ export interface OptionsBottomTabs {
|
|
|
155
157
|
* @default true
|
|
156
158
|
*/
|
|
157
159
|
animate?: boolean;
|
|
160
|
+
/**
|
|
161
|
+
* How the content changes when another tab is selected on screen, by a press, by back or from code. `'platform'`
|
|
162
|
+
* does what the platform does: on Android the tab that goes fades out and the new one fades in and grows (Material's
|
|
163
|
+
* fade through, 300 ms), on iOS the content changes at once. `'none'` changes it at once on both platforms. The
|
|
164
|
+
* appear events of a switch and `ANN.BottomTabSelected` come at its end, so with `'none'` right away. The tab that is
|
|
165
|
+
* selected decides: the value of the screen it shows, over its own, the tabs' and the default options. A
|
|
166
|
+
* `mergeOptions` applies from the next switch. Off screen the content always changes at once.
|
|
167
|
+
* @default 'platform'
|
|
168
|
+
*/
|
|
169
|
+
switchAnimation?: 'platform' | 'none';
|
|
158
170
|
/**
|
|
159
171
|
* The tab to select, as an index from 0. It selects once, when the options arrive, at creation (the first tab to
|
|
160
172
|
* show) or in `mergeOptions`; it is not kept. An index out of range selects nothing (or the first tab at creation)
|
|
@@ -188,8 +200,9 @@ export interface OptionsBottomTabs {
|
|
|
188
200
|
drawBehind?: boolean;
|
|
189
201
|
/**
|
|
190
202
|
* The background color of the bar; `null` gives the default one. On Android the default is the surface color of the
|
|
191
|
-
* Material 3 theme. Before iOS 26
|
|
192
|
-
*
|
|
203
|
+
* Material 3 theme. Before iOS 26, and in the compatibility mode (`UIDesignRequiresCompatibility` in Info.plist: iOS 26, and iOS 27
|
|
204
|
+
* only for an app built with an SDK before iOS 27), the bar is opaque with the color, or system opaque without it,
|
|
205
|
+
* and a transparent color makes it transparent. On iOS 26 and later with glass the color is ignored
|
|
193
206
|
* with one warning, since the system has no color for glass, while a transparent color gives a transparent bar. The
|
|
194
207
|
* theme color `bar` is its default option.
|
|
195
208
|
*/
|
|
@@ -396,7 +409,7 @@ export interface OptionsBottomTab {
|
|
|
396
409
|
selectedFontSize?: number;
|
|
397
410
|
/**
|
|
398
411
|
* (iOS) The insets of the icon. Each side is independent. They apply before iOS 26 only; iOS 26 and the compatibility
|
|
399
|
-
* mode ignore them, and so does a system role before iOS 18.
|
|
412
|
+
* mode (see `backgroundColor`) ignore them, and so does a system role before iOS 18.
|
|
400
413
|
*/
|
|
401
414
|
iconInsets?: IconInsets;
|
|
402
415
|
/**
|
|
@@ -60,7 +60,7 @@ export interface IconInsets {
|
|
|
60
60
|
* a color the other fields are ignored.
|
|
61
61
|
*
|
|
62
62
|
* On iOS the icon is drawn onto the shape and the button becomes a button of its own (the back button keeps its
|
|
63
|
-
* history menu), without the glass capsule
|
|
63
|
+
* history menu), without the glass capsule (glass design, iOS 26+) by default. On Android the icon sits on the shape, mirrored in a
|
|
64
64
|
* right-to-left layout. Layers merge differently: on iOS an object merges field by field like any other, on Android
|
|
65
65
|
* an `iconBackground` that has a `color` replaces the earlier one as a whole.
|
|
66
66
|
*/
|
|
@@ -189,7 +189,7 @@ export interface OptionsTopBarButton {
|
|
|
189
189
|
*/
|
|
190
190
|
icon?: ImageResource;
|
|
191
191
|
/**
|
|
192
|
-
* (iOS) The space around the image of `icon`; the button becomes a button of its own, without a capsule
|
|
192
|
+
* (iOS) The space around the image of `icon`; the button becomes a button of its own, without a capsule with the glass design (iOS 26+, see `UIDesignRequiresCompatibility`).
|
|
193
193
|
*/
|
|
194
194
|
iconInsets?: IconInsets;
|
|
195
195
|
/**
|
|
@@ -238,14 +238,14 @@ export interface OptionsTopBarButton {
|
|
|
238
238
|
disabledColor?: Color;
|
|
239
239
|
/**
|
|
240
240
|
* A shape behind the icon. It works with an `icon` image and a `color` of the shape; on iOS the button becomes a
|
|
241
|
-
* button of its own without menu, toggle or style, and without a capsule
|
|
241
|
+
* button of its own without menu, toggle or style, and without a capsule with the glass design by default. The color of a whole
|
|
242
242
|
* side is `leftButtonBackgroundColor` / `rightButtonBackgroundColor`.
|
|
243
243
|
*/
|
|
244
244
|
iconBackground?: IconBackgroundOptions;
|
|
245
245
|
/**
|
|
246
|
-
* (iOS) `'plain'` or `'prominent'`, the main action of the bar (Done, Send).
|
|
246
|
+
* (iOS) `'plain'` or `'prominent'`, the main action of the bar (Done, Send). With the glass design (iOS 26+, see `UIDesignRequiresCompatibility`) a prominent button is a
|
|
247
247
|
* capsule in the button's tint with bold text or icon on it (the tint is `color`, the bar's tint without it);
|
|
248
|
-
*
|
|
248
|
+
* without it, it is the system's done style with bold text. Not for component buttons, buttons with
|
|
249
249
|
* `iconBackground`, and `showText` buttons.
|
|
250
250
|
* @default 'plain'
|
|
251
251
|
*/
|
|
@@ -257,7 +257,7 @@ export interface OptionsTopBarButton {
|
|
|
257
257
|
*/
|
|
258
258
|
testID?: string;
|
|
259
259
|
/**
|
|
260
|
-
* (iOS 26
|
|
260
|
+
* (iOS 26+, glass design) Whether the button has no glass capsule under it; neighbors keep theirs. By default `true` for
|
|
261
261
|
* component buttons and for icon buttons with a background or insets, `false` for the rest. In a `group` of several
|
|
262
262
|
* buttons the capsule is shared and this has no effect. A change by `mergeOptions` builds the buttons anew.
|
|
263
263
|
*/
|
|
@@ -270,8 +270,8 @@ export interface OptionsTopBarButton {
|
|
|
270
270
|
*/
|
|
271
271
|
showText?: boolean;
|
|
272
272
|
/**
|
|
273
|
-
* (iOS 26
|
|
274
|
-
* own.
|
|
273
|
+
* (iOS 26+, glass design) Buttons next to each other with the same group share one capsule; a button without a group has its
|
|
274
|
+
* own. Without the glass design it does nothing, on iOS 15 there are no groups. A side that has a group of several buttons
|
|
275
275
|
* doesn't animate button changes. The toolbar has no groups: only icons share a capsule there. For center buttons
|
|
276
276
|
* the group is a section of the overflow menu, and its name is the id the customization is saved under.
|
|
277
277
|
*/
|
|
@@ -34,12 +34,15 @@ export interface OptionsLayout {
|
|
|
34
34
|
* indicator or navigation bar, the camera cutout. `[]` lets the content reach every edge. The array replaces the
|
|
35
35
|
* one from a lower layer. The screen adds the padding itself; `useSafeAreaInsets()` returns what is still covered,
|
|
36
36
|
* which is 0 on an edge the screen keeps and the whole covered size on an edge where the content goes under a bar.
|
|
37
|
-
* Edges listed here
|
|
37
|
+
* Edges listed here win, but the top under a large title: there the list keeps its first rows clear of the bar
|
|
38
|
+
* itself and scrolls under it, which collapses the title, so a `'top'` listed here counts for nothing.
|
|
38
39
|
*
|
|
39
|
-
* Without it
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
40
|
+
* Without it the screen keeps the top and the sides, and its content goes down to the bottom: under the home
|
|
41
|
+
* indicator or the navigation bar, and under a tab bar or toolbar it goes under. A list keeps its last rows clear
|
|
42
|
+
* with `useSafeAreaInsets().bottom`. The top is free where the content goes under a top bar: on iOS under a bar
|
|
43
|
+
* that shows, on Android under a bar that hides on scroll; on both under a large title, so the list scrolls under
|
|
44
|
+
* the bar. On iOS the side of a vertical bar is free too. To have the screen keep the bottom, list every edge it
|
|
45
|
+
* keeps: listed edges replace the default.
|
|
43
46
|
*/
|
|
44
47
|
safeAreaEdges?: SafeAreaEdge[];
|
|
45
48
|
/**
|
|
@@ -4,7 +4,7 @@ import type { OptionsTopBarButton } from './buttons';
|
|
|
4
4
|
export interface OptionsToolbarSpace {
|
|
5
5
|
/**
|
|
6
6
|
* `'flexibleSpace'` takes the free width and pushes the next buttons to the far edge; `'fixedSpace'` is a gap of zero
|
|
7
|
-
* width that starts a new capsule
|
|
7
|
+
* width that starts a new capsule with the glass design (iOS 26+).
|
|
8
8
|
*/
|
|
9
9
|
systemItem: 'flexibleSpace' | 'fixedSpace';
|
|
10
10
|
}
|
|
@@ -36,7 +36,7 @@ export interface OptionsToolbar {
|
|
|
36
36
|
* The buttons from the leading edge, in the format of the bar buttons: text, icon, SF Symbol, `systemItem`, a
|
|
37
37
|
* component (drawn before the screen shows), `enabled`, `color`, `style`, `menu` (it opens upward), `toggle`,
|
|
38
38
|
* `showText`, `group`; also spaces and the search field. A press sends a button press. The color of a side doesn't
|
|
39
|
-
* apply to them, and badges are not drawn.
|
|
39
|
+
* apply to them, and badges are not drawn. With the glass design (iOS 26+, see `UIDesignRequiresCompatibility`) each button has its own capsule, neighbor icons with the same
|
|
40
40
|
* `group` share one (the toolbar has no real groups, so text buttons never share), and a zero-width space is put
|
|
41
41
|
* between neighbors of different groups unless an explicit space is there. The list is replaced as a whole;
|
|
42
42
|
* `mergeOptions` animates it.
|
|
@@ -50,7 +50,7 @@ export interface OptionsTopBarTitleDocument {
|
|
|
50
50
|
export interface OptionsTopBarTitle {
|
|
51
51
|
/**
|
|
52
52
|
* The text of the title. Setting it removes a React title. On iOS it is the title of the screen's navigation item,
|
|
53
|
-
* the label the system shows on the next screen's back button
|
|
53
|
+
* the label the system shows on the next screen's back button without the glass design, and what Rename edits. On Android it
|
|
54
54
|
* is one line cut with an ellipsis, and also the text of the large title; a title component set together with the
|
|
55
55
|
* text drops the text and the subtitle (with a warning in development).
|
|
56
56
|
*/
|
|
@@ -94,9 +94,9 @@ export interface OptionsTopBarTitle {
|
|
|
94
94
|
*/
|
|
95
95
|
document?: OptionsTopBarTitleDocument;
|
|
96
96
|
/**
|
|
97
|
-
* (iOS 26
|
|
97
|
+
* (iOS 26+, glass design) Puts the title on a Liquid Glass capsule like the buttons: `'regular'` or `'clear'`; `'none'` and any
|
|
98
98
|
* other value mean no capsule. A text title and the subtitle are two lines on the capsule; a component title sits on
|
|
99
|
-
* it as it is, the capsule taking its size.
|
|
99
|
+
* it as it is, the capsule taking its size. Without the glass design (see `UIDesignRequiresCompatibility`) and on Android it does nothing.
|
|
100
100
|
*/
|
|
101
101
|
glass?: 'regular' | 'clear' | 'none';
|
|
102
102
|
/** (Android) The height of the row of title and buttons, in dp. By default 64, regardless of `topBar.height`. */
|
|
@@ -118,15 +118,15 @@ export interface OptionsTopBarTitle {
|
|
|
118
118
|
/** The subtitle: a second line under the title. */
|
|
119
119
|
export interface OptionsTopBarSubtitle {
|
|
120
120
|
/**
|
|
121
|
-
* The text of the second line. An empty text removes it.
|
|
122
|
-
* large title and the collapsed bar, and on the capsule when the title has `glass`; a React title hides it.
|
|
123
|
-
*
|
|
121
|
+
* 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
|
|
122
|
+
* large title and the collapsed bar, and on the capsule when the title has `glass`; a React title hides it. Without
|
|
123
|
+
* it, it makes a two-line title view, only without a large title or a React title. On Android it is the line under
|
|
124
124
|
* the title, hidden when empty and dropped when the title is a component.
|
|
125
125
|
*/
|
|
126
126
|
text?: string;
|
|
127
127
|
/**
|
|
128
|
-
* The size of the font.
|
|
129
|
-
* font;
|
|
128
|
+
* 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
|
|
129
|
+
* font; without it the size is 12. On Android it is in sp, 14 by default.
|
|
130
130
|
*/
|
|
131
131
|
fontSize?: number;
|
|
132
132
|
/** The color of the subtitle. On Android the theme's on-surface-variant color by default. */
|
|
@@ -177,14 +177,14 @@ export interface OptionsTopBarBackButton {
|
|
|
177
177
|
*/
|
|
178
178
|
visible?: boolean;
|
|
179
179
|
/**
|
|
180
|
-
* (iOS) The text of the back button.
|
|
181
|
-
* the screen below is never shown;
|
|
180
|
+
* (iOS) The text of the back button. With the glass design (iOS 26+, see `UIDesignRequiresCompatibility`) the system button without it is an arrow alone,
|
|
181
|
+
* 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
|
|
182
182
|
* its back button title.
|
|
183
183
|
*/
|
|
184
184
|
title?: string;
|
|
185
185
|
/**
|
|
186
186
|
* (iOS) `true` shows the title of the screen below (or `title`), `false` shows an arrow alone (the minimal mode).
|
|
187
|
-
* Without it the system decides;
|
|
187
|
+
* Without it the system decides; with the glass design that is the arrow.
|
|
188
188
|
*/
|
|
189
189
|
showTitle?: boolean;
|
|
190
190
|
/**
|
|
@@ -207,7 +207,7 @@ export interface OptionsTopBarBackButton {
|
|
|
207
207
|
/**
|
|
208
208
|
* A shape behind the icon, as for a button. It takes effect with a `color` of the shape. On iOS the icon (the
|
|
209
209
|
* chevron by default) is drawn on it and the back button becomes an own button that keeps the history menu unless
|
|
210
|
-
* `enableMenu` is `false`; without a capsule
|
|
210
|
+
* `enableMenu` is `false`; without a capsule with the glass design by default. On Android the arrow sits on the shape.
|
|
211
211
|
*/
|
|
212
212
|
iconBackground?: IconBackgroundOptions;
|
|
213
213
|
/**
|
|
@@ -228,7 +228,7 @@ export interface OptionsTopBarBackButton {
|
|
|
228
228
|
*/
|
|
229
229
|
displayMode?: 'default' | 'generic' | 'minimal';
|
|
230
230
|
/**
|
|
231
|
-
* (iOS 26
|
|
231
|
+
* (iOS 26+, glass design) Whether the Liquid Glass capsule under the back button is hidden. It works only for an own button with
|
|
232
232
|
* an `iconBackground`, where the shape is already drawn into the icon; the system button ignores it.
|
|
233
233
|
* @default true
|
|
234
234
|
*/
|
|
@@ -245,9 +245,9 @@ export interface OptionsTopBarBackButton {
|
|
|
245
245
|
/** The background of the bar: a color, a component, translucency and blur. */
|
|
246
246
|
export interface OptionsTopBarBackground {
|
|
247
247
|
/**
|
|
248
|
-
* The color of the bar. On iOS it fills both the standard look and the one at the scroll edge;
|
|
249
|
-
* then solid in this color instead of glass. A transparent color makes a transparent bar. It beats `blur` and
|
|
250
|
-
* `translucent`. With a large title
|
|
248
|
+
* 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
|
|
249
|
+
* 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
|
|
250
|
+
* `translucent`. With a large title and the glass design the color is drawn into the list under the title, and the collapsed bar
|
|
251
251
|
* paints itself. On Android it is the background of the bar with the status bar strip, by default the theme's
|
|
252
252
|
* surface color, changing at once on push and pop. Together with `component` the color lies under the component.
|
|
253
253
|
*/
|
|
@@ -266,8 +266,8 @@ export interface OptionsTopBarBackground {
|
|
|
266
266
|
*/
|
|
267
267
|
component?: OptionsTopBarBackgroundComponent;
|
|
268
268
|
/**
|
|
269
|
-
* (iOS) Whether content shows through the bar. By default `true`
|
|
270
|
-
* the bar is glass
|
|
269
|
+
* (iOS) Whether content shows through the bar. By default `true` with the glass design (iOS 26+, see `UIDesignRequiresCompatibility`) and `false` without it. With `true`
|
|
270
|
+
* the bar is glass with the glass design and the system translucent bar without it; with `false` it is solid in the system color.
|
|
271
271
|
* `color` and `blur` beat it. Only an explicit `true` puts the screen under the bar.
|
|
272
272
|
*/
|
|
273
273
|
translucent?: boolean;
|
|
@@ -301,7 +301,7 @@ export interface OptionsTopBarBackgroundComponent {
|
|
|
301
301
|
export interface OptionsTopBarScrollEdgeAppearanceTitle {
|
|
302
302
|
/** The size of the font, handled like `topBar.title.fontSize`. */
|
|
303
303
|
fontSize?: number;
|
|
304
|
-
/** The color of the title at the edge.
|
|
304
|
+
/** The color of the title at the edge. With the glass design it is fixed during a push, like the usual title color. */
|
|
305
305
|
color?: Color;
|
|
306
306
|
/** The font family, handled like `topBar.title.fontFamily`. */
|
|
307
307
|
fontFamily?: FontFamily;
|
|
@@ -327,7 +327,7 @@ export interface OptionsTopBarScrollEdgeAppearanceBackground {
|
|
|
327
327
|
|
|
328
328
|
/**
|
|
329
329
|
* (iOS) How the bar looks while the list is at its top edge. Without `active` the edge looks as the usual bar, except
|
|
330
|
-
* for the transparency under a large title
|
|
330
|
+
* for the transparency under a large title with the glass design; the title and the border at the edge still come from the fields
|
|
331
331
|
* here or from the usual ones. Android doesn't read it.
|
|
332
332
|
*/
|
|
333
333
|
export interface OptionsTopBarScrollEdgeAppearance {
|
|
@@ -337,7 +337,7 @@ export interface OptionsTopBarScrollEdgeAppearance {
|
|
|
337
337
|
background?: OptionsTopBarScrollEdgeAppearanceBackground;
|
|
338
338
|
/**
|
|
339
339
|
* Whether the bar has a background of its own at the edge (`background`). With it the edge isn't made transparent
|
|
340
|
-
* under a large title, and
|
|
340
|
+
* under a large title, and with the glass design an opaque color covers the large title. A change by `mergeOptions` applies at
|
|
341
341
|
* once.
|
|
342
342
|
* @default false
|
|
343
343
|
*/
|
|
@@ -373,7 +373,7 @@ export interface OptionsTopBarLargeTitle {
|
|
|
373
373
|
* Whether the large title collapses into the bar as the list scrolls. With `false` on iOS the bar follows an empty
|
|
374
374
|
* scroll view instead of the list, so the title stays as at the top of the list; under the row it then needs a
|
|
375
375
|
* background (`background.color`, else a system blur), and `searchBar.hideOnScroll` doesn't work. On Android `false`
|
|
376
|
-
* leaves the bar as it is and stops listening to the list.
|
|
376
|
+
* leaves the bar as it is and stops listening to the list. With the glass design in a right-to-left layout nothing collapses.
|
|
377
377
|
* @default true
|
|
378
378
|
*/
|
|
379
379
|
collapseOnScroll?: boolean;
|
|
@@ -637,7 +637,7 @@ export interface OptionsTopBar {
|
|
|
637
637
|
/**
|
|
638
638
|
* The shape color behind the icons of the left buttons that have an `icon` image and no `iconBackground.color`; the
|
|
639
639
|
* size and corners come from the button's `iconBackground`, or the icon's size without corners. On iOS only image
|
|
640
|
-
* buttons, not SF Symbols, and without a capsule
|
|
640
|
+
* buttons, not SF Symbols, and without a capsule with the glass design. A color sent by `mergeOptions` repaints all the side's
|
|
641
641
|
* image buttons, those with their own shape color too.
|
|
642
642
|
*/
|
|
643
643
|
leftButtonBackgroundColor?: Color;
|
|
@@ -815,12 +815,15 @@ export interface OptionsScrollEdge {
|
|
|
815
815
|
|
|
816
816
|
/**
|
|
817
817
|
* (iOS 26+) The scroll edge effect of the scroll views of a screen: how the content fades or blurs where it scrolls
|
|
818
|
-
* under a bar. The scroll views draw it, and only where content goes under a bar.
|
|
819
|
-
*
|
|
820
|
-
* `
|
|
821
|
-
*
|
|
822
|
-
*
|
|
823
|
-
*
|
|
818
|
+
* under a bar. The scroll views draw it, and only where content goes under a bar. When the screen appears, it applies
|
|
819
|
+
* to the vertical lists and text views (a multi-line `TextInput`) in the view of the screen, except in hidden views
|
|
820
|
+
* (`display: none`). A list inside another vertical list gets none (UIKit draws no edge effect there); a scroll view
|
|
821
|
+
* that doesn't scroll vertically, like a pager, is searched for its lists. A list nested very deep in the screen's
|
|
822
|
+
* views may not get it. After React mounts, the main list of the screen gets it; a list mounted later gets it at the
|
|
823
|
+
* next appearance, or at a `mergeOptions` of `scrollEdgeEffect` or of the bar's background. The lists get the system
|
|
824
|
+
* effect back when the screen leaves or is destroyed, and a list React removes from the screen gets it back too. Under
|
|
825
|
+
* a bar with `background.color` or `background.component` there is no effect at the top unless the screen sets one for
|
|
826
|
+
* the top or for all edges. Before iOS 26 and on Android it does nothing.
|
|
824
827
|
*/
|
|
825
828
|
export interface OptionsScrollEdgeEffect {
|
|
826
829
|
/** Whether the effect is hidden on all four edges. The value of an edge beats it. */
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
package dev.apexnative.navigation.react
|
|
2
|
-
|
|
3
|
-
import com.facebook.react.bridge.Arguments
|
|
4
|
-
import com.facebook.react.bridge.WritableMap
|
|
5
|
-
import dev.apexnative.navigation.react.events.EventContract
|
|
6
|
-
import dev.apexnative.navigation.react.events.EventEmitter
|
|
7
|
-
import java.util.concurrent.ConcurrentHashMap
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* The state of each screen of a pair (`useArrangement`): which screen of the pair it is, how the pair lies, whether it
|
|
11
|
-
* lies over the other one and whether it is out of the window. Set on the main thread as the pair lays out; JavaScript
|
|
12
|
-
* reads it from its own thread for a screen's first render, and gets every change as `ANN.ArrangementChanged`. A
|
|
13
|
-
* screen outside a pair has none.
|
|
14
|
-
*/
|
|
15
|
-
internal object ArrangementStates {
|
|
16
|
-
data class State(val placement: String, val layout: String, val front: Boolean, val hidden: Boolean)
|
|
17
|
-
|
|
18
|
-
private val states = ConcurrentHashMap<String, State>()
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Keeps the screen's state, and tells JavaScript when it changed and [notify] holds, through [emitter], the one of
|
|
22
|
-
* the JavaScript the screen was made for: silent once it went. Main thread only.
|
|
23
|
-
*/
|
|
24
|
-
fun set(screenId: String, state: State, notify: Boolean, emitter: EventEmitter) {
|
|
25
|
-
if (states.put(screenId, state) == state || !notify) return
|
|
26
|
-
emitter.emitArrangementChanged(screenId, toMap(state))
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/** `{ placement, layout, front, hidden }`, empty for a screen outside a pair. Any thread. */
|
|
30
|
-
fun get(screenId: String): WritableMap = states[screenId]?.let(::toMap) ?: Arguments.createMap()
|
|
31
|
-
|
|
32
|
-
fun remove(screenId: String) {
|
|
33
|
-
states.remove(screenId)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
private fun toMap(state: State): WritableMap = Arguments.createMap().apply {
|
|
37
|
-
putString(EventContract.ArrangementChanged.PLACEMENT, state.placement)
|
|
38
|
-
putString(EventContract.ArrangementChanged.LAYOUT, state.layout)
|
|
39
|
-
putBoolean(EventContract.ArrangementChanged.FRONT, state.front)
|
|
40
|
-
putBoolean(EventContract.ArrangementChanged.HIDDEN, state.hidden)
|
|
41
|
-
}
|
|
42
|
-
}
|