Skip to content

Commit 40ec16a

Browse files
fix(mobile): the Duo sidebar changes with the rotation, not after it (#24951)
Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent 8096799 commit 40ec16a

8 files changed

Lines changed: 60 additions & 20 deletions
-770 KB
Binary file not shown.
771 KB
Binary file not shown.

‎apps/mobile/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@
134134
"react-native-pdf-jsi": "5.0.0",
135135
"react-native-reanimated": "4.7.1",
136136
"react-native-safe-area-context": "~5.10.1",
137-
"react-native-screens": "file:deps/react-native-screens-5.0.0-t3.43.tgz",
137+
"react-native-screens": "file:deps/react-native-screens-5.0.0-t3.44.tgz",
138138
"react-native-svg": "15.16.0",
139139
"react-native-webview": "14.0.1",
140140
"react-native-worklets": "0.13.0",

‎apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,24 @@ function AdaptiveWorkspaceLayoutContent(
743743
});
744744
};
745745

746+
// Rotating flips the overlay; until the new size reaches JS, predict the reset above.
747+
const sidebarOverRotates =
748+
nativeWorkspace && nativeMetrics?.hasHinge === true && layout.usesSplitView;
749+
// The current orientation's panes already account for an inspector that needs the sidebar's room.
750+
const sidebarInLandscape = baseLayout.primarySidebarOverlaysContent
751+
? primarySidebarPinned || primarySidebarPreferredVisible
752+
: panes.primarySidebarVisible;
753+
const sidebarInPortrait =
754+
primarySidebarPinned ||
755+
(baseLayout.primarySidebarOverlaysContent
756+
? overlaySidebar.visible
757+
: isWorkspaceListPath(pathname));
758+
const sidebarByOrientation = useMemo(
759+
() =>
760+
sidebarOverRotates ? { landscape: sidebarInLandscape, portrait: sidebarInPortrait } : null,
761+
[sidebarInLandscape, sidebarInPortrait, sidebarOverRotates],
762+
);
763+
746764
const contextValue = {
747765
layout,
748766
panes,
@@ -762,6 +780,7 @@ function AdaptiveWorkspaceLayoutContent(
762780
setAuxiliaryPaneWidth,
763781
composerKeyboardActive,
764782
setComposerEditing,
783+
sidebarByOrientation,
765784
};
766785

767786
if (nativeWorkspace) {

‎apps/mobile/src/features/layout/adaptive-workspace-context.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ interface AdaptiveWorkspaceContextValue {
4141
* sidebar and rail step aside and the thread header drops to one line.
4242
*/
4343
readonly composerKeyboardActive: boolean;
44+
/**
45+
* Whether the sidebar shows in each orientation, where it floats over the content in portrait
46+
* (the unfolded Duo). The native split switches between them as a rotation starts.
47+
*/
48+
readonly sidebarByOrientation: { readonly landscape: boolean; readonly portrait: boolean } | null;
4449
/** The thread composer reports its focus so the layout can make room for typing. */
4550
readonly setComposerEditing: (editing: boolean) => void;
4651
}
@@ -73,6 +78,7 @@ export const AdaptiveWorkspaceContext = createContext<AdaptiveWorkspaceContextVa
7378
openWorkspaceTab: () => undefined,
7479
setAuxiliaryPaneWidth: () => undefined,
7580
composerKeyboardActive: false,
81+
sidebarByOrientation: null,
7682
setComposerEditing: () => undefined,
7783
});
7884

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

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ function WorkspaceColumns(
182182
toggleAuxiliaryPane,
183183
startNewTask,
184184
openWorkspaceTab,
185+
sidebarByOrientation,
185186
} = useAdaptiveWorkspaceLayout();
186187
const deviceType = useDeviceType();
187188
const settingsDetailIn = (detail: readonly Route[]) =>
@@ -302,7 +303,13 @@ function WorkspaceColumns(
302303
<Split.Host
303304
ref={hostRef}
304305
testID="adaptive-workspace-layout"
305-
preferredSplitBehavior={layout.primarySidebarOverlaysContent ? "overlay" : "tile"}
306+
preferredSplitBehavior={
307+
!sidebarByOrientation && layout.primarySidebarOverlaysContent ? "overlay" : "tile"
308+
}
309+
portraitPreferredSplitBehavior={sidebarByOrientation ? "overlay" : undefined}
310+
portraitPreferredDisplayMode={
311+
sidebarByOrientation ? sidebarDisplayMode(sidebarByOrientation.portrait, true) : undefined
312+
}
306313
primaryBackgroundStyle={deviceType === "pad" ? "none" : "default"}
307314
topColumnForCollapsing={compactColumn}
308315
onCollapse={() => {
@@ -326,14 +333,17 @@ function WorkspaceColumns(
326333
openWorkspaceTab(tab ?? "threads", { columns: true });
327334
}}
328335
preferredDisplayMode={
329-
// UIKit applies the mode as a collapsed split expands, before the new width reaches JS, so a
330-
// collapsed split already carries the sidebar the expanded one will show.
331-
(layout.usesSplitView ? panes.primarySidebarVisible : panes.primarySidebarWhenExpanded) ||
332-
(!layout.usesSplitView && !activeDetailKey)
333-
? layout.primarySidebarOverlaysContent
334-
? "oneOverSecondary"
335-
: "oneBesideSecondary"
336-
: "secondaryOnly"
336+
sidebarByOrientation
337+
? sidebarDisplayMode(sidebarByOrientation.landscape, false)
338+
: sidebarDisplayMode(
339+
// UIKit applies the mode as a collapsed split expands, before the new width reaches
340+
// JS, so a collapsed split already carries the sidebar the expanded one will show.
341+
(layout.usesSplitView
342+
? panes.primarySidebarVisible
343+
: panes.primarySidebarWhenExpanded) ||
344+
(!layout.usesSplitView && !activeDetailKey),
345+
layout.primarySidebarOverlaysContent,
346+
)
337347
}
338348
onDisplayModeWillChange={({ nativeEvent }) => {
339349
if (!layout.primarySidebarOverlaysContent) return;
@@ -604,3 +614,8 @@ export function createWorkspaceStackNavigator<
604614
>(config?: Config): TypedNavigator<TypeBag, Config> {
605615
return createNavigatorFactory(WorkspaceStackNavigator)(config);
606616
}
617+
618+
function sidebarDisplayMode(visible: boolean, overlay: boolean) {
619+
if (!visible) return "secondaryOnly";
620+
return overlay ? "oneOverSecondary" : "oneBesideSecondary";
621+
}

‎docs/operations/mobile-screens-fork.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Building the mobile Screens dependency
22

33
The mobile v5 stack uses a committed tarball from the
4-
[T3 Screens fork](https://github.com/PixPMusic/react-native-screens/tree/t3-v5.0.0-t3.43).
4+
[T3 Screens fork](https://github.com/pingdotgg/react-native-screens/tree/t3-v5.0.0-t3.44).
55
The fork owns the integration changes; the app does not patch this package.
66
Each archive includes compiled JavaScript, declarations, native source and
77
`t3-fork.json` recording its version, source commit and upstream base.

‎pnpm-lock.yaml‎

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)