diff --git a/apps/mobile/src/features/files/thread-file-navigator-pane.tsx b/apps/mobile/src/features/files/thread-file-navigator-pane.tsx index c11095b725..58a77a7460 100644 --- a/apps/mobile/src/features/files/thread-file-navigator-pane.tsx +++ b/apps/mobile/src/features/files/thread-file-navigator-pane.tsx @@ -1,9 +1,17 @@ import type { EnvironmentId, ProjectListEntriesResult } from "@t3tools/contracts"; import { SymbolView } from "expo-symbols"; -import { useCallback, useState } from "react"; -import { Pressable, useColorScheme, View } from "react-native"; +import { useCallback, useMemo, useState, type ComponentProps } from "react"; +import { Platform, Pressable, useColorScheme, View, type NativeSyntheticEvent } from "react-native"; +import { + Screen, + ScreenStack, + ScreenStackHeaderConfig, + ScreenStackHeaderSearchBarView, + SearchBar, +} from "react-native-screens"; import { AppText as Text, AppTextInput as TextInput } from "../../components/AppText"; +import { nativeTopScrollEdgeEffect } from "../../lib/native-scroll-edge-effect"; import { useThemeColor } from "../../lib/useThemeColor"; import { projectEnvironment } from "../../state/projects"; import { useEnvironmentQuery } from "../../state/query"; @@ -22,6 +30,9 @@ export function ThreadFileNavigatorPane(props: { const colorScheme = useColorScheme(); const highlightTheme = colorScheme === "dark" ? "dark" : "light"; const iconColor = String(useThemeColor("--color-icon-muted")); + const foregroundColor = String(useThemeColor("--color-foreground")); + const sheetColor = String(useThemeColor("--color-sheet")); + const topScrollEdgeEffect = nativeTopScrollEdgeEffect(Platform.OS, Platform.Version); const entriesQuery = useEnvironmentQuery( projectEnvironment.listEntries({ environmentId: props.environmentId, @@ -40,6 +51,94 @@ export function ThreadFileNavigatorPane(props: { }, [highlightTheme, props.cwd, props.environmentId], ); + const nativeHeaderRightBarButtonItems = useMemo( + () => + [ + { + accessibilityLabel: "Refresh files", + icon: { name: "arrow.clockwise", type: "sfSymbol" as const }, + identifier: "thread-file-navigator-refresh", + onPress: entriesQuery.refresh, + sharesBackground: false, + tintColor: foregroundColor, + type: "button" as const, + width: 44, + }, + ] as ComponentProps["headerRightBarButtonItems"], + [entriesQuery.refresh, foregroundColor], + ); + + const fileTree = ( + + ); + + if (Platform.OS === "ios") { + return ( + + + + {fileTree} + + + { + setSearchQuery(""); + }} + onChangeText={(event: NativeSyntheticEvent<{ readonly text?: string }>) => { + setSearchQuery(event.nativeEvent.text ?? ""); + }} + placement="integratedButton" + placeholder="Search files" + textColor={foregroundColor} + tintColor={foregroundColor} + /> + + + + + + ); + } return ( @@ -75,16 +174,7 @@ export function ThreadFileNavigatorPane(props: { /> - + {fileTree} ); }