import { Stack, useRouter } from "expo-router"; import { useRef, useState } from "react"; import type { SearchBarCommands } from "react-native-screens"; import { useFeedbackUi } from "../../shared/context/FeedbackProvider.js"; import type { mergeFeedbackMessages } from "../../shared/messages.js"; import type { mergeFeedbackTheme } from "../../shared/theme.js"; import type { RoadmapScreenProps } from "../../shared/types/index.js"; import { RoadmapProvider, RoadmapScreen as NativeRoadmapScreen, RoadmapScreenContent, } from "../shared/ui/RoadmapScreen.js"; import type { RoadmapAndroidToolbarIcons, RoadmapStackScreenOptions, } from "./types.js"; import { supportsRoadmapBottomToolbar, useStackBottomInset, } from "./stackInsets.js"; import { useStackHeaderHeight } from "./useStackHeaderHeight.js"; interface RoadmapScreenWithStack { /** Enables the current Expo Router stack integration. @default true */ useStack?: true; /** Options applied to the current Expo Router screen. */ StackOptions?: RoadmapStackScreenOptions; /** Android image source for the toolbar back action. */ androidToolbarIcons?: RoadmapAndroidToolbarIcons; /** * Total top space reserved for a transparent stack header. When omitted, * the native-stack header height is used. If `headerTransparent` is `false`, * the default is `0` because the stack lays content below the header; * `0` also explicitly disables the automatic inset. */ topInset?: number; /** * Total bottom space reserved for a host navigation bar or overlay. When * omitted, the safe-area bottom is used, plus the built-in iOS bottom * toolbar height when that toolbar is available; `0` disables the inset. */ bottomInset?: number; } interface RoadmapScreenWithoutStack { useStack: false; StackOptions?: never; androidToolbarIcons?: never; } export type ExpoRoadmapScreenProps = RoadmapScreenProps & (RoadmapScreenWithStack | RoadmapScreenWithoutStack); /** * Convenience roadmap screen for a single Expo route. Use * `RoadmapStackLayout` when the board and item detail should be separate * discovered Expo Router pages. */ export function RoadmapScreen(props: ExpoRoadmapScreenProps) { if (props.useStack === false) { return ; } return ( ); } function StackedRoadmapScreen({ props, }: { props: RoadmapScreenWithStack & RoadmapScreenProps; }) { const { androidToolbarIcons = {}, hooks, pageSize, entryPageSize, onEntryOpen, onUnauthenticated, primaryColor, primaryForeground, backgroundColor, surfaceColor, inputColor, textColor, mutedColor, borderColor, dangerColor, topInset, bottomInset, } = props; const { messages, theme } = useFeedbackUi(); const headerHeight = useStackHeaderHeight(); const headerTransparent = props.StackOptions?.headerTransparent ?? true; const resolvedBottomInset = useStackBottomInset( bottomInset, supportsRoadmapBottomToolbar, ); const [query, setQuery] = useState(""); const searchRef = useRef(null); return ( <> setQuery( (event as unknown as { nativeEvent: { text: string } }).nativeEvent .text, ) } obscureBackground={false} allowToolbarIntegration hideNavigationBar={false} textColor={theme.colors.text} /> {supportsRoadmapBottomToolbar && ( )} ); } function RoadmapToolbar({ androidToolbarIcons, messages, theme, }: { androidToolbarIcons: RoadmapAndroidToolbarIcons; messages: ReturnType; theme: ReturnType; }) { const router = useRouter(); return ( ); }