diff --git a/apps/mobile/src/components/layouts/header/NavigationHeader.tsx b/apps/mobile/src/components/layouts/header/NavigationHeader.tsx index 4cc2bcf47..4bbafbe63 100644 --- a/apps/mobile/src/components/layouts/header/NavigationHeader.tsx +++ b/apps/mobile/src/components/layouts/header/NavigationHeader.tsx @@ -3,13 +3,12 @@ import { router, 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" -import { StyleSheet, TouchableOpacity, useWindowDimensions, View } from "react-native" +import { StyleSheet, TouchableOpacity, View } from "react-native" import type { AnimatedProps } from "react-native-reanimated" import Animated, { useAnimatedRef, useAnimatedStyle, useSharedValue, - withSpring, withTiming, } from "react-native-reanimated" import type { DefaultStyle } from "react-native-reanimated/lib/typescript/hook/commonTypes" @@ -211,27 +210,6 @@ export const NavigationHeader = ({ }) }, [animatedRef, setHeaderHeight]) - const [headerLeftWidth, setHeaderLeftWidth] = useState(0) - - const titleBarWidth = useWindowDimensions().width - const [titleWidth, setTitleWidth] = useState(0) - - const titleShouldCenterTransformX = useMemo(() => { - if (!titleWidth) return 0 - const halfTitleWidth = titleWidth / 2 - const currentTitleCenterX = - titlebarPaddingHorizontal + headerLeftWidth + titleMarginHorizontal + halfTitleWidth - const centerX = titleBarWidth / 2 - - const transformX = centerX - currentTitleCenterX - return transformX - }, [titleBarWidth, titleWidth, headerLeftWidth]) - const titleTransformX = useSharedValue(0) - - useEffect(() => { - titleTransformX.value = withSpring(titleShouldCenterTransformX) - }, [titleShouldCenterTransformX, titleTransformX]) - return ( {/* Left */} { - setHeaderLeftWidth(e.nativeEvent.layout.width) - }, [])} > {/* Center */} { - setTitleWidth(e.nativeEvent.layout.width) - }} - className="flex-1 items-center justify-center" + className="items-center justify-center" pointerEvents={"box-none"} style={{ marginHorizontal: titleMarginHorizontal, - transform: [{ translateX: titleTransformX }], }} > {headerTitleAbsolute ? : headerTitle} {/* Right */} - + isTimeline || isSubscriptions - ? () => ( - - - - ) - : () => ( - - - - ), + ? () => + : () => , [isTimeline, isSubscriptions], )} headerRight={useMemo(() => { @@ -69,16 +60,7 @@ export function TimelineSelectorProvider({ children }: { children: React.ReactNo })() if (Component) - return () => ( - - {Component()} - - ) + return () => {Component()} return }, [isFeed, isTimeline, isSubscriptions, params])} headerHideableBottom={isTimeline || isSubscriptions ? TimelineViewSelector : undefined} diff --git a/apps/mobile/src/screens/(modal)/rsshub-form.tsx b/apps/mobile/src/screens/(modal)/rsshub-form.tsx index 08c7940ff..c9e0dcd8e 100644 --- a/apps/mobile/src/screens/(modal)/rsshub-form.tsx +++ b/apps/mobile/src/screens/(modal)/rsshub-form.tsx @@ -10,7 +10,7 @@ import { router, Stack, useLocalSearchParams } from "expo-router" import { memo, useEffect, useMemo, useState } from "react" import type { FieldErrors } from "react-hook-form" import { Controller, useForm } from "react-hook-form" -import { Linking, Text, TouchableOpacity, View } from "react-native" +import { KeyboardAvoidingView, Linking, Text, TouchableOpacity, View } from "react-native" import { z } from "zod" import { BlurEffectWithBottomBorder } from "@/src/components/common/BlurEffect" @@ -127,64 +127,68 @@ function FormImpl({ route, routePrefix, name }: RsshubFormParams) { - - {keys.map((keyItem) => { - const parameters = normalizeRSSHubParameters(route.parameters[keyItem.name]!) + {keys.length > 0 && ( + + {keys.map((keyItem) => { + const parameters = normalizeRSSHubParameters(route.parameters[keyItem.name]!) - return ( - - {!parameters?.options && ( - { - // return dynamicFormSchema.safeParse({ - // [keyItem.name]: value, - // }).success - // }, - }} - render={({ field: { onChange, onBlur, ref, value } }) => ( - - )} - /> - )} + return ( + + {!parameters?.options && ( + { + // return dynamicFormSchema.safeParse({ + // [keyItem.name]: value, + // }).success + // }, + }} + render={({ field: { onChange, onBlur, ref, value } }) => ( + + + + )} + /> + )} - {!!parameters?.options && ( - ( - + )} + /> + )} - {!!parameters && ( - - {parameters.description} - - )} - - ) - })} - + {!!parameters && ( + + {parameters.description} + + )} + + ) + })} + + )} {!!route.description && (