Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

HomeScreen.tsx

1,236 lines46.1 KB

1import {
2 LegendList,
3 type LegendListRef,
4 type LegendListRenderItemProps,
5} from "@legendapp/list/react-native";
6import {
7 type EnvironmentProject,
8 type EnvironmentThreadShell,
9} from "@t3tools/client-runtime/state/shell";
10import {
11 threadSearchMatchKey,
12 type EnvironmentThreadSearchMatch,
13} from "@t3tools/client-runtime/state/thread-search";
14import { sortPinnedThreadsByOrderKey } from "@t3tools/client-runtime/state/thread-sort";
15import type {
16 EnvironmentId,
17 SidebarProjectGroupingMode,
18 SidebarThreadSortOrder,
19} from "@t3tools/contracts";
20import { useAtomSet, useAtomValue } from "@effect/atom-react";
21import { AsyncResult } from "effect/unstable/reactivity";
22import { useFocusEffect } from "@react-navigation/native";
23import { useCallback, useEffect, useMemo, useRef, useState } from "react";
24import { ActivityIndicator, FlatList, Platform, Pressable, View } from "react-native";
25import type { SwipeableMethods } from "react-native-gesture-handler/ReanimatedSwipeable";
26import { useSafeAreaInsets } from "react-native-safe-area-context";
27​
28import { AppText as Text } from "../../components/AppText";
29import { EmptyState } from "../../components/EmptyState";
30import type { WorkspaceEnvironment, WorkspaceState } from "../../state/workspaceModel";
31import type { SavedRemoteConnection } from "../../lib/connection";
32import { scopedProjectKey } from "../../lib/scopedEntities";
33import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
34import { mobilePreferencesAtom, updateMobilePreferencesAtom } from "../../state/preferences";
35import { useThreadSearch } from "../../state/queries";
36import { useThreadListV2Enabled } from "../threads/use-thread-list-v2-enabled";
37import { environmentServerConfigsAtom } from "../../state/server";
38import type { PendingNewTask } from "../../state/use-pending-new-tasks";
39import {
40 PendingTaskListRow,
41 ThreadListGroupHeader,
42 ThreadListRow,
43 ThreadListShowMoreRow,
44} from "../threads/thread-list-items";
45import {
46 ThreadListV2PendingRow,
47 ThreadListV2Row,
48 ThreadListV2SettledShelfHeader,
49 ThreadListV2SnoozedShelfHeader,
50} from "../threads/thread-list-v2-items";
51import {
52 buildThreadListV2Items,
53 buildThreadListV2ListItems,
54 THREAD_LIST_V2_SETTLED_INITIAL_COUNT,
55 THREAD_LIST_V2_SETTLED_PAGE_COUNT,
56 type ThreadListV2ChangeRequestState,
57 type ThreadListV2ListItem,
58} from "../threads/threadListV2";
59import { useThreadListV2ShelfPreferences } from "../threads/use-thread-list-v2-shelf-preferences";
60import type { HomeListFilterMenuEnvironment } from "./home-list-filter-menu";
61import {
62 buildHomeListLayout,
63 DEFAULT_GROUP_DISPLAY_STATE,
64 homeListItemsAreEqual,
65 nextGroupDisplayState,
66 type HomeGroupDisplayAction,
67 type HomeGroupDisplayState,
68 type HomeListItem,
69} from "./homeListItems";
70import {
71 buildHomeProjectScopes,
72 buildHomeThreadGroups,
73 sortHomeProjectScopes,
74 type HomeProjectSortOrder,
75} from "./homeThreadList";
76import { SwipeableScrollGateProvider, useSwipeableScrollGate } from "./thread-swipe-actions";
77​
78/* ─── Types ──────────────────────────────────────────────────────────── */
79​
80interface HomeScreenProps {
81 readonly projects: ReadonlyArray<EnvironmentProject>;
82 readonly threads: ReadonlyArray<EnvironmentThreadShell>;
83 readonly pendingTasks: ReadonlyArray<PendingNewTask>;
84 readonly catalogState: WorkspaceState;
85 readonly savedConnectionsById: Readonly<Record<string, SavedRemoteConnection>>;
86 readonly environments: ReadonlyArray<
87 HomeListFilterMenuEnvironment & Pick<WorkspaceEnvironment, "connectionState">
88 >;
89 readonly searchQuery: string;
90 readonly selectedEnvironmentId: EnvironmentId | null;
91 readonly selectedProjectKey: string | null;
92 readonly projectSortOrder: HomeProjectSortOrder;
93 readonly threadSortOrder: SidebarThreadSortOrder;
94 readonly projectGroupingMode: SidebarProjectGroupingMode;
95 readonly onSearchQueryChange: (query: string) => void;
96 readonly onEnvironmentChange: (environmentId: EnvironmentId | null) => void;
97 readonly onProjectChange: (projectKey: string | null) => void;
98 readonly onProjectSortOrderChange: (sortOrder: HomeProjectSortOrder) => void;
99 readonly onThreadSortOrderChange: (sortOrder: SidebarThreadSortOrder) => void;
100 readonly onAddConnection: () => void;
101 readonly onOpenSettings: () => void;
102 readonly onStartNewTask: () => void;
103 readonly onSelectThread: (thread: EnvironmentThreadShell) => void;
104 readonly onArchiveThread: (thread: EnvironmentThreadShell) => void;
105 readonly onDeleteThread: (thread: EnvironmentThreadShell) => void;
106 /** Resolves true iff the settle was dispatched and succeeded. */
107 readonly onSettleThread: (thread: EnvironmentThreadShell) => Promise<boolean>;
108 readonly onSnoozeThread: (
109 thread: EnvironmentThreadShell,
110 snoozedUntil: string,
111 ) => Promise<boolean>;
112 readonly onUnsnoozeThread: (thread: EnvironmentThreadShell) => Promise<boolean>;
113 readonly onUnsettleThread: (thread: EnvironmentThreadShell) => void;
114 readonly onPinThread: (thread: EnvironmentThreadShell) => Promise<boolean>;
115 readonly onUnpinThread: (thread: EnvironmentThreadShell) => Promise<boolean>;
116 readonly onMovePinnedThread: (
117 thread: EnvironmentThreadShell,
118 direction: "up" | "down",
119 ) => Promise<boolean>;
120 readonly onRegenerateThreadTitle: (thread: EnvironmentThreadShell) => Promise<boolean>;
121 readonly onSelectPendingTask: (pendingTask: PendingNewTask) => void;
122 readonly onDeletePendingTask: (pendingTask: PendingNewTask) => void;
123 readonly onNewThreadInProject: (project: EnvironmentProject) => void;
125​
126/* ─── Layout constants ───────────────────────────────────────────────── */
127​
128const ESTIMATED_THREAD_ROW_HEIGHT = 72;
129const PRE_LIQUID_GLASS_BOTTOM_TOOLBAR_HEIGHT = 44;
130/**
131 * Top spacing between the list and the Android custom header. The Android
132 * header (AndroidHomeHeader) is rendered in-flow above this screen and
133 * already consumes the top safe-area inset, so the list only needs breathing
134 * room here.
135 */
136​
137function deriveEmptyState(props: {
138 readonly catalogState: WorkspaceState;
139 readonly projectCount: number;
140}): { readonly title: string; readonly detail: string; readonly loading: boolean } {
141 const { catalogState } = props;
142 if (catalogState.isLoadingConnections) {
143 return {
144 title: "Loading environments",
145 detail: "Checking saved environments on this device.",
146 loading: true,
147 };
148 }
149​
150 if (!catalogState.hasConnections) {
151 return {
152 title: "No environments connected",
153 detail: "Add an environment to load projects and start coding sessions.",
154 loading: false,
155 };
156 }
157​
158 if (
159 (catalogState.connectionState === "available" ||
160 catalogState.connectionState === "offline" ||
161 catalogState.connectionState === "error") &&
162 !catalogState.hasLoadedShellSnapshot
163 ) {
164 return {
165 title: "Environment unavailable",
166 detail:
167 catalogState.connectionError ??
168 "The saved environment is offline. Check the URL or start the environment, then retry.",
169 loading: false,
170 };
171 }
172​
173 if (
174 catalogState.hasConnectingEnvironment &&
175 !catalogState.hasLoadedShellSnapshot &&
176 catalogState.connectionError === null
177 ) {
178 return {
179 title: "Connecting to environment",
180 detail: "Loading projects and threads from the saved environment.",
181 loading: true,
182 };
183 }
184​
185 if (props.projectCount === 0 && catalogState.hasLoadedShellSnapshot) {
186 return {
187 title: "No projects found",
188 detail: "The connected environment did not report any projects.",
189 loading: false,
190 };
191 }
192​
193 return {
194 title: "No threads yet",
195 detail: "Create a task to start a new coding session in one of your connected projects.",
196 loading: false,
197 };
199​
200function HomeTopContentSpacer() {
201 return <View className="h-4" />;
203​
204/* ─── Main screen ────────────────────────────────────────────────────── */
205​
206export function HomeScreen(props: HomeScreenProps) {
207 const [groupDisplayStates, setGroupDisplayStates] = useState<
208 ReadonlyMap<string, HomeGroupDisplayState>
209 >(() => new Map());
210 const preferencesResult = useAtomValue(mobilePreferencesAtom);
211 const threadListV2Enabled = useThreadListV2Enabled();
212 const autoSettleOnMerge =
213 !AsyncResult.isSuccess(preferencesResult) ||
214 preferencesResult.value.autoSettleOnMerge !== false;
215 const savePreferences = useAtomSet(updateMobilePreferencesAtom);
216 const openSwipeableRef = useRef<SwipeableMethods | null>(null);
217 const listRef = useRef<LegendListRef | null>(null);
218 const insets = useSafeAreaInsets();
219 const iosBottomToolbarClearance =
220 Platform.OS === "ios" && !NATIVE_LIQUID_GLASS_SUPPORTED
221 ? PRE_LIQUID_GLASS_BOTTOM_TOOLBAR_HEIGHT
222 : 0;
223 const searchEnvironmentIds = useMemo(
224 () =>
225 props.selectedEnvironmentId === null
226 ? props.environments
227 .filter((environment) => environment.connectionState === "connected")
228 .map((environment) => environment.environmentId)
229 : props.environments.some(
230 (environment) =>
231 environment.environmentId === props.selectedEnvironmentId &&
232 environment.connectionState === "connected",
233 )
234 ? [props.selectedEnvironmentId]
235 : [],
236 [props.environments, props.selectedEnvironmentId],
237 );
238 const threadSearch = useThreadSearch(searchEnvironmentIds, props.searchQuery);
239 const threadSearchMatchByKey = useMemo(() => {
240 const matches = new Map<string, EnvironmentThreadSearchMatch>();
241 for (const match of threadSearch.matches) {
242 if (match.source === "user" || match.source === "assistant") {
243 matches.set(threadSearchMatchKey(match), match);
244 }
245 }
246 return matches;
247 }, [threadSearch.matches]);
248 const matchedThreadKeys = useMemo(
249 () => new Set(threadSearch.matches.map(threadSearchMatchKey)),
250 [threadSearch.matches],
251 );
252 const effectiveGroupDisplayStates = useMemo(() => {
253 const next = new Map(groupDisplayStates);
254 if (!AsyncResult.isSuccess(preferencesResult)) {
255 return next;
256 }
257 for (const key of preferencesResult.value.collapsedProjectGroups ?? []) {
258 const existing = next.get(key);
259 next.set(key, {
260 ...(existing ?? DEFAULT_GROUP_DISPLAY_STATE),
261 collapsed: true,
262 });
263 }
264 return next;
265 }, [groupDisplayStates, preferencesResult]);
266 const effectiveGroupDisplayStatesRef = useRef(effectiveGroupDisplayStates);
267 effectiveGroupDisplayStatesRef.current = effectiveGroupDisplayStates;
268​
269 const updateGroupDisplay = useCallback(
270 (key: string, action: HomeGroupDisplayAction) => {
271 const next = new Map(effectiveGroupDisplayStatesRef.current);
272 next.set(key, nextGroupDisplayState(next.get(key) ?? DEFAULT_GROUP_DISPLAY_STATE, action));
273 effectiveGroupDisplayStatesRef.current = next;
274 setGroupDisplayStates(next);
275 if (action === "toggle-collapsed") {
276 const collapsedProjectGroups: string[] = [];
277 for (const [groupKey, state] of next) {
278 if (state.collapsed) {
279 collapsedProjectGroups.push(groupKey);
280 }
281 }
282 savePreferences({ collapsedProjectGroups });
283 }
284 },
285 [savePreferences],
286 );
287​
288 const handleSwipeableWillOpen = useCallback((methods: SwipeableMethods) => {
289 if (openSwipeableRef.current !== methods) {
290 openSwipeableRef.current?.close();
291 openSwipeableRef.current = methods;
292 }
293 }, []);
294​
295 const handleSwipeableClose = useCallback((methods: SwipeableMethods) => {
296 if (openSwipeableRef.current === methods) {
297 openSwipeableRef.current = null;
298 }
299 }, []);
300​
301 const handleScrollBeginDrag = useCallback(() => {
302 openSwipeableRef.current?.close();
303 }, []);
304 const { swipeEnabled, scrollGateHandlers } = useSwipeableScrollGate({
305 onScrollBeginDrag: handleScrollBeginDrag,
306 });
307​
308 const projectScopes = useMemo(
309 () =>
310 buildHomeProjectScopes({
311 projects: props.projects,
312 environmentId: props.selectedEnvironmentId,
313 projectGroupingMode: props.projectGroupingMode,
314 }),
315 [props.projectGroupingMode, props.projects, props.selectedEnvironmentId],
316 );
317 const selectedProjectScope = useMemo(
318 () =>
319 props.selectedProjectKey === null
320 ? null
321 : (projectScopes.find(
322 (scope) =>
323 scope.key === props.selectedProjectKey ||
324 scope.projectRefs.some(
325 (projectRef) =>
326 scopedProjectKey(projectRef.environmentId, projectRef.projectId) ===
327 props.selectedProjectKey,
328 ),
329 ) ?? null),
330 [projectScopes, props.selectedProjectKey],
331 );
332 const selectedProjectRefKeys = useMemo(
333 () =>
334 selectedProjectScope === null
335 ? null
336 : new Set(
337 selectedProjectScope.projectRefs.map((projectRef) =>
338 scopedProjectKey(projectRef.environmentId, projectRef.projectId),
339 ),
340 ),
341 [selectedProjectScope],
342 );
343 const scopedProjects = useMemo(
344 () =>
345 selectedProjectRefKeys === null
346 ? props.projects
347 : props.projects.filter((project) =>
348 selectedProjectRefKeys.has(scopedProjectKey(project.environmentId, project.id)),
349 ),
350 [props.projects, selectedProjectRefKeys],
351 );
352 const scopedThreads = useMemo(
353 () =>
354 selectedProjectRefKeys === null
355 ? props.threads
356 : props.threads.filter((thread) =>
357 selectedProjectRefKeys.has(scopedProjectKey(thread.environmentId, thread.projectId)),
358 ),
359 [props.threads, selectedProjectRefKeys],
360 );
361 const scopedPendingTasks = useMemo(
362 () =>
363 selectedProjectRefKeys === null
364 ? props.pendingTasks
365 : props.pendingTasks.filter((pendingTask) =>
366 selectedProjectRefKeys.has(
367 scopedProjectKey(pendingTask.message.environmentId, pendingTask.creation.projectId),
368 ),
369 ),
370 [props.pendingTasks, selectedProjectRefKeys],
371 );
372​
373 const projectGroups = useMemo(
374 () =>
375 buildHomeThreadGroups({
376 projects: scopedProjects,
377 threads: scopedThreads,
378 pendingTasks: scopedPendingTasks,
379 environmentId: props.selectedEnvironmentId,
380 searchQuery: props.searchQuery,
381 matchedThreadKeys,
382 projectSortOrder: props.projectSortOrder,
383 threadSortOrder: props.threadSortOrder,
384 projectGroupingMode: props.projectGroupingMode,
385 }),
386 [
387 props.projectGroupingMode,
388 props.projectSortOrder,
389 props.searchQuery,
390 props.selectedEnvironmentId,
391 props.threadSortOrder,
392 matchedThreadKeys,
393 scopedPendingTasks,
394 scopedProjects,
395 scopedThreads,
396 ],
397 );
398​
399 const hasSearchQuery = props.searchQuery.trim().length > 0;
400 const listLayout = useMemo(
401 () =>
402 buildHomeListLayout({
403 groups: projectGroups,
404 displayStates: effectiveGroupDisplayStates,
405 showAllThreads: hasSearchQuery,
406 }),
407 [projectGroups, effectiveGroupDisplayStates, hasSearchQuery],
408 );
409​
410 const projectCwdByKey = useMemo(() => {
411 const map = new Map<string, string>();
412 for (const project of props.projects) {
413 map.set(scopedProjectKey(project.environmentId, project.id), project.workspaceRoot);
414 }
415 return map;
416 }, [props.projects]);
417​
418 const projectByKey = useMemo(() => {
419 const map = new Map<string, EnvironmentProject>();
420 for (const project of props.projects) {
421 map.set(scopedProjectKey(project.environmentId, project.id), project);
422 }
423 return map;
424 }, [props.projects]);
425​
426 const v2ProjectScopeKey = props.selectedProjectKey;
427 const v2ScopeProjects = useMemo(
428 () =>
429 sortHomeProjectScopes({
430 scopes: projectScopes,
431 threads: props.threads,
432 pendingTasks: props.pendingTasks,
433 projectSortOrder: props.projectSortOrder,
434 }),
435 [
436 props.pendingTasks,
437 props.projects,
438 props.projectSortOrder,
439 props.selectedEnvironmentId,
440 props.threads,
441 projectScopes,
442 ],
443 );
444 const v2ScopedProjectGroup = useMemo(
445 () =>
446 v2ProjectScopeKey === null
447 ? null
448 : (v2ScopeProjects.find(
449 (scope) =>
450 scope.key === v2ProjectScopeKey ||
451 scope.projectRefs.some(
452 (projectRef) =>
453 scopedProjectKey(projectRef.environmentId, projectRef.projectId) ===
454 v2ProjectScopeKey,
455 ),
456 ) ?? null),
457 [v2ProjectScopeKey, v2ScopeProjects],
458 );
459 const v2ProjectTitleByProjectKey = useMemo(
460 () =>
461 new Map(
462 v2ScopeProjects.flatMap((scope) =>
463 scope.projectRefs.map(
464 (projectRef) =>
465 [
466 scopedProjectKey(projectRef.environmentId, projectRef.projectId),
467 scope.title,
468 ] as const,
469 ),
470 ),
471 ),
472 [v2ScopeProjects],
473 );
474 const v2ScopedProjectKeys = useMemo(
475 () =>
476 v2ScopedProjectGroup === null
477 ? null
478 : new Set(
479 v2ScopedProjectGroup.projectRefs.map((projectRef) =>
480 scopedProjectKey(projectRef.environmentId, projectRef.projectId),
481 ),
482 ),
483 [v2ScopedProjectGroup],
484 );
485 // Thread List v2 (beta): one flat list in creation order, no grouping.
486 // Settled threads collapse into a recency tail below the card block.
487 // Settled threads stay in the live shell stream (settled ≠ archived), so
488 // the partition works directly off live shells — no snapshot merging or
489 // optimistic holds.
490 // PR states stream in per-row. The next partition applies the configured
491 // merge rule and the always-on close rule, matching web.
492 const [changeRequestByKey, setChangeRequestByKey] = useState<
493 ReadonlyMap<string, ThreadListV2ChangeRequestState>
494 >(() => new Map());
495 const handleChangeRequestState = useCallback(
496 (threadKey: string, changeRequest: ThreadListV2ChangeRequestState | null) => {
497 setChangeRequestByKey((current) => {
498 const existing = current.get(threadKey) ?? null;
499 if (
500 (existing?.state ?? null) === (changeRequest?.state ?? null) &&
501 (existing?.updatedAt ?? null) === (changeRequest?.updatedAt ?? null) &&
502 (existing?.linkedPullRequestKey ?? null) === (changeRequest?.linkedPullRequestKey ?? null)
503 ) {
504 return current;
505 }
506 const next = new Map(current);
507 if (changeRequest === null) {
508 next.delete(threadKey);
509 } else {
510 next.set(threadKey, changeRequest);
511 }
512 return next;
513 });
514 },
515 [],
516 );
517 const handleSettleThread = useCallback(
518 (thread: EnvironmentThreadShell) => {
519 void props.onSettleThread(thread);
520 },
521 [props.onSettleThread],
522 );
523 const handleSnoozeThread = useCallback(
524 (thread: EnvironmentThreadShell, snoozedUntil: string) => {
525 void props.onSnoozeThread(thread, snoozedUntil);
526 },
527 [props.onSnoozeThread],
528 );
529 const handleUnsnoozeThread = useCallback(
530 (thread: EnvironmentThreadShell) => {
531 void props.onUnsnoozeThread(thread);
532 },
533 [props.onUnsnoozeThread],
534 );
535 const handlePinThread = useCallback(
536 (thread: EnvironmentThreadShell) => {
537 void props.onPinThread(thread);
538 },
539 [props.onPinThread],
540 );
541 const handleMovePinnedThread = useCallback(
542 (thread: EnvironmentThreadShell, direction: "up" | "down") => {
543 void props.onMovePinnedThread(thread, direction);
544 },
545 [props.onMovePinnedThread],
546 );
547 const handleUnpinThread = useCallback(
548 (thread: EnvironmentThreadShell) => {
549 void props.onUnpinThread(thread);
550 },
551 [props.onUnpinThread],
552 );
553 const handleRegenerateThreadTitle = useCallback(
554 (thread: EnvironmentThreadShell) => {
555 void props.onRegenerateThreadTitle(thread);
556 },
557 [props.onRegenerateThreadTitle],
558 );
559 const handleDeleteThread = props.onDeleteThread;
560 const handleUnsettleThread = props.onUnsettleThread;
561 // The settled tail renders in pages; expansion resets when the filter
562 // context changes so environment/search flips never inherit a deep page.
563 const [settledVisibleCount, setSettledVisibleCount] = useState(
564 THREAD_LIST_V2_SETTLED_INITIAL_COUNT,
565 );
566 const settledResetKey = `${props.selectedEnvironmentId ?? "all"}:${v2ProjectScopeKey ?? "all"}:${props.searchQuery.trim()}`;
567 const lastSettledResetKeyRef = useRef(settledResetKey);
568 if (lastSettledResetKeyRef.current !== settledResetKey) {
569 lastSettledResetKeyRef.current = settledResetKey;
570 setSettledVisibleCount(THREAD_LIST_V2_SETTLED_INITIAL_COUNT);
571 }
572 const showMoreSettled = useCallback(
573 () => setSettledVisibleCount((count) => count + THREAD_LIST_V2_SETTLED_PAGE_COUNT),
574 [],
575 );
576 const {
577 loaded: shelfPreferencesLoaded,
578 settledShelfExpanded,
579 snoozedShelfExpanded,
580 toggleSettledShelf,
581 toggleSnoozedShelf,
582 } = useThreadListV2ShelfPreferences();
583 // now is quantized to the minute and ticks so the inactivity auto-settle
584 // boundary is actually crossed while the app stays open (mirrors web);
585 // without a clock dependency the partition memoizes a frozen "now".
586 const [nowMinute, setNowMinute] = useState(() => new Date().toISOString().slice(0, 16));
587 // Snooze wake times are second-precise; a counter bumped exactly at the
588 // next wake boundary re-runs the partition with a fresh clock so a woken
589 // thread reappears immediately instead of on the next minute tick.
590 const [snoozeWakeTick, bumpSnoozeWakeTick] = useState(0);
591 useFocusEffect(
592 useCallback(() => {
593 if (!threadListV2Enabled) return;
594 // Refresh immediately on enable or focus: the previous value can be hours
595 // old and misclassify the inactivity auto-settle boundary until the first tick.
596 setNowMinute(new Date().toISOString().slice(0, 16));
597 const id = setInterval(() => setNowMinute(new Date().toISOString().slice(0, 16)), 60_000);
598 return () => clearInterval(id);
599 }, [threadListV2Enabled]),
600 );
601 // Threads on servers without the settlement capability never classify as
602 // settled (the user could neither un-settle nor pin them).
603 const serverConfigs = useAtomValue(environmentServerConfigsAtom);
604 const settlementEnvironmentIds = useMemo(() => {
605 const supported = new Set<EnvironmentId>();
606 for (const [environmentId, config] of serverConfigs) {
607 if (config.environment.capabilities.threadSettlement === true) {
608 supported.add(environmentId);
609 }
610 }
611 return supported;
612 }, [serverConfigs]);
613 const snoozeEnvironmentIds = useMemo(() => {
614 const supported = new Set<EnvironmentId>();
615 for (const [environmentId, config] of serverConfigs) {
616 if (config.environment.capabilities.threadSnooze === true) {
617 supported.add(environmentId);
618 }
619 }
620 return supported;
621 }, [serverConfigs]);
622 const pinningEnvironmentIds = useMemo(() => {
623 const supported = new Set<EnvironmentId>();
624 for (const [environmentId, config] of serverConfigs) {
625 if (config.environment.capabilities.threadPinning === true) {
626 supported.add(environmentId);
627 }
628 }
629 return supported;
630 }, [serverConfigs]);
631 const pinReorderEnvironmentIds = useMemo(() => {
632 const supported = new Set<EnvironmentId>();
633 for (const [environmentId, config] of serverConfigs) {
634 if (config.environment.capabilities.threadPinReorder === true) {
635 supported.add(environmentId);
636 }
637 }
638 return supported;
639 }, [serverConfigs]);
640 const titleRegenerationEnvironmentIds = useMemo(() => {
641 const supported = new Set<EnvironmentId>();
642 for (const [environmentId, config] of serverConfigs) {
643 if (config.environment.capabilities.threadTitleRegeneration === true) {
644 supported.add(environmentId);
645 }
646 }
647 return supported;
648 }, [serverConfigs]);
649 // Canonical arranged pinned order (reorder-capable threads only) for the
650 // Move up/down position flags. Computed from all shells, not the rendered
651 // list, so search/scope filtering never disables or misdirects a move.
652 const arrangedPinnedKeys = useMemo(() => {
653 const pinned = sortPinnedThreadsByOrderKey(
654 props.threads.filter(
655 (thread) =>
656 thread.pinnedAt != null &&
657 thread.archivedAt === null &&
658 pinReorderEnvironmentIds.has(thread.environmentId),
659 ),
660 );
661 return pinned.map((thread) => `${thread.environmentId}:${thread.id}`);
662 }, [pinReorderEnvironmentIds, props.threads]);
663 const threadListV2Layout = useMemo(() => {
664 if (!threadListV2Enabled)
665 return {
666 items: [],
667 hiddenSettledCount: 0,
668 snoozedCount: 0,
669 snoozedShelfHeaderIndex: null,
670 settledCount: 0,
671 settledShelfHeaderIndex: null,
672 nextSnoozeWakeAt: null,
673 };
674 // Settled threads are live shells; archived threads keep their original
675 // "hidden from lists" meaning.
676 return buildThreadListV2Items({
677 threads: props.threads.filter((thread) => thread.archivedAt === null),
678 environmentId: props.selectedEnvironmentId,
679 projectRefs: v2ScopedProjectGroup === null ? null : v2ScopedProjectGroup.projectRefs,
680 searchQuery: props.searchQuery,
681 matchedThreadKeys,
682 changeRequestByKey,
683 autoSettleOnMerge,
684 settlementEnvironmentIds,
685 snoozeEnvironmentIds,
686 settledLimit: settledVisibleCount,
687 now: `${nowMinute}:00.000Z`,
688 snoozeNow: new Date().toISOString(),
689 snoozedShelfExpanded,
690 settledShelfExpanded,
691 selectedThreadKey: null,
692 });
693 }, [
694 changeRequestByKey,
695 autoSettleOnMerge,
696 nowMinute,
697 snoozeWakeTick,
698 snoozedShelfExpanded,
699 settledShelfExpanded,
700 settledVisibleCount,
701 settlementEnvironmentIds,
702 snoozeEnvironmentIds,
703 props.searchQuery,
704 props.selectedEnvironmentId,
705 props.threads,
706 matchedThreadKeys,
707 threadListV2Enabled,
708 v2ScopedProjectGroup,
709 ]);
710 // Re-partition the moment the earliest snooze expires (clamped to the
711 // signed-32-bit setTimeout range; far-future wakes re-arm at the clamp).
712 const nextSnoozeWakeAt = threadListV2Layout.nextSnoozeWakeAt;
713 useEffect(() => {
714 if (nextSnoozeWakeAt === null) return;
715 const wakeAtMs = Date.parse(nextSnoozeWakeAt);
716 if (Number.isNaN(wakeAtMs)) return;
717 const delayMs = Math.min(Math.max(0, wakeAtMs - Date.now()) + 50, 2_147_483_647);
718 const id = setTimeout(() => bumpSnoozeWakeTick((tick) => tick + 1), delayMs);
719 return () => clearTimeout(id);
720 // snoozeWakeTick must re-arm the timer even when nextSnoozeWakeAt is
721 // unchanged: after a clamped fire (wake beyond the 32-bit setTimeout
722 // range) the boundary string is identical and the chain would die.
723 }, [nextSnoozeWakeAt, snoozeWakeTick]);
724 // Queued tasks are not thread shells, so the v2 partition never sees them;
725 // they are spliced in below the active block and stay visible and deletable
726 // while their environment is offline. Same environment scope and search
727 // filter as the list itself.
728 const v2SearchQuery = props.searchQuery.trim().toLocaleLowerCase();
729 const v2PendingTasks = useMemo(
730 () =>
731 props.pendingTasks.filter(
732 (pendingTask) =>
733 (props.selectedEnvironmentId === null ||
734 pendingTask.message.environmentId === props.selectedEnvironmentId) &&
735 (v2ScopedProjectKeys === null ||
736 v2ScopedProjectKeys.has(
737 scopedProjectKey(pendingTask.message.environmentId, pendingTask.creation.projectId),
738 )) &&
739 (v2SearchQuery.length === 0 ||
740 pendingTask.title.toLocaleLowerCase().includes(v2SearchQuery)),
741 ),
742 [props.pendingTasks, props.selectedEnvironmentId, v2ScopedProjectKeys, v2SearchQuery],
743 );
744 const threadListV2Items = useMemo(
745 () =>
746 buildThreadListV2ListItems({
747 items: threadListV2Layout.items,
748 pendingTasks: v2PendingTasks,
749 snoozedCount: threadListV2Layout.snoozedCount,
750 snoozedShelfExpanded,
751 snoozedShelfHeaderIndex: threadListV2Layout.snoozedShelfHeaderIndex,
752 settledCount: threadListV2Layout.settledCount,
753 settledShelfExpanded,
754 settledShelfHeaderIndex: threadListV2Layout.settledShelfHeaderIndex,
755 snoozeLabelNow: `${nowMinute}:00.000Z`,
756 }),
757 [settledShelfExpanded, snoozedShelfExpanded, threadListV2Layout, v2PendingTasks],
758 );
759​
760 const renderV2Item = useCallback(
761 ({ item, index }: { readonly item: ThreadListV2ListItem; readonly index: number }) => {
762 const nextItem = threadListV2Items[index + 1];
763 const showTrailingDivider =
764 nextItem?.type === "v2-thread" ||
765 (nextItem?.type === "v2-pending" && !nextItem.showPendingDivider);
766 if (item.type === "v2-pending") {
767 const pendingScopeKey = scopedProjectKey(
768 item.pendingTask.message.environmentId,
769 item.pendingTask.creation.projectId,
770 );
771 return (
772 <ThreadListV2PendingRow
773 pendingTask={item.pendingTask}
774 project={projectByKey.get(pendingScopeKey) ?? null}
775 projectTitle={v2ProjectTitleByProjectKey.get(pendingScopeKey)}
776 environmentLabel={
777 Object.keys(props.savedConnectionsById).length > 1
778 ? (props.savedConnectionsById[item.pendingTask.message.environmentId]
779 ?.environmentLabel ?? null)
780 : null
781 }
782 showPendingDivider={item.showPendingDivider}
783 showTrailingDivider={showTrailingDivider}
784 onSelectPendingTask={props.onSelectPendingTask}
785 onDeletePendingTask={props.onDeletePendingTask}
786 />
787 );
788 }
789 if (item.type === "v2-snoozed-shelf") {
790 return (
791 <ThreadListV2SnoozedShelfHeader
792 count={item.count}
793 disabled={!shelfPreferencesLoaded}
794 expanded={item.expanded}
795 onToggle={toggleSnoozedShelf}
796 />
797 );
798 }
799 if (item.type === "v2-settled-shelf") {
800 return (
801 <ThreadListV2SettledShelfHeader
802 count={item.count}
803 disabled={!shelfPreferencesLoaded}
804 expanded={item.expanded}
805 onToggle={toggleSettledShelf}
806 />
807 );
808 }
809 const thread = item.item.thread;
810 return (
811 <ThreadListV2Row
812 thread={thread}
813 variant={item.item.variant}
814 snoozed={item.item.snoozed}
815 pinned={item.item.pinned}
816 snoozePresetMinute={nowMinute}
817 snoozeWakeLabelText={item.snoozeWakeLabelText}
818 showTrailingDivider={showTrailingDivider}
819 project={
820 projectByKey.get(scopedProjectKey(thread.environmentId, thread.projectId)) ?? null
821 }
822 projectTitle={v2ProjectTitleByProjectKey.get(
823 scopedProjectKey(thread.environmentId, thread.projectId),
824 )}
825 providerDriver={
826 serverConfigs
827 .get(thread.environmentId)
828 ?.providers.find(
829 (provider) =>
830 provider.instanceId ===
831 (thread.session?.providerInstanceId ?? thread.modelSelection.instanceId),
832 )?.driver ?? null
833 }
834 environmentLabel={
835 Object.keys(props.savedConnectionsById).length > 1
836 ? (props.savedConnectionsById[thread.environmentId]?.environmentLabel ?? null)
837 : null
838 }
839 searchMatch={threadSearchMatchByKey.get(
840 threadSearchMatchKey({
841 environmentId: thread.environmentId,
842 threadId: thread.id,
843 }),
844 )}
845 searchQuery={props.searchQuery}
846 onSelectThread={props.onSelectThread}
847 onDeleteThread={handleDeleteThread}
848 onArchiveThread={props.onArchiveThread}
849 onRegenerateThreadTitle={handleRegenerateThreadTitle}
850 titleRegenerationSupported={titleRegenerationEnvironmentIds.has(thread.environmentId)}
851 settlementSupported={settlementEnvironmentIds.has(thread.environmentId)}
852 onSettleThread={handleSettleThread}
853 snoozeSupported={snoozeEnvironmentIds.has(thread.environmentId)}
854 pinningSupported={pinningEnvironmentIds.has(thread.environmentId)}
855 pinReorderSupported={pinReorderEnvironmentIds.has(thread.environmentId)}
856 canMovePinnedUp={arrangedPinnedKeys.indexOf(`${thread.environmentId}:${thread.id}`) > 0}
857 canMovePinnedDown={(() => {
858 const index = arrangedPinnedKeys.indexOf(`${thread.environmentId}:${thread.id}`);
859 return index !== -1 && index < arrangedPinnedKeys.length - 1;
860 })()}
861 onSnoozeThread={handleSnoozeThread}
862 onUnsnoozeThread={handleUnsnoozeThread}
863 onUnsettleThread={handleUnsettleThread}
864 onPinThread={handlePinThread}
865 onUnpinThread={handleUnpinThread}
866 onMovePinnedThread={handleMovePinnedThread}
867 onChangeRequestState={handleChangeRequestState}
868 projectCwd={
869 projectCwdByKey.get(scopedProjectKey(thread.environmentId, thread.projectId)) ?? null
870 }
871 onSwipeableClose={handleSwipeableClose}
872 onSwipeableWillOpen={handleSwipeableWillOpen}
873 />
874 );
875 },
876 [
877 handleChangeRequestState,
878 handleDeleteThread,
879 arrangedPinnedKeys,
880 handleMovePinnedThread,
881 handlePinThread,
882 handleRegenerateThreadTitle,
883 handleSettleThread,
884 handleSnoozeThread,
885 handleUnpinThread,
886 handleUnsnoozeThread,
887 handleSwipeableClose,
888 handleSwipeableWillOpen,
889 handleUnsettleThread,
890 pinningEnvironmentIds,
891 pinReorderEnvironmentIds,
892 projectByKey,
893 projectCwdByKey,
894 props.onArchiveThread,
895 props.onDeletePendingTask,
896 props.onSelectPendingTask,
897 props.onSelectThread,
898 props.savedConnectionsById,
899 serverConfigs,
900 shelfPreferencesLoaded,
901 settlementEnvironmentIds,
902 snoozeEnvironmentIds,
903 threadListV2Items,
904 threadSearchMatchByKey,
905 titleRegenerationEnvironmentIds,
906 toggleSettledShelf,
907 toggleSnoozedShelf,
908 v2ProjectTitleByProjectKey,
909 props.searchQuery,
910 nowMinute,
911 ],
912 );
913 const v2KeyExtractor = useCallback((item: ThreadListV2ListItem) => item.key, []);
914​
915 // FlatList treats a changed extraData identity as "re-render every visible
916 // row", so an inline object literal would invalidate all rows on every
917 // HomeScreen render.
918 const v2ExtraData = useMemo(
919 () => ({
920 projectByKey,
921 projectCwdByKey,
922 projectTitleByProjectKey: v2ProjectTitleByProjectKey,
923 serverConfigs,
924 savedConnectionsById: props.savedConnectionsById,
925 searchQuery: props.searchQuery,
926 snoozePresetMinute: nowMinute,
927 threadSearchMatchByKey,
928 }),
929 [
930 projectByKey,
931 projectCwdByKey,
932 props.searchQuery,
933 props.savedConnectionsById,
934 serverConfigs,
935 nowMinute,
936 threadSearchMatchByKey,
937 v2ProjectTitleByProjectKey,
938 ],
939 );
940​
941 const extraData = useMemo(
942 () => ({
943 projectCwdByKey,
944 savedConnectionsById: props.savedConnectionsById,
945 searchQuery: props.searchQuery,
946 threadSearchMatchByKey,
947 }),
948 [projectCwdByKey, props.savedConnectionsById, props.searchQuery, threadSearchMatchByKey],
949 );
950​
951 const renderItem = useCallback(
952 ({ item }: LegendListRenderItemProps<HomeListItem>) => {
953 switch (item.type) {
954 case "header":
955 return (
956 <ThreadListGroupHeader
957 variant="compact"
958 collapsed={item.collapsed}
959 isFirst={item.isFirst}
960 groupKey={item.group.key}
961 onGroupAction={updateGroupDisplay}
962 // Aggregated groups (same repo across machines) have no single
963 // target project, and `pending-project:` groups hold a placeholder
964 // built from queued-task metadata rather than a real project shell,
965 // so the quick new-thread button is single-real-project only.
966 newThreadTarget={item.group.newThreadTarget}
967 onNewThread={props.onNewThreadInProject}
968 project={item.group.representative}
969 threadCount={item.group.threads.length + item.group.pendingTasks.length}
970 title={item.group.title}
971 />
972 );
973 case "pending-task":
974 return (
975 <PendingTaskListRow
976 variant="compact"
977 pendingTask={item.pendingTask}
978 environmentLabel={
979 props.savedConnectionsById[item.pendingTask.message.environmentId]
980 ?.environmentLabel ?? null
981 }
982 isLast={item.isLast}
983 onSelectPendingTask={props.onSelectPendingTask}
984 onDeletePendingTask={props.onDeletePendingTask}
985 />
986 );
987 case "thread": {
988 const thread = item.thread;
989 return (
990 <ThreadListRow
991 variant="compact"
992 thread={thread}
993 environmentLabel={
994 props.savedConnectionsById[thread.environmentId]?.environmentLabel ?? null
995 }
996 projectCwd={
997 projectCwdByKey.get(scopedProjectKey(thread.environmentId, thread.projectId)) ??
998 null
999 }
1000 isLast={item.isLast}
1001 searchMatch={threadSearchMatchByKey.get(
1002 threadSearchMatchKey({
1003 environmentId: thread.environmentId,
1004 threadId: thread.id,
1005 }),
1006 )}
1007 searchQuery={props.searchQuery}
1008 onArchiveThread={props.onArchiveThread}
1009 onDeleteThread={props.onDeleteThread}
1010 onRegenerateThreadTitle={handleRegenerateThreadTitle}
1011 titleRegenerationSupported={titleRegenerationEnvironmentIds.has(thread.environmentId)}
1012 onSelectThread={props.onSelectThread}
1013 onSwipeableClose={handleSwipeableClose}
1014 onSwipeableWillOpen={handleSwipeableWillOpen}
1015 />
1016 );
1018 case "show-more":
1019 return (
1020 <ThreadListShowMoreRow
1021 variant="compact"
1022 hiddenCount={item.hiddenCount}
1023 canShowLess={item.canShowLess}
1024 groupKey={item.groupKey}
1025 onGroupAction={updateGroupDisplay}
1026 />
1027 );
1029 },
1031 handleSwipeableClose,
1032 handleSwipeableWillOpen,
1033 handleRegenerateThreadTitle,
1034 projectCwdByKey,
1035 props.onArchiveThread,
1036 props.onDeletePendingTask,
1037 props.onDeleteThread,
1038 props.onNewThreadInProject,
1039 props.onSelectPendingTask,
1040 props.onSelectThread,
1041 props.searchQuery,
1042 props.savedConnectionsById,
1043 threadSearchMatchByKey,
1044 titleRegenerationEnvironmentIds,
1045 updateGroupDisplay,
1046 ],
1047 );
1048​
1049 const keyExtractor = useCallback((item: HomeListItem) => item.key, []);
1050​
1051 /* Empty states */
1052 // The signal must ignore the search/environment filters: an active query
1053 // that matches nothing needs the in-list "No results" state, not the
1054 // full-page "No threads yet". Settled threads are unarchived live shells,
1055 // so the v1 check already covers v2.
1056 const hasAnyThreads =
1057 props.threads.some((thread) => thread.archivedAt === null) || props.pendingTasks.length > 0;
1058 const hasResults = projectGroups.length > 0;
1059 const selectedEnvironmentLabel =
1060 props.selectedEnvironmentId === null
1061 ? null
1062 : (props.savedConnectionsById[props.selectedEnvironmentId]?.environmentLabel ??
1063 "this environment");
1064 // Connection state surfaces in the header title slot
1065 // (WorkspaceConnectionTitle) — nothing renders inside the list, so
1066 // reconnects never shift the rows.
1067 const emptyState = deriveEmptyState({
1068 catalogState: props.catalogState,
1069 projectCount: props.projects.length,
1070 });
1071​
1072 if (!hasAnyThreads) {
1073 return (
1074 <View
1075 className="flex-1 items-center justify-center bg-screen px-8"
1076 style={{
1077 paddingBottom: Math.max(insets.bottom, 24) + iosBottomToolbarClearance,
1078 paddingTop: NATIVE_LIQUID_GLASS_SUPPORTED ? insets.top + 72 : 0,
1079 }}
1081 <View className="w-full max-w-[430px]">
1082 <EmptyState
1083 title={emptyState.title}
1084 detail={emptyState.detail}
1085 actionLabel={!props.catalogState.hasReadyEnvironment ? "Add environment" : undefined}
1086 onAction={!props.catalogState.hasReadyEnvironment ? props.onAddConnection : undefined}
1087 variant="plain"
1088 />
1089 {emptyState.loading ? (
1090 <View className="mt-4 items-center">
1091 <ActivityIndicator colorClassName={"accent-icon-muted"} />
1092 </View>
1093 ) : null}
1094 </View>
1095 </View>
1096 );
1098​
1099 const listHeader = Platform.OS === "ios" ? null : <HomeTopContentSpacer />;
1100​
1101 // Project scoping lives in the header filter menu (no inline chip row on
1102 // mobile — the menu is the one filter surface).
1103 const v2ListHeader = listHeader;
1104​
1105 const listEmpty = !hasResults ? (
1106 hasSearchQuery && threadSearch.isPending ? null : hasSearchQuery ? (
1107 <EmptyState title="No results" detail={`No threads matching "${props.searchQuery}".`} />
1108 ) : selectedProjectScope !== null ? (
1109 <EmptyState
1110 title={`No threads in ${selectedProjectScope.title}`}
1111 detail="Choose another project or create a new task."
1112 />
1113 ) : selectedEnvironmentLabel ? (
1114 <EmptyState
1115 title={`No threads in ${selectedEnvironmentLabel}`}
1116 detail="Choose another environment or create a new task."
1117 />
1118 ) : (
1119 <EmptyState title="No threads yet" detail="Create a task to start a new coding session." />
1121 ) : null;
1122 // Self-contained: v1's listEmpty keys off projectGroups, which ignores the
1123 // v2 project scope, so it can be null (results elsewhere) while this list
1124 // is empty. Snoozed threads need no special empty state: their shelf header
1125 // is a list row even while collapsed.
1126 const v2ListEmpty =
1127 hasSearchQuery && threadSearch.isPending ? null : hasSearchQuery ? (
1128 <EmptyState title="No results" detail={`No threads matching "${props.searchQuery}".`} />
1129 ) : v2ScopedProjectGroup !== null ? (
1130 <EmptyState
1131 title={`No threads in ${v2ScopedProjectGroup.title}`}
1132 detail="Choose another project or create a new task."
1133 />
1134 ) : (
1135 listEmpty
1136 );
1137​
1138 if (threadListV2Enabled) {
1139 return (
1140 <View className="flex-1 bg-screen">
1141 <SwipeableScrollGateProvider enabled={swipeEnabled}>
1142 <FlatList
1143 data={threadListV2Items}
1144 renderItem={renderV2Item}
1145 keyExtractor={v2KeyExtractor}
1146 extraData={v2ExtraData}
1147 ListHeaderComponent={v2ListHeader}
1148 ListFooterComponent={
1149 settledShelfExpanded && threadListV2Layout.hiddenSettledCount > 0 ? (
1150 <Pressable
1151 accessibilityRole="button"
1152 accessibilityLabel={`Show ${Math.min(threadListV2Layout.hiddenSettledCount, THREAD_LIST_V2_SETTLED_PAGE_COUNT)} more settled threads`}
1153 onPress={showMoreSettled}
1154 className="mx-4 mt-2 items-center rounded-lg border border-dashed border-border py-2.5"
1155 style={({ pressed }) => ({ opacity: pressed ? 0.6 : 1 })}
1157 <Text className="text-xs font-t3-medium text-foreground-muted">
1158 Show more ({threadListV2Layout.hiddenSettledCount} settled hidden)
1159 </Text>
1160 </Pressable>
1161 ) : null
1163 ListEmptyComponent={v2ListEmpty}
1164 style={{ flex: 1 }}
1165 automaticallyAdjustsScrollIndicatorInsets={Platform.OS === "ios"}
1166 contentInsetAdjustmentBehavior={Platform.OS === "ios" ? "automatic" : "never"}
1167 showsVerticalScrollIndicator={false}
1168 keyboardDismissMode="on-drag"
1169 keyboardShouldPersistTaps="handled"
1170 {...scrollGateHandlers}
1171 scrollEventThrottle={16}
1172 contentContainerStyle={{
1173 paddingBottom:
1174 Platform.OS === "ios"
1175 ? Math.max(insets.bottom, 24) + 96 + iosBottomToolbarClearance
1176 : Math.max(insets.bottom, 16) + 88,
1177 }}
1178 />
1179 </SwipeableScrollGateProvider>
1180 </View>
1181 );
1183​
1184 return (
1185 <View className="flex-1 bg-screen">
1186 {/* Sticky headers are deliberately not wired up: LegendList's JS sticky
1187 implementation mispositions pinned headers at mount under iOS
1188 automatic content insets (headers render one nav-inset too low until
1189 the first scroll event) and blanks non-pinned headers after
1190 collapse/expand data changes. The flattened layout still exposes
1191 `stickyHeaderIndices` if this gets revisited. */}
1192 <SwipeableScrollGateProvider enabled={swipeEnabled}>
1193 <LegendList
1194 ref={listRef}
1195 data={listLayout.items}
1196 renderItem={renderItem}
1197 keyExtractor={keyExtractor}
1198 itemsAreEqual={homeListItemsAreEqual}
1199 drawDistance={500}
1200 estimatedItemSize={ESTIMATED_THREAD_ROW_HEIGHT}
1201 extraData={extraData}
1202 ListHeaderComponent={listHeader}
1203 ListEmptyComponent={listEmpty}
1204 style={{ flex: 1 }}
1205 automaticallyAdjustsScrollIndicatorInsets={NATIVE_LIQUID_GLASS_SUPPORTED}
1206 contentInsetAdjustmentBehavior={NATIVE_LIQUID_GLASS_SUPPORTED ? "automatic" : "never"}
1207 showsVerticalScrollIndicator={false}
1208 keyboardDismissMode="on-drag"
1209 keyboardShouldPersistTaps="handled"
1210 {...scrollGateHandlers}
1211 recycleItems
1212 scrollEventThrottle={16}
1213 contentContainerStyle={{
1214 // Android reserves room for the floating new-task FAB
1215 // (56 button + 16 gap + bottom inset). Pre-glass iOS shows a
1216 // standard 44pt bottom toolbar that overlays the list and is not
1217 // reflected in insets while contentInsetAdjustmentBehavior is
1218 // "never".
1219 paddingBottom:
1220 Platform.OS === "ios"
1221 ? Math.max(insets.bottom, 24) + 24 + iosBottomToolbarClearance
1222 : Math.max(insets.bottom, 16) + 88,
1223 }}
1224 scrollIndicatorInsets={
1225 Platform.OS === "ios"
1226 ? {
1227 bottom: Math.max(insets.bottom, 16) + 24 + iosBottomToolbarClearance,
1228 top: 0,
1230 : undefined
1232 />
1233 </SwipeableScrollGateProvider>
1234 </View>
1235 );