Skip to content

Commit 3c1a9a4

Browse files
committed
fix(mobile): keep files folder picker below iOS headers
1 parent 347f314 commit 3c1a9a4

3 files changed

Lines changed: 19 additions & 7 deletions

File tree

‎apps/mobile/src/features/files/FileTreeBrowser.tsx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { LegendList } from "@legendapp/list/react-native";
22
import type { ProjectEntry } from "@t3tools/contracts";
33
import { SymbolView } from "../../components/AppSymbol";
4-
import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
4+
import { memo, useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from "react";
55
import { ActivityIndicator, Platform, Pressable, RefreshControl, View } from "react-native";
66
import { useSafeAreaInsets } from "react-native-safe-area-context";
77

@@ -103,6 +103,7 @@ const FileTreeRow = memo(function FileTreeRow(props: {
103103
});
104104

105105
export function FileTreeBrowser(props: {
106+
readonly header?: ReactNode;
106107
readonly entries: ReadonlyArray<ProjectEntry>;
107108
readonly error: string | null;
108109
readonly isPending: boolean;
@@ -263,6 +264,7 @@ export function FileTreeBrowser(props: {
263264
renderItem={renderItem}
264265
ListHeaderComponent={
265266
<>
267+
{props.header}
266268
{props.error && props.entries.length > 0 ? (
267269
<Text accessibilityRole="alert" className="mx-4 my-2 text-xs text-foreground-muted">
268270
{props.error}

‎apps/mobile/src/features/files/ThreadFilesRouteScreen.tsx‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,14 @@ export function ThreadFilesTreeScreen(props: ThreadFilesRouteScreenProps) {
588588
);
589589
}
590590

591+
const folderPicker = (
592+
<WorkspaceFolderPicker
593+
roots={roots}
594+
selectedId={rootId}
595+
onSelect={(rootId) => navigation.setParams({ rootId })}
596+
/>
597+
);
598+
591599
const content = (
592600
<>
593601
<FilesBrowserHeader
@@ -598,13 +606,10 @@ export function ThreadFilesTreeScreen(props: ThreadFilesRouteScreenProps) {
598606
onBack={handleReturnToThread}
599607
/>
600608
<MaterialScreenContent insetHorizontal={layout.usesSplitView}>
601-
<WorkspaceFolderPicker
602-
roots={roots}
603-
selectedId={rootId}
604-
onSelect={(rootId) => navigation.setParams({ rootId })}
605-
/>
609+
{Platform.OS !== "ios" ? folderPicker : null}
606610
<FileTreeBrowser
607611
key={JSON.stringify([environmentId, cwd])}
612+
header={Platform.OS === "ios" ? folderPicker : undefined}
608613
entries={entriesQuery.entries}
609614
loadingDirectories={entriesQuery.loadingDirectories}
610615
onLoadDirectory={entriesQuery.loadDirectory}

‎apps/mobile/src/features/files/thread-file-navigator-pane.tsx‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,16 @@ export function ThreadFileNavigatorPane(props: {
9797
[foregroundColor, toggleAuxiliaryPane],
9898
);
9999

100+
const folderPicker = (
101+
<WorkspaceFolderPicker roots={roots} selectedId={root?.id} onSelect={setSelectedRootId} />
102+
);
103+
100104
const fileTree = (
101105
<>
102-
<WorkspaceFolderPicker roots={roots} selectedId={root?.id} onSelect={setSelectedRootId} />
106+
{Platform.OS !== "ios" ? folderPicker : null}
103107
<FileTreeBrowser
104108
key={JSON.stringify([props.environmentId, cwd])}
109+
header={Platform.OS === "ios" ? folderPicker : undefined}
105110
entries={entriesQuery.entries}
106111
loadingDirectories={entriesQuery.loadingDirectories}
107112
onLoadDirectory={entriesQuery.loadDirectory}

0 commit comments

Comments
 (0)