Open History to see the last commit
1import type {
2 EnvironmentProject,
3 EnvironmentThreadShell,
4} from "@t3tools/client-runtime/state/shell";
5import { EnvironmentId, ThreadId, type SidebarProjectGroupingMode } from "@t3tools/contracts";
6import { useAtomValue } from "@effect/atom-react";
7import { useFocusEffect } from "@react-navigation/native";
8import {
9 CommonActions,
10 NavigationContext,
11 NavigationRouteContext,
12 StackActions,
13 useNavigation,
14} from "@react-navigation/native";
15import {
16 createContext,
17 use,
18 useCallback,
19 useEffect,
20 useMemo,
21 useRef,
22 useState,
23 type ReactNode,
24} from "react";
25import { Platform, useWindowDimensions, View } from "react-native";
26import Animated, {
27 useAnimatedStyle,
28 useDerivedValue,
29 useSharedValue,
30 withTiming,
31} from "react-native-reanimated";
32import { AsyncResult } from "effect/unstable/reactivity";
33
34import {
35 deriveFileInspectorPaneLayout,
36 deriveLayout,
37 deriveWorkspacePaneLayout,
38 type FileInspectorPaneLayout,
39 type Layout,
40 type WorkspaceAuxiliaryPaneRole,
41 type WorkspacePaneLayout,
42} from "../../lib/layout";
43import {
44 resolveThreadSelectionNavigationAction,
45 resolveThreadSelectionOverlayState,
46} from "../../lib/adaptive-navigation";
47import { scopedThreadKey } from "../../lib/scopedEntities";
48import { mobilePreferencesAtom } from "../../state/preferences";
49import {
50 DEFAULT_MOBILE_PROJECT_GROUPING_SETTINGS,
51 resolveMobileProjectGroupingSettings,
52} from "../../state/project-grouping";
53import {
54 parseActiveThreadPath,
55 useHardwareKeyboardCommand,
56} from "../keyboard/hardwareKeyboardCommands";
57import { AndroidHomeFabLayout } from "../home/AndroidHomeFab";
58import { HomeListOptionsProvider } from "../home/home-list-options";
59import { ThreadNavigationSidebar } from "../threads/ThreadNavigationSidebar";
60import { RenderErrorBoundary, RenderFailureView } from "../../components/RenderErrorBoundary";
61import { WORKSPACE_PANE_TIMING } from "./workspace-pane-animation";
62import { WorkspaceInspectorPane } from "./workspace-inspector-pane";
63import { WorkspaceContentWidthContext } from "./workspace-content-width";
64
65interface AdaptiveWorkspaceContextValue {
66 readonly layout: Layout;
67 readonly panes: WorkspacePaneLayout;
68 readonly fileInspector: FileInspectorPaneLayout;
69 readonly primarySidebarSearchQuery: string;
70 readonly selectThread: (thread: EnvironmentThreadShell) => void;
71 readonly activateAuxiliaryPaneRole: (role: WorkspaceAuxiliaryPaneRole) => () => void;
72 /**
73 * Route screens hand their inspector pane content to the workspace so it
74 * renders BESIDE the navigator (outside the native stack header) instead of
75 * inside the route. Returns a deactivate callback: the pane animates closed
76 * (content kept mounted for the exit transition) unless a newer
77 * registration already took over — stale deactivates never clobber it.
78 * Prefer useRegisterWorkspaceInspector over calling this directly.
79 */
80 readonly registerWorkspaceInspector: (render: () => ReactNode) => () => void;
81 readonly setPrimarySidebarSearchQuery: (query: string) => void;
82 readonly showAuxiliaryPane: (role: WorkspaceAuxiliaryPaneRole) => void;
83 readonly toggleAuxiliaryPane: () => void;
84 readonly togglePrimarySidebar: () => void;
85 readonly setAuxiliaryPaneWidth: (width: number) => void;
86}
87
88const compactLayout = deriveLayout({ width: 0, height: 0 });
89const compactPanes = deriveWorkspacePaneLayout({
90 layout: compactLayout,
91 viewportWidth: 0,
92 primarySidebarPreferredVisible: true,
93 auxiliaryPanePreferredVisible: true,
94});
95const compactFileInspector = deriveFileInspectorPaneLayout({
96 layout: compactLayout,
97 viewportWidth: 0,
98});
99const AdaptiveWorkspaceContext = createContext<AdaptiveWorkspaceContextValue>({
100 layout: compactLayout,
101 panes: compactPanes,
102 fileInspector: compactFileInspector,
103 primarySidebarSearchQuery: "",
104 selectThread: () => undefined,
105 activateAuxiliaryPaneRole: () => () => undefined,
106 registerWorkspaceInspector: () => () => undefined,
107 setPrimarySidebarSearchQuery: () => undefined,
108 showAuxiliaryPane: () => undefined,
109 toggleAuxiliaryPane: () => undefined,
110 togglePrimarySidebar: () => undefined,
111 setAuxiliaryPaneWidth: () => undefined,
112});
113
114export function useAdaptiveWorkspaceLayout(): AdaptiveWorkspaceContextValue {
115 return use(AdaptiveWorkspaceContext);
116}
117
118export function useAdaptiveWorkspacePaneRole(role: WorkspaceAuxiliaryPaneRole) {
119 const { activateAuxiliaryPaneRole } = useAdaptiveWorkspaceLayout();
120
121 useFocusEffect(
122 useCallback(() => activateAuxiliaryPaneRole(role), [activateAuxiliaryPaneRole, role]),
123 );
124}
125
126/**
127 * Register this screen's inspector pane content with the workspace column.
128 *
129 * The column renders BESIDE the navigator — outside any screen — so the
130 * registering screen's navigation and route contexts are captured here and
131 * re-provided around the portal content. Without them, useNavigation/useRoute
132 * inside the pane (e.g. GitOverviewSheet via useThreadSelection) throw
133 * "Couldn't find a route object".
134 *
135 * Registration is FOCUS-scoped, driven by navigation events rather than the
136 * screen's own render cycle: react-native-screens freezes blurred screens, so
137 * a cleanup that depends on the blurred subtree re-rendering never runs and
138 * would leak the pane into the next route. Blur deactivates the pane (it
139 * animates closed, or is replaced seamlessly when the next route registers in
140 * the same commit); focus re-registers it.
141 */
142export function useRegisterWorkspaceInspector(render: (() => ReactNode) | undefined) {
143 const { registerWorkspaceInspector } = useAdaptiveWorkspaceLayout();
144 // Raw context values (not the useNavigation/useRoute wrappers) so the
145 // portal re-provides exactly what this screen sees.
146 const navigation = use(NavigationContext);
147 const route = use(NavigationRouteContext);
148
149 const wrappedRender = useMemo(() => {
150 if (render === undefined) {
151 return undefined;
152 }
153 return () => (
154 <NavigationContext.Provider value={navigation}>
155 <NavigationRouteContext.Provider value={route}>{render()}</NavigationRouteContext.Provider>
156 </NavigationContext.Provider>
157 );
158 }, [navigation, render, route]);
159
160 const wrappedRenderRef = useRef(wrappedRender);
161 wrappedRenderRef.current = wrappedRender;
162 const focusedRef = useRef(false);
163 const deactivateRef = useRef<(() => void) | null>(null);
164
165 const syncRegistration = useCallback(() => {
166 if (!focusedRef.current || wrappedRenderRef.current === undefined) {
167 deactivateRef.current?.();
168 return;
169 }
170 deactivateRef.current = registerWorkspaceInspector(wrappedRenderRef.current);
171 }, [registerWorkspaceInspector]);
172
173 // Focus lifecycle. Blur/focus events fire even when the blurred subtree is
174 // frozen (events are navigation-driven, renders are not).
175 useFocusEffect(
176 useCallback(() => {
177 focusedRef.current = true;
178 syncRegistration();
179 return () => {
180 focusedRef.current = false;
181 syncRegistration();
182 };
183 }, [syncRegistration]),
184 );
185
186 // Content changes while focused re-register in place.
187 useEffect(() => {
188 if (focusedRef.current) {
189 syncRegistration();
190 }
191 }, [syncRegistration, wrappedRender]);
192
193 // Unmount: hand the pane back (owner-guarded, so a route that already
194 // took over is unaffected).
195 useEffect(
196 () => () => {
197 deactivateRef.current?.();
198 deactivateRef.current = null;
199 },
200 [],
201 );
202}
203
204export function AdaptiveWorkspaceLayout(props: {
205 readonly children: ReactNode;
206 readonly pathname: string;
207 readonly workspaceRouteKey: string | undefined;
208}) {
209 const preferencesResult = useAtomValue(mobilePreferencesAtom);
210 if (!AsyncResult.isSuccess(preferencesResult)) {
211 return AsyncResult.isFailure(preferencesResult) ? (
212 <AdaptiveWorkspaceLayoutContent
213 {...props}
214 projectGroupingMode={DEFAULT_MOBILE_PROJECT_GROUPING_SETTINGS.sidebarProjectGroupingMode}
215 />
216 ) : null;
217 }
218 const groupingSettings = resolveMobileProjectGroupingSettings(preferencesResult.value);
219 return (
220 <AdaptiveWorkspaceLayoutContent
221 {...props}
222 projectGroupingMode={groupingSettings.sidebarProjectGroupingMode}
223 />
224 );
225}
226
227function AdaptiveWorkspaceLayoutContent(
228 props: {
229 readonly children: ReactNode;
230 readonly pathname: string;
231 readonly workspaceRouteKey: string | undefined;
232 } & {
233 readonly projectGroupingMode: SidebarProjectGroupingMode;
234 },
235) {
236 const projectGroupingMode = props.projectGroupingMode;
237 const { width, height } = useWindowDimensions();
238 const pathname = props.pathname;
239 const navigation = useNavigation();
240 const activeRoleOwner = useRef<symbol | null>(null);
241 const [primarySidebarPreferredVisible, setPrimarySidebarPreferredVisible] = useState(true);
242 const showPrimarySidebar = pathname === "/" || primarySidebarPreferredVisible;
243 const [supplementaryPanePreferredVisible, setSupplementaryPanePreferredVisible] = useState(true);
244 const [supplementaryPanePreferredWidth, setSupplementaryPanePreferredWidth] = useState<
245 number | null
246 >(null);
247 const [fileInspectorPreferredVisible, setFileInspectorPreferredVisible] = useState(true);
248 const [fileInspectorPreferredWidth, setFileInspectorPreferredWidth] = useState<number | null>(
249 null,
250 );
251 const [primarySidebarSearchQuery, setPrimarySidebarSearchQuery] = useState("");
252 const [focusedAuxiliaryPaneRole, setFocusedAuxiliaryPaneRole] =
253 useState<WorkspaceAuxiliaryPaneRole | null>(null);
254 const baseLayout = useMemo(() => deriveLayout({ width, height }), [height, width]);
255 const layout = baseLayout;
256 // In split layouts the sidebar IS the thread list — it renders on every
257 // route, including Home (which shows an empty-detail pane instead of the
258 // compact list).
259 const shouldRenderPrimarySidebar = layout.usesSplitView;
260 const fileInspector = useMemo(
261 () =>
262 deriveFileInspectorPaneLayout({
263 layout,
264 viewportWidth: width,
265 preferredWidth: fileInspectorPreferredWidth ?? undefined,
266 reservedLeadingWidth:
267 shouldRenderPrimarySidebar && showPrimarySidebar ? (layout.listPaneWidth ?? 0) : 0,
268 }),
269 [fileInspectorPreferredWidth, layout, showPrimarySidebar, shouldRenderPrimarySidebar, width],
270 );
271 const auxiliaryPaneRole: WorkspaceAuxiliaryPaneRole =
272 focusedAuxiliaryPaneRole ?? (/\/files(?:\/|$)/.test(pathname) ? "inspector" : "supplementary");
273 const auxiliaryPanePreferredVisible =
274 auxiliaryPaneRole === "inspector"
275 ? fileInspectorPreferredVisible
276 : supplementaryPanePreferredVisible;
277 const auxiliaryPanePreferredWidth =
278 auxiliaryPaneRole === "inspector"
279 ? fileInspectorPreferredWidth
280 : supplementaryPanePreferredWidth;
281 const panes = useMemo(
282 () =>
283 deriveWorkspacePaneLayout({
284 layout,
285 viewportWidth: width,
286 primarySidebarPreferredVisible: showPrimarySidebar,
287 auxiliaryPanePreferredVisible,
288 auxiliaryPaneRole,
289 auxiliaryPanePreferredWidth: auxiliaryPanePreferredWidth ?? undefined,
290 }),
291 [
292 auxiliaryPanePreferredVisible,
293 auxiliaryPaneRole,
294 auxiliaryPanePreferredWidth,
295 layout,
296 showPrimarySidebar,
297 width,
298 ],
299 );
300 const activeThread = parseActiveThreadPath(pathname);
301 const environmentId = activeThread?.environmentId ?? null;
302 const threadId = activeThread?.threadId ?? null;
303 const selectedThreadKey = useMemo(() => {
304 if (environmentId === null || threadId === null) {
305 return null;
306 }
307 try {
308 return scopedThreadKey(EnvironmentId.make(environmentId), ThreadId.make(threadId));
309 } catch {
310 return null;
311 }
312 }, [environmentId, threadId]);
313 // Wrapped in an object: bare functions in useState would be treated as
314 // lazy initializers/updaters. `active: false` keeps the outgoing route's
315 // content mounted so the pane can animate closed (or be replaced
316 // seamlessly by the next route's registration in the same commit).
317 const [workspaceInspector, setWorkspaceInspector] = useState<{
318 readonly render: () => ReactNode;
319 readonly active: boolean;
320 } | null>(null);
321 const workspaceInspectorOwner = useRef<symbol | null>(null);
322 const registerWorkspaceInspector = useCallback((render: () => ReactNode) => {
323 const owner = Symbol("workspace-inspector");
324 workspaceInspectorOwner.current = owner;
325 setWorkspaceInspector({ render, active: true });
326
327 return () => {
328 // During a push/replace the outgoing screen deactivates AFTER the
329 // incoming screen registered — only the current owner may deactivate.
330 if (workspaceInspectorOwner.current !== owner) {
331 return;
332 }
333 setWorkspaceInspector((current) => (current === null ? null : { ...current, active: false }));
334 };
335 }, []);
336 // Once the close animation settles, drop the stale content entirely.
337 const handleWorkspaceInspectorClosed = useCallback(() => {
338 setWorkspaceInspector((current) => (current !== null && !current.active ? null : current));
339 }, []);
340 const activateAuxiliaryPaneRole = useCallback((role: WorkspaceAuxiliaryPaneRole) => {
341 const owner = Symbol(role);
342 activeRoleOwner.current = owner;
343 setFocusedAuxiliaryPaneRole(role);
344
345 return () => {
346 if (activeRoleOwner.current !== owner) {
347 return;
348 }
349 activeRoleOwner.current = null;
350 setFocusedAuxiliaryPaneRole(null);
351 };
352 }, []);
353 const togglePrimarySidebar = useCallback(() => {
354 if (pathname === "/") {
355 return;
356 }
357 if (!panes.primarySidebarVisible && panes.primarySidebarSuppressedByAuxiliary) {
358 setFileInspectorPreferredVisible(false);
359 setPrimarySidebarPreferredVisible(true);
360 return;
361 }
362 setPrimarySidebarPreferredVisible((current) => !current);
363 }, [panes.primarySidebarSuppressedByAuxiliary, panes.primarySidebarVisible, pathname]);
364 const revealPrimarySidebar = useCallback(() => {
365 if (panes.primarySidebarSuppressedByAuxiliary) {
366 setFileInspectorPreferredVisible(false);
367 }
368 setPrimarySidebarPreferredVisible(true);
369 }, [panes.primarySidebarSuppressedByAuxiliary]);
370 const handleToggleSidebarCommand = useCallback(() => {
371 togglePrimarySidebar();
372 return true;
373 }, [togglePrimarySidebar]);
374 const sidebarCommands = useMemo(
375 () => (pathname === "/" ? [] : (["toggleSidebar"] as const)),
376 [pathname],
377 );
378 useHardwareKeyboardCommand(sidebarCommands, handleToggleSidebarCommand);
379 const showAuxiliaryPane = useCallback((role: WorkspaceAuxiliaryPaneRole) => {
380 if (role === "inspector") {
381 setFocusedAuxiliaryPaneRole("inspector");
382 setFileInspectorPreferredVisible(true);
383 return;
384 }
385 setFocusedAuxiliaryPaneRole("supplementary");
386 setSupplementaryPanePreferredVisible(true);
387 }, []);
388 const handleOpenFilesCommand = useCallback(() => {
389 const activeThread = parseActiveThreadPath(pathname);
390 if (!layout.usesSplitView || !fileInspector.supported || activeThread === null) {
391 return false;
392 }
393 showAuxiliaryPane("inspector");
394 if (/\/files(?:\/|$)/.test(pathname)) {
395 return true;
396 }
397 navigation.navigate("ThreadFiles", activeThread);
398 return true;
399 }, [fileInspector.supported, layout.usesSplitView, pathname, navigation, showAuxiliaryPane]);
400 useHardwareKeyboardCommand("files", handleOpenFilesCommand);
401 const toggleAuxiliaryPane = useCallback(() => {
402 if (auxiliaryPaneRole === "inspector") {
403 setFileInspectorPreferredVisible((current) => !current);
404 return;
405 }
406 setSupplementaryPanePreferredVisible((current) => !current);
407 }, [auxiliaryPaneRole]);
408 const setAuxiliaryPaneWidth = useCallback(
409 (nextWidth: number) => {
410 if (auxiliaryPaneRole === "inspector") {
411 setFileInspectorPreferredWidth(nextWidth);
412 return;
413 }
414 setSupplementaryPanePreferredWidth(nextWidth);
415 },
416 [auxiliaryPaneRole],
417 );
418 const handleOpenSettings = useCallback(() => {
419 navigation.navigate("SettingsSheet", {
420 screen: "SettingsContent",
421 params: { screen: "Settings" },
422 });
423 }, [navigation]);
424
425 const handleStartNewTask = useCallback(() => {
426 navigation.navigate("NewTaskSheet", { screen: "NewTask" });
427 }, [navigation]);
428
429 // Minted here (root stack navigation) so the sidebar pane stays free of
430 // navigation hooks — on iOS it renders inside an independent nav tree.
431 const handleOpenEnvironmentSettings = useCallback(() => {
432 navigation.navigate("SettingsSheet", {
433 screen: "SettingsContent",
434 params: { screen: "SettingsEnvironments" },
435 });
436 }, [navigation]);
437
438 const handleNewThreadOnBranch = useCallback(
439 (thread: EnvironmentThreadShell) => {
440 navigation.navigate("NewTaskSheet", {
441 screen: "NewTaskDraft",
442 params: {
443 environmentId: String(thread.environmentId),
444 projectId: String(thread.projectId),
445 branch: thread.branch,
446 worktreePath: thread.worktreePath,
447 },
448 });
449 },
450 [navigation],
451 );
452
453 const handleNewThreadInProject = useCallback(
454 (project: EnvironmentProject) => {
455 navigation.navigate("NewTaskSheet", {
456 screen: "NewTaskDraft",
457 params: {
458 environmentId: String(project.environmentId),
459 projectId: String(project.id),
460 title: project.title,
461 },
462 });
463 },
464 [navigation],
465 );
466
467 const renderedSidebarWidth = useSharedValue(
468 panes.primarySidebarVisible ? (layout.listPaneWidth ?? 0) : 0,
469 );
470 useEffect(() => {
471 const targetWidth = panes.primarySidebarVisible ? (layout.listPaneWidth ?? 0) : 0;
472 renderedSidebarWidth.value = withTiming(targetWidth, WORKSPACE_PANE_TIMING);
473 }, [layout.listPaneWidth, panes.primarySidebarVisible, renderedSidebarWidth]);
474 const sidebarAnimatedStyle = useAnimatedStyle(() => ({
475 opacity: Math.min(1, renderedSidebarWidth.value / 80),
476 width: renderedSidebarWidth.value,
477 }));
478
479 // Freeze the content pane at its SETTLED width while the side panes
480 // animate. The navigator (native header + markdown feed) lays out ONCE per
481 // pane toggle instead of re-measuring on every animation frame — the
482 // animating columns merely clip/reveal it over a matching background.
483 // Continuously re-wrapping the chat feed was the main source of dropped
484 // frames during sidebar/inspector transitions.
485 const inspectorColumnTargetWidth =
486 workspaceInspector !== null && workspaceInspector.active && panes.auxiliaryPaneVisible
487 ? (panes.auxiliaryPaneWidth ?? 0)
488 : 0;
489 const contentSettledWidth = layout.usesSplitView
490 ? Math.max(0, panes.contentPaneWidth - inspectorColumnTargetWidth)
491 : null;
492 const renderedInspectorWidth = useSharedValue(inspectorColumnTargetWidth);
493 const renderedContentWidth = useDerivedValue(() =>
494 Math.max(0, width - renderedSidebarWidth.value - renderedInspectorWidth.value),
495 );
496
497 const handleSelectThread = useCallback(
498 (thread: EnvironmentThreadShell) => {
499 const params = {
500 environmentId: String(thread.environmentId),
501 threadId: String(thread.id),
502 };
503 const navigationAction = resolveThreadSelectionNavigationAction({
504 usesSplitView: layout.usesSplitView,
505 pathname,
506 });
507 const overlayState = resolveThreadSelectionOverlayState({
508 state: navigation.getState(),
509 workspaceRouteKey: props.workspaceRouteKey,
510 action: navigationAction,
511 params,
512 });
513 if (overlayState !== null) {
514 setFileInspectorPreferredVisible(false);
515 navigation.dispatch(CommonActions.reset(overlayState));
516 return;
517 }
518 if (navigationAction === "set-params") {
519 const nextThreadKey = scopedThreadKey(thread.environmentId, thread.id);
520 if (nextThreadKey === selectedThreadKey) {
521 return;
522 }
523 setFileInspectorPreferredVisible(false);
524 navigation.navigate("Thread", params);
525 return;
526 }
527 if (navigationAction === "replace") {
528 setFileInspectorPreferredVisible(false);
529 navigation.dispatch(StackActions.replace("Thread", params));
530 return;
531 }
532 navigation.navigate("Thread", params);
533 },
534 [layout.usesSplitView, pathname, navigation, selectedThreadKey, props.workspaceRouteKey],
535 );
536
537 const contextValue = useMemo(
538 () => ({
539 layout,
540 panes,
541 fileInspector,
542 primarySidebarSearchQuery,
543 selectThread: handleSelectThread,
544 activateAuxiliaryPaneRole,
545 registerWorkspaceInspector,
546 setPrimarySidebarSearchQuery,
547 showAuxiliaryPane,
548 toggleAuxiliaryPane,
549 togglePrimarySidebar,
550 setAuxiliaryPaneWidth,
551 }),
552 [
553 activateAuxiliaryPaneRole,
554 fileInspector,
555 handleSelectThread,
556 layout,
557 panes,
558 primarySidebarSearchQuery,
559 registerWorkspaceInspector,
560 showAuxiliaryPane,
561 setPrimarySidebarSearchQuery,
562 setAuxiliaryPaneWidth,
563 toggleAuxiliaryPane,
564 togglePrimarySidebar,
565 ],
566 );
567
568 return (
569 <HomeListOptionsProvider projectGroupingMode={projectGroupingMode}>
570 <AdaptiveWorkspaceContext.Provider value={contextValue}>
571 <View testID="adaptive-workspace-layout" className="flex-1 flex-row">
572 {shouldRenderPrimarySidebar && layout.listPaneWidth !== null ? (
573 <Animated.View
574 className="self-stretch overflow-hidden"
575 accessibilityElementsHidden={!panes.primarySidebarVisible}
576 collapsable={false}
577 importantForAccessibility={
578 panes.primarySidebarVisible ? "auto" : "no-hide-descendants"
579 }
580 pointerEvents={panes.primarySidebarVisible ? "auto" : "none"}
581 style={sidebarAnimatedStyle}
582 >
583 <View className="flex-1" style={{ width: layout.listPaneWidth }}>
584 <RenderErrorBoundary
585 renderFallback={(fallback) => (
586 <RenderFailureView
587 {...fallback}
588 title="The sidebar couldn't be displayed"
589 exit={{ label: "Open settings", onPress: handleOpenSettings }}
590 />
591 )}
592 >
593 <AndroidHomeFabLayout sidebar onStartNewTask={handleStartNewTask}>
594 <ThreadNavigationSidebar
595 width={layout.listPaneWidth}
596 visible={panes.primarySidebarVisible}
597 onRequestVisibility={revealPrimarySidebar}
598 selectedThreadKey={selectedThreadKey}
599 onOpenSettings={handleOpenSettings}
600 onOpenEnvironmentSettings={handleOpenEnvironmentSettings}
601 onNewThreadInProject={handleNewThreadInProject}
602 onNewThreadOnBranch={handleNewThreadOnBranch}
603 onSelectThread={handleSelectThread}
604 onSearchQueryChange={setPrimarySidebarSearchQuery}
605 searchQuery={primarySidebarSearchQuery}
606 />
607 </AndroidHomeFabLayout>
608 </RenderErrorBoundary>
609 </View>
610 </Animated.View>
611 ) : null}
612 <View
613 className={
614 Platform.OS === "android"
615 ? "flex-1 overflow-hidden bg-header"
616 : "flex-1 overflow-hidden bg-screen"
617 }
618 collapsable={false}
619 >
620 <View
621 collapsable={false}
622 style={
623 contentSettledWidth !== null
624 ? {
625 flex: 1,
626 width: contentSettledWidth,
627 }
628 : { flex: 1 }
629 }
630 >
631 <WorkspaceContentWidthContext
632 value={layout.usesSplitView ? renderedContentWidth : null}
633 >
634 {props.children}
635 </WorkspaceContentWidthContext>
636 </View>
637 </View>
638 <WorkspaceInspectorPane
639 pathname={props.pathname}
640 renderedInspectorWidth={renderedInspectorWidth}
641 active={workspaceInspector?.active ?? false}
642 panes={panes}
643 renderInspector={workspaceInspector?.render}
644 setAuxiliaryPaneWidth={setAuxiliaryPaneWidth}
645 onClosed={handleWorkspaceInspectorClosed}
646 />
647 </View>
648 </AdaptiveWorkspaceContext.Provider>
649 </HomeListOptionsProvider>
650 );
651}