fix(wizard): scrollview

This commit is contained in:
devthejo 2025-09-22 14:40:33 +02:00
parent becb61967c
commit 36ad5aaf04
No known key found for this signature in database
GPG key ID: 00CCA7A92B1D5351
6 changed files with 46 additions and 14 deletions

View file

@ -23,6 +23,10 @@ import AppLifecycleListener from "~/containers/AppLifecycleListener";
import { useUpdates } from "~/updates"; import { useUpdates } from "~/updates";
import Error from "~/components/Error"; import Error from "~/components/Error";
import {
SafeAreaProvider,
initialWindowMetrics,
} from "react-native-safe-area-context";
import useTrackLocation from "~/hooks/useTrackLocation"; import useTrackLocation from "~/hooks/useTrackLocation";
// import { initializeBackgroundFetch } from "~/services/backgroundFetch"; // import { initializeBackgroundFetch } from "~/services/backgroundFetch";
@ -298,13 +302,15 @@ function AppContent() {
export default function App() { export default function App() {
return ( return (
<ErrorBoundary <SafeAreaProvider initialMetrics={initialWindowMetrics}>
onError={errorHandler} <ErrorBoundary
FallbackComponent={Error} onError={errorHandler}
// Add a buffer time before allowing reset to prevent immediate re-crashes FallbackComponent={Error}
minTimeBetweenResets={1000} // Add a buffer time before allowing reset to prevent immediate re-crashes
> minTimeBetweenResets={1000}
<AppContent /> >
</ErrorBoundary> <AppContent />
</ErrorBoundary>
</SafeAreaProvider>
); );
} }

View file

@ -8,6 +8,7 @@ import {
AppState, AppState,
} from "react-native"; } from "react-native";
import { Title } from "react-native-paper"; import { Title } from "react-native-paper";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { Ionicons, Entypo } from "@expo/vector-icons"; import { Ionicons, Entypo } from "@expo/vector-icons";
import { import {
permissionsActions, permissionsActions,
@ -55,6 +56,7 @@ const HeroMode = () => {
"batteryOptimizationDisabled", "batteryOptimizationDisabled",
]); ]);
const theme = useTheme(); const theme = useTheme();
const insets = useSafeAreaInsets();
const [skipMessage] = useState(() => { const [skipMessage] = useState(() => {
const randomIndex = Math.floor(Math.random() * skipMessages.length); const randomIndex = Math.floor(Math.random() * skipMessages.length);
@ -498,7 +500,12 @@ const HeroMode = () => {
<View <View
style={[styles.container, { backgroundColor: theme.colors.background }]} style={[styles.container, { backgroundColor: theme.colors.background }]}
> >
<ScrollView style={styles.scrollView}> <ScrollView
style={styles.scrollView}
contentContainerStyle={{ paddingBottom: insets.bottom + 32 }}
keyboardShouldPersistTaps="handled"
showsVerticalScrollIndicator={false}
>
<View style={styles.content}> <View style={styles.content}>
<View style={styles.heroHeader}> <View style={styles.heroHeader}>
<Image <Image

View file

@ -1,6 +1,7 @@
import React from "react"; import React from "react";
import { View, StyleSheet, Image, ScrollView } from "react-native"; import { View, StyleSheet, Image, ScrollView } from "react-native";
import { Title } from "react-native-paper"; import { Title } from "react-native-paper";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { useTheme } from "~/theme"; import { useTheme } from "~/theme";
import { permissionWizardActions } from "~/stores"; import { permissionWizardActions } from "~/stores";
import CustomButton from "~/components/CustomButton"; import CustomButton from "~/components/CustomButton";
@ -8,6 +9,7 @@ import Text from "~/components/Text";
const SkipInfo = () => { const SkipInfo = () => {
const theme = useTheme(); const theme = useTheme();
const insets = useSafeAreaInsets();
const handleFinish = () => { const handleFinish = () => {
permissionWizardActions.setCompleted(true); permissionWizardActions.setCompleted(true);
@ -17,7 +19,12 @@ const SkipInfo = () => {
<View <View
style={[styles.container, { backgroundColor: theme.colors.background }]} style={[styles.container, { backgroundColor: theme.colors.background }]}
> >
<ScrollView style={styles.scrollView}> <ScrollView
style={styles.scrollView}
contentContainerStyle={{ paddingBottom: insets.bottom + 32 }}
keyboardShouldPersistTaps="handled"
showsVerticalScrollIndicator={false}
>
<View style={styles.content}> <View style={styles.content}>
<View style={styles.header}> <View style={styles.header}>
<View style={styles.imageContainer}> <View style={styles.imageContainer}>

View file

@ -1,6 +1,7 @@
import React, { useCallback } from "react"; import React, { useCallback } from "react";
import { View, StyleSheet, Image, ScrollView } from "react-native"; import { View, StyleSheet, Image, ScrollView } from "react-native";
import { Button, Title } from "react-native-paper"; import { Button, Title } from "react-native-paper";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { Ionicons } from "@expo/vector-icons"; import { Ionicons } from "@expo/vector-icons";
import { permissionWizardActions } from "~/stores"; import { permissionWizardActions } from "~/stores";
import { useTheme } from "~/theme"; import { useTheme } from "~/theme";
@ -9,6 +10,7 @@ import CustomButton from "~/components/CustomButton";
const Success = () => { const Success = () => {
const theme = useTheme(); const theme = useTheme();
const insets = useSafeAreaInsets();
const handleFinish = useCallback(() => { const handleFinish = useCallback(() => {
permissionWizardActions.setCompleted(true); permissionWizardActions.setCompleted(true);
@ -18,7 +20,12 @@ const Success = () => {
<View <View
style={[styles.container, { backgroundColor: theme.colors.background }]} style={[styles.container, { backgroundColor: theme.colors.background }]}
> >
<ScrollView style={styles.scrollView}> <ScrollView
style={styles.scrollView}
contentContainerStyle={{ paddingBottom: insets.bottom + 32 }}
keyboardShouldPersistTaps="handled"
showsVerticalScrollIndicator={false}
>
<View style={styles.content}> <View style={styles.content}>
<Image <Image
source={require("~/assets/img/wizard-success.png")} source={require("~/assets/img/wizard-success.png")}

View file

@ -1,6 +1,7 @@
import React, { useState, useCallback, useEffect } from "react"; import React, { useState, useCallback, useEffect } from "react";
import { View, StyleSheet, Image, ScrollView } from "react-native"; import { View, StyleSheet, Image, ScrollView } from "react-native";
import { Title } from "react-native-paper"; import { Title } from "react-native-paper";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { Ionicons } from "@expo/vector-icons"; import { Ionicons } from "@expo/vector-icons";
import { import {
permissionsActions, permissionsActions,
@ -26,6 +27,7 @@ const Welcome = () => {
"locationForeground", "locationForeground",
]); ]);
const theme = useTheme(); const theme = useTheme();
const insets = useSafeAreaInsets();
const handleNext = useCallback(() => { const handleNext = useCallback(() => {
permissionWizardActions.setCurrentStep("hero"); permissionWizardActions.setCurrentStep("hero");
@ -148,7 +150,12 @@ const Welcome = () => {
<View <View
style={[styles.container, { backgroundColor: theme.colors.background }]} style={[styles.container, { backgroundColor: theme.colors.background }]}
> >
<ScrollView style={styles.scrollView}> <ScrollView
style={styles.scrollView}
contentContainerStyle={{ paddingBottom: insets.bottom + 32 }}
keyboardShouldPersistTaps="handled"
showsVerticalScrollIndicator={false}
>
<View style={styles.content}> <View style={styles.content}>
<Image <Image
source={require("~/assets/img/logo.png")} source={require("~/assets/img/logo.png")}

View file

@ -1,7 +1,6 @@
import React, { useRef, useState, useMemo } from "react"; import React, { useRef, useState, useMemo } from "react";
import { StatusBar } from "react-native"; import { StatusBar } from "react-native";
import { SafeAreaProvider } from "react-native-safe-area-context";
import { useColorScheme } from "~/theme"; import { useColorScheme } from "~/theme";
import { Provider as PaperProvider } from "react-native-paper"; import { Provider as PaperProvider } from "react-native-paper";
import { NavigationContainer } from "@react-navigation/native"; import { NavigationContainer } from "@react-navigation/native";
@ -58,7 +57,6 @@ export default function LayoutProviders({ layoutKey, setLayoutKey, children }) {
/> />
<ComposeComponents <ComposeComponents
components={[ components={[
SafeAreaProvider,
[PaperProvider, { theme: dark ? PaperDarkTheme : PaperLightTheme }], [PaperProvider, { theme: dark ? PaperDarkTheme : PaperLightTheme }],
[RootNavCtx.Provider, { value: navigationRef }], [RootNavCtx.Provider, { value: navigationRef }],
[DrawerStateCtx.Provider, { value: drawerStateCtxVal }], [DrawerStateCtx.Provider, { value: drawerStateCtxVal }],