From 956d9dfd1e2e662caf45b52aab661865d16438d7 Mon Sep 17 00:00:00 2001 From: Innei Date: Mon, 24 Feb 2025 20:47:38 +0800 Subject: [PATCH] feat(mobile): add titles and improve navigation screen configurations Signed-off-by: Innei --- .../src/modules/entry-content/EntryTitle.tsx | 2 + apps/mobile/src/modules/login/index.tsx | 1 + .../screen/TimelineSelectorProvider.tsx | 10 +- .../modules/settings/routes/ManageList.tsx | 1 + .../src/modules/settings/routes/index.tsx | 5 +- apps/mobile/src/screens/(headless)/2fa.tsx | 1 + .../src/screens/(stack)/(tabs)/_layout.tsx | 157 +++++++++--------- apps/mobile/src/screens/_layout.tsx | 9 +- .../html-renderer/src/components/image.tsx | 2 +- 9 files changed, 102 insertions(+), 86 deletions(-) diff --git a/apps/mobile/src/modules/entry-content/EntryTitle.tsx b/apps/mobile/src/modules/entry-content/EntryTitle.tsx index cca2082da..812a41357 100644 --- a/apps/mobile/src/modules/entry-content/EntryTitle.tsx +++ b/apps/mobile/src/modules/entry-content/EntryTitle.tsx @@ -46,6 +46,7 @@ export const EntryTitle = ({ title, entryId }: { title: string; entryId: string <> ( @@ -119,6 +120,7 @@ export const EntrySocialTitle = ({ entryId }: { entryId: string }) => { return ( <> ( diff --git a/apps/mobile/src/modules/login/index.tsx b/apps/mobile/src/modules/login/index.tsx index 35d246870..1990d92e2 100644 --- a/apps/mobile/src/modules/login/index.tsx +++ b/apps/mobile/src/modules/login/index.tsx @@ -27,6 +27,7 @@ export function Login() { const [isChecked, setIsChecked] = useState(false) const termsCheckBoxRef = useRef<{ shake: () => void }>(null) + return ( { - if (isTimeline) - return () => ( - - {view === FeedViewType.Pictures && } - - ) + const extraActions = <>{view === FeedViewType.Pictures && } + if (isTimeline) return () => {extraActions} if (isFeed) return () => ( - + {extraActions} ) diff --git a/apps/mobile/src/modules/settings/routes/ManageList.tsx b/apps/mobile/src/modules/settings/routes/ManageList.tsx index cc96dacca..8a4c4e698 100644 --- a/apps/mobile/src/modules/settings/routes/ManageList.tsx +++ b/apps/mobile/src/modules/settings/routes/ManageList.tsx @@ -35,6 +35,7 @@ import type { SettingsStackParamList } from "../types" const ManageListContext = createContext<{ nextSelectedFeedIdRef: MutableRefObject> }>(null!) + export const ManageListScreen = ({ route, }: { diff --git a/apps/mobile/src/modules/settings/routes/index.tsx b/apps/mobile/src/modules/settings/routes/index.tsx index c72798ee0..57fca3c19 100644 --- a/apps/mobile/src/modules/settings/routes/index.tsx +++ b/apps/mobile/src/modules/settings/routes/index.tsx @@ -1,4 +1,4 @@ -import type { createNativeStackNavigator } from "@react-navigation/native-stack" +import type { TypedNavigator } from "@react-navigation/native" import { AboutScreen } from "./About" import { AccountScreen } from "./Account" @@ -14,7 +14,7 @@ import { NotificationsScreen } from "./Notifications" import { PrivacyScreen } from "./Privacy" import { ProfileScreen } from "./Profile" -export const SettingRoutes = (Stack: ReturnType) => { +export const SettingRoutes = (Stack: TypedNavigator) => { return [ , , @@ -28,6 +28,7 @@ export const SettingRoutes = (Stack: ReturnType, , , + // @ts-expect-error , ] } diff --git a/apps/mobile/src/screens/(headless)/2fa.tsx b/apps/mobile/src/screens/(headless)/2fa.tsx index 8a17b6e94..7fd74c8a7 100644 --- a/apps/mobile/src/screens/(headless)/2fa.tsx +++ b/apps/mobile/src/screens/(headless)/2fa.tsx @@ -58,6 +58,7 @@ export default function TwoFactorAuthScreen() { { return ( router.back()}> diff --git a/apps/mobile/src/screens/(stack)/(tabs)/_layout.tsx b/apps/mobile/src/screens/(stack)/(tabs)/_layout.tsx index e4ab9e6e2..e393f35f6 100644 --- a/apps/mobile/src/screens/(stack)/(tabs)/_layout.tsx +++ b/apps/mobile/src/screens/(stack)/(tabs)/_layout.tsx @@ -1,4 +1,4 @@ -import { router, Tabs } from "expo-router" +import { router, Stack, Tabs } from "expo-router" import { Easing, Pressable, View } from "react-native" import { Gesture, GestureDetector } from "react-native-gesture-handler" import { runOnJS } from "react-native-reanimated" @@ -21,84 +21,93 @@ const fifthTap = Gesture.Tap() export default function TabLayout() { return ( - - + {/* Set navigation screen title */} + { - const Icon = !focused ? Home5CuteReIcon : Home5CuteFiIcon - return - }, - tabBarButton(props) { - return - }, + title: "Follow", }} /> - { - const Icon = !focused ? BlackBoard2CuteReIcon : BlackBoard2CuteFiIcon - return + + { + const Icon = !focused ? Home5CuteReIcon : Home5CuteFiIcon + return + }, + tabBarButton(props) { + return + }, + }} + /> + { + const Icon = !focused ? BlackBoard2CuteReIcon : BlackBoard2CuteFiIcon + return + }, + tabBarLabel: "Subscriptions", - tabBarButton(props) { - return - }, - }} - /> - { - const Icon = !focused ? Search3CuteReIcon : Search3CuteFiIcon - return - }, - tabBarButton(props) { - return - }, - }} - /> + tabBarButton(props) { + return + }, + }} + /> + { + const Icon = !focused ? Search3CuteReIcon : Search3CuteFiIcon + return + }, + tabBarButton(props) { + return + }, + }} + /> - - - - - - ) - }, - tabBarIcon: ({ color, focused }) => { - const Icon = !focused ? Settings1CuteReIcon : Settings1CuteFiIcon - return - }, - }} - /> - + + + + + + ) + }, + tabBarIcon: ({ color, focused }) => { + const Icon = !focused ? Settings1CuteReIcon : Settings1CuteFiIcon + return + }, + }} + /> + + ) } diff --git a/apps/mobile/src/screens/_layout.tsx b/apps/mobile/src/screens/_layout.tsx index a4c0e81fc..8ffaf06be 100644 --- a/apps/mobile/src/screens/_layout.tsx +++ b/apps/mobile/src/screens/_layout.tsx @@ -36,15 +36,20 @@ function AnimatedStack() { - - + + ) => { height: image?.height, max: { width: w, - height: window.innerHeight, + height: Infinity, }, }), [image?.width, image?.height, w],