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 <tukon479@gmail.com>
This commit is contained in:
@@ -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 (
|
||||
<View className="flex-1 items-center" style={{ marginTop: height }}>
|
||||
{children}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
@@ -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<PresetFeedConfig[]>(presetFeeds.slice(0, 7))
|
||||
@@ -20,7 +21,7 @@ export const StepInterests = () => {
|
||||
setDisplayFeeds(shuffled)
|
||||
}, [])
|
||||
return (
|
||||
<View className="mt-[10vh] flex-1 items-center">
|
||||
<OnboardingSectionScreenContainer>
|
||||
<View className="mb-10 flex items-center gap-4">
|
||||
<Search3CuteReIcon height={80} width={80} color={accentColor} />
|
||||
<Text className="text-text mt-2 text-2xl font-bold">Discover Interests</Text>
|
||||
@@ -47,7 +48,7 @@ export const StepInterests = () => {
|
||||
))}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</OnboardingSectionScreenContainer>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -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 (
|
||||
<View className="mt-[10vh] flex-1 p-4">
|
||||
<OnboardingSectionScreenContainer>
|
||||
<View className="mb-10 flex items-center gap-4">
|
||||
<ListCheck2CuteReIcon height={80} width={80} color={accentColor} />
|
||||
<Text className="text-text mt-2 text-center text-xl font-bold">
|
||||
@@ -35,7 +37,7 @@ export const StepPreferences = () => {
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
<View className="mb-6 gap-4">
|
||||
<ScrollView className="mb-6 w-full flex-1" contentContainerClassName="gap-4">
|
||||
<PreferenceCard
|
||||
title="Edit Profile"
|
||||
icon={
|
||||
@@ -97,8 +99,8 @@ export const StepPreferences = () => {
|
||||
</Text>
|
||||
</View>
|
||||
</PreferenceCard>
|
||||
</View>
|
||||
</View>
|
||||
</ScrollView>
|
||||
</OnboardingSectionScreenContainer>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -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 (
|
||||
<SheetScreen onClose={() => navigation.dismiss()}>
|
||||
<View className="bg-system-grouped-background flex-1 px-6">
|
||||
<SafeAreaView className="flex-1">
|
||||
<ProgressIndicator
|
||||
currentStep={currentStep}
|
||||
totalSteps={totalSteps}
|
||||
setCurrentStep={setCurrentStep}
|
||||
/>
|
||||
<View className="bg-system-grouped-background flex-1 px-6">
|
||||
<SafeAreaView className="flex-1">
|
||||
<ProgressIndicator
|
||||
currentStep={currentStep}
|
||||
totalSteps={totalSteps}
|
||||
setCurrentStep={setCurrentStep}
|
||||
/>
|
||||
|
||||
<Animated.View
|
||||
className={"flex-1"}
|
||||
key={`step-${currentStep}`}
|
||||
exiting={FadeOutLeft}
|
||||
entering={FadeInRight}
|
||||
>
|
||||
{/* Content */}
|
||||
{currentStep === 1 && <StepWelcome />}
|
||||
{currentStep === 2 && <StepPreferences />}
|
||||
{currentStep === 3 && <StepInterests />}
|
||||
{currentStep === 4 && <StepFinished />}
|
||||
</Animated.View>
|
||||
|
||||
{/* Navigation buttons */}
|
||||
<View className="mb-6 px-6">
|
||||
<TouchableOpacity
|
||||
onPress={handleNext}
|
||||
className="bg-accent w-full items-center rounded-xl py-4"
|
||||
>
|
||||
<Text className="text-lg font-bold text-white">
|
||||
{currentStep < totalSteps - 1
|
||||
? "Next"
|
||||
: currentStep === totalSteps - 1
|
||||
? "Finish Setup"
|
||||
: "Let's Go!"}
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
</SafeAreaView>
|
||||
</View>
|
||||
</SheetScreen>
|
||||
{/* Navigation buttons */}
|
||||
<View className="mb-6 px-6">
|
||||
<TouchableOpacity
|
||||
onPress={handleNext}
|
||||
className="bg-accent w-full items-center rounded-xl py-4"
|
||||
>
|
||||
<Text className="text-lg font-bold text-white">
|
||||
{currentStep < totalSteps - 1
|
||||
? "Next"
|
||||
: currentStep === totalSteps - 1
|
||||
? "Finish Setup"
|
||||
: "Let's Go!"}
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
</SafeAreaView>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
OnboardingScreen.transparent = true
|
||||
function ProgressIndicator({
|
||||
currentStep,
|
||||
totalSteps,
|
||||
|
||||
@@ -20,7 +20,7 @@ export function registerSitemap() {
|
||||
)
|
||||
;[OnboardingScreen].forEach((Component) => {
|
||||
NavigationSitemapRegistry.registerByComponent(Component, void 0, {
|
||||
stackPresentation: "transparentModal",
|
||||
stackPresentation: "fullScreenModal",
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
@@ -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])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user