@devries-cameron20 / t3code-1 / commits / 7ccd02cc81
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(mobile): smoother Settings and composer transitions on wide Android (#26297)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Nov 3, 2026 at 18:40 UTC 7ccd02cc810ab1ecee5ba505c960971d90e33a7c
11 files changed +182 -63
apps/mobile/src/Stack.tsx
+8 -2
@@ -1042,9 +1042,15 @@ export const RootStack = RootStackConfig.with(function AdaptiveRootStack({ Navig
1042 return (
1043 <Navigator
1044 screenLayout={(props) => <GuardedScreenLayout {...props} />}
1045 - screenOptions={({ route }) =>
1045 + screenOptions={({ route, navigation }) =>
1046 Platform.OS === "android"
1047 - ? { animation: androidWorkspaceDestinationAnimation(route.name, usesSplitView) }
1047 + ? {
1048 + animation: androidWorkspaceDestinationAnimation(
1049 + route,
1050 + navigation.getState().routes,
1051 + usesSplitView,
1052 + ),
1053 + }
1054 : {}
1055 }
1056 />
apps/mobile/src/features/keyboard/useSoftKeyboardShowing.ts new
+26
@@ -0,0 +1,26 @@
1 +import { useSyncExternalStore } from "react";
2 +import { KeyboardController, KeyboardEvents } from "react-native-keyboard-controller";
3 +
4 +// `useKeyboardState` only flips on willShow and didHide. This follows the will-events, so a
5 +// layout that makes room for the keyboard gives it back as soon as the keyboard starts hiding.
6 +let keyboardShowing = KeyboardController.isVisible();
7 +function subscribeKeyboardShowing(onChange: () => void) {
8 + keyboardShowing = KeyboardController.isVisible();
9 + const willShow = KeyboardEvents.addListener("keyboardWillShow", () => {
10 + keyboardShowing = true;
11 + onChange();
12 + });
13 + const willHide = KeyboardEvents.addListener("keyboardWillHide", () => {
14 + keyboardShowing = false;
15 + onChange();
16 + });
17 + return () => {
18 + willShow.remove();
19 + willHide.remove();
20 + };
21 +}
22 +const getKeyboardShowing = () => keyboardShowing;
23 +
24 +export function useSoftKeyboardShowing() {
25 + return useSyncExternalStore(subscribeKeyboardShowing, getKeyboardShowing);
26 +}
apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx
+83 -21
@@ -3,6 +3,7 @@ import {
3 WorkspacePresentationHostContext,
4 } from "./workspace-presentation-context";
5 import { useAndroidFloatingTabs } from "../settings/appearance/AppearancePreferencesProvider";
6 +import { useSoftKeyboardShowing } from "../keyboard/useSoftKeyboardShowing";
7 import { SafeAreaInsetsContext, useSafeAreaInsets } from "react-native-safe-area-context";
8 import { AdaptiveWorkspaceContext, useAdaptiveWorkspaceLayout } from "./adaptive-workspace-context";
9 import { threadSelectionDeferral } from "./deferred-navigation";
@@ -28,7 +29,7 @@ import {
29 useWindowDimensions,
30 View,
31 } from "react-native";
31 -import { KeyboardController, useKeyboardState } from "react-native-keyboard-controller";
32 +import { KeyboardController, useKeyboardContext } from "react-native-keyboard-controller";
33 import Animated, {
34 runOnJS,
35 useAnimatedStyle,
@@ -285,20 +286,32 @@ function AdaptiveWorkspaceLayoutContent(
286 usesSplitView: baseLayout.usesSplitView,
287 });
288 const [composerEditing, setComposerEditing] = useState(false);
288 - const softKeyboardVisible = useKeyboardState((state) => state.isVisible);
289 + const softKeyboardVisible = useSoftKeyboardShowing();
290 // Keyed on the soft keyboard, not focus: a hardware keyboard leaves room for the sidebar, and
290 - // Back closes the keyboard while the editor keeps focus. Deferred so the composer commits its
291 - // keyboard render first; relaying out in the same commit held it behind the keyboard.
291 + // Back closes the keyboard while the editor keeps focus. The sidebar returns as the keyboard
292 + // starts hiding, not after. Deferred so the composer commits its keyboard render first;
293 + // relaying out in the same commit held it behind the keyboard.
294 const composerKeyboardActive = useDeferredValue(
295 Platform.OS === "android" && baseLayout.usesSplitView && composerEditing && softKeyboardVisible,
296 );
297 + const sidebarWithoutKeyboard =
298 + !workspacePage && (primarySidebarPinned || preferredSidebarVisible);
299 const showPrimarySidebar =
296 - !workspacePage &&
297 - (primarySidebarPinned || (preferredSidebarVisible && !composerKeyboardActive));
300 + sidebarWithoutKeyboard && (primarySidebarPinned || !composerKeyboardActive);
301 // Medium windows float the sidebar over a page; beside a list it keeps its room.
302 const sidebarFloats =
303 baseLayout.variant === "medium" &&
304 (nativeWorkspace || (!primarySidebarPinned && !workspacePage));
305 + // While the composer edits, the sidebar's width follows the keyboard's own progress, so it
306 + // leaves and returns in step with the keyboard instead of on a timer of its own.
307 + const keyboardHoldsSidebar =
308 + Platform.OS === "android" &&
309 + baseLayout.usesSplitView &&
310 + !workspacePage &&
311 + !primarySidebarPinned &&
312 + !sidebarFloats &&
313 + (composerEditing || composerKeyboardActive);
314 + const keyboardProgress = useKeyboardContext().reanimated.progress;
315 const shouldRenderNavigationRail =
316 Platform.OS === "android" && baseLayout.usesSplitView && !floatingTabsEnabled;
317 const enabledTabs = useEnabledNavigationTabs();
@@ -405,6 +418,37 @@ function AdaptiveWorkspaceLayoutContent(
418 workspacePage,
419 ],
420 );
421 + // Whether the sidebar is open once the keyboard is gone; the keyboard's progress scales it.
422 + const sidebarRestsOpen = useMemo(
423 + () =>
424 + showPrimarySidebar === sidebarWithoutKeyboard
425 + ? panes.primarySidebarVisible
426 + : deriveWorkspacePaneLayout({
427 + layout,
428 + viewportWidth: width,
429 + nativeWorkspace,
430 + primarySidebarFloats: sidebarFloats,
431 + primarySidebarPreferredVisible: sidebarWithoutKeyboard,
432 + auxiliaryPanePreferredVisible:
433 + !workspacePage && inspectorActive && fileInspectorPreferredVisible,
434 + auxiliaryPanePreferredWidth: fileInspectorPreferredWidth ?? undefined,
435 + nativeInspectorWidth,
436 + }).primarySidebarVisible,
437 + [
438 + nativeInspectorWidth,
439 + fileInspectorPreferredVisible,
440 + fileInspectorPreferredWidth,
441 + inspectorActive,
442 + layout,
443 + nativeWorkspace,
444 + panes.primarySidebarVisible,
445 + showPrimarySidebar,
446 + sidebarFloats,
447 + sidebarWithoutKeyboard,
448 + width,
449 + workspacePage,
450 + ],
451 + );
452 // Routes still on the stack remember their reveal, so going back to one keeps the user's choice.
453 const revealedInspectors = useRef<ReadonlyMap<string, string>>(new Map());
454 const workspaceInspectorOwner = useRef<symbol | null>(null);
@@ -704,10 +748,16 @@ function AdaptiveWorkspaceLayoutContent(
748 panes.primarySidebarVisible ? (layout.listPaneWidth ?? 0) + (layout.listPaneGap ?? 0) : 0,
749 );
750 const renderedRailWidth = useSharedValue(navigationRailWidth);
751 + const keyboardHold = useSharedValue(keyboardHoldsSidebar);
752 const leavingWorkspacePage = useRef(false);
753 // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- animates the Reanimated rail and sidebar width shared values toward the layout's targets
754 useEffect(() => {
755 if (nativeWorkspace) return;
756 + // Released mid-keyboard (the composer blurred), the timing starts where the sidebar is drawn.
757 + if (keyboardHold.get() && !keyboardHoldsSidebar) {
758 + renderedSidebarWidth.set(renderedSidebarWidth.get() * (1 - keyboardProgress.get()));
759 + }
760 + keyboardHold.set(keyboardHoldsSidebar);
761 renderedRailWidth.set(withTiming(navigationRailWidth, WORKSPACE_PANE_TIMING));
762 // A workspace page hides the sidebar through React instead, in the same commit that mounts
763 // the page. Animating it here would hide it a few frames before the page appears.
@@ -717,7 +767,7 @@ function AdaptiveWorkspaceLayoutContent(
767 }
768 const snap = leavingWorkspacePage.current;
769 leavingWorkspacePage.current = false;
720 - const targetWidth = panes.primarySidebarVisible
770 + const targetWidth = (keyboardHoldsSidebar ? sidebarRestsOpen : panes.primarySidebarVisible)
771 ? (layout.listPaneWidth ?? 0) + (layout.listPaneGap ?? 0)
772 : 0;
773 // The content beside it already took its final width when the page closed.
@@ -732,6 +782,10 @@ function AdaptiveWorkspaceLayoutContent(
782 layout.listPaneWidth,
783 layout.listPaneGap,
784 panes.primarySidebarVisible,
785 + keyboardHoldsSidebar,
786 + keyboardHold,
787 + keyboardProgress,
788 + sidebarRestsOpen,
789 renderedSidebarWidth,
790 renderedRailWidth,
791 settleListPane,
@@ -765,19 +819,23 @@ function AdaptiveWorkspaceLayoutContent(
819 // Showing or hiding the sidebar clips a fixed-width list. A hinge resize instead tracks the
820 // animated edge, so the header actions slide with it rather than jumping or being covered.
821 const listPaneGap = layout.listPaneGap ?? 0;
822 + const drawnSidebarWidth = useDerivedValue(
823 + () => renderedSidebarWidth.value * (keyboardHold.value ? 1 - keyboardProgress.value : 1),
824 + );
825 const listPaneAnimatedStyle = useAnimatedStyle(() => ({
826 width: Math.min(
827 listPaneCeiling,
771 - Math.max(listPaneFloor, renderedSidebarWidth.value - listPaneGap),
828 + Math.max(listPaneFloor, drawnSidebarWidth.value - listPaneGap),
829 ),
830 + // Following the keyboard, the list rides the sidebar's edge like the content beside it,
831 + // instead of being uncovered in place.
832 + transform: [{ translateX: drawnSidebarWidth.value - renderedSidebarWidth.value }],
833 }));
834 const sidebarAnimatedStyle = useAnimatedStyle(() => ({
835 // Fading a UIKit glass ancestor can leave remounted header effects missing.
836 opacity:
777 - Platform.OS === "ios" || floatingTabsEnabled
778 - ? 1
779 - : Math.min(1, renderedSidebarWidth.value / 80),
780 - width: renderedSidebarWidth.value,
837 + Platform.OS === "ios" || floatingTabsEnabled ? 1 : Math.min(1, drawnSidebarWidth.value / 80),
838 + width: drawnSidebarWidth.value,
839 }));
840
841 // Clip the navigator at its settled width so native headers and markdown reflow only once per pane toggle.
@@ -787,7 +845,7 @@ function AdaptiveWorkspaceLayoutContent(
845 0,
846 viewportWidth -
847 (sidebarFloats ? 0 : renderedRailWidth.value) -
790 - (workspacePage || sidebarFloats ? 0 : renderedSidebarWidth.value) -
848 + (workspacePage || sidebarFloats ? 0 : drawnSidebarWidth.value) -
849 renderedInspectorWidth.value,
850 ),
851 );
@@ -951,14 +1009,18 @@ function AdaptiveWorkspaceLayoutContent(
1009 <Animated.View
1010 collapsable={false}
1011 style={[
954 - contentTargetWidth !== null
955 - ? {
956 - flex: 1,
957 - width: contentTargetWidth,
958 - alignSelf: contentAnchor.end ? "flex-end" : "flex-start",
959 - marginRight: contentAnchor.end ? contentEndGap : 0,
960 - }
961 - : { flex: 1 },
1012 + // While the keyboard moves the sidebar, the content tracks its edge every frame so
1013 + // the two land together; a settled width would jump when React commits mid-slide.
1014 + keyboardHoldsSidebar
1015 + ? { flex: 1, marginRight: contentEndGap }
1016 + : contentTargetWidth !== null
1017 + ? {
1018 + flex: 1,
1019 + width: contentTargetWidth,
1020 + alignSelf: contentAnchor.end ? "flex-end" : "flex-start",
1021 + marginRight: contentAnchor.end ? contentEndGap : 0,
1022 + }
1023 + : { flex: 1 },
1024 Platform.OS === "android" ? androidNavigatorLimit : undefined,
1025 ]}
1026 >
apps/mobile/src/features/settings/SettingsKeyboardRouteScreen.tsx
+3 -3
@@ -1,11 +1,11 @@
1 import { ScreenScrollView as ScrollView } from "../../components/ui/ScreenScrollView";
2 import { useAtomSet, useAtomValue } from "@effect/atom-react";
3 -import { useNavigation } from "@react-navigation/native";
3 import { AsyncResult } from "effect/reactivity";
4 import { Platform, View } from "react-native";
5 import { useSafeAreaInsets } from "react-native-safe-area-context";
6
7 import { AppBar } from "../../components/ui/AppBar";
8 +import { useSettingsPageBack } from "./useSettingsPageBack";
9 import { AppText as Text } from "../../components/ui/AppText";
10 import { NativeStackScreenOptions } from "../../native/StackHeader";
11 import {
@@ -34,7 +34,7 @@ const ENTER_BEHAVIOR_OPTIONS: ReadonlyArray<{
34 ];
35
36 export function SettingsKeyboardRouteScreen() {
37 - const navigation = useNavigation();
37 + const back = useSettingsPageBack();
38 const insets = useSafeAreaInsets();
39 const preferencesResult = useAtomValue(mobilePreferencesAtom);
40 const savePreferences = useAtomSet(updateMobilePreferencesAtom);
@@ -48,7 +48,7 @@ export function SettingsKeyboardRouteScreen() {
48 {Platform.OS === "android" ? (
49 <>
50 <NativeStackScreenOptions options={{ headerShown: false }} />
51 - <AppBar embedded title="Keyboard" onBack={() => navigation.goBack()} />
51 + <AppBar embedded title="Keyboard" onBack={back} />
52 </>
53 ) : null}
54 <ScrollView
apps/mobile/src/features/settings/SettingsWorkspaceLayout.android.tsx
+2 -1
@@ -33,7 +33,8 @@ export function SettingsWorkspaceLayout(props: { readonly children: ReactNode })
33 </View>
34 </Activity>
35 ) : null}
36 - <View className="flex-1">
36 + {/* A push slides the page underneath to the left; keep it out of the list beside it. */}
37 + <View className="flex-1 overflow-hidden">
38 <View
39 className="flex-1"
40 pointerEvents={emptyDetail ? "none" : "auto"}
apps/mobile/src/features/settings/components/SettingsScreen.tsx
+4 -3
@@ -1,4 +1,4 @@
1 -import { useNavigation, useRoute } from "@react-navigation/native";
1 +import { useRoute } from "@react-navigation/native";
2 import type { ReactNode } from "react";
3 import { Platform, View } from "react-native";
4
@@ -9,6 +9,7 @@ import { useWorkspaceTabs } from "../../workspace/WorkspaceTabsContext";
9 import { useDeviceType } from "../../../native/native-layout-metrics";
10 import { useCompactWorkspaceTabs } from "../../workspace/useSystemWorkspaceTabBar";
11 import { useAdaptiveWorkspaceLayout } from "../../layout/adaptive-workspace-context";
12 +import { useSettingsPageBack } from "../useSettingsPageBack";
13 import {
14 ScreenScrollViewBottomInset,
15 ScreenScrollViewSurface,
@@ -23,12 +24,12 @@ export function SettingsScreen(
24 readonly workspaceRoot?: boolean;
25 },
26 ) {
26 - const navigation = useNavigation();
27 const route = useRoute();
28 const workspace = useWorkspaceTabs();
29 const deviceType = useDeviceType();
30 const compactTabs = useCompactWorkspaceTabs();
31 const { layout } = useAdaptiveWorkspaceLayout();
32 + const back = useSettingsPageBack();
33 const cover = deviceType === "duo-folded";
34 // Android opens Settings as a workspace tab; its root page has nothing to go back to.
35 const workspaceRoot =
@@ -47,7 +48,7 @@ export function SettingsScreen(
48 // iOS screens put their filter menus in native header items themselves.
49 menus={Platform.OS === "android" ? props.menus : undefined}
50 sheet={Platform.OS === "android" && props.formSheet}
50 - onBack={workspaceRoot ? undefined : () => navigation.goBack()}
51 + onBack={workspaceRoot ? undefined : back}
52 hideBottomBorder={!props.formSheet || Platform.OS === "android"}
53 options={props.options}
54 />
apps/mobile/src/features/settings/useSettingsPageBack.ts new
+25
@@ -0,0 +1,25 @@
1 +import { useNavigation, useRoute } from "@react-navigation/native";
2 +import { Platform } from "react-native";
3 +
4 +import { resetAndroidWorkspace } from "../../lib/android-workspace-navigation";
5 +import { useHardwareBack } from "../../lib/backHandler";
6 +import { useAdaptiveWorkspaceLayout } from "../layout/adaptive-workspace-context";
7 +
8 +/**
9 + * The page's Back action, or undefined for the first page beside the Settings list on wide
10 + * Android: that page roots the detail column, so Back leaves Settings rather than emptying it.
11 + */
12 +export function useSettingsPageBack() {
13 + const navigation = useNavigation();
14 + const route = useRoute();
15 + const { layout } = useAdaptiveWorkspaceLayout();
16 + const routes = navigation.getState()?.routes ?? [];
17 + const below = routes[routes.findIndex((candidate) => candidate.key === route.key) - 1];
18 + const columnRoot =
19 + Platform.OS === "android" && layout.usesSplitView && below?.name === "Settings";
20 + useHardwareBack(columnRoot, () => {
21 + resetAndroidWorkspace(navigation);
22 + return true;
23 + });
24 + return columnRoot ? undefined : () => navigation.goBack();
25 +}
apps/mobile/src/features/terminal/ThreadTerminalRouteScreen.tsx
+4 -23
@@ -13,7 +13,7 @@ import { AppBar } from "../../components/ui/AppBar";
13 import { useNativeColumnLayoutMetrics } from "../../native/native-layout-metrics";
14 import { StackActions, useNavigation, type StaticScreenProps } from "@react-navigation/native";
15 import { useAtomMount } from "@effect/atom-react";
16 -import { useMemo, useRef, useState, useSyncExternalStore } from "react";
16 +import { useMemo, useRef, useState } from "react";
17 import { Platform, Pressable, View } from "react-native";
18 import { useSafeAreaInsets } from "react-native-safe-area-context";
19 import { AppText as Text } from "../../components/ui/AppText";
@@ -24,7 +24,6 @@ import * as Schema from "effect/Schema";
24 import { AsyncResult } from "effect/reactivity";
25 import {
26 KeyboardController,
27 - KeyboardEvents,
27 KeyboardStickyView,
28 useKeyboardState,
29 } from "react-native-keyboard-controller";
@@ -35,6 +34,7 @@ import {
34 ComposerToolbarScroller,
35 } from "../../components/ComposerToolbar";
36 import { EmptyState } from "../../components/ui/EmptyState";
37 +import { useSoftKeyboardShowing } from "../keyboard/useSoftKeyboardShowing";
38 import { GlassSurface } from "../../components/ui/GlassSurface";
39 import { LoadingScreen } from "../../components/LoadingScreen";
40 import { ScreenContent } from "../../components/ui/ScreenContent";
@@ -352,26 +352,6 @@ function readLiveTerminalSessions(
352 }));
353 }
354
355 -// `useKeyboardState` only flips on willShow and didHide; the accessory must
356 -// leave as soon as the keyboard starts hiding, so it follows the will-events.
357 -let keyboardShowing = KeyboardController.isVisible();
358 -function subscribeKeyboardShowing(onChange: () => void) {
359 - keyboardShowing = KeyboardController.isVisible();
360 - const willShow = KeyboardEvents.addListener("keyboardWillShow", () => {
361 - keyboardShowing = true;
362 - onChange();
363 - });
364 - const willHide = KeyboardEvents.addListener("keyboardWillHide", () => {
365 - keyboardShowing = false;
366 - onChange();
367 - });
368 - return () => {
369 - willShow.remove();
370 - willHide.remove();
371 - };
372 -}
373 -const getKeyboardShowing = () => keyboardShowing;
374 -
355 function ThreadTerminal(props: {
356 readonly params: ThreadTerminalRouteScreenProps["route"]["params"];
357 readonly routeEnvironmentId: EnvironmentId | null;
@@ -589,7 +569,8 @@ function ThreadTerminal(props: {
569 height: state.height,
570 isVisible: state.isVisible,
571 }));
592 - const keyboardShowing = useSyncExternalStore(subscribeKeyboardShowing, getKeyboardShowing);
572 + // The accessory leaves as soon as the keyboard starts hiding.
573 + const keyboardShowing = useSoftKeyboardShowing();
574 // The accessory follows the keyboard, except that the dismiss and show
575 // buttons flip it ahead of the keyboard animation.
576 const [accessory, setAccessory] = useState({ keyboardShowing, dismissed: false });
apps/mobile/src/features/threads/ThreadFeed.tsx
+6 -1
@@ -3807,7 +3807,12 @@ export const ThreadFeed = memo(function ThreadFeed({
3807
3808 return (
3809 <PresentationSource identifier={fileShareSourceIdentifier} style={{ flex: 1 }}>
3810 - <View className="flex-1" onLayout={handleViewportLayout}>
3810 + {/* While the pane tracks a sliding sidebar, rows keep its settled width and re-wrap once. */}
3811 + <View
3812 + className="flex-1"
3813 + style={settledPaneWidth !== null ? { width: settledPaneWidth } : undefined}
3814 + onLayout={handleViewportLayout}
3815 + >
3816 <View className="flex-1">
3817 {/* oxlint-disable-next-line t3code/require-registered-list-scroll -- ThreadFeedScrollView is passed through the iOS-only spread below; the prop rejects undefined. */}
3818 <KeyboardAwareLegendList
apps/mobile/src/features/workspace/AndroidWorkspaceNavigation.android.tsx
+7 -3
@@ -10,7 +10,6 @@ import {
10 type ViewProps,
11 } from "react-native";
12 import { useSafeAreaInsets } from "react-native-safe-area-context";
13 -import { useKeyboardState } from "react-native-keyboard-controller";
13
14 import { useAndroidControlSizing } from "../../components/ui/useAndroidControlSizing";
15 import { useToolbarLayout } from "../../components/ui/useToolbarLayout";
@@ -22,6 +21,8 @@ import {
21 type AndroidWorkspaceNavigationTab,
22 } from "./android-workspace-tabs";
23 import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
24 +import { useSoftKeyboardShowing } from "../keyboard/useSoftKeyboardShowing";
25 +import { useAdaptiveWorkspaceLayout } from "../layout/adaptive-workspace-context";
26 import { useAndroidWorkspaceRoot } from "./AndroidWorkspaceTabsProvider";
27 import { useNavigationTabOrder, useHiddenNavigationTabs } from "./navigation-tabs";
28 import { useWorkspaceTabs } from "./WorkspaceTabsContext";
@@ -79,7 +80,8 @@ export function AndroidWorkspaceNavigation(props: {
80 const insets = useSafeAreaInsets();
81 const toolbar = useToolbarLayout();
82 const connectionState = useWorkspaceConnectionState();
82 - const keyboardVisible = useKeyboardState((state) => state.isVisible);
83 + const keyboardVisible = useSoftKeyboardShowing();
84 + const { layout } = useAdaptiveWorkspaceLayout();
85 const { themeAppearance, themeVariables: colors } = useAppearancePreferences();
86 const { scale, fabSize } = useAndroidControlSizing();
87 const window = useWindowDimensions();
@@ -141,7 +143,9 @@ export function AndroidWorkspaceNavigation(props: {
143 const rootState = rootNavigationRef.getRootState();
144 if (root && rootState) {
145 navigation.dispatch({
144 - ...CommonActions.reset(androidWorkspaceTabNavigationState(rootState, tab, rail)),
146 + ...CommonActions.reset(
147 + androidWorkspaceTabNavigationState(rootState, tab, layout.usesSplitView),
148 + ),
149 target: root.key,
150 });
151 }
apps/mobile/src/lib/android-workspace-navigation.ts
+14 -6
@@ -1,4 +1,5 @@
1 import type { NavigationState } from "@react-navigation/native";
2 +import { isSettingsRoute } from "../features/settings/settings-navigation";
3 import { resetRootStack, type RootStackNavigation } from "./root-stack-reset";
4
5 function androidWorkspaceBackReturnsToThread(state: NavigationState) {
@@ -67,10 +68,17 @@ export function returnToAndroidWorkspaceList(
68 resetAndroidWorkspace(navigation);
69 }
70
70 -// In the split view these destinations swap the detail pane beside the sidebar instead of
71 -// stacking over Home, so the default slide-in would show a layer that is not there.
72 -export function androidWorkspaceDestinationAnimation(routeName: string, usesSplitView: boolean) {
73 - return usesSplitView && (routeName === "Thread" || routeName === "PullRequest")
74 - ? ("none" as const)
75 - : undefined;
71 +// Split view: Thread, PullRequest, and a Settings page picked from the list swap the detail pane
72 +// rather than stack, so they don't animate. Pages opened from a Settings page crossfade inside the
73 +// pane's card; the default push edge-extends the incoming page, bleeding a stripe beside the list.
74 +export function androidWorkspaceDestinationAnimation(
75 + route: { readonly key: string; readonly name: string },
76 + routes: readonly { readonly key: string; readonly name: string }[],
77 + usesSplitView: boolean,
78 +) {
79 + if (!usesSplitView) return undefined;
80 + if (route.name === "Thread" || route.name === "PullRequest") return "none" as const;
81 + if (route.name === "Settings" || !isSettingsRoute(route.name)) return undefined;
82 + const below = routes[routes.findIndex((candidate) => candidate.key === route.key) - 1];
83 + return below?.name === "Settings" ? ("none" as const) : ("fade" as const);
84 }