Skip to content

Commit fcdf208

Browse files
fix(mobile): align native stack focus contexts
1 parent c9508f7 commit fcdf208

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

‎apps/mobile/src/features/layout/createWorkspaceStackNavigator.ios.tsx‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,13 @@ function WorkspaceStackView(props: ViewProps) {
234234
if (!primaryRoute) return <V5StackView {...props} />;
235235
const primaryDescriptor = props.descriptors[primaryRoute.key]!;
236236
const baseRoute = { key: `${props.state.key}:workspace`, name: "Workspace" };
237+
const visibleRoute = projection.detail.at(-1) ?? primaryRoute;
237238
const baseDescriptor: Descriptor = {
238239
...primaryDescriptor,
240+
navigation: props.descriptors[visibleRoute.key]!.navigation,
239241
// The native envelope keeps a stable key, but its NavigationProvider must
240242
// identify the real visible route or useIsFocused closes media viewers.
241-
route: projection.detail.at(-1) ?? primaryRoute,
243+
route: visibleRoute,
242244
options: { headerShown: false },
243245
render: () => <WorkspaceColumns {...props} primary={primaryRoute} detail={projection.detail} />,
244246
};
@@ -256,11 +258,13 @@ function WorkspaceStackView(props: ViewProps) {
256258
overlays.map((group) => {
257259
const route = group[0]!;
258260
const descriptor = props.descriptors[route.key]!;
261+
const visibleRoute = group.at(-1)!;
259262
return [
260263
route.key,
261264
{
262265
...descriptor,
263-
route: group.at(-1)!,
266+
navigation: props.descriptors[visibleRoute.key]!.navigation,
267+
route: visibleRoute,
264268
options: modalEnvelopeOptions(descriptor.options),
265269
render: () => (
266270
<V5CardStackView

‎apps/mobile/src/native/createV5StackNavigator.ios.tsx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,14 @@ export function V5StackView(props: V5StackViewProps) {
207207
groups.map((group) => {
208208
const first = group[0]!;
209209
const descriptor = props.descriptors[first.key]!;
210+
const visibleRoute = group.at(-1)!;
210211
return [
211212
first.key,
212213
{
213214
...descriptor,
215+
navigation: props.descriptors[visibleRoute.key]!.navigation,
214216
// Focus belongs to the pushed page inside this presentation group.
215-
route: group.at(-1)!,
217+
route: visibleRoute,
216218
options: modalEnvelopeOptions(descriptor.options),
217219
render: () => (
218220
<V5CardStackView

0 commit comments

Comments
 (0)