From f6df16ab1ebf0bbcc718e84a514da2ffd70b2948 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 30 Jun 2026 11:41:13 -0700 Subject: [PATCH] Replace Expo Router with native stack navigation --- apps/mobile/app.config.ts | 1 - apps/mobile/index.ts | 6 +- apps/mobile/package.json | 4 +- apps/mobile/src/App.tsx | 542 ++++++++++++++++++ apps/mobile/src/app/_layout.tsx | 206 ------- apps/mobile/src/app/connections/_layout.tsx | 29 - apps/mobile/src/app/new/_layout.tsx | 52 -- apps/mobile/src/app/settings/_layout.tsx | 62 -- .../[environmentId]/[threadId]/_layout.tsx | 113 ---- .../[threadId]/git/_layout.tsx | 58 -- .../[environmentId]/[threadId]/git/review.tsx | 18 - .../agent-awareness/notificationNavigation.ts | 2 +- .../archive/ArchivedThreadsRouteScreen.tsx | 2 +- .../archive/ArchivedThreadsScreen.tsx | 2 +- .../features/files/ThreadFilesRouteScreen.tsx | 4 +- apps/mobile/src/features/home/HomeHeader.tsx | 2 +- .../HardwareKeyboardCommandProvider.tsx | 2 +- .../layout/AdaptiveWorkspaceLayout.tsx | 7 +- .../layout/workspace-sidebar-toolbar.tsx | 2 +- .../features/projects/AddProjectScreen.tsx | 2 +- .../review/ReviewCommentComposerSheet.tsx | 2 +- .../src/features/review/ReviewSheet.tsx | 6 +- .../useReviewCommentSelectionController.ts | 2 +- .../terminal/ThreadTerminalRouteScreen.tsx | 2 +- .../features/threads/NewTaskDraftScreen.tsx | 2 +- .../features/threads/ThreadDetailScreen.tsx | 2 +- .../src/features/threads/ThreadFeed.tsx | 2 +- .../features/threads/ThreadGitControls.tsx | 15 +- .../threads/ThreadNavigationSidebar.tsx | 2 +- .../features/threads/ThreadRouteScreen.tsx | 7 +- .../features/threads/git/GitBranchesSheet.tsx | 2 +- .../features/threads/git/GitCommitSheet.tsx | 2 +- .../features/threads/git/GitConfirmSheet.tsx | 2 +- .../features/threads/git/GitOverviewSheet.tsx | 2 +- apps/mobile/src/lib/routes.ts | 2 +- apps/mobile/src/navigation/route-model.ts | 375 ++++++++++++ apps/mobile/src/navigation/router.tsx | 536 +++++++++++++++++ .../src/{app => screens}/+not-found.tsx | 2 +- .../{app => screens}/connections/index.tsx | 2 +- .../src/{app => screens}/connections/new.tsx | 2 +- .../src/{app => screens}/debug/rns-glass.tsx | 2 +- apps/mobile/src/{app => screens}/index.tsx | 2 +- .../new/add-project/destination.tsx | 0 .../new/add-project/index.tsx | 0 .../new/add-project/local.tsx | 0 .../new/add-project/repository.tsx | 2 +- .../mobile/src/{app => screens}/new/draft.tsx | 2 +- .../mobile/src/{app => screens}/new/index.tsx | 2 +- .../src/{app => screens}/settings/archive.tsx | 0 .../src/{app => screens}/settings/auth.tsx | 2 +- .../settings/environment-new.tsx | 0 .../settings/environments.tsx | 2 +- .../src/{app => screens}/settings/index.tsx | 2 +- .../{app => screens}/settings/waitlist.tsx | 2 +- .../[threadId]/files/[...path].tsx | 0 .../[threadId]/files/index.tsx | 0 .../[threadId]/git-confirm.tsx | 0 .../[threadId]/git/branches.tsx | 0 .../[environmentId]/[threadId]/git/commit.tsx | 0 .../[environmentId]/[threadId]/git/index.tsx | 0 .../[environmentId]/[threadId]/index.tsx | 0 .../[threadId]/review-comment.tsx | 0 .../[environmentId]/[threadId]/review.tsx | 0 .../[environmentId]/[threadId]/terminal.tsx | 0 apps/mobile/src/state/use-thread-selection.ts | 2 +- patches/expo-router@56.2.11.patch | 115 ---- pnpm-lock.yaml | 153 ++++- pnpm-workspace.yaml | 1 - 68 files changed, 1648 insertions(+), 726 deletions(-) create mode 100644 apps/mobile/src/App.tsx delete mode 100644 apps/mobile/src/app/_layout.tsx delete mode 100644 apps/mobile/src/app/connections/_layout.tsx delete mode 100644 apps/mobile/src/app/new/_layout.tsx delete mode 100644 apps/mobile/src/app/settings/_layout.tsx delete mode 100644 apps/mobile/src/app/threads/[environmentId]/[threadId]/_layout.tsx delete mode 100644 apps/mobile/src/app/threads/[environmentId]/[threadId]/git/_layout.tsx delete mode 100644 apps/mobile/src/app/threads/[environmentId]/[threadId]/git/review.tsx create mode 100644 apps/mobile/src/navigation/route-model.ts create mode 100644 apps/mobile/src/navigation/router.tsx rename apps/mobile/src/{app => screens}/+not-found.tsx (96%) rename apps/mobile/src/{app => screens}/connections/index.tsx (98%) rename apps/mobile/src/{app => screens}/connections/new.tsx (99%) rename apps/mobile/src/{app => screens}/debug/rns-glass.tsx (99%) rename apps/mobile/src/{app => screens}/index.tsx (98%) rename apps/mobile/src/{app => screens}/new/add-project/destination.tsx (100%) rename apps/mobile/src/{app => screens}/new/add-project/index.tsx (100%) rename apps/mobile/src/{app => screens}/new/add-project/local.tsx (100%) rename apps/mobile/src/{app => screens}/new/add-project/repository.tsx (90%) rename apps/mobile/src/{app => screens}/new/draft.tsx (91%) rename apps/mobile/src/{app => screens}/new/index.tsx (99%) rename apps/mobile/src/{app => screens}/settings/archive.tsx (100%) rename apps/mobile/src/{app => screens}/settings/auth.tsx (93%) rename apps/mobile/src/{app => screens}/settings/environment-new.tsx (100%) rename apps/mobile/src/{app => screens}/settings/environments.tsx (99%) rename apps/mobile/src/{app => screens}/settings/index.tsx (99%) rename apps/mobile/src/{app => screens}/settings/waitlist.tsx (94%) rename apps/mobile/src/{app => screens}/threads/[environmentId]/[threadId]/files/[...path].tsx (100%) rename apps/mobile/src/{app => screens}/threads/[environmentId]/[threadId]/files/index.tsx (100%) rename apps/mobile/src/{app => screens}/threads/[environmentId]/[threadId]/git-confirm.tsx (100%) rename apps/mobile/src/{app => screens}/threads/[environmentId]/[threadId]/git/branches.tsx (100%) rename apps/mobile/src/{app => screens}/threads/[environmentId]/[threadId]/git/commit.tsx (100%) rename apps/mobile/src/{app => screens}/threads/[environmentId]/[threadId]/git/index.tsx (100%) rename apps/mobile/src/{app => screens}/threads/[environmentId]/[threadId]/index.tsx (100%) rename apps/mobile/src/{app => screens}/threads/[environmentId]/[threadId]/review-comment.tsx (100%) rename apps/mobile/src/{app => screens}/threads/[environmentId]/[threadId]/review.tsx (100%) rename apps/mobile/src/{app => screens}/threads/[environmentId]/[threadId]/terminal.tsx (100%) delete mode 100644 patches/expo-router@56.2.11.patch diff --git a/apps/mobile/app.config.ts b/apps/mobile/app.config.ts index 1dd884aeb8..b6c3b4dd3d 100644 --- a/apps/mobile/app.config.ts +++ b/apps/mobile/app.config.ts @@ -109,7 +109,6 @@ const config: ExpoConfig = { favicon: "./assets/favicon.png", }, plugins: [ - "expo-router", "expo-font", "expo-secure-store", ["@clerk/expo", { theme: "./clerk-theme.json" }], diff --git a/apps/mobile/index.ts b/apps/mobile/index.ts index 642e1b77be..febabbfe39 100644 --- a/apps/mobile/index.ts +++ b/apps/mobile/index.ts @@ -1,2 +1,6 @@ import "react-native-gesture-handler"; -import "expo-router/entry"; +import { registerRootComponent } from "expo"; + +import App from "./src/App"; + +registerRootComponent(App); diff --git a/apps/mobile/package.json b/apps/mobile/package.json index c9e8051ede..4212c22169 100644 --- a/apps/mobile/package.json +++ b/apps/mobile/package.json @@ -50,6 +50,9 @@ "@noble/hashes": "catalog:", "@pierre/diffs": "catalog:", "@react-native-menu/menu": "^2.0.0", + "@react-navigation/elements": "2.9.26", + "@react-navigation/native": "7.3.4", + "@react-navigation/native-stack": "7.17.6", "@shikijs/core": "4.2.0", "@shikijs/engine-javascript": "4.2.0", "@shikijs/langs": "4.2.0", @@ -81,7 +84,6 @@ "expo-network": "~56.0.5", "expo-notifications": "~56.0.18", "expo-paste-input": "^0.1.15", - "expo-router": "~56.2.11", "expo-secure-store": "~56.0.4", "expo-splash-screen": "~56.0.10", "expo-symbols": "~56.0.6", diff --git a/apps/mobile/src/App.tsx b/apps/mobile/src/App.tsx new file mode 100644 index 0000000000..543a9f64e8 --- /dev/null +++ b/apps/mobile/src/App.tsx @@ -0,0 +1,542 @@ +import { + DMSans_400Regular, + DMSans_500Medium, + DMSans_700Bold, + useFonts, +} from "@expo-google-fonts/dm-sans"; +import { NavigationContainer, type NavigationContainerRef } from "@react-navigation/native"; +import { createNativeStackNavigator } from "@react-navigation/native-stack"; +import * as Linking from "expo-linking"; +import { use, useCallback, useMemo, useRef, useState, type ReactNode } from "react"; +import { StatusBar, useColorScheme, useWindowDimensions } from "react-native"; +import { GestureHandlerRootView } from "react-native-gesture-handler"; +import { KeyboardProvider } from "react-native-keyboard-controller"; +import { SafeAreaProvider } from "react-native-safe-area-context"; +import { useResolveClassNames } from "uniwind"; + +import { RegistryContext } from "@effect/atom-react"; +import { LoadingScreen } from "./components/LoadingScreen"; +import { ArchivedThreadsRouteScreen } from "./features/archive/ArchivedThreadsRouteScreen"; +import { useAgentNotificationNavigation } from "./features/agent-awareness/notificationNavigation"; +import { CloudAuthProvider } from "./features/cloud/CloudAuthProvider"; +import { + ClerkSettingsSheetDetentProvider, + useClerkSettingsSheetDetent, +} from "./features/cloud/ClerkSettingsSheetDetent"; +import { + AdaptiveWorkspaceLayout, + useAdaptiveWorkspaceLayout, +} from "./features/layout/AdaptiveWorkspaceLayout"; +import { deriveStableFormSheetDetent } from "./lib/layout"; +import { useThemeColor } from "./lib/useThemeColor"; +import { appAtomRegistry } from "./state/atom-registry"; +import { ThreadSelectionProvider } from "./state/use-thread-selection"; +import { useThreadOutboxDrain } from "./state/use-thread-outbox-drain"; +import HomeRouteScreen from "./screens/index"; +import SettingsRouteScreen from "./screens/settings/index"; +import SettingsEnvironmentsRouteScreen from "./screens/settings/environments"; +import SettingsAuthRouteScreen from "./screens/settings/auth"; +import SettingsWaitlistRouteScreen from "./screens/settings/waitlist"; +import ConnectionsRouteScreen from "./screens/connections/index"; +import ConnectionsNewRouteScreen from "./screens/connections/new"; +import NewTaskRoute from "./screens/new/index"; +import AddProjectRoute from "./screens/new/add-project/index"; +import AddProjectRepositoryRoute from "./screens/new/add-project/repository"; +import AddProjectDestinationRoute from "./screens/new/add-project/destination"; +import AddProjectLocalRoute from "./screens/new/add-project/local"; +import NewTaskDraftRoute from "./screens/new/draft"; +import RnsGlassDebugRoute from "./screens/debug/rns-glass"; +import NotFoundRoute from "./screens/+not-found"; +import { ThreadFilesTreeScreen, ThreadFileScreen } from "./features/files/ThreadFilesRouteScreen"; +import { ReviewHighlighterProvider } from "./features/review/ReviewHighlighterProvider"; +import { ReviewCommentComposerSheet } from "./features/review/ReviewCommentComposerSheet"; +import { ReviewSheet } from "./features/review/ReviewSheet"; +import { ThreadTerminalRouteScreen } from "./features/terminal/ThreadTerminalRouteScreen"; +import { ThreadRouteScreen } from "./features/threads/ThreadRouteScreen"; +import { GitBranchesSheet } from "./features/threads/git/GitBranchesSheet"; +import { GitCommitSheet } from "./features/threads/git/GitCommitSheet"; +import { GitConfirmSheet } from "./features/threads/git/GitConfirmSheet"; +import { GitOverviewSheet } from "./features/threads/git/GitOverviewSheet"; +import { HardwareKeyboardCommandProvider } from "./features/keyboard/HardwareKeyboardCommandProvider"; +import { + AppNavigationContext, + createRouter, + pathAndParamsFromCurrentRoute, +} from "./navigation/router"; +import { + getFocusedRoute, + type AppStackParamList, + type RouteParams, +} from "./navigation/route-model"; + +import "../global.css"; + +const RootStack = createNativeStackNavigator(); + +const linking = { + prefixes: [Linking.createURL("/"), "t3code://", "t3code-dev://", "t3code-preview://"], + config: { + screens: { + Home: "", + DebugRnsGlass: "debug/rns-glass", + Settings: "settings", + SettingsEnvironments: "settings/environments", + SettingsEnvironmentNew: "settings/environment-new", + SettingsArchive: "settings/archive", + SettingsAuth: "settings/auth", + SettingsWaitlist: "settings/waitlist", + Connections: "connections", + ConnectionsNew: "connections/new", + NewTask: "new", + AddProject: "new/add-project", + AddProjectRepository: "new/add-project/repository", + AddProjectDestination: "new/add-project/destination", + AddProjectLocal: "new/add-project/local", + NewTaskDraft: "new/draft", + Thread: "threads/:environmentId/:threadId", + ThreadTerminal: "threads/:environmentId/:threadId/terminal", + ThreadReview: "threads/:environmentId/:threadId/review", + ThreadReviewComment: "threads/:environmentId/:threadId/review-comment", + ThreadFiles: "threads/:environmentId/:threadId/files", + ThreadFile: "threads/:environmentId/:threadId/files/:path*", + GitOverview: "threads/:environmentId/:threadId/git", + GitCommit: "threads/:environmentId/:threadId/git/commit", + GitBranches: "threads/:environmentId/:threadId/git/branches", + GitConfirm: "threads/:environmentId/:threadId/git-confirm", + NotFound: "*", + }, + }, +}; + +function ThreadSelectionRoute(props: { readonly children: ReactNode }) { + return {props.children}; +} + +function ThreadRoute() { + return ( + + + + ); +} + +function ThreadTerminalRoute() { + return ( + + + + ); +} + +function ThreadFilesRoute() { + return ( + + + + ); +} + +function ThreadFileRoute() { + return ( + + + + ); +} + +function ThreadReviewRoute() { + return ( + + + + + + ); +} + +function ThreadReviewCommentRoute() { + return ( + + + + ); +} + +function GitOverviewRoute() { + return ( + + + + ); +} + +function GitCommitRoute() { + return ( + + + + ); +} + +function GitBranchesRoute() { + return ( + + + + ); +} + +function GitConfirmRoute() { + return ( + + + + ); +} + +function AppNavigationProvider(props: { readonly children: ReactNode }) { + const navigationRef = useRef>(null); + const [pathname, setPathname] = useState("/"); + const [params, setParams] = useState({}); + const router = useMemo(() => createRouter(navigationRef), []); + const contextValue = useMemo( + () => ({ + navigationRef, + pathname, + params, + router, + }), + [params, pathname, router], + ); + const syncState = useCallback(() => { + const route = getFocusedRoute(navigationRef.current?.getRootState()); + if (!route) { + setPathname("/"); + setParams({}); + return; + } + + const current = pathAndParamsFromCurrentRoute(route); + setPathname(current.pathname); + setParams(current.params); + }, []); + + return ( + + + {props.children} + + + ); +} + +function AppNavigator() { + const pathname = usePathnameFromContext(); + const expandedSettingsRouteIsActive = + pathname === "/settings/archive" || pathname === "/settings/auth"; + + return ( + + + + ); +} + +function usePathnameFromContext() { + const context = use(AppNavigationContext); + if (context === null) { + return "/"; + } + return context.pathname; +} + +function AppNavigatorContent() { + const pathname = usePathnameFromContext(); + const isDebugRoute = pathname.startsWith("/debug/"); + + if (isDebugRoute) { + return ; + } + + return ; +} + +function DebugNavigatorHost() { + return ( + <> + + + + + + + + ); +} + +function WorkspaceNavigatorHost() { + const colorScheme = useColorScheme(); + const statusBarBg = useThemeColor("--color-status-bar"); + useAgentNotificationNavigation(); + useThreadOutboxDrain(); + + return ( + <> + + + + + + ); +} + +function WorkspaceNavigator() { + const { collapse, isExpanded } = useClerkSettingsSheetDetent(); + const { layout } = useAdaptiveWorkspaceLayout(); + const { height } = useWindowDimensions(); + const sheetStyle = useResolveClassNames("bg-sheet"); + + const handleSettingsTransitionEnd = useCallback( + (event: { data: { closing: boolean } }) => { + if (event.data.closing) { + collapse(); + } + }, + [collapse], + ); + + const connectionSheetScreenOptions = { + contentStyle: sheetStyle, + gestureEnabled: true, + headerShown: false, + presentation: "formSheet" as const, + sheetAllowedDetents: [0.55, 0.7], + sheetGrabberVisible: true, + }; + const settingsScreenOptions = layout.usesSplitView + ? { + animation: "none" as const, + contentStyle: sheetStyle, + gestureEnabled: false, + headerShown: false, + presentation: "card" as const, + } + : { + ...connectionSheetScreenOptions, + sheetAllowedDetents: isExpanded ? [0.92] : [0.7], + }; + const newTaskScreenOptions = { + contentStyle: sheetStyle, + gestureEnabled: true, + headerShown: false, + presentation: "formSheet" as const, + sheetAllowedDetents: [layout.usesSplitView ? deriveStableFormSheetDetent(height) : 0.92], + sheetGrabberVisible: !layout.usesSplitView, + }; + + return ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ); +} + +export default function App() { + const [fontsLoaded] = useFonts({ + DMSans_400Regular, + DMSans_500Medium, + DMSans_700Bold, + }); + + return ( + + + + + + + + {fontsLoaded ? ( + + ) : ( + + )} + + + + + + + + ); +} diff --git a/apps/mobile/src/app/_layout.tsx b/apps/mobile/src/app/_layout.tsx deleted file mode 100644 index 159bd50974..0000000000 --- a/apps/mobile/src/app/_layout.tsx +++ /dev/null @@ -1,206 +0,0 @@ -import { - DMSans_400Regular, - DMSans_500Medium, - DMSans_700Bold, - useFonts, -} from "@expo-google-fonts/dm-sans"; -import { usePathname } from "expo-router"; -import Stack from "expo-router/stack"; -import { useCallback } from "react"; -import { StatusBar, useColorScheme, useWindowDimensions } from "react-native"; -import { GestureHandlerRootView } from "react-native-gesture-handler"; -import { KeyboardProvider } from "react-native-keyboard-controller"; -import { SafeAreaProvider } from "react-native-safe-area-context"; -import { useResolveClassNames } from "uniwind"; - -import { LoadingScreen } from "../components/LoadingScreen"; - -import { useThreadOutboxDrain } from "../state/use-thread-outbox-drain"; -import { RegistryContext } from "@effect/atom-react"; -import { appAtomRegistry } from "../state/atom-registry"; -import { CloudAuthProvider } from "../features/cloud/CloudAuthProvider"; -import { - ClerkSettingsSheetDetentProvider, - useClerkSettingsSheetDetent, -} from "../features/cloud/ClerkSettingsSheetDetent"; -import { useAgentNotificationNavigation } from "../features/agent-awareness/notificationNavigation"; -import { - AdaptiveWorkspaceLayout, - useAdaptiveWorkspaceLayout, -} from "../features/layout/AdaptiveWorkspaceLayout"; -import { deriveStableFormSheetDetent } from "../lib/layout"; -import { useThemeColor } from "../lib/useThemeColor"; -import { HardwareKeyboardCommandProvider } from "../features/keyboard/HardwareKeyboardCommandProvider"; - -require("../../global.css"); - -function AppNavigator() { - const pathname = usePathname(); - const expandedSettingsRouteIsActive = - pathname === "/settings/archive" || pathname === "/settings/auth"; - - return ( - - - - ); -} - -function AppNavigatorContent() { - const pathname = usePathname(); - const isDebugRoute = pathname.startsWith("/debug/"); - - if (isDebugRoute) { - return ; - } - - return ; -} - -function DebugNavigatorHost() { - return ( - <> - - - - - - ); -} - -function WorkspaceNavigatorHost() { - const colorScheme = useColorScheme(); - const statusBarBg = useThemeColor("--color-status-bar"); - useAgentNotificationNavigation(); - useThreadOutboxDrain(); - - return ( - <> - - - - - - ); -} - -function WorkspaceNavigator() { - const { collapse, isExpanded } = useClerkSettingsSheetDetent(); - const { layout } = useAdaptiveWorkspaceLayout(); - const { height } = useWindowDimensions(); - const sheetStyle = useResolveClassNames("bg-sheet"); - - const handleSettingsTransitionEnd = useCallback( - (event: { data: { closing: boolean } }) => { - if (event.data.closing) { - collapse(); - } - }, - [collapse], - ); - - const connectionSheetScreenOptions = { - contentStyle: sheetStyle, - gestureEnabled: true, - headerShown: false, - presentation: "formSheet" as const, - sheetAllowedDetents: [0.55, 0.7], - sheetGrabberVisible: true, - }; - const settingsScreenOptions = layout.usesSplitView - ? { - animation: "none" as const, - contentStyle: sheetStyle, - gestureEnabled: false, - headerShown: false, - presentation: "card" as const, - } - : { - ...connectionSheetScreenOptions, - sheetAllowedDetents: isExpanded ? [0.92] : [0.7], - }; - const newTaskScreenOptions = { - contentStyle: sheetStyle, - gestureEnabled: true, - headerShown: false, - presentation: "formSheet" as const, - sheetAllowedDetents: [layout.usesSplitView ? deriveStableFormSheetDetent(height) : 0.92], - sheetGrabberVisible: !layout.usesSplitView, - }; - - return ( - - - - - - - - - ); -} - -export default function RootLayout() { - const [fontsLoaded] = useFonts({ - DMSans_400Regular, - DMSans_500Medium, - DMSans_700Bold, - }); - return ( - - - - - - - {fontsLoaded ? ( - - ) : ( - - )} - - - - - - - ); -} diff --git a/apps/mobile/src/app/connections/_layout.tsx b/apps/mobile/src/app/connections/_layout.tsx deleted file mode 100644 index 902b53cb15..0000000000 --- a/apps/mobile/src/app/connections/_layout.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import Stack from "expo-router/stack"; -import { useResolveClassNames } from "uniwind"; -import { useThemeColor } from "../../lib/useThemeColor"; - -export const unstable_settings = { - anchor: "index", -}; - -export default function ConnectionsLayout() { - const contentStyle = useResolveClassNames("bg-sheet"); - const connSheetBg = useThemeColor("--color-sheet"); - const headerTint = useThemeColor("--color-foreground"); - - return ( - - - - - ); -} diff --git a/apps/mobile/src/app/new/_layout.tsx b/apps/mobile/src/app/new/_layout.tsx deleted file mode 100644 index 78720ac686..0000000000 --- a/apps/mobile/src/app/new/_layout.tsx +++ /dev/null @@ -1,52 +0,0 @@ -import Stack from "expo-router/stack"; -import { Platform } from "react-native"; -import { useResolveClassNames } from "uniwind"; - -import { NewTaskFlowProvider } from "../../features/threads/new-task-flow-provider"; -import { useThemeColor } from "../../lib/useThemeColor"; - -export const unstable_settings = { - anchor: "index", -}; - -export default function NewTaskLayout() { - const sheetStyle = useResolveClassNames("bg-sheet"); - const sheetBg = useThemeColor("--color-sheet"); - const headerTint = useThemeColor("--color-foreground"); - - return ( - - - - - - - - - - - ); -} diff --git a/apps/mobile/src/app/settings/_layout.tsx b/apps/mobile/src/app/settings/_layout.tsx deleted file mode 100644 index 2607c2cd1f..0000000000 --- a/apps/mobile/src/app/settings/_layout.tsx +++ /dev/null @@ -1,62 +0,0 @@ -import Stack from "expo-router/stack"; -import { useCallback } from "react"; -import { useResolveClassNames } from "uniwind"; - -import { useClerkSettingsSheetDetent } from "../../features/cloud/ClerkSettingsSheetDetent"; -import { useThemeColor } from "../../lib/useThemeColor"; - -export const unstable_settings = { - anchor: "index", -}; - -export default function SettingsLayout() { - const { collapse } = useClerkSettingsSheetDetent(); - const contentStyle = useResolveClassNames("bg-sheet"); - const sheetBg = useThemeColor("--color-sheet"); - const headerTint = useThemeColor("--color-foreground"); - const handleExpandedRouteTransitionEnd = useCallback( - (event: { data: { closing: boolean } }) => { - if (event.data.closing) { - collapse(); - } - }, - [collapse], - ); - - return ( - - - - - - - - - ); -} diff --git a/apps/mobile/src/app/threads/[environmentId]/[threadId]/_layout.tsx b/apps/mobile/src/app/threads/[environmentId]/[threadId]/_layout.tsx deleted file mode 100644 index d69e42310b..0000000000 --- a/apps/mobile/src/app/threads/[environmentId]/[threadId]/_layout.tsx +++ /dev/null @@ -1,113 +0,0 @@ -import Stack from "expo-router/stack"; -import { StyleSheet } from "react-native"; -import { useResolveClassNames } from "uniwind"; -import { useAdaptiveWorkspaceLayout } from "../../../../features/layout/AdaptiveWorkspaceLayout"; -import { ThreadSelectionProvider } from "../../../../state/use-thread-selection"; - -export default function ThreadLayout() { - const { fileInspector } = useAdaptiveWorkspaceLayout(); - const sheetStyle = StyleSheet.flatten(useResolveClassNames("bg-sheet")); - const headerBg = { - backgroundColor: (sheetStyle as { backgroundColor?: string })?.backgroundColor, - }; - - return ( - - - - - - - - - - - - - ); -} diff --git a/apps/mobile/src/app/threads/[environmentId]/[threadId]/git/_layout.tsx b/apps/mobile/src/app/threads/[environmentId]/[threadId]/git/_layout.tsx deleted file mode 100644 index 15b10c295f..0000000000 --- a/apps/mobile/src/app/threads/[environmentId]/[threadId]/git/_layout.tsx +++ /dev/null @@ -1,58 +0,0 @@ -import Stack from "expo-router/stack"; -import { StyleSheet } from "react-native"; -import { useResolveClassNames } from "uniwind"; - -export const unstable_settings = { - anchor: "index", -}; - -export default function GitSheetLayout() { - const sheetStyle = StyleSheet.flatten(useResolveClassNames("bg-sheet")); - const headerBg = { - backgroundColor: (sheetStyle as { backgroundColor?: string })?.backgroundColor, - }; - - return ( - - - - - - - ); -} diff --git a/apps/mobile/src/app/threads/[environmentId]/[threadId]/git/review.tsx b/apps/mobile/src/app/threads/[environmentId]/[threadId]/git/review.tsx deleted file mode 100644 index 8ca686c146..0000000000 --- a/apps/mobile/src/app/threads/[environmentId]/[threadId]/git/review.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { Redirect, useLocalSearchParams } from "expo-router"; -import type { EnvironmentId, ThreadId } from "@t3tools/contracts"; - -export default function ReviewRoute() { - const { environmentId, threadId } = useLocalSearchParams<{ - environmentId: EnvironmentId; - threadId: ThreadId; - }>(); - - return ( - - ); -} diff --git a/apps/mobile/src/features/agent-awareness/notificationNavigation.ts b/apps/mobile/src/features/agent-awareness/notificationNavigation.ts index 18bb93d723..03aacf2ca3 100644 --- a/apps/mobile/src/features/agent-awareness/notificationNavigation.ts +++ b/apps/mobile/src/features/agent-awareness/notificationNavigation.ts @@ -1,6 +1,6 @@ import { useEffect, useRef } from "react"; import * as Notifications from "expo-notifications"; -import { useRouter } from "expo-router"; +import { useRouter } from "../../navigation/router"; import { routeAgentNotificationResponseOnce } from "./notificationPayload"; import { consumeLastAgentNotificationResponse } from "./notificationResponseConsumer"; diff --git a/apps/mobile/src/features/archive/ArchivedThreadsRouteScreen.tsx b/apps/mobile/src/features/archive/ArchivedThreadsRouteScreen.tsx index d560f8db9f..8253481bf2 100644 --- a/apps/mobile/src/features/archive/ArchivedThreadsRouteScreen.tsx +++ b/apps/mobile/src/features/archive/ArchivedThreadsRouteScreen.tsx @@ -1,7 +1,7 @@ import type { EnvironmentId } from "@t3tools/contracts"; import * as Arr from "effect/Array"; import * as Order from "effect/Order"; -import { useFocusEffect } from "expo-router"; +import { useFocusEffect } from "../../navigation/router"; import { useCallback, useMemo, useState } from "react"; import { useSavedRemoteConnections } from "../../state/use-remote-environment-registry"; diff --git a/apps/mobile/src/features/archive/ArchivedThreadsScreen.tsx b/apps/mobile/src/features/archive/ArchivedThreadsScreen.tsx index 292828c434..354da26494 100644 --- a/apps/mobile/src/features/archive/ArchivedThreadsScreen.tsx +++ b/apps/mobile/src/features/archive/ArchivedThreadsScreen.tsx @@ -4,7 +4,7 @@ import type { } from "@t3tools/client-runtime/state/shell"; import type { EnvironmentId } from "@t3tools/contracts"; import type { MenuAction } from "@react-native-menu/menu"; -import { Stack } from "expo-router"; +import { Stack } from "../../navigation/router"; import { SymbolView } from "expo-symbols"; import { useCallback, useMemo, useRef, type ComponentProps } from "react"; import { diff --git a/apps/mobile/src/features/files/ThreadFilesRouteScreen.tsx b/apps/mobile/src/features/files/ThreadFilesRouteScreen.tsx index 2fa912243d..083ba56d7a 100644 --- a/apps/mobile/src/features/files/ThreadFilesRouteScreen.tsx +++ b/apps/mobile/src/features/files/ThreadFilesRouteScreen.tsx @@ -1,6 +1,6 @@ -import Stack from "expo-router/stack"; +import Stack from "../../navigation/router"; import { SymbolView } from "expo-symbols"; -import { useLocalSearchParams, useRouter } from "expo-router"; +import { useLocalSearchParams, useRouter } from "../../navigation/router"; import { useCallback, useEffect, useMemo, useRef, useState } from "react"; import { ActivityIndicator, diff --git a/apps/mobile/src/features/home/HomeHeader.tsx b/apps/mobile/src/features/home/HomeHeader.tsx index e68e07c683..287c40c85b 100644 --- a/apps/mobile/src/features/home/HomeHeader.tsx +++ b/apps/mobile/src/features/home/HomeHeader.tsx @@ -3,7 +3,7 @@ import type { SidebarProjectGroupingMode, SidebarThreadSortOrder, } from "@t3tools/contracts"; -import { Stack } from "expo-router"; +import { Stack } from "../../navigation/router"; import { useCallback, useRef } from "react"; import { Platform } from "react-native"; import type { SearchBarCommands } from "react-native-screens"; diff --git a/apps/mobile/src/features/keyboard/HardwareKeyboardCommandProvider.tsx b/apps/mobile/src/features/keyboard/HardwareKeyboardCommandProvider.tsx index 4db0449ee4..b026e8c646 100644 --- a/apps/mobile/src/features/keyboard/HardwareKeyboardCommandProvider.tsx +++ b/apps/mobile/src/features/keyboard/HardwareKeyboardCommandProvider.tsx @@ -1,4 +1,4 @@ -import { usePathname, useRouter } from "expo-router"; +import { usePathname, useRouter } from "../../navigation/router"; import { useCallback, useMemo, useSyncExternalStore, type PropsWithChildren } from "react"; import { diff --git a/apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx b/apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx index 4cd73883a2..bcb69a0c93 100644 --- a/apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx +++ b/apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx @@ -1,6 +1,11 @@ import type { EnvironmentThreadShell } from "@t3tools/client-runtime/state/shell"; import { EnvironmentId, ThreadId } from "@t3tools/contracts"; -import { useFocusEffect, useGlobalSearchParams, usePathname, useRouter } from "expo-router"; +import { + useFocusEffect, + useGlobalSearchParams, + usePathname, + useRouter, +} from "../../navigation/router"; import { createContext, use, diff --git a/apps/mobile/src/features/layout/workspace-sidebar-toolbar.tsx b/apps/mobile/src/features/layout/workspace-sidebar-toolbar.tsx index c38304428d..3db7c343cc 100644 --- a/apps/mobile/src/features/layout/workspace-sidebar-toolbar.tsx +++ b/apps/mobile/src/features/layout/workspace-sidebar-toolbar.tsx @@ -1,4 +1,4 @@ -import { Stack } from "expo-router"; +import { Stack } from "../../navigation/router"; import type { ReactNode } from "react"; import { useAdaptiveWorkspaceLayout } from "./AdaptiveWorkspaceLayout"; diff --git a/apps/mobile/src/features/projects/AddProjectScreen.tsx b/apps/mobile/src/features/projects/AddProjectScreen.tsx index fa1f635de8..db00a9d202 100644 --- a/apps/mobile/src/features/projects/AddProjectScreen.tsx +++ b/apps/mobile/src/features/projects/AddProjectScreen.tsx @@ -22,7 +22,7 @@ import { isFilesystemBrowseQuery, } from "@t3tools/client-runtime/state/projects"; import { CommandId, type EnvironmentId, ProjectId } from "@t3tools/contracts"; -import { useLocalSearchParams, useRouter } from "expo-router"; +import { useLocalSearchParams, useRouter } from "../../navigation/router"; import { SymbolView } from "expo-symbols"; import { useCallback, useEffect, useMemo, useState, type ReactNode } from "react"; import { ActivityIndicator, Alert, Pressable, ScrollView, View } from "react-native"; diff --git a/apps/mobile/src/features/review/ReviewCommentComposerSheet.tsx b/apps/mobile/src/features/review/ReviewCommentComposerSheet.tsx index d35c48e8a9..862949db3b 100644 --- a/apps/mobile/src/features/review/ReviewCommentComposerSheet.tsx +++ b/apps/mobile/src/features/review/ReviewCommentComposerSheet.tsx @@ -1,4 +1,4 @@ -import { useLocalSearchParams, useRouter } from "expo-router"; +import { useLocalSearchParams, useRouter } from "../../navigation/router"; import { SymbolView } from "expo-symbols"; import { TextInputWrapper } from "expo-paste-input"; import type { EnvironmentId, ThreadId } from "@t3tools/contracts"; diff --git a/apps/mobile/src/features/review/ReviewSheet.tsx b/apps/mobile/src/features/review/ReviewSheet.tsx index 0199d693c8..fc78caf5c5 100644 --- a/apps/mobile/src/features/review/ReviewSheet.tsx +++ b/apps/mobile/src/features/review/ReviewSheet.tsx @@ -1,7 +1,7 @@ import type { EnvironmentId, ThreadId } from "@t3tools/contracts"; -import { useLocalSearchParams } from "expo-router"; -import { useHeaderHeight } from "expo-router/build/react-navigation/elements"; -import Stack from "expo-router/stack"; +import { useLocalSearchParams } from "../../navigation/router"; +import { useHeaderHeight } from "@react-navigation/elements"; +import Stack from "../../navigation/router"; import { SymbolView } from "expo-symbols"; import { memo, diff --git a/apps/mobile/src/features/review/useReviewCommentSelectionController.ts b/apps/mobile/src/features/review/useReviewCommentSelectionController.ts index ae1dc6a057..30549bfc7a 100644 --- a/apps/mobile/src/features/review/useReviewCommentSelectionController.ts +++ b/apps/mobile/src/features/review/useReviewCommentSelectionController.ts @@ -1,6 +1,6 @@ import { useCallback, useEffect, useMemo, useState } from "react"; import type { NativeSyntheticEvent } from "react-native"; -import { useRouter } from "expo-router"; +import { useRouter } from "../../navigation/router"; import * as Arr from "effect/Array"; import { pipe } from "effect/Function"; import * as Result from "effect/Result"; diff --git a/apps/mobile/src/features/terminal/ThreadTerminalRouteScreen.tsx b/apps/mobile/src/features/terminal/ThreadTerminalRouteScreen.tsx index e386098d7b..6e2c386667 100644 --- a/apps/mobile/src/features/terminal/ThreadTerminalRouteScreen.tsx +++ b/apps/mobile/src/features/terminal/ThreadTerminalRouteScreen.tsx @@ -1,7 +1,7 @@ import { DEFAULT_TERMINAL_ID, EnvironmentId, ThreadId } from "@t3tools/contracts"; import { type KnownTerminalSession } from "@t3tools/client-runtime/state/terminal"; import { SymbolView } from "expo-symbols"; -import { Stack, useLocalSearchParams, useRouter } from "expo-router"; +import { Stack, useLocalSearchParams, useRouter } from "../../navigation/router"; import { useCallback, useEffect, useMemo, useRef, useState } from "react"; import { Platform, Pressable, Text as RNText, View, useColorScheme } from "react-native"; import { diff --git a/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx b/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx index ce24198f5e..60a5cac162 100644 --- a/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx +++ b/apps/mobile/src/features/threads/NewTaskDraftScreen.tsx @@ -1,4 +1,4 @@ -import { Stack, useRouter } from "expo-router"; +import { Stack, useRouter } from "../../navigation/router"; import { useCallback, useEffect, useMemo, useRef } from "react"; import { Alert, InteractionManager, View, useColorScheme } from "react-native"; import { KeyboardAvoidingView, useKeyboardState } from "react-native-keyboard-controller"; diff --git a/apps/mobile/src/features/threads/ThreadDetailScreen.tsx b/apps/mobile/src/features/threads/ThreadDetailScreen.tsx index 942dbd279b..cc69d5552a 100644 --- a/apps/mobile/src/features/threads/ThreadDetailScreen.tsx +++ b/apps/mobile/src/features/threads/ThreadDetailScreen.tsx @@ -15,7 +15,7 @@ import type { } from "@t3tools/contracts"; import { formatElapsed } from "@t3tools/shared/orchestrationTiming"; import * as Haptics from "expo-haptics"; -import { useHeaderHeight } from "expo-router/build/react-navigation/elements"; +import { useHeaderHeight } from "@react-navigation/elements"; import { memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react"; import { View, type GestureResponderEvent } from "react-native"; import { Gesture, GestureDetector } from "react-native-gesture-handler"; diff --git a/apps/mobile/src/features/threads/ThreadFeed.tsx b/apps/mobile/src/features/threads/ThreadFeed.tsx index 6547d3781f..89a977e8d7 100644 --- a/apps/mobile/src/features/threads/ThreadFeed.tsx +++ b/apps/mobile/src/features/threads/ThreadFeed.tsx @@ -4,7 +4,7 @@ import { type LegendListRef } from "@legendapp/list/react-native"; import type { EnvironmentId, MessageId, ThreadId, TurnId } from "@t3tools/contracts"; import { CHAT_LIST_ANCHOR_OFFSET, resolveChatListAnchoredEndSpace } from "@t3tools/shared/chatList"; import { SymbolView } from "expo-symbols"; -import { useRouter } from "expo-router"; +import { useRouter } from "../../navigation/router"; import { memo, useCallback, diff --git a/apps/mobile/src/features/threads/ThreadGitControls.tsx b/apps/mobile/src/features/threads/ThreadGitControls.tsx index 2c117c4f6f..022f55947a 100644 --- a/apps/mobile/src/features/threads/ThreadGitControls.tsx +++ b/apps/mobile/src/features/threads/ThreadGitControls.tsx @@ -10,9 +10,8 @@ import { requiresDefaultBranchConfirmation, resolveQuickAction, } from "@t3tools/client-runtime/state/vcs"; -import { useLocalSearchParams, useRouter } from "expo-router"; -import type { NativeStackNavigationOptions } from "expo-router/build/react-navigation/native-stack/types"; -import Stack from "expo-router/stack"; +import { useLocalSearchParams, useRouter } from "../../navigation/router"; +import Stack from "../../navigation/router"; import { useCallback, useMemo } from "react"; import { Alert } from "react-native"; import { buildThreadFilesNavigation, buildThreadReviewRoutePath } from "../../lib/routes"; @@ -66,10 +65,8 @@ function compactMenuStatus(gitStatus: VcsStatusResult | null): string { return parts.join(" · "); } -type HeaderItems = ReturnType< - NonNullable ->; -type HeaderItem = HeaderItems[number]; +type HeaderItem = Record; +type HeaderItems = HeaderItem[]; type ThreadGitHeaderActionItems = { readonly terminal: HeaderItem; readonly files: HeaderItem; @@ -330,7 +327,7 @@ function useThreadGitHeaderActionItems(props: ThreadGitControlsProps): ThreadGit type: "sfSymbol", }, label: compactMenuBranchLabel(model.currentBranchLabel), - onPress: () => {}, + onPress: (): void => {}, type: "action", }, { @@ -338,7 +335,7 @@ function useThreadGitHeaderActionItems(props: ThreadGitControlsProps): ThreadGit disabled: model.quickAction.disabled, icon: { name: model.quickActionIcon, type: "sfSymbol" }, label: model.quickAction.label, - onPress: () => void model.runQuickAction(), + onPress: (): void => void model.runQuickAction(), type: "action", }, { diff --git a/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx b/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx index 911a2d2f6b..47642b3728 100644 --- a/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx +++ b/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx @@ -2,7 +2,7 @@ import type { EnvironmentThreadShell } from "@t3tools/client-runtime/state/shell import { LegendList } from "@legendapp/list/react-native"; import type { MenuAction } from "@react-native-menu/menu"; import { SymbolView } from "expo-symbols"; -import { useRouter } from "expo-router"; +import { useRouter } from "../../navigation/router"; import { memo, useCallback, useMemo, useRef, useState, type ComponentProps } from "react"; import type { ColorValue, NativeScrollEvent, NativeSyntheticEvent } from "react-native"; import { Platform, Pressable, StyleSheet, TextInput, View, useColorScheme } from "react-native"; diff --git a/apps/mobile/src/features/threads/ThreadRouteScreen.tsx b/apps/mobile/src/features/threads/ThreadRouteScreen.tsx index ca2a9eac4c..e8f5ba82d8 100644 --- a/apps/mobile/src/features/threads/ThreadRouteScreen.tsx +++ b/apps/mobile/src/features/threads/ThreadRouteScreen.tsx @@ -1,5 +1,4 @@ -import { Stack, useFocusEffect, useLocalSearchParams, useRouter } from "expo-router"; -import type { NativeStackNavigationOptions } from "expo-router/build/react-navigation/native-stack/types"; +import { Stack, useFocusEffect, useLocalSearchParams, useRouter } from "../../navigation/router"; import { useCallback, useEffect, @@ -99,9 +98,7 @@ interface ThreadInspectorSelection { readonly mode: ThreadInspectorMode; } -type NativeHeaderItems = ReturnType< - NonNullable ->; +type NativeHeaderItems = ReadonlyArray>; type RnsHeaderItems = ComponentProps["headerRightBarButtonItems"]; const HEADER_SCROLL_EDGE_EFFECTS = nativeHeaderScrollEdgeEffects(Platform.OS, Platform.Version); diff --git a/apps/mobile/src/features/threads/git/GitBranchesSheet.tsx b/apps/mobile/src/features/threads/git/GitBranchesSheet.tsx index e27136702f..da62cf856c 100644 --- a/apps/mobile/src/features/threads/git/GitBranchesSheet.tsx +++ b/apps/mobile/src/features/threads/git/GitBranchesSheet.tsx @@ -1,5 +1,5 @@ import { sanitizeFeatureBranchName } from "@t3tools/shared/git"; -import { useRouter } from "expo-router"; +import { useRouter } from "../../../navigation/router"; import { useState } from "react"; import { Pressable, ScrollView, View } from "react-native"; import { useSafeAreaInsets } from "react-native-safe-area-context"; diff --git a/apps/mobile/src/features/threads/git/GitCommitSheet.tsx b/apps/mobile/src/features/threads/git/GitCommitSheet.tsx index 76e0daf5f0..5f9dd278b7 100644 --- a/apps/mobile/src/features/threads/git/GitCommitSheet.tsx +++ b/apps/mobile/src/features/threads/git/GitCommitSheet.tsx @@ -1,4 +1,4 @@ -import { useRouter } from "expo-router"; +import { useRouter } from "../../../navigation/router"; import { useCallback, useState } from "react"; import { Pressable, ScrollView, View, useColorScheme } from "react-native"; import { useSafeAreaInsets } from "react-native-safe-area-context"; diff --git a/apps/mobile/src/features/threads/git/GitConfirmSheet.tsx b/apps/mobile/src/features/threads/git/GitConfirmSheet.tsx index 4272c31d2c..bc0021cc9e 100644 --- a/apps/mobile/src/features/threads/git/GitConfirmSheet.tsx +++ b/apps/mobile/src/features/threads/git/GitConfirmSheet.tsx @@ -2,7 +2,7 @@ import { resolveDefaultBranchActionDialogCopy } from "@t3tools/client-runtime/st import { resolveAutoFeatureBranchName } from "@t3tools/shared/git"; import * as Arr from "effect/Array"; import * as Result from "effect/Result"; -import { useLocalSearchParams, useRouter } from "expo-router"; +import { useLocalSearchParams, useRouter } from "../../../navigation/router"; import { useCallback, useMemo } from "react"; import { View } from "react-native"; import { useSafeAreaInsets } from "react-native-safe-area-context"; diff --git a/apps/mobile/src/features/threads/git/GitOverviewSheet.tsx b/apps/mobile/src/features/threads/git/GitOverviewSheet.tsx index 1974f7a186..c246c9b302 100644 --- a/apps/mobile/src/features/threads/git/GitOverviewSheet.tsx +++ b/apps/mobile/src/features/threads/git/GitOverviewSheet.tsx @@ -5,7 +5,7 @@ import { requiresDefaultBranchConfirmation, } from "@t3tools/client-runtime/state/vcs"; import type { EnvironmentId, ThreadId } from "@t3tools/contracts"; -import { useLocalSearchParams, useRouter } from "expo-router"; +import { useLocalSearchParams, useRouter } from "../../../navigation/router"; import { SymbolView } from "expo-symbols"; import { useCallback, useEffect, useMemo, type ComponentProps } from "react"; import { Alert, Platform, Pressable, ScrollView, View } from "react-native"; diff --git a/apps/mobile/src/lib/routes.ts b/apps/mobile/src/lib/routes.ts index 3a33e2ee0f..a0ac64e68a 100644 --- a/apps/mobile/src/lib/routes.ts +++ b/apps/mobile/src/lib/routes.ts @@ -1,4 +1,4 @@ -import type { Href, useRouter } from "expo-router"; +import type { Href, useRouter } from "../navigation/router"; import { type EnvironmentThreadShell } from "@t3tools/client-runtime/state/shell"; import type { EnvironmentId, ThreadId } from "@t3tools/contracts"; diff --git a/apps/mobile/src/navigation/route-model.ts b/apps/mobile/src/navigation/route-model.ts new file mode 100644 index 0000000000..3da7df1764 --- /dev/null +++ b/apps/mobile/src/navigation/route-model.ts @@ -0,0 +1,375 @@ +import type { NavigationState, PartialState, Route } from "@react-navigation/native"; + +export type RouteParams = Record; + +export type AppRouteName = + | "Home" + | "Settings" + | "SettingsEnvironments" + | "SettingsEnvironmentNew" + | "SettingsArchive" + | "SettingsAuth" + | "SettingsWaitlist" + | "Connections" + | "ConnectionsNew" + | "NewTask" + | "AddProject" + | "AddProjectRepository" + | "AddProjectDestination" + | "AddProjectLocal" + | "NewTaskDraft" + | "Thread" + | "ThreadTerminal" + | "ThreadReview" + | "ThreadReviewComment" + | "ThreadFiles" + | "ThreadFile" + | "GitOverview" + | "GitCommit" + | "GitBranches" + | "GitConfirm" + | "DebugRnsGlass" + | "NotFound"; + +export type AppStackParamList = { + Home: undefined; + Settings: undefined; + SettingsEnvironments: undefined; + SettingsEnvironmentNew: RouteParams | undefined; + SettingsArchive: undefined; + SettingsAuth: undefined; + SettingsWaitlist: undefined; + Connections: undefined; + ConnectionsNew: RouteParams | undefined; + NewTask: undefined; + AddProject: RouteParams | undefined; + AddProjectRepository: RouteParams | undefined; + AddProjectDestination: RouteParams | undefined; + AddProjectLocal: RouteParams | undefined; + NewTaskDraft: RouteParams | undefined; + Thread: RouteParams; + ThreadTerminal: RouteParams; + ThreadReview: RouteParams; + ThreadReviewComment: RouteParams; + ThreadFiles: RouteParams; + ThreadFile: RouteParams; + GitOverview: RouteParams; + GitCommit: RouteParams; + GitBranches: RouteParams; + GitConfirm: RouteParams; + DebugRnsGlass: undefined; + NotFound: RouteParams | undefined; +}; + +export type AppHref = + | string + | { + readonly pathname: string; + readonly params?: RouteParams; + }; + +export type AppNavigationTarget = { + readonly name: AppRouteName; + readonly params?: RouteParams; +}; + +export type AppFocusedRoute = Pick, "name" | "params">; + +function normalizeParamValue(value: unknown): string | string[] | undefined { + if (value === undefined || value === null) { + return undefined; + } + if (Array.isArray(value)) { + return value.map((item) => String(item)); + } + return String(value); +} + +export function normalizeRouteParams( + params: Record | undefined, +): RouteParams | undefined { + if (!params) { + return undefined; + } + + const normalized: RouteParams = {}; + for (const [key, value] of Object.entries(params)) { + const normalizedValue = normalizeParamValue(value); + if (normalizedValue !== undefined) { + normalized[key] = normalizedValue; + } + } + return normalized; +} + +function withParams(name: AppRouteName, params?: Record): AppNavigationTarget { + return { name, params: normalizeRouteParams(params) }; +} + +function splitPathAndQuery(path: string): { + readonly pathname: string; + readonly query: RouteParams | undefined; +} { + const queryStart = path.indexOf("?"); + if (queryStart === -1) { + return { pathname: path, query: undefined }; + } + + const pathname = path.slice(0, queryStart); + const query = new URLSearchParams(path.slice(queryStart + 1)); + const params: RouteParams = {}; + for (const [key, value] of query.entries()) { + const existing = params[key]; + if (Array.isArray(existing)) { + existing.push(value); + } else if (existing !== undefined) { + params[key] = [existing, value]; + } else { + params[key] = value; + } + } + return { pathname, query: Object.keys(params).length > 0 ? params : undefined }; +} + +function pathSegments(pathname: string): string[] { + return pathname + .replace(/^\/+|\/+$/g, "") + .split("/") + .filter(Boolean) + .map((segment) => decodeURIComponent(segment)); +} + +function mergeParams( + base: Record | undefined, + extra: Record | undefined, +): RouteParams | undefined { + return normalizeRouteParams({ ...base, ...extra }); +} + +export function resolveNavigationTarget(href: AppHref): AppNavigationTarget { + if (typeof href !== "string") { + return resolveNavigationObject(href.pathname, href.params); + } + + const { pathname, query } = splitPathAndQuery(href); + const target = resolveNavigationPath(pathname); + return { name: target.name, params: mergeParams(target.params, query) }; +} + +function resolveNavigationObject( + pathname: string, + params: RouteParams | undefined, +): AppNavigationTarget { + switch (pathname) { + case "/threads/[environmentId]/[threadId]/terminal": + return withParams("ThreadTerminal", params); + case "/threads/[environmentId]/[threadId]/files": + return withParams("ThreadFiles", params); + case "/threads/[environmentId]/[threadId]/files/[...path]": + return withParams("ThreadFile", params); + case "/threads/[environmentId]/[threadId]/review": + return withParams("ThreadReview", params); + case "/threads/[environmentId]/[threadId]/review-comment": + return withParams("ThreadReviewComment", params); + case "/threads/[environmentId]/[threadId]/git": + return withParams("GitOverview", params); + case "/threads/[environmentId]/[threadId]/git/commit": + return withParams("GitCommit", params); + case "/threads/[environmentId]/[threadId]/git/branches": + return withParams("GitBranches", params); + case "/threads/[environmentId]/[threadId]/git-confirm": + return withParams("GitConfirm", params); + case "/new/draft": + return withParams("NewTaskDraft", params); + case "/new/add-project/repository": + return withParams("AddProjectRepository", params); + case "/new/add-project/destination": + return withParams("AddProjectDestination", params); + case "/new/add-project/local": + return withParams("AddProjectLocal", params); + default: { + const target = resolveNavigationPath(pathname); + return { ...target, params: mergeParams(target.params, params) }; + } + } +} + +export function resolveNavigationPath(pathname: string): AppNavigationTarget { + const segments = pathSegments(pathname); + + if (segments.length === 0) return { name: "Home" }; + if (segments[0] === "debug" && segments[1] === "rns-glass") return { name: "DebugRnsGlass" }; + + if (segments[0] === "settings") { + switch (segments[1]) { + case undefined: + return { name: "Settings" }; + case "environments": + return { name: "SettingsEnvironments" }; + case "environment-new": + return { name: "SettingsEnvironmentNew" }; + case "archive": + return { name: "SettingsArchive" }; + case "auth": + return { name: "SettingsAuth" }; + case "waitlist": + return { name: "SettingsWaitlist" }; + default: + return withParams("NotFound", { pathname }); + } + } + + if (segments[0] === "connections") { + return segments[1] === "new" ? { name: "ConnectionsNew" } : { name: "Connections" }; + } + + if (segments[0] === "new") { + if (segments[1] === "add-project") { + switch (segments[2]) { + case undefined: + return { name: "AddProject" }; + case "repository": + return { name: "AddProjectRepository" }; + case "destination": + return { name: "AddProjectDestination" }; + case "local": + return { name: "AddProjectLocal" }; + default: + return withParams("NotFound", { pathname }); + } + } + return segments[1] === "draft" ? { name: "NewTaskDraft" } : { name: "NewTask" }; + } + + if (segments[0] === "threads" && segments[1] && segments[2]) { + const baseParams = { environmentId: segments[1], threadId: segments[2] }; + switch (segments[3]) { + case undefined: + return withParams("Thread", baseParams); + case "terminal": + return withParams("ThreadTerminal", baseParams); + case "review": + return withParams("ThreadReview", baseParams); + case "review-comment": + return withParams("ThreadReviewComment", baseParams); + case "git": + if (segments[4] === "commit") return withParams("GitCommit", baseParams); + if (segments[4] === "branches") return withParams("GitBranches", baseParams); + if (segments[4] === "review") return withParams("ThreadReview", baseParams); + return withParams("GitOverview", baseParams); + case "git-confirm": + return withParams("GitConfirm", baseParams); + case "files": + if (segments.length > 4) { + return withParams("ThreadFile", { ...baseParams, path: segments.slice(4) }); + } + return withParams("ThreadFiles", baseParams); + default: + return withParams("NotFound", { pathname }); + } + } + + return withParams("NotFound", { pathname }); +} + +export function buildPathFromRoute(route: AppFocusedRoute): string { + const params = (route.params ?? {}) as RouteParams; + const environmentId = firstParam(params.environmentId); + const threadId = firstParam(params.threadId); + const path = params.path; + const pathSegmentsValue = Array.isArray(path) ? path : path ? [path] : []; + const query = new URLSearchParams(); + for (const [key, value] of Object.entries(params)) { + if (key === "environmentId" || key === "threadId" || key === "path") continue; + if (Array.isArray(value)) { + for (const item of value) query.append(key, item); + } else if (value !== undefined) { + query.set(key, value); + } + } + const querySuffix = query.size > 0 ? `?${query.toString()}` : ""; + + switch (route.name as AppRouteName) { + case "Home": + return "/"; + case "Settings": + return "/settings"; + case "SettingsEnvironments": + return "/settings/environments"; + case "SettingsEnvironmentNew": + return `/settings/environment-new${querySuffix}`; + case "SettingsArchive": + return "/settings/archive"; + case "SettingsAuth": + return "/settings/auth"; + case "SettingsWaitlist": + return "/settings/waitlist"; + case "Connections": + return "/connections"; + case "ConnectionsNew": + return `/connections/new${querySuffix}`; + case "NewTask": + return "/new"; + case "AddProject": + return "/new/add-project"; + case "AddProjectRepository": + return `/new/add-project/repository${querySuffix}`; + case "AddProjectDestination": + return `/new/add-project/destination${querySuffix}`; + case "AddProjectLocal": + return `/new/add-project/local${querySuffix}`; + case "NewTaskDraft": + return `/new/draft${querySuffix}`; + case "Thread": + return `/threads/${encodeURIComponent(environmentId ?? "")}/${encodeURIComponent(threadId ?? "")}`; + case "ThreadTerminal": + return `/threads/${encodeURIComponent(environmentId ?? "")}/${encodeURIComponent(threadId ?? "")}/terminal${querySuffix}`; + case "ThreadReview": + return `/threads/${encodeURIComponent(environmentId ?? "")}/${encodeURIComponent(threadId ?? "")}/review`; + case "ThreadReviewComment": + return `/threads/${encodeURIComponent(environmentId ?? "")}/${encodeURIComponent(threadId ?? "")}/review-comment${querySuffix}`; + case "ThreadFiles": + return `/threads/${encodeURIComponent(environmentId ?? "")}/${encodeURIComponent(threadId ?? "")}/files${querySuffix}`; + case "ThreadFile": + return `/threads/${encodeURIComponent(environmentId ?? "")}/${encodeURIComponent(threadId ?? "")}/files/${pathSegmentsValue.map(encodeURIComponent).join("/")}${querySuffix}`; + case "GitOverview": + return `/threads/${encodeURIComponent(environmentId ?? "")}/${encodeURIComponent(threadId ?? "")}/git${querySuffix}`; + case "GitCommit": + return `/threads/${encodeURIComponent(environmentId ?? "")}/${encodeURIComponent(threadId ?? "")}/git/commit${querySuffix}`; + case "GitBranches": + return `/threads/${encodeURIComponent(environmentId ?? "")}/${encodeURIComponent(threadId ?? "")}/git/branches${querySuffix}`; + case "GitConfirm": + return `/threads/${encodeURIComponent(environmentId ?? "")}/${encodeURIComponent(threadId ?? "")}/git-confirm${querySuffix}`; + case "DebugRnsGlass": + return "/debug/rns-glass"; + case "NotFound": + return firstParam(params.pathname) ?? "/not-found"; + } +} + +export function buildPathFromState( + state: NavigationState | PartialState | undefined, +): string { + const route = getFocusedRoute(state); + return route ? buildPathFromRoute(route) : "/"; +} + +export function getFocusedRoute( + state: NavigationState | PartialState | undefined, +): AppFocusedRoute | undefined { + if (!state || state.routes.length === 0) { + return undefined; + } + + const index = state.index ?? 0; + const route = state.routes[index]; + if (!route) { + return undefined; + } + + return getFocusedRoute(route.state as PartialState | undefined) ?? route; +} + +export function firstParam(value: string | string[] | undefined): string | undefined { + return Array.isArray(value) ? value[0] : value; +} diff --git a/apps/mobile/src/navigation/router.tsx b/apps/mobile/src/navigation/router.tsx new file mode 100644 index 0000000000..f97e534466 --- /dev/null +++ b/apps/mobile/src/navigation/router.tsx @@ -0,0 +1,536 @@ +import { + CommonActions, + StackActions, + useFocusEffect, + useNavigation, + useRoute, + type NavigationContainerRef, + type ParamListBase, +} from "@react-navigation/native"; +import type { ColorValue } from "react-native"; +import type { + NativeStackHeaderItem, + NativeStackHeaderItemMenu, + NativeStackNavigationOptions, + NativeStackNavigationProp, +} from "@react-navigation/native-stack"; +import { + Children, + cloneElement, + createContext, + createElement, + Fragment, + isValidElement, + use, + useEffect, + useMemo, + type ReactElement, + type ReactNode, +} from "react"; + +import { + buildPathFromRoute, + resolveNavigationTarget, + type AppHref, + type AppStackParamList, + type AppFocusedRoute, + type RouteParams, +} from "./route-model"; + +export { useFocusEffect }; +export type Href = AppHref; +type CompatNativeStackNavigationOptions = Omit< + NativeStackNavigationOptions, + "headerTintColor" | "unstable_headerLeftItems" | "unstable_headerRightItems" +> & { + readonly headerTintColor?: string | ColorValue; + readonly unstable_headerCenterItems?: unknown; + readonly unstable_headerLeftItems?: unknown; + readonly unstable_headerRightItems?: unknown; + readonly unstable_headerSubtitle?: unknown; + readonly unstable_headerToolbarItems?: unknown; + readonly unstable_navigationItemStyle?: unknown; +}; + +export type { CompatNativeStackNavigationOptions as NativeStackNavigationOptions }; + +type RouterLike = { + readonly push: (href: AppHref) => void; + readonly replace: (href: AppHref) => void; + readonly back: () => void; + readonly dismiss: () => void; + readonly dismissAll: () => void; + readonly canGoBack: () => boolean; + readonly setParams: (params: RouteParams) => void; +}; + +type NavigationContextValue = { + readonly navigationRef: React.RefObject | null>; + readonly pathname: string; + readonly params: RouteParams; + readonly router: RouterLike; +}; + +export const AppNavigationContext = createContext(null); + +export function useRouter(): RouterLike { + const context = use(AppNavigationContext); + if (context === null) { + throw new Error("useRouter must be used within AppNavigationProvider"); + } + return context.router; +} + +export function usePathname(): string { + const context = use(AppNavigationContext); + if (context === null) { + throw new Error("usePathname must be used within AppNavigationProvider"); + } + return context.pathname; +} + +export function useLocalSearchParams(): T { + const route = useRoute(); + return (route.params ?? {}) as RouteParams as T; +} + +export function useGlobalSearchParams(): T { + const context = use(AppNavigationContext); + if (context === null) { + throw new Error("useGlobalSearchParams must be used within AppNavigationProvider"); + } + return context.params as T; +} + +export function createRouter( + navigationRef: React.RefObject | null>, +): RouterLike { + const navigateWithAction = (href: AppHref, action: "push" | "replace" | "navigate"): void => { + const target = resolveNavigationTarget(href); + const navigation = navigationRef.current; + if (!navigation) { + return; + } + + if (action === "push") { + navigation.dispatch(StackActions.push(target.name, target.params)); + return; + } + if (action === "replace") { + navigation.dispatch(StackActions.replace(target.name, target.params)); + return; + } + navigation.dispatch( + CommonActions.navigate({ + name: target.name, + params: target.params, + }), + ); + }; + + return { + push: (href) => navigateWithAction(href, "push"), + replace: (href) => navigateWithAction(href, "replace"), + back: () => { + const navigation = navigationRef.current; + if (!navigation) return; + if (navigation.canGoBack()) { + navigation.goBack(); + return; + } + navigation.dispatch(StackActions.replace("Home")); + }, + dismiss: () => { + const navigation = navigationRef.current; + if (!navigation) return; + if (navigation.canGoBack()) { + navigation.goBack(); + return; + } + navigation.dispatch(StackActions.replace("Home")); + }, + dismissAll: () => { + const navigation = navigationRef.current; + if (!navigation) return; + navigation.dispatch( + CommonActions.reset({ + index: 0, + routes: [{ name: "Home" }], + }), + ); + }, + canGoBack: () => navigationRef.current?.canGoBack() ?? false, + setParams: (params) => { + navigationRef.current?.dispatch(CommonActions.setParams(params)); + }, + }; +} + +export function deriveNavigationContextValue(input: { + readonly navigationRef: React.RefObject | null>; + readonly pathname: string; + readonly params: RouteParams; +}): NavigationContextValue { + return { + navigationRef: input.navigationRef, + pathname: input.pathname, + params: input.params, + router: createRouter(input.navigationRef), + }; +} + +function useNativeStackNavigation(): NativeStackNavigationProp | null { + try { + return useNavigation>(); + } catch { + return null; + } +} + +function normalizeScreenOptions( + options: CompatNativeStackNavigationOptions | undefined, +): NativeStackNavigationOptions | undefined { + if (!options) { + return options; + } + + const normalized = { ...options } as NativeStackNavigationOptions & { + unstable_navigationItemStyle?: unknown; + unstable_headerCenterItems?: unknown; + unstable_headerSubtitle?: unknown; + unstable_headerToolbarItems?: unknown; + }; + + delete normalized.unstable_navigationItemStyle; + delete normalized.unstable_headerCenterItems; + delete normalized.unstable_headerSubtitle; + delete normalized.unstable_headerToolbarItems; + + if (normalized.headerTintColor !== undefined) { + normalized.headerTintColor = String(normalized.headerTintColor); + } + + return normalized as NativeStackNavigationOptions; +} + +function StackScreen(props: { + readonly options?: CompatNativeStackNavigationOptions; + readonly listeners?: Record void>; + readonly name?: string; +}) { + const navigation = useNativeStackNavigation(); + const normalizedOptions = useMemo(() => normalizeScreenOptions(props.options), [props.options]); + + useEffect(() => { + if (!navigation || !normalizedOptions) { + return; + } + navigation.setOptions(normalizedOptions); + }, [navigation, normalizedOptions]); + + useEffect(() => { + if (!navigation || !props.listeners) { + return; + } + const subscriptions = Object.entries(props.listeners).map(([eventName, listener]) => + navigation.addListener(eventName as never, listener as never), + ); + return () => { + for (const unsubscribe of subscriptions) { + unsubscribe(); + } + }; + }, [navigation, props.listeners]); + + return null; +} + +function labelFromChildren(children: ReactNode): string { + const parts: string[] = []; + Children.forEach(children, (child) => { + if (typeof child === "string" || typeof child === "number") { + parts.push(String(child)); + } else if (isValidElement<{ children?: ReactNode }>(child)) { + parts.push(labelFromChildren(child.props.children)); + } + }); + return parts.join(""); +} + +type NativeStackHeaderIcon = NonNullable< + Extract["icon"] +>; + +function iconFromProp(icon: unknown): NativeStackHeaderIcon | undefined { + if (typeof icon !== "string") { + return undefined; + } + return { type: "sfSymbol", name: icon as never }; +} + +type ToolbarElementProps = Record & { readonly children?: ReactNode }; + +function elementTypeName(element: ReactElement): string | undefined { + const type = element.type; + if (typeof type === "function") { + return (type as { displayName?: string; name?: string }).displayName ?? type.name; + } + return undefined; +} + +function convertMenuAction( + element: ReactElement, +): NativeStackHeaderItemMenu["menu"]["items"][number] | null { + const typeName = elementTypeName(element); + if (typeName === "ToolbarMenuAction") { + const label = labelFromChildren(element.props.children); + return { + type: "action", + label, + description: typeof element.props.subtitle === "string" ? element.props.subtitle : undefined, + disabled: Boolean(element.props.disabled), + icon: iconFromProp(element.props.icon), + onPress: + typeof element.props.onPress === "function" + ? (element.props.onPress as () => void) + : () => undefined, + state: element.props.isOn === true ? "on" : undefined, + destructive: Boolean(element.props.destructive), + discoverabilityLabel: + typeof element.props.discoverabilityLabel === "string" + ? element.props.discoverabilityLabel + : undefined, + }; + } + + if (typeName === "ToolbarMenu") { + return { + type: "submenu", + label: + typeof element.props.title === "string" + ? element.props.title + : labelFromChildren(element.props.children), + icon: iconFromProp(element.props.icon), + inline: Boolean(element.props.inline), + items: collectMenuItems(element.props.children), + }; + } + + return null; +} + +function collectMenuItems(children: ReactNode): NativeStackHeaderItemMenu["menu"]["items"] { + const items: NativeStackHeaderItemMenu["menu"]["items"] = []; + Children.forEach(children, (child) => { + if (!isValidElement(child)) { + return; + } + const item = convertMenuAction(child); + if (item) { + items.push(item); + return; + } + items.push(...collectMenuItems(child.props.children)); + }); + return items; +} + +function convertToolbarChild(child: ReactNode): NativeStackHeaderItem | null { + if (!isValidElement(child)) { + return null; + } + + const typeName = elementTypeName(child); + if (typeName === "ToolbarButton") { + return { + type: "button", + label: "", + accessibilityLabel: + typeof child.props.accessibilityLabel === "string" + ? child.props.accessibilityLabel + : undefined, + disabled: Boolean(child.props.disabled), + icon: iconFromProp(child.props.icon), + onPress: + typeof child.props.onPress === "function" + ? (child.props.onPress as () => void) + : () => undefined, + sharesBackground: !child.props.separateBackground, + variant: "prominent", + }; + } + + if (typeName === "ToolbarMenu") { + return { + type: "menu", + label: typeof child.props.title === "string" ? child.props.title : "", + accessibilityLabel: + typeof child.props.accessibilityLabel === "string" + ? child.props.accessibilityLabel + : undefined, + disabled: Boolean(child.props.disabled), + icon: iconFromProp(child.props.icon), + menu: { + title: typeof child.props.title === "string" ? child.props.title : undefined, + items: collectMenuItems(child.props.children), + }, + sharesBackground: !child.props.separateBackground, + variant: "prominent", + }; + } + + if (typeName === "ToolbarSpacer") { + return { + type: "spacing", + spacing: typeof child.props.width === "number" ? child.props.width : 8, + }; + } + + return null; +} + +function collectToolbarItems(children: ReactNode): NativeStackHeaderItem[] { + const items: NativeStackHeaderItem[] = []; + Children.forEach(children, (child) => { + const item = convertToolbarChild(child); + if (item) { + items.push(item); + } + }); + return items; +} + +function Toolbar(props: { + readonly placement?: "left" | "right" | "bottom"; + readonly children?: ReactNode; +}) { + const navigation = useNativeStackNavigation(); + const items = useMemo(() => collectToolbarItems(props.children), [props.children]); + + useEffect(() => { + if (!navigation || props.placement === "bottom" || items.length === 0) { + return; + } + if (props.placement === "left") { + navigation.setOptions({ unstable_headerLeftItems: () => items }); + return; + } + navigation.setOptions({ unstable_headerRightItems: () => items }); + }, [items, navigation, props.placement]); + + return null; +} + +function ToolbarButton(_props: { + readonly accessibilityLabel?: string; + readonly disabled?: boolean; + readonly icon?: string; + readonly onPress?: () => void; + readonly separateBackground?: boolean; +}) { + return null; +} +ToolbarButton.displayName = "ToolbarButton"; + +function ToolbarMenu(_props: { + readonly accessibilityLabel?: string; + readonly children?: ReactNode; + readonly disabled?: boolean; + readonly icon?: string; + readonly inline?: boolean; + readonly separateBackground?: boolean; + readonly title?: string; +}) { + return null; +} +ToolbarMenu.displayName = "ToolbarMenu"; + +function ToolbarMenuAction(_props: { + readonly children?: ReactNode; + readonly destructive?: boolean; + readonly disabled?: boolean; + readonly discoverabilityLabel?: string; + readonly icon?: string; + readonly isOn?: boolean; + readonly onPress?: () => void; + readonly subtitle?: string; +}) { + return null; +} +ToolbarMenuAction.displayName = "ToolbarMenuAction"; + +function ToolbarLabel(_props: { readonly children?: ReactNode }) { + return null; +} +ToolbarLabel.displayName = "ToolbarLabel"; + +function ToolbarSpacer(_props: { readonly sharesBackground?: boolean; readonly width?: number }) { + return null; +} +ToolbarSpacer.displayName = "ToolbarSpacer"; + +function ToolbarSearchBarSlot() { + return null; +} +ToolbarSearchBarSlot.displayName = "ToolbarSearchBarSlot"; + +function StackScreenTitle(_props: { readonly asChild?: boolean; readonly children?: ReactNode }) { + return null; +} + +StackScreen.Title = StackScreenTitle; + +export const Stack = Object.assign( + function StackCompat(props: { readonly children?: ReactNode }) { + return createElement(Fragment, null, props.children); + }, + { + Screen: StackScreen, + Toolbar: Object.assign(Toolbar, { + Button: ToolbarButton, + Label: ToolbarLabel, + Menu: Object.assign(ToolbarMenu, { + Action: ToolbarMenuAction, + }), + MenuAction: ToolbarMenuAction, + SearchBarSlot: ToolbarSearchBarSlot, + Spacer: ToolbarSpacer, + }), + }, +); + +export default Stack; + +export function Redirect(props: { readonly href: AppHref }) { + const router = useRouter(); + useEffect(() => { + router.replace(props.href); + }, [props.href, router]); + return null; +} + +export function Link(props: { + readonly href: AppHref; + readonly asChild?: boolean; + readonly children?: ReactNode; +}) { + const router = useRouter(); + if (props.asChild && isValidElement<{ onPress?: () => void }>(props.children)) { + return cloneElement(props.children, { + onPress: () => router.push(props.href), + }); + } + return null; +} + +export function pathAndParamsFromCurrentRoute(route: { + readonly name: string; + readonly params?: object; +}): { readonly pathname: string; readonly params: RouteParams } { + return { + pathname: buildPathFromRoute(route as AppFocusedRoute), + params: (route.params ?? {}) as RouteParams, + }; +} + +export type Router = RouterLike; diff --git a/apps/mobile/src/app/+not-found.tsx b/apps/mobile/src/screens/+not-found.tsx similarity index 96% rename from apps/mobile/src/app/+not-found.tsx rename to apps/mobile/src/screens/+not-found.tsx index ceee5e4126..94e24a7857 100644 --- a/apps/mobile/src/app/+not-found.tsx +++ b/apps/mobile/src/screens/+not-found.tsx @@ -1,4 +1,4 @@ -import { Link } from "expo-router"; +import { Link } from "../navigation/router"; import { Pressable, ScrollView, StyleSheet } from "react-native"; import { useResolveClassNames } from "uniwind"; diff --git a/apps/mobile/src/app/connections/index.tsx b/apps/mobile/src/screens/connections/index.tsx similarity index 98% rename from apps/mobile/src/app/connections/index.tsx rename to apps/mobile/src/screens/connections/index.tsx index 12a0699644..d6f5f7b282 100644 --- a/apps/mobile/src/app/connections/index.tsx +++ b/apps/mobile/src/screens/connections/index.tsx @@ -1,4 +1,4 @@ -import { Stack, useRouter } from "expo-router"; +import { Stack, useRouter } from "../../navigation/router"; import { SymbolView } from "expo-symbols"; import type { EnvironmentId } from "@t3tools/contracts"; import { useCallback, useState } from "react"; diff --git a/apps/mobile/src/app/connections/new.tsx b/apps/mobile/src/screens/connections/new.tsx similarity index 99% rename from apps/mobile/src/app/connections/new.tsx rename to apps/mobile/src/screens/connections/new.tsx index ca9693dbb1..3ab81830d9 100644 --- a/apps/mobile/src/app/connections/new.tsx +++ b/apps/mobile/src/screens/connections/new.tsx @@ -1,5 +1,5 @@ import { CameraView, useCameraPermissions } from "expo-camera"; -import { Stack, useLocalSearchParams, useRouter } from "expo-router"; +import { Stack, useLocalSearchParams, useRouter } from "../../navigation/router"; import { AsyncResult } from "effect/unstable/reactivity"; import { useCallback, useEffect, useState } from "react"; import { Alert, ScrollView, View } from "react-native"; diff --git a/apps/mobile/src/app/debug/rns-glass.tsx b/apps/mobile/src/screens/debug/rns-glass.tsx similarity index 99% rename from apps/mobile/src/app/debug/rns-glass.tsx rename to apps/mobile/src/screens/debug/rns-glass.tsx index 657911af56..c6cb3a8bfe 100644 --- a/apps/mobile/src/app/debug/rns-glass.tsx +++ b/apps/mobile/src/screens/debug/rns-glass.tsx @@ -1,4 +1,4 @@ -import { Stack } from "expo-router"; +import { Stack } from "../../navigation/router"; import { useEffect, useRef, useState, type ComponentProps } from "react"; import { Platform, diff --git a/apps/mobile/src/app/index.tsx b/apps/mobile/src/screens/index.tsx similarity index 98% rename from apps/mobile/src/app/index.tsx rename to apps/mobile/src/screens/index.tsx index 993458fee0..30cb75bd5b 100644 --- a/apps/mobile/src/app/index.tsx +++ b/apps/mobile/src/screens/index.tsx @@ -1,6 +1,6 @@ import * as Arr from "effect/Array"; import * as Order from "effect/Order"; -import { Stack, useRouter } from "expo-router"; +import { Stack, useRouter } from "../navigation/router"; import { useMemo, useState } from "react"; import { useProjects, useThreadShells } from "../state/entities"; diff --git a/apps/mobile/src/app/new/add-project/destination.tsx b/apps/mobile/src/screens/new/add-project/destination.tsx similarity index 100% rename from apps/mobile/src/app/new/add-project/destination.tsx rename to apps/mobile/src/screens/new/add-project/destination.tsx diff --git a/apps/mobile/src/app/new/add-project/index.tsx b/apps/mobile/src/screens/new/add-project/index.tsx similarity index 100% rename from apps/mobile/src/app/new/add-project/index.tsx rename to apps/mobile/src/screens/new/add-project/index.tsx diff --git a/apps/mobile/src/app/new/add-project/local.tsx b/apps/mobile/src/screens/new/add-project/local.tsx similarity index 100% rename from apps/mobile/src/app/new/add-project/local.tsx rename to apps/mobile/src/screens/new/add-project/local.tsx diff --git a/apps/mobile/src/app/new/add-project/repository.tsx b/apps/mobile/src/screens/new/add-project/repository.tsx similarity index 90% rename from apps/mobile/src/app/new/add-project/repository.tsx rename to apps/mobile/src/screens/new/add-project/repository.tsx index 7bf23a4955..be3140937c 100644 --- a/apps/mobile/src/app/new/add-project/repository.tsx +++ b/apps/mobile/src/screens/new/add-project/repository.tsx @@ -1,4 +1,4 @@ -import { Stack, useLocalSearchParams } from "expo-router"; +import { Stack, useLocalSearchParams } from "../../../navigation/router"; import { addProjectRemoteSourceLabel } from "@t3tools/client-runtime/operations/projects"; import { AddProjectRepositoryScreen } from "../../../features/projects/AddProjectScreen"; diff --git a/apps/mobile/src/app/new/draft.tsx b/apps/mobile/src/screens/new/draft.tsx similarity index 91% rename from apps/mobile/src/app/new/draft.tsx rename to apps/mobile/src/screens/new/draft.tsx index 3adc7c53f9..f4cb57935c 100644 --- a/apps/mobile/src/app/new/draft.tsx +++ b/apps/mobile/src/screens/new/draft.tsx @@ -1,4 +1,4 @@ -import { Stack, useLocalSearchParams } from "expo-router"; +import { Stack, useLocalSearchParams } from "../../navigation/router"; import { NewTaskDraftScreen } from "../../features/threads/NewTaskDraftScreen"; diff --git a/apps/mobile/src/app/new/index.tsx b/apps/mobile/src/screens/new/index.tsx similarity index 99% rename from apps/mobile/src/app/new/index.tsx rename to apps/mobile/src/screens/new/index.tsx index 4e5339e7de..82ab63fb4c 100644 --- a/apps/mobile/src/app/new/index.tsx +++ b/apps/mobile/src/screens/new/index.tsx @@ -1,4 +1,4 @@ -import { Link, Stack, useRouter } from "expo-router"; +import { Link, Stack, useRouter } from "../../navigation/router"; import { SymbolView } from "expo-symbols"; import type { EnvironmentId, ProjectId } from "@t3tools/contracts"; import { useMemo } from "react"; diff --git a/apps/mobile/src/app/settings/archive.tsx b/apps/mobile/src/screens/settings/archive.tsx similarity index 100% rename from apps/mobile/src/app/settings/archive.tsx rename to apps/mobile/src/screens/settings/archive.tsx diff --git a/apps/mobile/src/app/settings/auth.tsx b/apps/mobile/src/screens/settings/auth.tsx similarity index 93% rename from apps/mobile/src/app/settings/auth.tsx rename to apps/mobile/src/screens/settings/auth.tsx index de33207ccd..984e7fbb0d 100644 --- a/apps/mobile/src/app/settings/auth.tsx +++ b/apps/mobile/src/screens/settings/auth.tsx @@ -1,6 +1,6 @@ import { useAuth } from "@clerk/expo"; import { AuthView, UserProfileView } from "@clerk/expo/native"; -import { Redirect, Stack } from "expo-router"; +import { Redirect, Stack } from "../../navigation/router"; import { View } from "react-native"; import { hasCloudPublicConfig } from "../../features/cloud/publicConfig"; diff --git a/apps/mobile/src/app/settings/environment-new.tsx b/apps/mobile/src/screens/settings/environment-new.tsx similarity index 100% rename from apps/mobile/src/app/settings/environment-new.tsx rename to apps/mobile/src/screens/settings/environment-new.tsx diff --git a/apps/mobile/src/app/settings/environments.tsx b/apps/mobile/src/screens/settings/environments.tsx similarity index 99% rename from apps/mobile/src/app/settings/environments.tsx rename to apps/mobile/src/screens/settings/environments.tsx index 8f65c630a5..9584be950c 100644 --- a/apps/mobile/src/app/settings/environments.tsx +++ b/apps/mobile/src/screens/settings/environments.tsx @@ -1,5 +1,5 @@ import { useAuth } from "@clerk/expo"; -import { Stack, useRouter } from "expo-router"; +import { Stack, useRouter } from "../../navigation/router"; import { SymbolView } from "expo-symbols"; import { connectionStatusText, diff --git a/apps/mobile/src/app/settings/index.tsx b/apps/mobile/src/screens/settings/index.tsx similarity index 99% rename from apps/mobile/src/app/settings/index.tsx rename to apps/mobile/src/screens/settings/index.tsx index 76b9010816..0e4003a499 100644 --- a/apps/mobile/src/app/settings/index.tsx +++ b/apps/mobile/src/screens/settings/index.tsx @@ -1,6 +1,6 @@ import { useAuth, useUser } from "@clerk/expo"; import * as Notifications from "expo-notifications"; -import { Link, Stack, useRouter } from "expo-router"; +import { Link, Stack, useRouter } from "../../navigation/router"; import { SymbolView } from "expo-symbols"; import * as Effect from "effect/Effect"; import { useCallback, useEffect, useMemo, useState } from "react"; diff --git a/apps/mobile/src/app/settings/waitlist.tsx b/apps/mobile/src/screens/settings/waitlist.tsx similarity index 94% rename from apps/mobile/src/app/settings/waitlist.tsx rename to apps/mobile/src/screens/settings/waitlist.tsx index 3fc2fad269..952d119d82 100644 --- a/apps/mobile/src/app/settings/waitlist.tsx +++ b/apps/mobile/src/screens/settings/waitlist.tsx @@ -1,5 +1,5 @@ import { useAuth } from "@clerk/expo"; -import { Redirect, Stack, useFocusEffect, useRouter } from "expo-router"; +import { Redirect, Stack, useFocusEffect, useRouter } from "../../navigation/router"; import { useCallback } from "react"; import { ScrollView } from "react-native"; diff --git a/apps/mobile/src/app/threads/[environmentId]/[threadId]/files/[...path].tsx b/apps/mobile/src/screens/threads/[environmentId]/[threadId]/files/[...path].tsx similarity index 100% rename from apps/mobile/src/app/threads/[environmentId]/[threadId]/files/[...path].tsx rename to apps/mobile/src/screens/threads/[environmentId]/[threadId]/files/[...path].tsx diff --git a/apps/mobile/src/app/threads/[environmentId]/[threadId]/files/index.tsx b/apps/mobile/src/screens/threads/[environmentId]/[threadId]/files/index.tsx similarity index 100% rename from apps/mobile/src/app/threads/[environmentId]/[threadId]/files/index.tsx rename to apps/mobile/src/screens/threads/[environmentId]/[threadId]/files/index.tsx diff --git a/apps/mobile/src/app/threads/[environmentId]/[threadId]/git-confirm.tsx b/apps/mobile/src/screens/threads/[environmentId]/[threadId]/git-confirm.tsx similarity index 100% rename from apps/mobile/src/app/threads/[environmentId]/[threadId]/git-confirm.tsx rename to apps/mobile/src/screens/threads/[environmentId]/[threadId]/git-confirm.tsx diff --git a/apps/mobile/src/app/threads/[environmentId]/[threadId]/git/branches.tsx b/apps/mobile/src/screens/threads/[environmentId]/[threadId]/git/branches.tsx similarity index 100% rename from apps/mobile/src/app/threads/[environmentId]/[threadId]/git/branches.tsx rename to apps/mobile/src/screens/threads/[environmentId]/[threadId]/git/branches.tsx diff --git a/apps/mobile/src/app/threads/[environmentId]/[threadId]/git/commit.tsx b/apps/mobile/src/screens/threads/[environmentId]/[threadId]/git/commit.tsx similarity index 100% rename from apps/mobile/src/app/threads/[environmentId]/[threadId]/git/commit.tsx rename to apps/mobile/src/screens/threads/[environmentId]/[threadId]/git/commit.tsx diff --git a/apps/mobile/src/app/threads/[environmentId]/[threadId]/git/index.tsx b/apps/mobile/src/screens/threads/[environmentId]/[threadId]/git/index.tsx similarity index 100% rename from apps/mobile/src/app/threads/[environmentId]/[threadId]/git/index.tsx rename to apps/mobile/src/screens/threads/[environmentId]/[threadId]/git/index.tsx diff --git a/apps/mobile/src/app/threads/[environmentId]/[threadId]/index.tsx b/apps/mobile/src/screens/threads/[environmentId]/[threadId]/index.tsx similarity index 100% rename from apps/mobile/src/app/threads/[environmentId]/[threadId]/index.tsx rename to apps/mobile/src/screens/threads/[environmentId]/[threadId]/index.tsx diff --git a/apps/mobile/src/app/threads/[environmentId]/[threadId]/review-comment.tsx b/apps/mobile/src/screens/threads/[environmentId]/[threadId]/review-comment.tsx similarity index 100% rename from apps/mobile/src/app/threads/[environmentId]/[threadId]/review-comment.tsx rename to apps/mobile/src/screens/threads/[environmentId]/[threadId]/review-comment.tsx diff --git a/apps/mobile/src/app/threads/[environmentId]/[threadId]/review.tsx b/apps/mobile/src/screens/threads/[environmentId]/[threadId]/review.tsx similarity index 100% rename from apps/mobile/src/app/threads/[environmentId]/[threadId]/review.tsx rename to apps/mobile/src/screens/threads/[environmentId]/[threadId]/review.tsx diff --git a/apps/mobile/src/app/threads/[environmentId]/[threadId]/terminal.tsx b/apps/mobile/src/screens/threads/[environmentId]/[threadId]/terminal.tsx similarity index 100% rename from apps/mobile/src/app/threads/[environmentId]/[threadId]/terminal.tsx rename to apps/mobile/src/screens/threads/[environmentId]/[threadId]/terminal.tsx diff --git a/apps/mobile/src/state/use-thread-selection.ts b/apps/mobile/src/state/use-thread-selection.ts index 656a961386..c5eaf5743d 100644 --- a/apps/mobile/src/state/use-thread-selection.ts +++ b/apps/mobile/src/state/use-thread-selection.ts @@ -1,4 +1,4 @@ -import { useGlobalSearchParams } from "expo-router"; +import { useGlobalSearchParams } from "../navigation/router"; import { createContext, createElement, use, useMemo, useRef, type ReactNode } from "react"; import { EnvironmentId, diff --git a/patches/expo-router@56.2.11.patch b/patches/expo-router@56.2.11.patch deleted file mode 100644 index 9564867cbf..0000000000 --- a/patches/expo-router@56.2.11.patch +++ /dev/null @@ -1,115 +0,0 @@ -diff --git a/build/react-navigation/native-stack/types.d.ts b/build/react-navigation/native-stack/types.d.ts -index 6de73e0c33cedbaaaffdcb092ba21fc9ff71862e..78929fe237b7f9d7808f8de2b844e822976e0d69 100644 ---- a/build/react-navigation/native-stack/types.d.ts -+++ b/build/react-navigation/native-stack/types.d.ts -@@ -306,6 +306,39 @@ export type NativeStackNavigationOptions = { - * @platform ios - */ - unstable_headerRightItems?: (props: NativeStackHeaderItemProps) => NativeStackHeaderItem[]; -+ /** -+ * Function which returns an array of items to display as the centered item -+ * group in modern iOS headers. -+ * -+ * This is an unstable API and might change in the future. -+ * -+ * @platform ios -+ */ -+ unstable_headerCenterItems?: (props: NativeStackHeaderItemProps) => NativeStackHeaderItem[]; -+ /** -+ * Function which returns an array of toolbar items for the current screen. -+ * -+ * This is an unstable API and might change in the future. -+ * -+ * @platform ios -+ */ -+ unstable_headerToolbarItems?: (props: NativeStackHeaderItemProps) => NonNullable; -+ /** -+ * String displayed below the compact navigation title on iOS 26+. -+ * -+ * This is an unstable API and might change in the future. -+ * -+ * @platform ios -+ */ -+ unstable_headerSubtitle?: ScreenStackHeaderConfigProps['subtitle']; -+ /** -+ * Native iOS navigation item style to apply to the header. -+ * -+ * This is an unstable API and might change in the future. -+ * -+ * @platform ios -+ */ -+ unstable_navigationItemStyle?: ScreenStackHeaderConfigProps['navigationItemStyle']; - /** - * String or a function that returns a React Element to be used by the header. - * Defaults to screen `title` or route name. -@@ -1115,7 +1148,8 @@ export type NativeStackHeaderItemCustom = { - * if the items don't fit the available space, they will be collapsed into a menu automatically. - * Items with `type: 'custom'` will not be included in this automatic collapsing behavior. - */ --export type NativeStackHeaderItem = NativeStackHeaderItemButton | NativeStackHeaderItemMenu | NativeStackHeaderItemSpacing | NativeStackHeaderItemCustom; -+export type NativeStackHeaderRawRNSItem = NonNullable[number] | NonNullable[number] | NonNullable[number]; -+export type NativeStackHeaderItem = NativeStackHeaderItemButton | NativeStackHeaderItemMenu | NativeStackHeaderItemSpacing | NativeStackHeaderItemCustom | NativeStackHeaderRawRNSItem; - export type NativeStackNavigatorProps = DefaultNavigatorOptions, NativeStackNavigationOptions, NativeStackNavigationEventMap, NativeStackNavigationProp> & StackRouterOptions & NativeStackNavigationConfig; - export type NativeStackDescriptor = Descriptor, RouteProp>; - export type NativeStackDescriptorMap = { -diff --git a/build/react-navigation/native-stack/views/useHeaderConfigProps.d.ts b/build/react-navigation/native-stack/views/useHeaderConfigProps.d.ts -index 218c4291fdb57600a45d32fbcefe3707a520fe79..5fdbb2754755a27589ad1555eae892b5fbee2c6a 100644 ---- a/build/react-navigation/native-stack/views/useHeaderConfigProps.d.ts -+++ b/build/react-navigation/native-stack/views/useHeaderConfigProps.d.ts -@@ -10,6 +10,6 @@ type Props = NativeStackNavigationOptions & { - } | undefined; - route: Route; - }; --export declare function useHeaderConfigProps({ headerBackIcon, headerBackImageSource, headerBackButtonDisplayMode, headerBackButtonMenuEnabled, headerBackTitle, headerBackTitleStyle, headerBackVisible, headerShadowVisible, headerLargeStyle, headerLargeTitle: headerLargeTitleDeprecated, headerLargeTitleEnabled, headerLargeTitleShadowVisible, headerLargeTitleStyle, headerBackground, headerLeft, headerRight, headerShown, headerStyle, headerBlurEffect, headerTintColor, headerTitle, headerTitleAlign, headerTitleStyle, headerTransparent, headerSearchBarOptions, headerTopInsetEnabled, headerBack, route, title, unstable_headerLeftItems: headerLeftItems, unstable_headerRightItems: headerRightItems, }: Props): ScreenStackHeaderConfigProps; -+export declare function useHeaderConfigProps({ headerBackIcon, headerBackImageSource, headerBackButtonDisplayMode, headerBackButtonMenuEnabled, headerBackTitle, headerBackTitleStyle, headerBackVisible, headerShadowVisible, headerLargeStyle, headerLargeTitle: headerLargeTitleDeprecated, headerLargeTitleEnabled, headerLargeTitleShadowVisible, headerLargeTitleStyle, headerBackground, headerLeft, headerRight, headerShown, headerStyle, headerBlurEffect, headerTintColor, headerTitle, headerTitleAlign, headerTitleStyle, headerTransparent, headerSearchBarOptions, headerTopInsetEnabled, headerBack, route, title, unstable_headerLeftItems: headerLeftItems, unstable_headerRightItems: headerRightItems, unstable_headerCenterItems: headerCenterItems, unstable_headerToolbarItems: headerToolbarItems, unstable_headerSubtitle: headerSubtitle, unstable_navigationItemStyle: navigationItemStyle, }: Props): ScreenStackHeaderConfigProps; - export {}; - //# sourceMappingURL=useHeaderConfigProps.d.ts.map -diff --git a/build/react-navigation/native-stack/views/useHeaderConfigProps.js b/build/react-navigation/native-stack/views/useHeaderConfigProps.js -index 2de6d160cedffb4ffb124adf7cd10979ec6ee778..9d839442e00e136204630663f207a45c950dcd25 100644 ---- a/build/react-navigation/native-stack/views/useHeaderConfigProps.js -+++ b/build/react-navigation/native-stack/views/useHeaderConfigProps.js -@@ -22,6 +22,9 @@ const processBarButtonItems = (items, colors, fonts) => { - } - return item; - } -+ if (item.type === 'searchField' || item.type === 'searchBarPlacement' || item.type === 'mailSearchToolbar') { -+ return item; -+ } - if (item.type === 'button' || item.type === 'menu') { - if (item.type === 'menu' && item.menu == null) { - throw new Error(`Menu item must have a 'menu' property defined: ${JSON.stringify(item)}`); -@@ -108,7 +111,7 @@ const getMenuItem = (item) => { - subtitle: description, - }; - }; --function useHeaderConfigProps({ headerBackIcon, headerBackImageSource, headerBackButtonDisplayMode, headerBackButtonMenuEnabled, headerBackTitle, headerBackTitleStyle, headerBackVisible, headerShadowVisible, headerLargeStyle, headerLargeTitle: headerLargeTitleDeprecated, headerLargeTitleEnabled = headerLargeTitleDeprecated, headerLargeTitleShadowVisible, headerLargeTitleStyle, headerBackground, headerLeft, headerRight, headerShown, headerStyle, headerBlurEffect, headerTintColor, headerTitle, headerTitleAlign, headerTitleStyle, headerTransparent, headerSearchBarOptions, headerTopInsetEnabled, headerBack, route, title, unstable_headerLeftItems: headerLeftItems, unstable_headerRightItems: headerRightItems, }) { -+function useHeaderConfigProps({ headerBackIcon, headerBackImageSource, headerBackButtonDisplayMode, headerBackButtonMenuEnabled, headerBackTitle, headerBackTitleStyle, headerBackVisible, headerShadowVisible, headerLargeStyle, headerLargeTitle: headerLargeTitleDeprecated, headerLargeTitleEnabled = headerLargeTitleDeprecated, headerLargeTitleShadowVisible, headerLargeTitleStyle, headerBackground, headerLeft, headerRight, headerShown, headerStyle, headerBlurEffect, headerTintColor, headerTitle, headerTitleAlign, headerTitleStyle, headerTransparent, headerSearchBarOptions, headerTopInsetEnabled, headerBack, route, title, unstable_headerLeftItems: headerLeftItems, unstable_headerRightItems: headerRightItems, unstable_headerCenterItems: headerCenterItems, unstable_headerToolbarItems: headerToolbarItems, unstable_headerSubtitle: headerSubtitle, unstable_navigationItemStyle: navigationItemStyle, }) { - const { direction } = (0, native_1.useLocale)(); - const { colors, fonts, dark } = (0, native_1.useTheme)(); - const tintColor = headerTintColor ?? (react_native_1.Platform.OS === 'ios' ? colors.primary : colors.text); -@@ -216,6 +219,14 @@ function useHeaderConfigProps({ headerBackIcon, headerBackImageSource, headerBac - tintColor, - canGoBack, - }); -+ const centerItems = headerCenterItems?.({ -+ tintColor, -+ canGoBack, -+ }); -+ const toolbarItems = headerToolbarItems?.({ -+ tintColor, -+ canGoBack, -+ }); - if (rightItems) { - // iOS renders right items in reverse order - // So we need to reverse them here to match the order -@@ -270,6 +281,10 @@ function useHeaderConfigProps({ headerBackIcon, headerBackImageSource, headerBac - children, - headerLeftBarButtonItems: processBarButtonItems(leftItems, colors, fonts), - headerRightBarButtonItems: processBarButtonItems(rightItems, colors, fonts), -+ subtitle: headerSubtitle, -+ headerCenterBarButtonItems: processBarButtonItems(centerItems, colors, fonts), -+ headerToolbarItems: toolbarItems, -+ navigationItemStyle, - experimental_userInterfaceStyle: dark ? 'dark' : 'light', - }; - } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5a62d88ec2..151d801a13 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -72,7 +72,6 @@ patchedDependencies: '@pierre/diffs@1.3.0-beta.5': 7cb6da88544119adda056b2f46f43956f99326227732da0b345081e285a6c53a effect@4.0.0-beta.78: c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5 expo-modules-jsi@56.0.10: 9170f8074ae4e35a0a086e756c8f815794fd3abe51eac67ca3ba02804225ec1f - expo-router@56.2.11: 3c26210132f023a81982922c80746cb1008e8ec3b699ee6d054d687a9a24e3f8 react-native-nitro-modules@0.35.9: 825622aae63a8fb5b904f3c77908a0e216261d727ea171709f2c0b6088422675 react-native-screens@4.25.2: 914870f7aa1cbbbb0bff272c223fabfb154d84dc3a53054b76c3c2c8727c71b7 @@ -214,6 +213,15 @@ importers: '@react-native-menu/menu': specifier: ^2.0.0 version: 2.0.0(react-native@0.85.3(@babel/core@7.29.7)(@react-native/metro-config@0.85.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.2.16)(bufferutil@4.1.0)(react@19.2.3)(utf-8-validate@6.0.6))(react@19.2.3) + '@react-navigation/elements': + specifier: 2.9.26 + version: 2.9.26(c6a2ad0e2c930f8e3896e77c3ba11bc4) + '@react-navigation/native': + specifier: 7.3.4 + version: 7.3.4(react-native@0.85.3(@babel/core@7.29.7)(@react-native/metro-config@0.85.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.2.16)(bufferutil@4.1.0)(react@19.2.3)(utf-8-validate@6.0.6))(react@19.2.3) + '@react-navigation/native-stack': + specifier: 7.17.6 + version: 7.17.6(dc1fa3b83a3d36b06fc35a0865f3d516) '@shikijs/core': specifier: 4.2.0 version: 4.2.0 @@ -307,9 +315,6 @@ importers: expo-paste-input: specifier: ^0.1.15 version: 0.1.15(expo@56.0.12)(react-native@0.85.3(@babel/core@7.29.7)(@react-native/metro-config@0.85.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.2.16)(bufferutil@4.1.0)(react@19.2.3)(utf-8-validate@6.0.6))(react@19.2.3) - expo-router: - specifier: ~56.2.11 - version: 56.2.11(patch_hash=3c26210132f023a81982922c80746cb1008e8ec3b699ee6d054d687a9a24e3f8)(58010f146fb71a08f4c76f0e25e5e6b3) expo-secure-store: specifier: ~56.0.4 version: 56.0.4(expo@56.0.12) @@ -3844,6 +3849,41 @@ packages: '@types/react': optional: true + '@react-navigation/core@7.21.2': + resolution: {integrity: sha512-EsJhQnsL5NuIhXsWF7URijS5hd2AaJUREdq1fOIowlyNNQBA3jCnkGU0DkW7+eI40cQ+GXH8DQw+ci7TefLIxQ==} + peerDependencies: + react: '>= 18.2.0' + + '@react-navigation/elements@2.9.26': + resolution: {integrity: sha512-EaHSJf42MjnH5VFL+KZfQIyqJvdQWK9Z27J7WUSuIVX5NXlR925sPmhWf540DX9gD1ny8BfUGPZAuw/PO4tK2w==} + peerDependencies: + '@react-native-masked-view/masked-view': '>= 0.2.0' + '@react-navigation/native': ^7.3.4 + react: '>= 18.2.0' + react-native: '*' + react-native-safe-area-context: '>= 4.0.0' + peerDependenciesMeta: + '@react-native-masked-view/masked-view': + optional: true + + '@react-navigation/native-stack@7.17.6': + resolution: {integrity: sha512-CnNPnlSGnrxPyHguDp/xDg5w9STMmIoI6IFZe7cpvEeD0GF/LTzvZ0gmq+hPJTm2/KIrnuPx34emCofzpht45g==} + peerDependencies: + '@react-navigation/native': ^7.3.4 + react: '>= 18.2.0' + react-native: '*' + react-native-safe-area-context: '>= 4.0.0' + react-native-screens: '>= 4.0.0' + + '@react-navigation/native@7.3.4': + resolution: {integrity: sha512-zyAqFLeZuaakerMMnhYqBeGAzJ+WFQUTgezP3FxSlXNwFq5XxnjP28vi2XHGqm4zg4pGWls9Ay4JKshIHUOpwA==} + peerDependencies: + react: '>= 18.2.0' + react-native: '*' + + '@react-navigation/routers@7.6.0': + resolution: {integrity: sha512-lblhDXfS75jLc7G2K7BZGM+7cjqQXk13X/MA4fq/12r62zM+fBhhreLzYflSitrDDXFRJpSvJXy0ziiGU04Xow==} + '@rolldown/binding-android-arm64@1.0.0-rc.17': resolution: {integrity: sha512-s70pVGhw4zqGeFnXWvAzJDlvxhlRollagdCCKRgOsgUOH3N1l0LIxf83AtGzmb5SiVM4Hjl5HyarMRfdfj3DaQ==} engines: {node: ^20.19.0 || >=22.12.0} @@ -9326,6 +9366,9 @@ packages: standard-navigation@0.0.5: resolution: {integrity: sha512-YAmzwAiiQVocZxO/VGPFiQHcu5pKiz09QIGC0MK6aRMoa3E0QkoTQgcqJr7ZZ3OMiNhu4DkaGElFI5htjOIDbw==} + standard-navigation@0.0.7: + resolution: {integrity: sha512-NCGLCNyuXrFOkGHxdNZFnpsehGtiq1oXbPhKl7ZuxFO5J//H2evqqOchmD4YwEUJnkjO4kH9Xp4hQX6hdAYCKQ==} + standardwebhooks@1.0.0: resolution: {integrity: sha512-BbHGOQK9olHPMvQNHWul6MYlrRTAOKn03rOe4A8O3CLWhNf4YHBqq2HJKKC+sfqpxiBY52pNeesD6jIiLDz8jg==} @@ -10268,7 +10311,8 @@ snapshots: 7zip-bin@5.2.0: {} - '@adobe/css-tools@4.5.0': {} + '@adobe/css-tools@4.5.0': + optional: true '@alcalzone/ansi-tokenize@0.2.5': dependencies: @@ -12003,7 +12047,7 @@ snapshots: ws: 8.21.0(bufferutil@4.1.0)(utf-8-validate@6.0.6) zod: 3.25.76 optionalDependencies: - expo-router: 56.2.11(patch_hash=3c26210132f023a81982922c80746cb1008e8ec3b699ee6d054d687a9a24e3f8)(58010f146fb71a08f4c76f0e25e5e6b3) + expo-router: 56.2.11(58010f146fb71a08f4c76f0e25e5e6b3) react-native: 0.85.3(@babel/core@7.29.7)(@react-native/metro-config@0.85.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.2.16)(bufferutil@4.1.0)(react@19.2.3)(utf-8-validate@6.0.6) transitivePeerDependencies: - '@expo/dom-webview' @@ -12301,7 +12345,7 @@ snapshots: react: 19.2.3 optionalDependencies: '@expo/metro-runtime': 56.0.15(@expo/log-box@56.0.13)(expo@56.0.12)(react-dom@19.2.3(react@19.2.3))(react-native@0.85.3(@babel/core@7.29.7)(@react-native/metro-config@0.85.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.2.16)(bufferutil@4.1.0)(react@19.2.3)(utf-8-validate@6.0.6))(react@19.2.3) - expo-router: 56.2.11(patch_hash=3c26210132f023a81982922c80746cb1008e8ec3b699ee6d054d687a9a24e3f8)(58010f146fb71a08f4c76f0e25e5e6b3) + expo-router: 56.2.11(58010f146fb71a08f4c76f0e25e5e6b3) react-dom: 19.2.3(react@19.2.3) transitivePeerDependencies: - supports-color @@ -13220,6 +13264,7 @@ snapshots: optionalDependencies: '@types/react': 19.2.16 '@types/react-dom': 19.2.3(@types/react@19.2.16) + optional: true '@radix-ui/react-compose-refs@1.1.2(@types/react@19.2.16)(react@19.2.3)': dependencies: @@ -13260,6 +13305,7 @@ snapshots: react: 19.2.3 optionalDependencies: '@types/react': 19.2.16 + optional: true '@radix-ui/react-dismissable-layer@1.1.11(@types/react-dom@19.2.3(@types/react@19.2.16))(@types/react@19.2.16)(react-dom@19.2.3(react@19.2.3))(react@19.2.3)': dependencies: @@ -13343,6 +13389,7 @@ snapshots: optionalDependencies: '@types/react': 19.2.16 '@types/react-dom': 19.2.3(@types/react@19.2.16) + optional: true '@radix-ui/react-slot@1.2.3(@types/react@19.2.16)(react@19.2.3)': dependencies: @@ -13357,6 +13404,7 @@ snapshots: react: 19.2.3 optionalDependencies: '@types/react': 19.2.16 + optional: true '@radix-ui/react-tabs@1.1.13(@types/react-dom@19.2.3(@types/react@19.2.16))(@types/react@19.2.16)(react-dom@19.2.3(react@19.2.3))(react@19.2.3)': dependencies: @@ -13373,6 +13421,7 @@ snapshots: optionalDependencies: '@types/react': 19.2.16 '@types/react-dom': 19.2.3(@types/react@19.2.16) + optional: true '@radix-ui/react-use-callback-ref@1.1.1(@types/react@19.2.16)(react@19.2.3)': dependencies: @@ -13423,6 +13472,7 @@ snapshots: dependencies: react: 19.2.3 react-native: 0.85.3(@babel/core@7.29.7)(@react-native/metro-config@0.85.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.2.16)(bufferutil@4.1.0)(react@19.2.3)(utf-8-validate@6.0.6) + optional: true '@react-native-menu/menu@2.0.0(react-native@0.85.3(@babel/core@7.29.7)(@react-native/metro-config@0.85.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.2.16)(bufferutil@4.1.0)(react@19.2.3)(utf-8-validate@6.0.6))(react@19.2.3)': dependencies: @@ -13568,6 +13618,59 @@ snapshots: optionalDependencies: '@types/react': 19.2.16 + '@react-navigation/core@7.21.2(react@19.2.3)': + dependencies: + '@react-navigation/routers': 7.6.0 + escape-string-regexp: 4.0.0 + fast-deep-equal: 3.1.3 + nanoid: 3.3.12 + query-string: 7.1.3 + react: 19.2.3 + react-is: 19.2.7 + use-latest-callback: 0.2.6(react@19.2.3) + use-sync-external-store: 1.6.0(react@19.2.3) + + '@react-navigation/elements@2.9.26(c6a2ad0e2c930f8e3896e77c3ba11bc4)': + dependencies: + '@react-navigation/native': 7.3.4(react-native@0.85.3(@babel/core@7.29.7)(@react-native/metro-config@0.85.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.2.16)(bufferutil@4.1.0)(react@19.2.3)(utf-8-validate@6.0.6))(react@19.2.3) + color: 4.2.3 + react: 19.2.3 + react-native: 0.85.3(@babel/core@7.29.7)(@react-native/metro-config@0.85.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.2.16)(bufferutil@4.1.0)(react@19.2.3)(utf-8-validate@6.0.6) + react-native-safe-area-context: 5.7.0(react-native@0.85.3(@babel/core@7.29.7)(@react-native/metro-config@0.85.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.2.16)(bufferutil@4.1.0)(react@19.2.3)(utf-8-validate@6.0.6))(react@19.2.3) + use-latest-callback: 0.2.6(react@19.2.3) + use-sync-external-store: 1.6.0(react@19.2.3) + optionalDependencies: + '@react-native-masked-view/masked-view': 0.3.2(react-native@0.85.3(@babel/core@7.29.7)(@react-native/metro-config@0.85.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.2.16)(bufferutil@4.1.0)(react@19.2.3)(utf-8-validate@6.0.6))(react@19.2.3) + + '@react-navigation/native-stack@7.17.6(dc1fa3b83a3d36b06fc35a0865f3d516)': + dependencies: + '@react-navigation/elements': 2.9.26(c6a2ad0e2c930f8e3896e77c3ba11bc4) + '@react-navigation/native': 7.3.4(react-native@0.85.3(@babel/core@7.29.7)(@react-native/metro-config@0.85.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.2.16)(bufferutil@4.1.0)(react@19.2.3)(utf-8-validate@6.0.6))(react@19.2.3) + color: 4.2.3 + react: 19.2.3 + react-native: 0.85.3(@babel/core@7.29.7)(@react-native/metro-config@0.85.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.2.16)(bufferutil@4.1.0)(react@19.2.3)(utf-8-validate@6.0.6) + react-native-safe-area-context: 5.7.0(react-native@0.85.3(@babel/core@7.29.7)(@react-native/metro-config@0.85.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.2.16)(bufferutil@4.1.0)(react@19.2.3)(utf-8-validate@6.0.6))(react@19.2.3) + react-native-screens: 4.25.2(patch_hash=914870f7aa1cbbbb0bff272c223fabfb154d84dc3a53054b76c3c2c8727c71b7)(react-native@0.85.3(@babel/core@7.29.7)(@react-native/metro-config@0.85.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.2.16)(bufferutil@4.1.0)(react@19.2.3)(utf-8-validate@6.0.6))(react@19.2.3) + sf-symbols-typescript: 2.2.0 + warn-once: 0.1.1 + transitivePeerDependencies: + - '@react-native-masked-view/masked-view' + + '@react-navigation/native@7.3.4(react-native@0.85.3(@babel/core@7.29.7)(@react-native/metro-config@0.85.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.2.16)(bufferutil@4.1.0)(react@19.2.3)(utf-8-validate@6.0.6))(react@19.2.3)': + dependencies: + '@react-navigation/core': 7.21.2(react@19.2.3) + escape-string-regexp: 4.0.0 + fast-deep-equal: 3.1.3 + nanoid: 3.3.12 + react: 19.2.3 + react-native: 0.85.3(@babel/core@7.29.7)(@react-native/metro-config@0.85.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.2.16)(bufferutil@4.1.0)(react@19.2.3)(utf-8-validate@6.0.6) + standard-navigation: 0.0.7 + use-latest-callback: 0.2.6(react@19.2.3) + + '@react-navigation/routers@7.6.0': + dependencies: + nanoid: 3.3.12 + '@rolldown/binding-android-arm64@1.0.0-rc.17': optional: true @@ -14213,6 +14316,7 @@ snapshots: dom-accessibility-api: 0.6.3 picocolors: 1.1.1 redent: 3.0.0 + optional: true '@testing-library/user-event@14.6.1(@testing-library/dom@10.4.1)': dependencies: @@ -15402,7 +15506,8 @@ snapshots: cli-width@4.1.0: {} - client-only@0.0.1: {} + client-only@0.0.1: + optional: true cliui@8.0.1: dependencies: @@ -15594,7 +15699,8 @@ snapshots: css-what@6.2.2: {} - css.escape@1.5.1: {} + css.escape@1.5.1: + optional: true csso@5.0.5: dependencies: @@ -15717,7 +15823,8 @@ snapshots: dom-accessibility-api@0.5.16: {} - dom-accessibility-api@0.6.3: {} + dom-accessibility-api@0.6.3: + optional: true dom-serializer@2.0.0: dependencies: @@ -16217,7 +16324,7 @@ snapshots: react: 19.2.3 react-native: 0.85.3(@babel/core@7.29.7)(@react-native/metro-config@0.85.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.2.16)(bufferutil@4.1.0)(react@19.2.3)(utf-8-validate@6.0.6) - expo-router@56.2.11(patch_hash=3c26210132f023a81982922c80746cb1008e8ec3b699ee6d054d687a9a24e3f8)(58010f146fb71a08f4c76f0e25e5e6b3): + expo-router@56.2.11(58010f146fb71a08f4c76f0e25e5e6b3): dependencies: '@expo/log-box': 56.0.13(@expo/dom-webview@56.0.5)(expo@56.0.12)(react-native@0.85.3(@babel/core@7.29.7)(@react-native/metro-config@0.85.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.2.16)(bufferutil@4.1.0)(react@19.2.3)(utf-8-validate@6.0.6))(react@19.2.3) '@expo/metro-runtime': 56.0.15(@expo/log-box@56.0.13)(expo@56.0.12)(react-dom@19.2.3(react@19.2.3))(react-native@0.85.3(@babel/core@7.29.7)(@react-native/metro-config@0.85.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.2.16)(bufferutil@4.1.0)(react@19.2.3)(utf-8-validate@6.0.6))(react@19.2.3) @@ -16266,6 +16373,7 @@ snapshots: - expo-font - react-native-worklets - supports-color + optional: true expo-secure-store@56.0.4(expo@56.0.12): dependencies: @@ -16974,7 +17082,8 @@ snapshots: immediate@3.0.6: {} - indent-string@4.0.0: {} + indent-string@4.0.0: + optional: true indent-string@5.0.0: {} @@ -18086,7 +18195,8 @@ snapshots: mimic-response@3.1.0: {} - min-indent@1.0.1: {} + min-indent@1.0.1: + optional: true minimatch@10.2.5: dependencies: @@ -18755,7 +18865,8 @@ snapshots: dependencies: react: 19.2.6 - react-fast-compare@3.2.2: {} + react-fast-compare@3.2.2: + optional: true react-freeze@1.0.4(react@19.2.3): dependencies: @@ -18802,6 +18913,7 @@ snapshots: react-native-gesture-handler: 2.31.2(react-native@0.85.3(@babel/core@7.29.7)(@react-native/metro-config@0.85.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.2.16)(bufferutil@4.1.0)(react@19.2.3)(utf-8-validate@6.0.6))(react@19.2.3) react-native-reanimated: 4.3.1(react-native-worklets@0.8.3(@babel/core@7.29.7)(@react-native/metro-config@0.85.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(react-native@0.85.3(@babel/core@7.29.7)(@react-native/metro-config@0.85.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.2.16)(bufferutil@4.1.0)(react@19.2.3)(utf-8-validate@6.0.6))(react@19.2.3))(react-native@0.85.3(@babel/core@7.29.7)(@react-native/metro-config@0.85.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.2.16)(bufferutil@4.1.0)(react@19.2.3)(utf-8-validate@6.0.6))(react@19.2.3) use-latest-callback: 0.2.6(react@19.2.3) + optional: true react-native-gesture-handler@2.31.2(react-native@0.85.3(@babel/core@7.29.7)(@react-native/metro-config@0.85.3(@babel/core@7.29.7)(bufferutil@4.1.0)(utf-8-validate@6.0.6))(@types/react@19.2.16)(bufferutil@4.1.0)(react@19.2.3)(utf-8-validate@6.0.6))(react@19.2.3): dependencies: @@ -19016,6 +19128,7 @@ snapshots: dependencies: indent-string: 4.0.0 strip-indent: 3.0.0 + optional: true redis-errors@1.2.0: {} @@ -19447,7 +19560,8 @@ snapshots: transitivePeerDependencies: - supports-color - server-only@0.0.1: {} + server-only@0.0.1: + optional: true setimmediate@1.0.5: {} @@ -19455,7 +19569,8 @@ snapshots: sf-symbols-typescript@2.2.0: {} - shallowequal@1.1.0: {} + shallowequal@1.1.0: + optional: true sharp@0.34.5: dependencies: @@ -19619,7 +19734,10 @@ snapshots: standard-as-callback@2.1.0: {} - standard-navigation@0.0.5: {} + standard-navigation@0.0.5: + optional: true + + standard-navigation@0.0.7: {} standardwebhooks@1.0.0: dependencies: @@ -19683,6 +19801,7 @@ snapshots: strip-indent@3.0.0: dependencies: min-indent: 1.0.1 + optional: true strnum@2.3.0: {} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index b566cc03b9..f3b8d15cd7 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -110,7 +110,6 @@ patchedDependencies: "@pierre/diffs@1.3.0-beta.5": patches/@pierre%2Fdiffs@1.3.0-beta.5.patch effect@4.0.0-beta.78: patches/effect@4.0.0-beta.78.patch expo-modules-jsi@56.0.10: patches/expo-modules-jsi@56.0.10.patch - expo-router@56.2.11: patches/expo-router@56.2.11.patch react-native-nitro-modules@0.35.9: patches/react-native-nitro-modules@0.35.9.patch react-native-screens@4.25.2: patches/react-native-screens@4.25.2.patch