@symbiote-native/navigation 2.2.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -2
- package/build/angular/drawer/index.js +2 -2
- package/build/angular/index.js +1 -1
- package/build/angular/tabs/index.js +5 -5
- package/build/core/render-drawer.js +4 -4
- package/build/core/render-tabs.js +5 -5
- package/build/react/drawer/index.js +1 -1
- package/build/react/index.js +1 -1
- package/build/react/tabs/index.js +2 -2
- package/build/solid/drawer/index.js +17 -14
- package/build/solid/index.js +1 -1
- package/build/solid/tabs/index.js +3 -3
- package/build/svelte/drawer/index.svelte +23 -24
- package/build/svelte/index.js +1 -1
- package/build/svelte/registry-host.js +2 -2
- package/build/svelte/stack/index.svelte +5 -5
- package/build/svelte/tabs/index.svelte +9 -9
- package/build/vue/drawer/index.js +1 -1
- package/build/vue/index.js +1 -1
- package/build/vue/tabs/index.js +3 -3
- package/build-ngc/angular/drawer/index.js +5 -5
- package/build-ngc/angular/drawer/index.js.map +1 -1
- package/build-ngc/angular/tabs/index.js +10 -10
- package/build-ngc/angular/tabs/index.js.map +1 -1
- package/build-ngc/core/render-drawer.js +4 -4
- package/build-ngc/core/render-drawer.js.map +1 -1
- package/build-ngc/core/render-tabs.js +5 -5
- package/build-ngc/core/render-tabs.js.map +1 -1
- package/package.json +27 -16
- package/src/angular/drawer/index.ts +2 -2
- package/src/angular/tabs/index.ts +5 -5
- package/src/core/render-drawer.ts +4 -4
- package/src/core/render-tabs.ts +5 -7
- package/src/react/drawer/index.ts +1 -1
- package/src/react/tabs/index.ts +3 -3
- package/src/solid/drawer/index.ts +18 -20
- package/src/solid/tabs/index.ts +3 -3
- package/src/svelte/drawer/index.svelte +23 -24
- package/src/svelte/registry-host.ts +2 -2
- package/src/svelte/stack/index.svelte +5 -5
- package/src/svelte/tabs/index.svelte +9 -9
- package/src/vue/drawer/index.ts +1 -1
- package/src/vue/tabs/index.ts +3 -3
package/README.md
CHANGED
|
@@ -142,9 +142,62 @@ export class AppComponent {
|
|
|
142
142
|
}
|
|
143
143
|
```
|
|
144
144
|
|
|
145
|
+
```svelte
|
|
146
|
+
<!-- Svelte — examples/svelte/App.svelte -->
|
|
147
|
+
<script lang="ts">
|
|
148
|
+
import { Screen, Stack } from '@symbiote-native/navigation/svelte';
|
|
149
|
+
import type { INavigatorHandle } from '@symbiote-native/navigation/svelte';
|
|
150
|
+
|
|
151
|
+
let stackInstance = $state.raw<INavigatorHandle | null>(null);
|
|
152
|
+
</script>
|
|
153
|
+
|
|
154
|
+
<Stack bind:this={stackInstance} initialRouteName="Menu">
|
|
155
|
+
<Screen
|
|
156
|
+
name="Menu"
|
|
157
|
+
component={MenuScreen}
|
|
158
|
+
options={{ title: 'Navigation Demos' }}
|
|
159
|
+
/>
|
|
160
|
+
<Screen
|
|
161
|
+
name="Details"
|
|
162
|
+
component={DetailsScreen}
|
|
163
|
+
options={{ title: 'Details' }}
|
|
164
|
+
/>
|
|
165
|
+
</Stack>
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
```tsx
|
|
169
|
+
// Solid — examples/solid/App.tsx
|
|
170
|
+
import { createSignal } from 'solid-js';
|
|
171
|
+
import { Stack } from '@symbiote-native/navigation/solid';
|
|
172
|
+
import type { INavigatorHandle } from '@symbiote-native/navigation/solid';
|
|
173
|
+
|
|
174
|
+
export default function App() {
|
|
175
|
+
const [stackHandle, setStackHandle] = createSignal<INavigatorHandle | null>(
|
|
176
|
+
null,
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
return (
|
|
180
|
+
<Stack ref={handle => setStackHandle(handle)} initialRouteName="Menu">
|
|
181
|
+
<Stack.Screen
|
|
182
|
+
name="Menu"
|
|
183
|
+
component={MenuScreen}
|
|
184
|
+
options={{ title: 'Navigation Demos' }}
|
|
185
|
+
/>
|
|
186
|
+
<Stack.Screen
|
|
187
|
+
name="Details"
|
|
188
|
+
component={DetailsScreen}
|
|
189
|
+
options={{ title: 'Details' }}
|
|
190
|
+
/>
|
|
191
|
+
</Stack>
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
145
196
|
`Stack` itself implements `INavigatorHandle` in Angular — `@ViewChild` gives you the handle
|
|
146
|
-
directly, no separate ref callback. In React/Vue, the ref only attaches during
|
|
147
|
-
needs the handle (e.g. `useLinkingIntegration` below) must gate on it being
|
|
197
|
+
directly, no separate ref callback. In React/Vue/Svelte/Solid, the ref only attaches during
|
|
198
|
+
commit — code that needs the handle (e.g. `useLinkingIntegration` below) must gate on it being
|
|
199
|
+
non-null first (Svelte's `bind:this` binds during mount, so `$effect`-gate on it; Solid's `ref`
|
|
200
|
+
callback fires during creation, strictly before any effect runs).
|
|
148
201
|
|
|
149
202
|
### Tabs, Drawer, hooks, deep linking, and state persistence
|
|
150
203
|
|
|
@@ -88,7 +88,7 @@ let Drawer = (() => {
|
|
|
88
88
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
89
89
|
template: `
|
|
90
90
|
@if (state(); as currentState) {
|
|
91
|
-
<
|
|
91
|
+
<view [style]="rootStyle()" [symbioteHostProps]="rootPanHandlers()">
|
|
92
92
|
@for (slot of slotOrder(); track slot) {
|
|
93
93
|
@switch (slot) {
|
|
94
94
|
@case ('content') {
|
|
@@ -132,7 +132,7 @@ let Drawer = (() => {
|
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
|
-
</
|
|
135
|
+
</view>
|
|
136
136
|
}
|
|
137
137
|
`,
|
|
138
138
|
})];
|
package/build/angular/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// views' ViewConfigs (../register, a side-effect import of the three codegen specs - never
|
|
4
4
|
// react-native-screens' own React components), then exposes Stack/Tab/Drawer with their Screen
|
|
5
5
|
// directives and navigator handles. Mirrors react/index.ts's barrel shape.
|
|
6
|
-
import '../register';
|
|
6
|
+
import '../register.js';
|
|
7
7
|
export { Stack } from './stack/index.js';
|
|
8
8
|
export { ScreenDirective } from './screen.directive.js';
|
|
9
9
|
export { injectNavigation, injectStackNavigation, injectTabNavigation, injectDrawerNavigation, injectRoute, injectIsFocused, injectFocusEffect, injectNavigationState, } from './injectors/index.js';
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// implements ITabNavigatorHandle`) - plus the descriptor bridge (`symbiote-descriptor-outlet`,
|
|
7
7
|
// `@symbiote-native/angular`) for the tab-bar leaf, exactly like Stack bridges its header config.
|
|
8
8
|
// Unlike Stack, a bottom-tabs bar is a PURE-JS UI: it paints
|
|
9
|
-
// ordinary `
|
|
9
|
+
// ordinary `view`/`text` primitives via the shared render fn, so there is no
|
|
10
10
|
// react-native-screens ViewConfig to register - Tab needs no `../register` import. Every tag this
|
|
11
11
|
// template names (`View`, `symbiote-descriptor-outlet`) is a REAL imported Angular component (no
|
|
12
12
|
// raw non-dashed native tag names the way stack.ts needs `NO_ERRORS_SCHEMA` for), so no loosened
|
|
@@ -71,8 +71,8 @@ let Tab = (() => {
|
|
|
71
71
|
],
|
|
72
72
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
73
73
|
template: `
|
|
74
|
-
<
|
|
75
|
-
<
|
|
74
|
+
<view [style]="rootStyle">
|
|
75
|
+
<view [style]="contentStyle">
|
|
76
76
|
@if (focusedRoute(); as route) {
|
|
77
77
|
@if (componentForRoute(route); as component) {
|
|
78
78
|
<ng-container
|
|
@@ -84,9 +84,9 @@ let Tab = (() => {
|
|
|
84
84
|
</ng-container>
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
</
|
|
87
|
+
</view>
|
|
88
88
|
<symbiote-descriptor-outlet [node]="tabBarDescriptor()" />
|
|
89
|
-
</
|
|
89
|
+
</view>
|
|
90
90
|
`,
|
|
91
91
|
})];
|
|
92
92
|
let _classDescriptor;
|
|
@@ -68,14 +68,14 @@ function panelBaseStyle(options) {
|
|
|
68
68
|
}
|
|
69
69
|
export function renderDrawer(view, options) {
|
|
70
70
|
const type = resolveDrawerType(options);
|
|
71
|
-
const content = el('
|
|
72
|
-
const panel = el('
|
|
71
|
+
const content = el('view', { ...view.contentPassthrough, style: CONTENT_STYLE }, []);
|
|
72
|
+
const panel = el('view', {
|
|
73
73
|
...view.panelPassthrough,
|
|
74
74
|
style: [panelBaseStyle(options), view.drawerStyle],
|
|
75
75
|
}, []);
|
|
76
76
|
const slots = { content, panel };
|
|
77
77
|
if (isDrawerOverlayVisible(options)) {
|
|
78
|
-
slots.overlay = el('
|
|
78
|
+
slots.overlay = el('view', {
|
|
79
79
|
...view.overlayPassthrough,
|
|
80
80
|
style: [OVERLAY_BASE_STYLE, { backgroundColor: view.overlayColor }],
|
|
81
81
|
}, []);
|
|
@@ -87,5 +87,5 @@ export function renderDrawer(view, options) {
|
|
|
87
87
|
return acc;
|
|
88
88
|
}, []);
|
|
89
89
|
const rootStyle = type === 'permanent' ? { ...ROOT_STYLE, flexDirection: 'row' } : ROOT_STYLE;
|
|
90
|
-
return el('
|
|
90
|
+
return el('view', { style: rootStyle }, children);
|
|
91
91
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// TabBar: the render half (framework-agnostic). A bottom-tabs bar is a PURE-JS UI - unlike
|
|
2
2
|
// Stack, which drives real native RNSScreen/RNSScreenStack views, this paints ordinary
|
|
3
|
-
// `
|
|
3
|
+
// `view`/`text` primitives, so it needs no react-native-screens ViewConfig
|
|
4
4
|
// work at all (see the task brief in packages/navigation's skill notes). Mirrors renderSwitch's
|
|
5
5
|
// shape: pure prop-driven functions building a `Descriptor` tree from pre-resolved view props;
|
|
6
6
|
// the adapter supplies focus state, tint-color resolution inputs, and the press wiring via
|
|
@@ -72,7 +72,7 @@ function renderIcon(icon, color) {
|
|
|
72
72
|
function renderBadge(badge) {
|
|
73
73
|
if (badge === undefined)
|
|
74
74
|
return undefined;
|
|
75
|
-
return el('
|
|
75
|
+
return el('view', { style: BADGE_STYLE }, [
|
|
76
76
|
txt({ style: BADGE_TEXT_STYLE }, [String(badge)]),
|
|
77
77
|
]);
|
|
78
78
|
}
|
|
@@ -87,11 +87,11 @@ export function renderTabBarItem(item) {
|
|
|
87
87
|
iconChildren.push(badge);
|
|
88
88
|
const children = [];
|
|
89
89
|
if (iconChildren.length > 0)
|
|
90
|
-
children.push(el('
|
|
90
|
+
children.push(el('view', { style: ICON_WRAPPER_STYLE }, iconChildren));
|
|
91
91
|
children.push(txt({ style: { color, fontSize: TAB_LABEL_FONT_SIZE } }, [item.label]));
|
|
92
|
-
return el('
|
|
92
|
+
return el('view', { ...item.passthrough, style: TAB_ITEM_STYLE, accessibilityRole: 'tab' }, children, item.key);
|
|
93
93
|
}
|
|
94
94
|
export function renderTabBar(view) {
|
|
95
95
|
const items = view.items.map(renderTabBarItem);
|
|
96
|
-
return el('
|
|
96
|
+
return el('view', { ...view.passthrough, style: [TAB_BAR_STYLE, view.style] }, items);
|
|
97
97
|
}
|
|
@@ -290,7 +290,7 @@ const DrawerImpl = forwardRef((props, forwardedRef) => {
|
|
|
290
290
|
const drawerChildren = order
|
|
291
291
|
.map(renderSlot)
|
|
292
292
|
.filter((element) => element !== null);
|
|
293
|
-
return createElement('
|
|
293
|
+
return createElement('view', { style: root.props.style, ...panResponder.panHandlers }, ...drawerChildren);
|
|
294
294
|
});
|
|
295
295
|
export const Drawer = Object.assign(DrawerImpl, { Screen: DrawerScreen });
|
|
296
296
|
// --- Explicit gap list vs the real react-native-gesture-handler + react-native-reanimated
|
package/build/react/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// native view primitives. Importing this barrel first registers the native views' ViewConfigs
|
|
3
3
|
// (../register, a side-effect import of the three codegen specs - never react-native-screens' own
|
|
4
4
|
// React components), then exposes Stack (with Stack.Screen attached) and the navigator handle.
|
|
5
|
-
import '../register';
|
|
5
|
+
import '../register.js';
|
|
6
6
|
export { Stack } from './stack/index.js';
|
|
7
7
|
export { Screen } from './screen.js';
|
|
8
8
|
export { useNavigation, useRoute, useIsFocused, useFocusEffect, useNavigationState, } from './hooks/index.js';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// router state, useId for route-key generation, useImperativeHandle for the jumpTo/setParams
|
|
5
5
|
// handle - plus the descriptor bridge for the tab-bar leaf, exactly like Stack bridges its header
|
|
6
6
|
// config (react/stack.ts). Unlike Stack, a bottom-tabs bar is a PURE-JS UI: it paints ordinary
|
|
7
|
-
// `
|
|
7
|
+
// `view`/`text` primitives via the shared render fn, so there is no
|
|
8
8
|
// react-native-screens ViewConfig to register here - Tab needs no `../register` import.
|
|
9
9
|
import { createElement, forwardRef, isValidElement, useCallback, useContext, useEffect, useId, useImperativeHandle, useMemo, useState, } from 'react';
|
|
10
10
|
import { descriptorToReact } from '@symbiote-native/react';
|
|
@@ -135,6 +135,6 @@ const TabImpl = forwardRef((props, forwardedRef) => {
|
|
|
135
135
|
},
|
|
136
136
|
}, createElement(focusedEntry.component))
|
|
137
137
|
: null;
|
|
138
|
-
return createElement('
|
|
138
|
+
return createElement('view', { style: TAB_ROOT_STYLE }, createElement('view', { style: TAB_CONTENT_STYLE }, content), tabBar);
|
|
139
139
|
});
|
|
140
140
|
export const Tab = Object.assign(TabImpl, { Screen: TabScreen });
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
// value: §4 of the same rules file. A value snapshot would freeze the drawer's own content at the
|
|
25
25
|
// state it was built with, and re-invoking it from inside a tracked scope would replace the whole
|
|
26
26
|
// panel subtree mid-gesture.
|
|
27
|
-
import { createEffect, createMemo, createSignal,
|
|
27
|
+
import { createEffect, createMemo, createSignal, onCleanup, untrack, } from 'solid-js';
|
|
28
28
|
import { Animated, createWindowDimensions } from '@symbiote-native/solid';
|
|
29
29
|
// createComponent from solid-js, insert from the renderer - see stack/index.ts's note.
|
|
30
30
|
import { createComponent } from 'solid-js';
|
|
@@ -342,21 +342,24 @@ function DrawerImpl(props) {
|
|
|
342
342
|
insert(node, children);
|
|
343
343
|
return node;
|
|
344
344
|
}
|
|
345
|
-
// ONE source, never a spread followed by an explicit prop: mergeProps
|
|
346
|
-
// NON-undefined value scanning back-to-front, so a later `undefined` silently
|
|
347
|
-
// earlier
|
|
348
|
-
//
|
|
349
|
-
//
|
|
350
|
-
//
|
|
351
|
-
|
|
345
|
+
// ONE source, never a spread followed by an explicit prop: mergeProps took the first
|
|
346
|
+
// NON-undefined value scanning back-to-front, so a later `undefined` silently lost to an
|
|
347
|
+
// earlier one (.claude/rules/solid-descriptor-bridge.md §6). A single bag removes the
|
|
348
|
+
// question, and the thunk is what keeps the slot's props live without rebuilding the node.
|
|
349
|
+
//
|
|
350
|
+
// No Animated.View: the engine resolves an AnimatedNode written into any prop of any host
|
|
351
|
+
// node, so the interpolation in `animatedStyle` binds from a plain `view`.
|
|
352
|
+
const animated = hostElement('view', () => ({
|
|
352
353
|
...slotDescriptor(slot).props,
|
|
353
354
|
style: [slotDescriptor(slot).props.style, animatedStyle(slot)],
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
355
|
+
}));
|
|
356
|
+
// An ACCESSOR, not a value: the slot's children are the focused screen, which mounts after
|
|
357
|
+
// this node is built. Reading once here yields the pre-mount slot and the screen never
|
|
358
|
+
// arrives — where the branch above may read eagerly, because its children are already built.
|
|
359
|
+
insert(animated, () => slotChildren(slot));
|
|
360
|
+
return animated;
|
|
358
361
|
}
|
|
359
|
-
const root = hostElement('
|
|
362
|
+
const root = hostElement('view', () => ({
|
|
360
363
|
...rootDescriptor().props,
|
|
361
364
|
...panResponder.panHandlers,
|
|
362
365
|
}));
|
|
@@ -367,7 +370,7 @@ function DrawerImpl(props) {
|
|
|
367
370
|
const current = shape();
|
|
368
371
|
return untrack(() => buildDrawer(current));
|
|
369
372
|
});
|
|
370
|
-
const host = hostElement('
|
|
373
|
+
const host = hostElement('view', () => ({ style: { flex: 1 } }));
|
|
371
374
|
insert(host, drawer);
|
|
372
375
|
return createComponent(ScreenCollectorProvider, {
|
|
373
376
|
value: collector,
|
package/build/solid/index.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
// signal, an effect or a subscription (createIsFocused / createFocusEffect / createNavigationState
|
|
11
11
|
// / createLinkingIntegration). Same rule the adapter's `createColorScheme` follows; a blanket `use`
|
|
12
12
|
// would read as a foreign ecosystem's convention (<adapter_src_follows_framework_idioms>).
|
|
13
|
-
import '../register';
|
|
13
|
+
import '../register.js';
|
|
14
14
|
export { Stack } from './stack/index.js';
|
|
15
15
|
export { Screen, TabScreen, DrawerScreen } from './screen.js';
|
|
16
16
|
export { useNavigation, useStackNavigation, useTabNavigation, useDrawerNavigation, useRoute, createIsFocused, createFocusEffect, createNavigationState, } from './primitives/index.js';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// every other adapter; here Solid supplies the lifecycle - a signal for the dispatched router
|
|
4
4
|
// state, a callback `ref` for the jumpTo/setParams handle - plus the descriptor bridge for the
|
|
5
5
|
// tab-bar leaf. Unlike Stack, a bottom-tabs bar is a PURE-JS UI painting ordinary
|
|
6
|
-
// `
|
|
6
|
+
// `view`/`text` primitives, so there is no react-native-screens ViewConfig to
|
|
7
7
|
// register here.
|
|
8
8
|
//
|
|
9
9
|
// TWO SOLID-ONLY REBUILD BOUNDARIES, both invisible in every other adapter:
|
|
@@ -209,11 +209,11 @@ function TabImpl(props) {
|
|
|
209
209
|
const found = state().routes.find(route => route.key === routeKey);
|
|
210
210
|
return found ?? { key: routeKey, name: '', params: undefined };
|
|
211
211
|
}
|
|
212
|
-
const contentHost = hostElement('
|
|
212
|
+
const contentHost = hostElement('view', () => ({
|
|
213
213
|
style: TAB_CONTENT_STYLE,
|
|
214
214
|
}));
|
|
215
215
|
insert(contentHost, content);
|
|
216
|
-
const root = hostElement('
|
|
216
|
+
const root = hostElement('view', () => ({ style: TAB_ROOT_STYLE }));
|
|
217
217
|
// ONE array insert rather than two: a second `insert` on the same parent would find the first
|
|
218
218
|
// child already there and REPLACE it (solid-js/universal's insertExpression), while an array is
|
|
219
219
|
// reconciled by identity - contentHost keeps its node, only the bar is swapped when it rebuilds.
|
|
@@ -35,10 +35,6 @@
|
|
|
35
35
|
IPanResponderGestureState,
|
|
36
36
|
ISymbioteEvent,
|
|
37
37
|
} from '@symbiote-native/engine';
|
|
38
|
-
// The ONLY import from the adapter's main barrel: `Animated.View` is a compiled `.svelte`
|
|
39
|
-
// component, so unlike PanResponder/Dimensions/AnimatedValue (pure engine re-exports, taken
|
|
40
|
-
// from the engine directly here) it has no `.svelte`-free home to import from.
|
|
41
|
-
import { Animated } from '@symbiote-native/svelte';
|
|
42
38
|
import {
|
|
43
39
|
DRAWER_DEFAULT_OVERLAY_COLOR,
|
|
44
40
|
NAVIGATION_EVENT_BLUR,
|
|
@@ -471,16 +467,18 @@
|
|
|
471
467
|
{@const descriptor = slotDescriptors.content}
|
|
472
468
|
{#if descriptor !== undefined}
|
|
473
469
|
{#if contentStyle !== undefined}
|
|
474
|
-
<
|
|
475
|
-
{
|
|
476
|
-
|
|
470
|
+
<view
|
|
471
|
+
p={{
|
|
472
|
+
...descriptor.props,
|
|
473
|
+
style: [descriptor.props.style, contentStyle],
|
|
474
|
+
}}
|
|
477
475
|
>
|
|
478
476
|
{@render screenContent()}
|
|
479
|
-
</
|
|
477
|
+
</view>
|
|
480
478
|
{:else}
|
|
481
|
-
<
|
|
479
|
+
<view p={descriptor.props}>
|
|
482
480
|
{@render screenContent()}
|
|
483
|
-
</
|
|
481
|
+
</view>
|
|
484
482
|
{/if}
|
|
485
483
|
{/if}
|
|
486
484
|
{/snippet}
|
|
@@ -489,12 +487,14 @@
|
|
|
489
487
|
{@const descriptor = slotDescriptors.overlay}
|
|
490
488
|
{#if descriptor !== undefined}
|
|
491
489
|
{#if overlayStyle !== undefined}
|
|
492
|
-
<
|
|
493
|
-
{
|
|
494
|
-
|
|
490
|
+
<view
|
|
491
|
+
p={{
|
|
492
|
+
...descriptor.props,
|
|
493
|
+
style: [descriptor.props.style, overlayStyle],
|
|
494
|
+
}}
|
|
495
495
|
/>
|
|
496
496
|
{:else}
|
|
497
|
-
<
|
|
497
|
+
<view p={descriptor.props} />
|
|
498
498
|
{/if}
|
|
499
499
|
{/if}
|
|
500
500
|
{/snippet}
|
|
@@ -503,32 +503,31 @@
|
|
|
503
503
|
{@const descriptor = slotDescriptors.panel}
|
|
504
504
|
{#if descriptor !== undefined}
|
|
505
505
|
{#if panelStyle !== undefined}
|
|
506
|
-
<
|
|
507
|
-
{...descriptor.props}
|
|
508
|
-
style={[descriptor.props.style, panelStyle]}
|
|
506
|
+
<view
|
|
507
|
+
p={{ ...descriptor.props, style: [descriptor.props.style, panelStyle] }}
|
|
509
508
|
>
|
|
510
509
|
{@render drawerContent?.({
|
|
511
510
|
state,
|
|
512
511
|
descriptors,
|
|
513
512
|
navigation: handle,
|
|
514
513
|
})}
|
|
515
|
-
</
|
|
514
|
+
</view>
|
|
516
515
|
{:else}
|
|
517
|
-
<
|
|
516
|
+
<view p={descriptor.props}>
|
|
518
517
|
{@render drawerContent?.({
|
|
519
518
|
state,
|
|
520
519
|
descriptors,
|
|
521
520
|
navigation: handle,
|
|
522
521
|
})}
|
|
523
|
-
</
|
|
522
|
+
</view>
|
|
524
523
|
{/if}
|
|
525
524
|
{/if}
|
|
526
525
|
{/snippet}
|
|
527
526
|
|
|
528
|
-
<
|
|
529
|
-
<
|
|
527
|
+
<view p={rootProps}>
|
|
528
|
+
<text p={SCREEN_REGISTRY_HOST_PROPS}>
|
|
530
529
|
{@render children?.()}
|
|
531
|
-
</
|
|
530
|
+
</text>
|
|
532
531
|
{#each order as slot (slot)}
|
|
533
532
|
{#if slot === 'content'}
|
|
534
533
|
{@render contentSlot()}
|
|
@@ -538,7 +537,7 @@
|
|
|
538
537
|
{@render panelSlot()}
|
|
539
538
|
{/if}
|
|
540
539
|
{/each}
|
|
541
|
-
</
|
|
540
|
+
</view>
|
|
542
541
|
|
|
543
542
|
<!-- --- Explicit gap list vs the real react-native-gesture-handler + react-native-reanimated
|
|
544
543
|
@react-navigation/drawer (confirmed against its current docs, mirrored verbatim from the
|
package/build/svelte/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// views' ViewConfigs (../register, a side-effect import of the codegen specs - never
|
|
4
4
|
// react-native-screens' own React components), then exposes Stack (with Stack.Screen attached)
|
|
5
5
|
// and the navigator handle. Mirrors vue/index.ts's barrel shape.
|
|
6
|
-
import '../register';
|
|
6
|
+
import '../register.js';
|
|
7
7
|
export { Stack } from './stack/index.js';
|
|
8
8
|
export { default as Screen } from './screen.svelte';
|
|
9
9
|
export { useNavigation, useStackNavigation, useTabNavigation, useDrawerNavigation, useRoute, useIsFocused, useFocusEffect, useNavigationState, } from './runes/index.js';
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
//
|
|
13
13
|
// therefore compiles to `from_tree([marker, ' ', marker])`, and each ' ' becomes an RCTRawText
|
|
14
14
|
// engine node parented to whatever host tag holds the `{@render children?.()}` call. Inside a
|
|
15
|
-
// plain `
|
|
15
|
+
// plain `view` that is the invalid "text outside a <text> component" shape; inside
|
|
16
16
|
// RNSScreenStack it is worse, since react-native-screens' native side expects only RNSScreen
|
|
17
17
|
// children there.
|
|
18
18
|
//
|
|
19
|
-
// So the markers are rendered inside a zero-size `
|
|
19
|
+
// So the markers are rendered inside a zero-size `text` instead: raw text inside an
|
|
20
20
|
// RCTText is LEGAL, which turns the hazard from a device crash into a no-op and makes it
|
|
21
21
|
// structurally impossible rather than a rule app authors have to remember. The cost is one
|
|
22
22
|
// collapsed, non-interactive RCTText per navigator.
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
// HOW SCREENS ARE DISCOVERED: not by reading `children`, which Svelte hands over as an opaque
|
|
16
16
|
// Snippet - the markers register themselves through the context collector (../screen-registry.ts)
|
|
17
17
|
// while the snippet renders, and the route list derives from that. The snippet is rendered
|
|
18
|
-
// inside a collapsed `
|
|
18
|
+
// inside a collapsed `text` (../registry-host.ts) so whitespace between two markers
|
|
19
19
|
// can never become an illegal raw-text child of a native view.
|
|
20
20
|
|
|
21
21
|
// Route keys must be unique per Stack INSTANCE (Svelte has no useId); a module counter is the
|
|
@@ -233,10 +233,10 @@
|
|
|
233
233
|
}
|
|
234
234
|
</script>
|
|
235
235
|
|
|
236
|
-
<
|
|
237
|
-
<
|
|
236
|
+
<view p={STACK_ROOT_PROPS}>
|
|
237
|
+
<text p={SCREEN_REGISTRY_HOST_PROPS}>
|
|
238
238
|
{@render children?.()}
|
|
239
|
-
</
|
|
239
|
+
</text>
|
|
240
240
|
<svelte:element
|
|
241
241
|
this={RNS_SCREEN_STACK_VIEW_NAME}
|
|
242
242
|
{@attach hostProps(stackProps)}
|
|
@@ -258,4 +258,4 @@
|
|
|
258
258
|
{/if}
|
|
259
259
|
{/each}
|
|
260
260
|
</svelte:element>
|
|
261
|
-
</
|
|
261
|
+
</view>
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
// with the React/Vue/Angular entries; here Svelte supplies the lifecycle - `$state.raw` for the
|
|
5
5
|
// router (its twin of useReducer), a module counter for route-key generation, `export
|
|
6
6
|
// function`s for the jumpTo/setParams handle - plus the Descriptor bridge for the tab-bar leaf.
|
|
7
|
-
// Unlike Stack, a bottom-tabs bar is a PURE-JS UI: it paints ordinary `
|
|
8
|
-
// `
|
|
7
|
+
// Unlike Stack, a bottom-tabs bar is a PURE-JS UI: it paints ordinary `view`/
|
|
8
|
+
// `text` primitives via the shared render fn, so there is no react-native-screens
|
|
9
9
|
// ViewConfig to register here - Tab needs no `../../register` import.
|
|
10
10
|
//
|
|
11
11
|
// Screens are discovered through the context collector (../screen-registry.ts), not by reading
|
|
@@ -253,17 +253,17 @@
|
|
|
253
253
|
});
|
|
254
254
|
</script>
|
|
255
255
|
|
|
256
|
-
<
|
|
257
|
-
<
|
|
256
|
+
<view p={TAB_ROOT_PROPS}>
|
|
257
|
+
<text p={SCREEN_REGISTRY_HOST_PROPS}>
|
|
258
258
|
{@render children?.()}
|
|
259
|
-
</
|
|
260
|
-
<
|
|
259
|
+
</text>
|
|
260
|
+
<view p={TAB_CONTENT_PROPS}>
|
|
261
261
|
{#if focusedScreen !== undefined}
|
|
262
262
|
{@const FocusedComponent = focusedScreen.component}
|
|
263
263
|
<NavigationScope value={focusedScreen.scope}>
|
|
264
264
|
<FocusedComponent />
|
|
265
265
|
</NavigationScope>
|
|
266
266
|
{/if}
|
|
267
|
-
</
|
|
268
|
-
<
|
|
269
|
-
</
|
|
267
|
+
</view>
|
|
268
|
+
<view p={tabBar.props} bind:this={tabBarHost} />
|
|
269
|
+
</view>
|
|
@@ -391,7 +391,7 @@ const DrawerImpl = defineComponent((_props, { attrs: rawAttrs, slots, expose })
|
|
|
391
391
|
const drawerChildren = order
|
|
392
392
|
.map(renderSlot)
|
|
393
393
|
.filter((element) => element !== null);
|
|
394
|
-
return h('
|
|
394
|
+
return h('view', { style: root.props.style, ...panResponder.panHandlers }, drawerChildren);
|
|
395
395
|
};
|
|
396
396
|
}, { name: 'Drawer', inheritAttrs: false });
|
|
397
397
|
export const Drawer = Object.assign(DrawerImpl, { Screen: DrawerScreen });
|
package/build/vue/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// native view primitives. Importing this barrel first registers the native views' ViewConfigs
|
|
3
3
|
// (../register, a side-effect import of the three codegen specs - never react-native-screens' own
|
|
4
4
|
// React components), then exposes Stack (with Stack.Screen attached) and the navigator handle.
|
|
5
|
-
import '../register';
|
|
5
|
+
import '../register.js';
|
|
6
6
|
export { Stack } from './stack/index.js';
|
|
7
7
|
export { Screen } from './screen.js';
|
|
8
8
|
export { useNavigation, useStackNavigation, useTabNavigation, useDrawerNavigation, useRoute, useIsFocused, useFocusEffect, useNavigationState, } from './composables/index.js';
|
package/build/vue/tabs/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// router state (Vue's twin of useReducer), useId for route-key generation, expose() for the
|
|
5
5
|
// jumpTo/setParams handle - plus the descriptor bridge for the tab-bar leaf, like Stack's header
|
|
6
6
|
// config (stack.ts). Unlike Stack, a bottom-tabs bar is a PURE-JS UI: it paints ordinary
|
|
7
|
-
// `
|
|
7
|
+
// `view`/`text` primitives via the shared render fn, so there is no
|
|
8
8
|
// react-native-screens ViewConfig to register here - Tab needs no `../register` import.
|
|
9
9
|
import { defineComponent, h, nextTick, onUnmounted, shallowRef, useId, } from '@vue/runtime-core';
|
|
10
10
|
import { descriptorToVue, normalizeVueAttrs } from '@symbiote-native/vue';
|
|
@@ -226,8 +226,8 @@ const TabImpl = defineComponent((_props, { attrs: rawAttrs, slots, expose }) =>
|
|
|
226
226
|
// NavigationScope provided just above (useRoute / useTabNavigation).
|
|
227
227
|
() => h(focusedEntry.component))
|
|
228
228
|
: null;
|
|
229
|
-
return h('
|
|
230
|
-
h('
|
|
229
|
+
return h('view', { style: TAB_ROOT_STYLE }, [
|
|
230
|
+
h('view', { style: TAB_CONTENT_STYLE }, content === null ? [] : [content]),
|
|
231
231
|
tabBar,
|
|
232
232
|
]);
|
|
233
233
|
};
|
|
@@ -359,7 +359,7 @@ export class Drawer {
|
|
|
359
359
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: Drawer, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
360
360
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: Drawer, isStandalone: true, selector: "Drawer", inputs: { initialRouteName: "initialRouteName", drawerStyle: "drawerStyle", drawerType: "drawerType", drawerPosition: "drawerPosition", drawerWidth: "drawerWidth", overlayColor: "overlayColor", swipeEnabled: "swipeEnabled", swipeEdgeWidth: "swipeEdgeWidth", swipeMinDistance: "swipeMinDistance", swipeMinVelocity: "swipeMinVelocity" }, queries: [{ propertyName: "drawerContentTemplate", first: true, predicate: ["drawerContent"], descendants: true, read: TemplateRef }, { propertyName: "drawerScreenChildren", predicate: DrawerScreenDirective }], usesOnChanges: true, ngImport: i0, template: `
|
|
361
361
|
@if (state(); as currentState) {
|
|
362
|
-
<
|
|
362
|
+
<view [style]="rootStyle()" [symbioteHostProps]="rootPanHandlers()">
|
|
363
363
|
@for (slot of slotOrder(); track slot) {
|
|
364
364
|
@switch (slot) {
|
|
365
365
|
@case ('content') {
|
|
@@ -403,9 +403,9 @@ export class Drawer {
|
|
|
403
403
|
}
|
|
404
404
|
}
|
|
405
405
|
}
|
|
406
|
-
</
|
|
406
|
+
</view>
|
|
407
407
|
}
|
|
408
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: NavigationScopeDirective, selector: "[symbioteNavigationScope]", inputs: ["symbioteNavigationScope", "navigation", "emitter"] }, { kind: "directive", type: SymbioteHostPropsDirective, selector: "[symbioteHostProps]", inputs: ["symbioteHostProps"], exportAs: ["symbioteHost"] }, { kind: "component", type: View, selector: "
|
|
408
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: NavigationScopeDirective, selector: "[symbioteNavigationScope]", inputs: ["symbioteNavigationScope", "navigation", "emitter"] }, { kind: "directive", type: SymbioteHostPropsDirective, selector: "[symbioteHostProps]", inputs: ["symbioteHostProps"], exportAs: ["symbioteHost"] }, { kind: "component", type: View, selector: "view" }, { kind: "component", type: AnimatedView, selector: "AnimatedView, symbiote-animated-view", inputs: ["style", "testID", "animatedProps", "passthroughAnimatedPropExplicitValues"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
409
409
|
}
|
|
410
410
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: Drawer, decorators: [{
|
|
411
411
|
type: Component,
|
|
@@ -423,7 +423,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
423
423
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
424
424
|
template: `
|
|
425
425
|
@if (state(); as currentState) {
|
|
426
|
-
<
|
|
426
|
+
<view [style]="rootStyle()" [symbioteHostProps]="rootPanHandlers()">
|
|
427
427
|
@for (slot of slotOrder(); track slot) {
|
|
428
428
|
@switch (slot) {
|
|
429
429
|
@case ('content') {
|
|
@@ -467,7 +467,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
467
467
|
}
|
|
468
468
|
}
|
|
469
469
|
}
|
|
470
|
-
</
|
|
470
|
+
</view>
|
|
471
471
|
}
|
|
472
472
|
`,
|
|
473
473
|
}]
|