@sigx/lynx-navigation 0.4.4 → 0.4.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/dist/components/Layer.d.ts +18 -11
- package/dist/components/Layer.d.ts.map +1 -1
- package/dist/components/Layer.js +33 -21
- package/dist/components/Layer.js.map +1 -1
- package/dist/components/NavigationRoot.d.ts +9 -1
- package/dist/components/NavigationRoot.d.ts.map +1 -1
- package/dist/components/NavigationRoot.js +12 -1
- package/dist/components/NavigationRoot.js.map +1 -1
- package/dist/components/Stack.d.ts +19 -7
- package/dist/components/Stack.d.ts.map +1 -1
- package/dist/components/Stack.js +28 -15
- package/dist/components/Stack.js.map +1 -1
- package/dist/hooks/use-hardware-back.d.ts +30 -12
- package/dist/hooks/use-hardware-back.d.ts.map +1 -1
- package/dist/hooks/use-hardware-back.js +99 -54
- package/dist/hooks/use-hardware-back.js.map +1 -1
- package/dist/internal/layer-plan.d.ts +56 -30
- package/dist/internal/layer-plan.d.ts.map +1 -1
- package/dist/internal/layer-plan.js +84 -48
- package/dist/internal/layer-plan.js.map +1 -1
- package/dist/navigator/core.d.ts.map +1 -1
- package/dist/navigator/core.js +41 -21
- package/dist/navigator/core.js.map +1 -1
- package/package.json +10 -10
- package/src/components/Layer.tsx +41 -22
- package/src/components/NavigationRoot.tsx +21 -1
- package/src/components/Stack.tsx +58 -14
- package/src/hooks/use-hardware-back.ts +102 -54
- package/src/internal/layer-plan.ts +128 -75
- package/src/navigator/core.ts +42 -21
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/navigator/core.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,eAAe,EACf,MAAM,EACN,OAAO,GAGV,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAqE/C;;;;GAIG;AACH,MAA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AAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAClD,CAAC;QACD,GAAG,CAAC,GAAW;YACX,0DAA0D;YAC1D,+DAA+D;YAC/D,+DAA+D;YAC/D,2DAA2D;YAC3D,2DAA2D;YAC3D,KAAK,OAAO,CAAC,CAAC,CAAC;YACf,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC1B,CAAC;KACJ,CAAC;AACN,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sigx/lynx-navigation",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
4
4
|
"description": "Type-first native navigator for sigx-lynx — Stack, Tabs, Drawer, modals, lazy routes, deep links",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
"dist"
|
|
17
17
|
],
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"@sigx/lynx": "^0.4.
|
|
20
|
-
"@sigx/lynx
|
|
21
|
-
"@sigx/lynx-
|
|
22
|
-
"@sigx/lynx-
|
|
19
|
+
"@sigx/lynx-icons": "^0.4.6",
|
|
20
|
+
"@sigx/lynx": "^0.4.6",
|
|
21
|
+
"@sigx/lynx-linking": "^0.4.6",
|
|
22
|
+
"@sigx/lynx-motion": "^0.4.6"
|
|
23
23
|
},
|
|
24
24
|
"peerDependenciesMeta": {
|
|
25
25
|
"@sigx/lynx-linking": {
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
"@typescript/native-preview": "7.0.0-dev.20260521.1",
|
|
31
31
|
"typescript": "^6.0.3",
|
|
32
32
|
"vitest": "^4.1.7",
|
|
33
|
-
"@sigx/lynx
|
|
34
|
-
"@sigx/lynx-
|
|
35
|
-
"@sigx/lynx-
|
|
36
|
-
"@sigx/lynx-
|
|
37
|
-
"@sigx/lynx": "^0.4.
|
|
33
|
+
"@sigx/lynx": "^0.4.6",
|
|
34
|
+
"@sigx/lynx-testing": "^0.4.6",
|
|
35
|
+
"@sigx/lynx-icons": "^0.4.6",
|
|
36
|
+
"@sigx/lynx-motion": "^0.4.6",
|
|
37
|
+
"@sigx/lynx-linking": "^0.4.6"
|
|
38
38
|
},
|
|
39
39
|
"keywords": [
|
|
40
40
|
"sigx",
|
package/src/components/Layer.tsx
CHANGED
|
@@ -5,17 +5,16 @@
|
|
|
5
5
|
* by a `SharedValue<number>` from the navigator's transition state.
|
|
6
6
|
*
|
|
7
7
|
* `<Stack>` emits one `<Layer>` per entry returned by
|
|
8
|
-
* `computeLayers(...)`. Layer.key in the parent is
|
|
9
|
-
*
|
|
8
|
+
* `computeLayers(...)`. Layer.key in the parent is `layer-${entry.key}` —
|
|
9
|
+
* stable for the entry's whole life. The host view, `<EntryScope>`, and the
|
|
10
|
+
* screen component therefore stay mounted across every animation phase
|
|
11
|
+
* (animated → static, push/pop transitions), so a screen's `onMounted` /
|
|
12
|
+
* data fetches fire exactly once per navigation and no state is lost.
|
|
10
13
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* top after its push transition completes) remounts so the
|
|
16
|
-
* `useAnimatedStyle` binding can be rebound — the underlying
|
|
17
|
-
* `useAnimatedStyle` is set-once at setup and can't switch its
|
|
18
|
-
* mapper at runtime.
|
|
14
|
+
* The transform binding is the only thing that changes as the layer animates
|
|
15
|
+
* vs rests: it's driven by the *reactive* form of `useAnimatedStyle`, which
|
|
16
|
+
* (re)registers/unregisters the MT style binding on this same element as
|
|
17
|
+
* `props.animation` flips between a spec and `null`. No remount needed.
|
|
19
18
|
*
|
|
20
19
|
* Layouts:
|
|
21
20
|
* - Host view is `position: absolute; top/right/bottom/left: 0;
|
|
@@ -41,21 +40,38 @@ export type LayerProps =
|
|
|
41
40
|
& Define.Prop<'entry', StackEntry, true>
|
|
42
41
|
& Define.Prop<'routes', RouteMap, true>
|
|
43
42
|
/** When set, the host view animates per the transform spec. */
|
|
44
|
-
& Define.Prop<'animation', LayerAnimation | null, false
|
|
43
|
+
& Define.Prop<'animation', LayerAnimation | null, false>
|
|
44
|
+
/**
|
|
45
|
+
* Retained-but-covered layer: render with `display: none` so the
|
|
46
|
+
* screen subtree stays mounted (state/scroll preserved) without
|
|
47
|
+
* costing paint/layout while a higher opaque card covers it.
|
|
48
|
+
* Toggling this is a style change on the stable host view — never a
|
|
49
|
+
* remount. Mirrors how `<Tabs>` hides inactive tab bodies.
|
|
50
|
+
*/
|
|
51
|
+
& Define.Prop<'hidden', boolean, false>;
|
|
45
52
|
|
|
46
53
|
export const Layer = component<LayerProps>(({ props }) => {
|
|
47
54
|
const ref = useMainThreadRef<MainThread.Element | null>(null);
|
|
48
|
-
//
|
|
49
|
-
//
|
|
50
|
-
//
|
|
51
|
-
//
|
|
52
|
-
|
|
55
|
+
// Reactive binding: the Layer's key is stable for the entry's life, so
|
|
56
|
+
// `props.animation` changes (spec ↔ null) at runtime as the layer
|
|
57
|
+
// animates and then settles. The reactive `useAnimatedStyle` re-binds the
|
|
58
|
+
// MT transform on this same element each time, leaving the host view and
|
|
59
|
+
// the screen subtree mounted throughout. Going static returns `null`,
|
|
60
|
+
// which unregisters the binding (required: the navigator reuses one
|
|
61
|
+
// shared progress SharedValue that resets to 0 on the next transition, so
|
|
62
|
+
// a resting layer must not stay bound).
|
|
63
|
+
useAnimatedStyle(ref, () => {
|
|
53
64
|
const a = props.animation;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
65
|
+
if (!a) return null;
|
|
66
|
+
return {
|
|
67
|
+
sv: a.progress,
|
|
68
|
+
mapperName: a.axis,
|
|
69
|
+
params: {
|
|
70
|
+
inputRange: [a.inputRange[0], a.inputRange[1]],
|
|
71
|
+
outputRange: [a.outputRange[0], a.outputRange[1]],
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
});
|
|
59
75
|
|
|
60
76
|
return () => {
|
|
61
77
|
const route = props.routes[props.entry.route];
|
|
@@ -83,7 +99,10 @@ export const Layer = component<LayerProps>(({ props }) => {
|
|
|
83
99
|
left: '0',
|
|
84
100
|
right: '0',
|
|
85
101
|
bottom: '0',
|
|
86
|
-
|
|
102
|
+
// `none` keeps a covered card mounted but unpainted;
|
|
103
|
+
// reading `props.hidden` here re-renders (no remount)
|
|
104
|
+
// when the layer is covered/revealed.
|
|
105
|
+
display: props.hidden ? 'none' : 'flex',
|
|
87
106
|
flexDirection: 'column',
|
|
88
107
|
}}
|
|
89
108
|
>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { component, defineProvide, useSharedValue, type Define } from '@sigx/lynx';
|
|
1
|
+
import { component, defineProvide, onMounted, onUnmounted, useSharedValue, type Define } from '@sigx/lynx';
|
|
2
2
|
import { createNavigatorState } from '../navigator/core.js';
|
|
3
3
|
import { useNav } from '../hooks/use-nav.js';
|
|
4
|
+
import { wireHardwareBack } from '../hooks/use-hardware-back.js';
|
|
4
5
|
import { useNavInternals, useNavRoutes } from '../hooks/use-nav-internal.js';
|
|
5
6
|
import type { RouteId } from '../register.js';
|
|
6
7
|
import type { Presentation, RouteMap, StackEntry } from '../types.js';
|
|
@@ -23,6 +24,14 @@ type NavigationRootProps =
|
|
|
23
24
|
* or while debugging gesture issues.
|
|
24
25
|
*/
|
|
25
26
|
& Define.Prop<'edgeSwipeEnabled', boolean>
|
|
27
|
+
/**
|
|
28
|
+
* Subscribe the Android hardware back button / system back gesture to
|
|
29
|
+
* this navigator. Defaults to true — a back press pops the deepest
|
|
30
|
+
* focused stack, falling through to `exitApp()` only at the base entry.
|
|
31
|
+
* Set to false to handle hardware back yourself (then call
|
|
32
|
+
* `useHardwareBack()` in your own component). No-op on iOS.
|
|
33
|
+
*/
|
|
34
|
+
& Define.Prop<'hardwareBack', boolean>
|
|
26
35
|
& Define.Slot<'default'>;
|
|
27
36
|
|
|
28
37
|
/**
|
|
@@ -89,5 +98,16 @@ export const NavigationRoot = component<NavigationRootProps>(({ props, slots })
|
|
|
89
98
|
screens: navState._screens,
|
|
90
99
|
}));
|
|
91
100
|
|
|
101
|
+
// Auto-wire Android hardware/system back unless opted out. Without this,
|
|
102
|
+
// the OS back gesture fires `hardwareBackPress` but nothing pops — every
|
|
103
|
+
// app would otherwise have to remember to call `useHardwareBack()`.
|
|
104
|
+
// Idempotent per tree (see `wireHardwareBack`), so a manual call still
|
|
105
|
+
// works and never double-pops. No-op on iOS / non-native runtimes.
|
|
106
|
+
if (props.hardwareBack !== false) {
|
|
107
|
+
let dispose: () => void = () => {};
|
|
108
|
+
onMounted(() => { dispose = wireHardwareBack(navState.nav); });
|
|
109
|
+
onUnmounted(() => { dispose(); });
|
|
110
|
+
}
|
|
111
|
+
|
|
92
112
|
return () => slots.default?.();
|
|
93
113
|
});
|
package/src/components/Stack.tsx
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
type NavInternals,
|
|
17
17
|
} from '../hooks/use-nav-internal.js';
|
|
18
18
|
import type { Presentation, StackEntry } from '../types.js';
|
|
19
|
-
import {
|
|
19
|
+
import { computeLayers, isOverlayPresentation, MAX_LAYERS } from '../internal/layer-plan.js';
|
|
20
20
|
import { EdgeBackHandle } from './EdgeBackHandle.js';
|
|
21
21
|
import { Layer } from './Layer.js';
|
|
22
22
|
import { useTabScreenName, useTabs } from './Tabs.js';
|
|
@@ -40,6 +40,17 @@ type StackProps =
|
|
|
40
40
|
& Define.Prop<'initialParams', Record<string, unknown>>
|
|
41
41
|
/** Initial search for the nested-stack base entry. */
|
|
42
42
|
& Define.Prop<'initialSearch', Record<string, unknown>>
|
|
43
|
+
/**
|
|
44
|
+
* Max number of *covered* cards kept mounted-but-hidden beneath the
|
|
45
|
+
* visible top (card-stack screen retention). Covered cards stay
|
|
46
|
+
* mounted so back-navigation reveals them instantly with state
|
|
47
|
+
* intact, instead of rebuilding. Omit to retain all (bounded only by
|
|
48
|
+
* the renderer's `MAX_LAYERS` slot cap). Set a small number to bound
|
|
49
|
+
* memory — the deepest covered cards beyond the window unmount and
|
|
50
|
+
* rebuild on pop-back. Mirrors React Navigation's
|
|
51
|
+
* `detachInactiveScreens` / `maxRetainedScreens`.
|
|
52
|
+
*/
|
|
53
|
+
& Define.Prop<'maxRetainedScreens', number>
|
|
43
54
|
/**
|
|
44
55
|
* Optional chrome rendered *above* the active screen, **inside this
|
|
45
56
|
* Stack's nav scope**. The intended use is `<Header />`, which needs
|
|
@@ -55,6 +66,22 @@ type StackProps =
|
|
|
55
66
|
|
|
56
67
|
let _nestedKeyCounter = 0;
|
|
57
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Number of `renderLayerNode(layers[n])` slots unrolled in the render
|
|
71
|
+
* below. Must equal `MAX_LAYERS` — `computeLayers` trims its output to
|
|
72
|
+
* `MAX_LAYERS`, so any layer beyond this count would be silently
|
|
73
|
+
* dropped. The type-level check fails to compile if the two drift, so
|
|
74
|
+
* raising `MAX_LAYERS` forces you to add matching slots here.
|
|
75
|
+
*/
|
|
76
|
+
const RENDERED_LAYER_SLOTS = 24;
|
|
77
|
+
type _AssertSlotCount = typeof MAX_LAYERS extends typeof RENDERED_LAYER_SLOTS
|
|
78
|
+
? typeof RENDERED_LAYER_SLOTS extends typeof MAX_LAYERS
|
|
79
|
+
? true
|
|
80
|
+
: never
|
|
81
|
+
: never;
|
|
82
|
+
const _slotCountOk: _AssertSlotCount = true;
|
|
83
|
+
void _slotCountOk;
|
|
84
|
+
|
|
58
85
|
/**
|
|
59
86
|
* Stack navigator — renders the topmost stack entry's component at rest, or
|
|
60
87
|
* the top + underneath entries during a transition.
|
|
@@ -101,13 +128,14 @@ let _nestedKeyCounter = 0;
|
|
|
101
128
|
* transform. After settle, the overlay either joins the static
|
|
102
129
|
* idle stack (push) or unmounts (pop).
|
|
103
130
|
*
|
|
104
|
-
* Layer keys are `layer-${entry.key}
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
131
|
+
* Layer keys are `layer-${entry.key}` — stable for the entry's whole
|
|
132
|
+
* life. A layer is never remounted just because its animation state
|
|
133
|
+
* changes; instead `<Layer>` drives the *reactive* `useAnimatedStyle`,
|
|
134
|
+
* which re-binds the MT transform on the same element as the entry
|
|
135
|
+
* animates and then settles. So a single push mounts the target screen
|
|
136
|
+
* exactly once (one `onMounted`, one data fetch) and the underneath /
|
|
137
|
+
* modal-underneath subtrees (per-tab Stack navigators, scroll positions,
|
|
138
|
+
* in-flight inputs) survive the whole transition.
|
|
111
139
|
*/
|
|
112
140
|
export const Stack = component<StackProps>(({ props, slots }) => {
|
|
113
141
|
// Capture enclosing scope's nav + routes + internals BEFORE any of the
|
|
@@ -263,15 +291,21 @@ export const Stack = component<StackProps>(({ props, slots }) => {
|
|
|
263
291
|
|
|
264
292
|
return () => {
|
|
265
293
|
const chrome = slots.default?.();
|
|
266
|
-
const layers = computeLayers(
|
|
294
|
+
const layers = computeLayers(
|
|
295
|
+
nav.stack,
|
|
296
|
+
nav.transition,
|
|
297
|
+
internals.progress,
|
|
298
|
+
props.maxRetainedScreens,
|
|
299
|
+
);
|
|
267
300
|
|
|
268
301
|
const renderLayerNode = (layer: typeof layers[number] | undefined) =>
|
|
269
302
|
layer ? (
|
|
270
303
|
<Layer
|
|
271
|
-
key={`layer-${layer.entry.key}
|
|
304
|
+
key={`layer-${layer.entry.key}`}
|
|
272
305
|
entry={layer.entry}
|
|
273
306
|
routes={routes}
|
|
274
307
|
animation={layer.animation}
|
|
308
|
+
hidden={layer.hidden}
|
|
275
309
|
/>
|
|
276
310
|
) : null;
|
|
277
311
|
// sigx's reconciler treats a single array-valued JSX child as
|
|
@@ -283,10 +317,12 @@ export const Stack = component<StackProps>(({ props, slots }) => {
|
|
|
283
317
|
// JSX child slot rather than as an array. The slots are
|
|
284
318
|
// position-stable across renders — the only thing that
|
|
285
319
|
// changes is a slot turning from `null` to a Layer (mount) or
|
|
286
|
-
// vice versa (unmount).
|
|
287
|
-
//
|
|
288
|
-
//
|
|
289
|
-
//
|
|
320
|
+
// vice versa (unmount). The slot count MUST equal MAX_LAYERS
|
|
321
|
+
// (the cap `computeLayers` trims to); card retention keeps
|
|
322
|
+
// covered cards mounted, so the slots now also hold a deep
|
|
323
|
+
// card history, not just 2-3 overlays. If you raise MAX_LAYERS,
|
|
324
|
+
// add matching slots below — the unrolled shape is just
|
|
325
|
+
// verbose, not algorithmically limited.
|
|
290
326
|
|
|
291
327
|
// Edge-swipe handle on top, gated on:
|
|
292
328
|
// - `internals.edgeSwipeEnabled` — opt-out flag (also off
|
|
@@ -344,6 +380,14 @@ export const Stack = component<StackProps>(({ props, slots }) => {
|
|
|
344
380
|
{renderLayerNode(layers[13])}
|
|
345
381
|
{renderLayerNode(layers[14])}
|
|
346
382
|
{renderLayerNode(layers[15])}
|
|
383
|
+
{renderLayerNode(layers[16])}
|
|
384
|
+
{renderLayerNode(layers[17])}
|
|
385
|
+
{renderLayerNode(layers[18])}
|
|
386
|
+
{renderLayerNode(layers[19])}
|
|
387
|
+
{renderLayerNode(layers[20])}
|
|
388
|
+
{renderLayerNode(layers[21])}
|
|
389
|
+
{renderLayerNode(layers[22])}
|
|
390
|
+
{renderLayerNode(layers[23])}
|
|
347
391
|
{edgeHandle}
|
|
348
392
|
</view>
|
|
349
393
|
);
|
|
@@ -1,29 +1,113 @@
|
|
|
1
|
-
import { onMounted } from '@sigx/lynx';
|
|
1
|
+
import { onMounted, onUnmounted } from '@sigx/lynx';
|
|
2
2
|
import { BackHandler } from '@sigx/lynx-linking';
|
|
3
3
|
import { useNav, type Nav } from './use-nav.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Navigator trees with an active hardware-back registration, keyed by
|
|
7
|
+
* their root nav. Used to keep wiring idempotent per tree: `<NavigationRoot>`
|
|
8
|
+
* auto-wires by default, and an app that *also* calls `useHardwareBack()`
|
|
9
|
+
* (or migrates from manual wiring) must not end up with two listeners that
|
|
10
|
+
* both pop on a single back press. The first registration for a root wins;
|
|
11
|
+
* later ones are no-ops until it unsubscribes.
|
|
12
|
+
*/
|
|
13
|
+
const wiredRoots = new WeakSet<Nav>();
|
|
14
|
+
|
|
15
|
+
/** Walk up the `parent` chain to the top-most navigator. */
|
|
16
|
+
function rootOf(nav: Nav): Nav {
|
|
17
|
+
let cur = nav;
|
|
18
|
+
while (cur.parent) cur = cur.parent;
|
|
19
|
+
return cur;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Subscribe the Android hardware back button/gesture to a navigator tree.
|
|
7
24
|
*
|
|
8
25
|
* Listens for `hardwareBackPress` events from `@sigx/lynx-linking`'s
|
|
9
26
|
* `BackHandler` (which the native side dispatches from
|
|
10
|
-
* `MainActivity.onBackPressed`). On press the handler walks
|
|
11
|
-
* deepest currently-focused navigator (per-tab `<Stack>`s
|
|
12
|
-
* their parent), then walks back up the `parent` chain looking
|
|
13
|
-
* first nav that `canGoBack`:
|
|
27
|
+
* `MainActivity.onBackPressed`). On press the handler walks from the tree's
|
|
28
|
+
* root to the deepest currently-focused navigator (per-tab `<Stack>`s
|
|
29
|
+
* register with their parent), then walks back up the `parent` chain looking
|
|
30
|
+
* for the first nav that `canGoBack`:
|
|
14
31
|
*
|
|
15
32
|
* - If any nav in the chain can go back → `nav.pop()` on that nav.
|
|
16
33
|
* - Otherwise → `BackHandler.exitApp()` (Android: `moveTaskToBack(true)`,
|
|
17
34
|
* keeps the bundle warm; iOS: rejects, since iOS doesn't permit
|
|
18
35
|
* programmatic termination).
|
|
19
36
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
37
|
+
* **Idempotent per tree.** Only the first registration for a given root
|
|
38
|
+
* actually subscribes; later calls return a no-op disposer. So `<NavigationRoot>`
|
|
39
|
+
* auto-wiring this and an app calling `useHardwareBack()` coexist without
|
|
40
|
+
* double-popping.
|
|
23
41
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
42
|
+
* Returns a disposer that unsubscribes (and frees the root for re-wiring).
|
|
43
|
+
* No-op on iOS (event never fires) and in non-native environments (no
|
|
44
|
+
* `GlobalEventEmitter`, e.g. web/SSR/tests) — `addEventListener` returns a
|
|
45
|
+
* no-op subscription there.
|
|
46
|
+
*
|
|
47
|
+
* @internal Apps should rely on `<NavigationRoot>`'s default or call
|
|
48
|
+
* `useHardwareBack()`; this raw form exists so the root can wire from setup.
|
|
49
|
+
*/
|
|
50
|
+
export function wireHardwareBack(nav: Nav): () => void {
|
|
51
|
+
const root = rootOf(nav);
|
|
52
|
+
// A registration for this tree already exists — don't add a second
|
|
53
|
+
// listener that would pop twice on one press.
|
|
54
|
+
if (wiredRoots.has(root)) return () => {};
|
|
55
|
+
wiredRoots.add(root);
|
|
56
|
+
|
|
57
|
+
const sub = BackHandler.addEventListener(() => {
|
|
58
|
+
// Walk down to the deepest focused nav. Per-tab `<Stack>`s register
|
|
59
|
+
// themselves via `parent._children.add(nav)`; only one child per
|
|
60
|
+
// level is `isLocallyFocused` at a time, so the traversal is
|
|
61
|
+
// unambiguous. Falls back to the root if no nested stacks are wired.
|
|
62
|
+
let active: Nav = root;
|
|
63
|
+
// Loop instead of recursion so a deeply-nested tree doesn't blow the
|
|
64
|
+
// stack on a synchronous back press.
|
|
65
|
+
outer: while (active._children.size > 0) {
|
|
66
|
+
for (const child of active._children) {
|
|
67
|
+
if (child.isLocallyFocused) {
|
|
68
|
+
active = child;
|
|
69
|
+
continue outer;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
// No focused child at this level — stop drilling.
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
// Walk back up the chain looking for the first nav that has something
|
|
76
|
+
// to pop. This is what makes "back press in trips tab with empty
|
|
77
|
+
// inner stack" fall through to root (which might have a modal on top)
|
|
78
|
+
// before exiting.
|
|
79
|
+
let cur: Nav | null = active;
|
|
80
|
+
while (cur) {
|
|
81
|
+
if (cur.canGoBack) {
|
|
82
|
+
cur.pop();
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
cur = cur.parent;
|
|
86
|
+
}
|
|
87
|
+
// At the root with nothing to pop — leave the app. Promise is
|
|
88
|
+
// fire-and-forget; we don't await because we want the back press to
|
|
89
|
+
// feel instant (Android starts the move-to-back transition
|
|
90
|
+
// immediately).
|
|
91
|
+
void BackHandler.exitApp();
|
|
92
|
+
return true;
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
return () => {
|
|
96
|
+
wiredRoots.delete(root);
|
|
97
|
+
sub.remove();
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Wire the Android hardware back button to the active navigator.
|
|
103
|
+
*
|
|
104
|
+
* `<NavigationRoot>` already does this by default (see its `hardwareBack`
|
|
105
|
+
* prop). Use this hook only when you've opted out (`hardwareBack={false}`)
|
|
106
|
+
* and want to wire it yourself — it's safe to call regardless thanks to the
|
|
107
|
+
* idempotency in {@link wireHardwareBack}.
|
|
108
|
+
*
|
|
109
|
+
* Call it once in any component under `<NavigationRoot>`. iOS doesn't fire
|
|
110
|
+
* the event so the hook is a no-op there.
|
|
27
111
|
*
|
|
28
112
|
* @example
|
|
29
113
|
* ```tsx
|
|
@@ -32,7 +116,7 @@ import { useNav, type Nav } from './use-nav.js';
|
|
|
32
116
|
* return () => null;
|
|
33
117
|
* });
|
|
34
118
|
*
|
|
35
|
-
* <NavigationRoot routes={routes}>
|
|
119
|
+
* <NavigationRoot routes={routes} hardwareBack={false}>
|
|
36
120
|
* <BackHandlerWiring />
|
|
37
121
|
* <Stack />
|
|
38
122
|
* </NavigationRoot>
|
|
@@ -40,45 +124,9 @@ import { useNav, type Nav } from './use-nav.js';
|
|
|
40
124
|
*/
|
|
41
125
|
export function useHardwareBack(): void {
|
|
42
126
|
const nav = useNav();
|
|
43
|
-
onMounted
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
// traversal is unambiguous. Falls back to the starting nav if
|
|
49
|
-
// no nested stacks are wired up.
|
|
50
|
-
let active: Nav = nav;
|
|
51
|
-
// Loop instead of recursion so a deeply-nested tree doesn't blow
|
|
52
|
-
// the stack on a synchronous back press.
|
|
53
|
-
outer: while (active._children.size > 0) {
|
|
54
|
-
for (const child of active._children) {
|
|
55
|
-
if (child.isLocallyFocused) {
|
|
56
|
-
active = child;
|
|
57
|
-
continue outer;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
// No focused child at this level — stop drilling.
|
|
61
|
-
break;
|
|
62
|
-
}
|
|
63
|
-
// Walk back up the chain looking for the first nav that has
|
|
64
|
-
// something to pop. This is what makes "back press in trips
|
|
65
|
-
// tab with empty inner stack" fall through to root (which might
|
|
66
|
-
// have a modal on top) before exiting.
|
|
67
|
-
let cur: Nav | null = active;
|
|
68
|
-
while (cur) {
|
|
69
|
-
if (cur.canGoBack) {
|
|
70
|
-
cur.pop();
|
|
71
|
-
return true;
|
|
72
|
-
}
|
|
73
|
-
cur = cur.parent;
|
|
74
|
-
}
|
|
75
|
-
// At the root with nothing to pop — leave the app. Promise is
|
|
76
|
-
// fire-and-forget; we don't await because we want the back
|
|
77
|
-
// press to feel instant (Android starts the move-to-back
|
|
78
|
-
// transition immediately).
|
|
79
|
-
void BackHandler.exitApp();
|
|
80
|
-
return true;
|
|
81
|
-
});
|
|
82
|
-
return () => sub.remove();
|
|
83
|
-
});
|
|
127
|
+
// `onMounted`'s return value isn't a cleanup hook in sigx — register the
|
|
128
|
+
// disposer with `onUnmounted` explicitly so the listener is released.
|
|
129
|
+
let dispose: () => void = () => {};
|
|
130
|
+
onMounted(() => { dispose = wireHardwareBack(nav); });
|
|
131
|
+
onUnmounted(() => { dispose(); });
|
|
84
132
|
}
|