From 14ae20fb5aa7bd1312cabd022a489a3a47736fe2 Mon Sep 17 00:00:00 2001 From: Innei Date: Sun, 30 Mar 2025 17:28:14 +0800 Subject: [PATCH] fix: wrapper scrollview to onboarding screens avoide small height mobile viewport - Changed stack presentation for the OnboardingScreen to "fullScreenModal". - Wrapped StepInterests and StepPreferences components in OnboardingSectionScreenContainer for consistent layout. - Replaced View with Animated.View in OnboardingScreen for improved animations during transitions. Signed-off-by: Innei --- apps/mobile/src/modules/onboarding/shared.tsx | 12 ++++ .../src/modules/onboarding/step-interests.tsx | 5 +- .../modules/onboarding/step-preferences.tsx | 10 ++-- apps/mobile/src/screens/onboarding.tsx | 60 ++++++++++--------- apps/mobile/src/sitemap.tsx | 2 +- apps/mobile/src/store/user/hooks.ts | 2 +- 6 files changed, 55 insertions(+), 36 deletions(-) create mode 100644 apps/mobile/src/modules/onboarding/shared.tsx diff --git a/apps/mobile/src/modules/onboarding/shared.tsx b/apps/mobile/src/modules/onboarding/shared.tsx new file mode 100644 index 000000000..90889d2e5 --- /dev/null +++ b/apps/mobile/src/modules/onboarding/shared.tsx @@ -0,0 +1,12 @@ +import { View } from "react-native" + +import { useScaleHeight } from "@/src/lib/responsive" + +export const OnboardingSectionScreenContainer = ({ children }: { children: React.ReactNode }) => { + const height = useScaleHeight()(50) + return ( + + {children} + + ) +} diff --git a/apps/mobile/src/modules/onboarding/step-interests.tsx b/apps/mobile/src/modules/onboarding/step-interests.tsx index d8470fab5..9e2d5cde5 100644 --- a/apps/mobile/src/modules/onboarding/step-interests.tsx +++ b/apps/mobile/src/modules/onboarding/step-interests.tsx @@ -11,6 +11,7 @@ import { accentColor } from "@/src/theme/colors" import type { PresetFeedConfig } from "./preset" import { presetFeeds } from "./preset" +import { OnboardingSectionScreenContainer } from "./shared" export const StepInterests = () => { const [displayFeeds, setDisplayFeeds] = useState(presetFeeds.slice(0, 7)) @@ -20,7 +21,7 @@ export const StepInterests = () => { setDisplayFeeds(shuffled) }, []) return ( - + Discover Interests @@ -47,7 +48,7 @@ export const StepInterests = () => { ))} - + ) } diff --git a/apps/mobile/src/modules/onboarding/step-preferences.tsx b/apps/mobile/src/modules/onboarding/step-preferences.tsx index aeb64074a..412e8ba03 100644 --- a/apps/mobile/src/modules/onboarding/step-preferences.tsx +++ b/apps/mobile/src/modules/onboarding/step-preferences.tsx @@ -1,5 +1,6 @@ import type { PropsWithChildren } from "react" import { ActivityIndicator, Pressable, Text, TouchableOpacity, View } from "react-native" +import { ScrollView } from "react-native-gesture-handler" import { useColor } from "react-native-uikit-colors" import { UserAvatar } from "@/src/components/ui/avatar/UserAvatar" @@ -17,13 +18,14 @@ import { accentColor } from "@/src/theme/colors" import { EditProfileScreen } from "../settings/routes/EditProfile" import { importOpml, setAvatar } from "../settings/utils" import { useReadingBehavior } from "./hooks/use-reading-behavior" +import { OnboardingSectionScreenContainer } from "./shared" export const StepPreferences = () => { const { behavior } = useReadingBehavior() const navigation = useNavigation() return ( - + @@ -35,7 +37,7 @@ export const StepPreferences = () => { - + { - - + + ) } diff --git a/apps/mobile/src/screens/onboarding.tsx b/apps/mobile/src/screens/onboarding.tsx index 6d4aa3c99..b04535683 100644 --- a/apps/mobile/src/screens/onboarding.tsx +++ b/apps/mobile/src/screens/onboarding.tsx @@ -1,7 +1,7 @@ import { tracker } from "@follow/tracker" import { useCallback, useEffect, useState } from "react" import { SafeAreaView, Text, TouchableOpacity, View } from "react-native" -import { SheetScreen } from "react-native-sheet-transitions" +import Animated, { FadeInRight, FadeOutLeft } from "react-native-reanimated" import { kv } from "../lib/kv" import { useNavigation } from "../lib/navigation/hooks" @@ -36,43 +36,47 @@ export const OnboardingScreen: NavigationControllerView = () => { }, []) return ( - navigation.dismiss()}> - - - + + + + {/* Content */} {currentStep === 1 && } {currentStep === 2 && } {currentStep === 3 && } {currentStep === 4 && } + - {/* Navigation buttons */} - - - - {currentStep < totalSteps - 1 - ? "Next" - : currentStep === totalSteps - 1 - ? "Finish Setup" - : "Let's Go!"} - - - - - - + {/* Navigation buttons */} + + + + {currentStep < totalSteps - 1 + ? "Next" + : currentStep === totalSteps - 1 + ? "Finish Setup" + : "Let's Go!"} + + + + + ) } -OnboardingScreen.transparent = true function ProgressIndicator({ currentStep, totalSteps, diff --git a/apps/mobile/src/sitemap.tsx b/apps/mobile/src/sitemap.tsx index 6d8e1ec9d..d5392072c 100644 --- a/apps/mobile/src/sitemap.tsx +++ b/apps/mobile/src/sitemap.tsx @@ -20,7 +20,7 @@ export function registerSitemap() { ) ;[OnboardingScreen].forEach((Component) => { NavigationSitemapRegistry.registerByComponent(Component, void 0, { - stackPresentation: "transparentModal", + stackPresentation: "fullScreenModal", }) }) } diff --git a/apps/mobile/src/store/user/hooks.ts b/apps/mobile/src/store/user/hooks.ts index d2a358fcf..8d72f2c59 100644 --- a/apps/mobile/src/store/user/hooks.ts +++ b/apps/mobile/src/store/user/hooks.ts @@ -62,7 +62,7 @@ export function useOnboarding() { const navigation = useNavigation() useEffect(() => { if (isNewUser) { - navigation.presentControllerView(OnboardingScreen, undefined, "transparentModal") + navigation.presentControllerView(OnboardingScreen, undefined, "fullScreenModal") } }, [isNewUser, navigation]) }