diff --git a/apps/mobile/src/components/common/ModalSharedComponents.tsx b/apps/mobile/src/components/common/ModalSharedComponents.tsx
index 04d7bfe4b..e095bf043 100644
--- a/apps/mobile/src/components/common/ModalSharedComponents.tsx
+++ b/apps/mobile/src/components/common/ModalSharedComponents.tsx
@@ -1,9 +1,10 @@
import { withOpacity } from "@follow/utils"
-import { router } from "expo-router"
+import { router, useNavigation } from "expo-router"
import { TouchableOpacity } from "react-native"
import { CheckLineIcon } from "@/src/icons/check_line"
import { CloseCuteReIcon } from "@/src/icons/close_cute_re"
+import { MingcuteLeftLineIcon } from "@/src/icons/mingcute_left_line"
import { useColor } from "@/src/theme/colors"
import { RotateableLoading } from "./RotateableLoading"
@@ -14,9 +15,20 @@ export const ModalHeaderCloseButton = () => {
const ModalHeaderCloseButtonImpl = () => {
const label = useColor("label")
+
+ const navigation = useNavigation()
+
+ const state = navigation.getState()
+
+ const routeOnlyOne = state.routes.length === 1
+
return (
router.dismiss()}>
-
+ {routeOnlyOne ? (
+
+ ) : (
+
+ )}
)
}
diff --git a/apps/mobile/src/icons/mingcute_left_line.tsx b/apps/mobile/src/icons/mingcute_left_line.tsx
new file mode 100644
index 000000000..841a3b1a2
--- /dev/null
+++ b/apps/mobile/src/icons/mingcute_left_line.tsx
@@ -0,0 +1,26 @@
+import * as React from "react"
+import Svg, { G, Path } from "react-native-svg"
+
+interface MingcuteLeftLineIconProps {
+ width?: number
+ height?: number
+ color?: string
+}
+
+export const MingcuteLeftLineIcon = ({
+ width = 24,
+ height = 24,
+ color = "#10161F",
+}: MingcuteLeftLineIconProps) => {
+ return (
+
+ )
+}
diff --git a/apps/mobile/src/screens/(modal)/follow.tsx b/apps/mobile/src/screens/(modal)/follow.tsx
index 2ebe599f6..653bc96aa 100644
--- a/apps/mobile/src/screens/(modal)/follow.tsx
+++ b/apps/mobile/src/screens/(modal)/follow.tsx
@@ -1,23 +1,24 @@
import { FeedViewType } from "@follow/constants"
-import { withOpacity } from "@follow/utils"
import { zodResolver } from "@hookform/resolvers/zod"
import { router, Stack, useLocalSearchParams } from "expo-router"
+import { useState } from "react"
import { Controller, useForm } from "react-hook-form"
-import { ScrollView, Text, TouchableOpacity, View } from "react-native"
+import { ScrollView, Text, View } from "react-native"
import { z } from "zod"
-import { ModalHeaderCloseButton } from "@/src/components/common/ModalSharedComponents"
+import {
+ ModalHeaderCloseButton,
+ ModalHeaderShubmitButton,
+} from "@/src/components/common/ModalSharedComponents"
import { FormProvider } from "@/src/components/ui/form/FormProvider"
import { FormLabel } from "@/src/components/ui/form/Label"
import { FormSwitch } from "@/src/components/ui/form/Switch"
import { TextField } from "@/src/components/ui/form/TextField"
import { FeedIcon } from "@/src/components/ui/icon/feed-icon"
-import { CheckLineIcon } from "@/src/icons/check_line"
import { FeedViewSelector } from "@/src/modules/feed/view-selector"
import { useFeed } from "@/src/store/feed/hooks"
import { subscriptionSyncService } from "@/src/store/subscription/store"
import type { SubscriptionForm } from "@/src/store/subscription/types"
-import { useColor } from "@/src/theme/colors"
const formSchema = z.object({
view: z.string(),
@@ -39,7 +40,9 @@ export default function Follow() {
defaultValues,
})
+ const [isLoading, setIsLoading] = useState(false)
const submit = async () => {
+ setIsLoading(true)
const values = form.getValues()
const body: SubscriptionForm = {
url: feed.url,
@@ -50,15 +53,16 @@ export default function Follow() {
feedId: feed.id,
}
- await subscriptionSyncService.subscribe(body)
+ await subscriptionSyncService.subscribe(body).finally(() => {
+ setIsLoading(false)
+ })
if (router.canDismiss()) {
- router.dismiss()
+ router.dismissAll()
}
}
const { isValid, isDirty } = form.formState
- const label = useColor("label")
return (
@@ -68,9 +72,11 @@ export default function Follow() {
headerLeft: ModalHeaderCloseButton,
gestureEnabled: !isDirty,
headerRight: () => (
-
-
-
+
),
}}
/>