diff --git a/apps/mobile/src/components/layouts/views/SafeModalScrollView.tsx b/apps/mobile/src/components/layouts/views/SafeModalScrollView.tsx
index 85a5692c1..f8013faa2 100644
--- a/apps/mobile/src/components/layouts/views/SafeModalScrollView.tsx
+++ b/apps/mobile/src/components/layouts/views/SafeModalScrollView.tsx
@@ -8,21 +8,21 @@
* ```
*/
import { useHeaderHeight } from "@react-navigation/elements"
-import type { KeyboardAwareScrollViewProps } from "react-native-keyboard-controller"
-import { KeyboardAwareScrollView } from "react-native-keyboard-controller"
+import type { ScrollViewProps } from "react-native"
+import { ScrollView } from "react-native"
import { useSafeAreaInsets } from "react-native-safe-area-context"
-interface SafeModalScrollViewProps extends KeyboardAwareScrollViewProps {}
+interface SafeModalScrollViewProps extends ScrollViewProps {}
export const SafeModalScrollView = (props: SafeModalScrollViewProps) => {
const headerHeight = useHeaderHeight()
const insets = useSafeAreaInsets()
return (
-
{props.children}
-
+
)
}
diff --git a/apps/mobile/src/screens/(modal)/rsshub-form.tsx b/apps/mobile/src/screens/(modal)/rsshub-form.tsx
index d69c167a9..7078a700e 100644
--- a/apps/mobile/src/screens/(modal)/rsshub-form.tsx
+++ b/apps/mobile/src/screens/(modal)/rsshub-form.tsx
@@ -8,6 +8,7 @@ import {
import { zodResolver } from "@hookform/resolvers/zod"
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 { z } from "zod"
@@ -111,6 +112,9 @@ function FormImpl({ route, routePrefix, name }: RsshubFormParams) {
mode: "all",
})
+ // eslint-disable-next-line unicorn/prefer-structured-clone
+ const nextErrors = JSON.parse(JSON.stringify(form.formState.errors))
+
return (
@@ -231,33 +236,40 @@ type ScreenOptionsProps = {
routeName: string
route: string
routePrefix: string
+ errors: FieldErrors
}
-const ScreenOptions = memo(({ name, routeName, route, routePrefix }: ScreenOptionsProps) => {
- const form = useFormContext()
+const ScreenOptions = memo(
+ ({ name, routeName, route, routePrefix, errors }: ScreenOptionsProps) => {
+ const form = useFormContext()
- return (
- (
-
-
-
- ),
+ headerRight: () => (
+
+
+
+ ),
- headerTitle: () => (
-
- ),
- }}
- />
- )
-})
+ headerTitle: () => (
+
+ ),
+ }}
+ />
+ )
+ },
+)
-const Title = ({ name, routeName, route, routePrefix }: ScreenOptionsProps) => {
+const Title = ({ name, routeName, route, routePrefix }: Omit) => {
return (
{`${name} - ${routeName}`}
@@ -270,12 +282,14 @@ const routeParamsKeyPrefix = "route-params-"
const ModalHeaderSubmitButtonImpl = ({
routePrefix,
route,
+ errors,
}: {
routePrefix: string
route: string
+ errors: FieldErrors
}) => {
const form = useFormContext()
- const { isValid } = form.formState
+ const isValid = Object.keys(errors).length === 0
const [isLoading, setIsLoading] = useState(false)