diff --git a/apps/mobile/src/components/layouts/header/NavigationHeader.tsx b/apps/mobile/src/components/layouts/header/NavigationHeader.tsx index b18ab6fcf..fa783267b 100644 --- a/apps/mobile/src/components/layouts/header/NavigationHeader.tsx +++ b/apps/mobile/src/components/layouts/header/NavigationHeader.tsx @@ -1,6 +1,6 @@ import { cn } from "@follow/utils" -import { getDefaultHeaderHeight, HeaderTitle } from "@react-navigation/elements" -import { router, useNavigation } from "expo-router" +import { HeaderTitle } from "@react-navigation/elements" +import { router, Stack, useNavigation } from "expo-router" import type { FC, PropsWithChildren, ReactNode } from "react" import { createElement, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react" import type { LayoutChangeEvent } from "react-native" @@ -14,12 +14,14 @@ import Animated, { } from "react-native-reanimated" import type { DefaultStyle } from "react-native-reanimated/lib/typescript/hook/commonTypes" import { useSafeAreaFrame, useSafeAreaInsets } from "react-native-safe-area-context" +import type { NativeStackNavigationOptions } from "react-native-screens/lib/typescript/native-stack/types" import type { ViewProps } from "react-native-svg/lib/typescript/fabric/utils" import { useColor } from "react-native-uikit-colors" import { MingcuteLeftLineIcon } from "@/src/icons/mingcute_left_line" import { ThemedBlurView } from "../../common/ThemedBlurView" +import { getDefaultHeaderHeight } from "../utils" import { NavigationContext } from "../views/NavigationContext" import { SetNavigationHeaderHeightContext } from "../views/NavigationHeaderContext" @@ -137,9 +139,10 @@ export const InternalNavigationHeader = ({ const insets = useSafeAreaInsets() const frame = useSafeAreaFrame() const defaultHeight = useMemo( - () => getDefaultHeaderHeight(frame, modal, insets.top), + () => getDefaultHeaderHeight(frame, modal, modal ? 0 : insets.top), [frame, insets.top, modal], ) + const border = useColor("opaqueSeparator") const opacityAnimated = useSharedValue(0) const { scrollY } = useContext(NavigationContext)! @@ -172,11 +175,8 @@ export const InternalNavigationHeader = ({ ) const rootTitleBarStyle = useAnimatedStyle(() => { const styles = { - paddingTop: insets.top, - - minHeight: defaultHeight, + paddingTop: modal ? 0 : insets.top, position: "relative", - overflow: "hidden", } satisfies DefaultStyle if (hideableBottom) { @@ -316,3 +316,24 @@ export const UINavigationHeaderActionButton = ({ ) } const Noop = () => null + +/** + * NativeNavigationHeader wrapped react navigation native-stack is universal in modal and stack, but there are significant limitations in UI customization. + */ +export interface NativeNavigationHeaderProps + extends Pick {} +export const NativeNavigationHeader: FC = (props) => { + const navigation = useNavigation() + return ( + , + headerTransparent: true, + headerBlurEffect: "systemChromeMaterial", + ...props, + }} + /> + ) +} diff --git a/apps/mobile/src/components/layouts/utils/index.tsx b/apps/mobile/src/components/layouts/utils/index.tsx index c52d867b8..9ca411d58 100644 --- a/apps/mobile/src/components/layouts/utils/index.tsx +++ b/apps/mobile/src/components/layouts/utils/index.tsx @@ -18,7 +18,7 @@ export function getDefaultHeaderHeight( const isLandscape = layout.width > layout.height - if (Platform.OS === "ios" && (Platform.isPad || Platform.isTV)) { + if (Platform.OS === "ios" && Platform.isPad) { if (modalPresentation) { headerHeight = 56 } else { diff --git a/apps/mobile/src/components/layouts/views/SafeNavigationScrollView.tsx b/apps/mobile/src/components/layouts/views/SafeNavigationScrollView.tsx index 35f1a20bf..ce4a03f4d 100644 --- a/apps/mobile/src/components/layouts/views/SafeNavigationScrollView.tsx +++ b/apps/mobile/src/components/layouts/views/SafeNavigationScrollView.tsx @@ -137,6 +137,7 @@ export const NavigationBlurEffectHeader = ({ router.push("/sign-up")}> - Don't have an account? Sign Up + Don't have an account? router.push("/forget-password")}> Forgot password? diff --git a/apps/mobile/src/screens/(headless)/_layout.tsx b/apps/mobile/src/screens/(headless)/_layout.tsx index ed7a8a6b7..12c91e7d2 100644 --- a/apps/mobile/src/screens/(headless)/_layout.tsx +++ b/apps/mobile/src/screens/(headless)/_layout.tsx @@ -1,16 +1,10 @@ import { Stack } from "expo-router" -import { useColorScheme } from "react-native" - -import { getSystemBackgroundColor } from "@/src/theme/utils" export default function HeadlessLayout() { - useColorScheme() - const systemBackgroundColor = getSystemBackgroundColor() - return ( diff --git a/apps/mobile/src/screens/(headless)/terms.tsx b/apps/mobile/src/screens/(headless)/terms.tsx index 1581f1db7..6480cc206 100644 --- a/apps/mobile/src/screens/(headless)/terms.tsx +++ b/apps/mobile/src/screens/(headless)/terms.tsx @@ -1,11 +1,6 @@ -import { useMemo } from "react" -import { useAnimatedValue } from "react-native" +import { ScrollView } from "react-native" -import { NavigationContext } from "@/src/components/layouts/views/NavigationContext" -import { - NavigationBlurEffectHeader, - SafeNavigationScrollView, -} from "@/src/components/layouts/views/SafeNavigationScrollView" +import { NativeNavigationHeader } from "@/src/components/layouts/header/NavigationHeader" import { Markdown } from "@/src/components/ui/typography/Markdown" const txt = `# Terms of Service @@ -96,15 +91,11 @@ export const TermsMarkdown = () => { } export default function Teams() { - const scrollY = useAnimatedValue(100) - return ( - ({ scrollY }), [scrollY])}> - - + + - - - + + ) } diff --git a/apps/mobile/src/screens/(modal)/_layout.tsx b/apps/mobile/src/screens/(modal)/_layout.tsx index fc5e1f851..15ea5ced0 100644 --- a/apps/mobile/src/screens/(modal)/_layout.tsx +++ b/apps/mobile/src/screens/(modal)/_layout.tsx @@ -9,30 +9,35 @@ export default function ModalLayout() { name="add" options={{ title: "Add Subscription", + presentation: "modal", }} /> @@ -42,6 +47,7 @@ export default function ModalLayout() { headerShown: true, title: "", headerTransparent: true, + presentation: "modal", headerLeft: ModalHeaderCloseButton, }} /> @@ -51,6 +57,7 @@ export default function ModalLayout() { headerShown: true, title: "", headerTransparent: true, + presentation: "modal", headerLeft: ModalHeaderCloseButton, }} /> @@ -61,6 +68,7 @@ export default function ModalLayout() { title: "", headerTransparent: true, headerLeft: ModalHeaderCloseButton, + presentation: "modal", }} /> diff --git a/apps/mobile/src/screens/_layout.tsx b/apps/mobile/src/screens/_layout.tsx index 0229323ac..0e1360aa9 100644 --- a/apps/mobile/src/screens/_layout.tsx +++ b/apps/mobile/src/screens/_layout.tsx @@ -36,6 +36,7 @@ export default function RootLayout() { + {__DEV__ && }