mirror of
https://github.com/Boof2015/astra-mobile.git
synced 2026-08-20 20:49:47 +02:00
fix onboarding minor visual bug
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { useEffect, useState } from 'react';
|
import { useState } from 'react';
|
||||||
import {
|
import {
|
||||||
ActivityIndicator,
|
ActivityIndicator,
|
||||||
ScrollView,
|
ScrollView,
|
||||||
@@ -11,9 +11,8 @@ import Animated, {
|
|||||||
FadeIn,
|
FadeIn,
|
||||||
FadeInDown,
|
FadeInDown,
|
||||||
FadeOutUp,
|
FadeOutUp,
|
||||||
useAnimatedStyle,
|
LinearTransition,
|
||||||
useSharedValue,
|
ReduceMotion,
|
||||||
withTiming,
|
|
||||||
} from 'react-native-reanimated';
|
} from 'react-native-reanimated';
|
||||||
import { Canvas, LinearGradient, Rect, vec } from '@shopify/react-native-skia';
|
import { Canvas, LinearGradient, Rect, vec } from '@shopify/react-native-skia';
|
||||||
import { Ionicons } from '@expo/vector-icons';
|
import { Ionicons } from '@expo/vector-icons';
|
||||||
@@ -69,6 +68,10 @@ const WIZARD_THEME_OPTIONS: { id: BaseThemeId; title: string }[] = [
|
|||||||
{ id: 'materialYou', title: 'Material You' },
|
{ id: 'materialYou', title: 'Material You' },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const DOT_TRANSITION = LinearTransition.duration(motion.snap.duration).reduceMotion(
|
||||||
|
ReduceMotion.System
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* First-run wizard. Rendered by the root layout instead of the app tree while
|
* First-run wizard. Rendered by the root layout instead of the app tree while
|
||||||
* `onboarding_complete` is unset. Purely presentational — it drives the existing
|
* `onboarding_complete` is unset. Purely presentational — it drives the existing
|
||||||
@@ -421,15 +424,12 @@ function ScanBanner() {
|
|||||||
/** Page indicator dot — widens + brightens when active. Animated View, not an icon. */
|
/** Page indicator dot — widens + brightens when active. Animated View, not an icon. */
|
||||||
function Dot({ active }: { active: boolean }) {
|
function Dot({ active }: { active: boolean }) {
|
||||||
const styles = useStyles();
|
const styles = useStyles();
|
||||||
const progress = useSharedValue(active ? 1 : 0);
|
return (
|
||||||
useEffect(() => {
|
<Animated.View
|
||||||
progress.value = withTiming(active ? 1 : 0, motion.snap);
|
layout={DOT_TRANSITION}
|
||||||
}, [active, progress]);
|
style={[styles.dot, active ? styles.dotActive : styles.dotInactive]}
|
||||||
const animatedStyle = useAnimatedStyle(() => ({
|
/>
|
||||||
width: 8 + progress.value * 14,
|
);
|
||||||
opacity: 0.3 + progress.value * 0.7,
|
|
||||||
}));
|
|
||||||
return <Animated.View style={[styles.dot, animatedStyle]} />;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const useStyles = createThemedStyles((colors) => ({
|
const useStyles = createThemedStyles((colors) => ({
|
||||||
@@ -568,6 +568,14 @@ const useStyles = createThemedStyles((colors) => ({
|
|||||||
borderRadius: 4,
|
borderRadius: 4,
|
||||||
backgroundColor: colors.accent,
|
backgroundColor: colors.accent,
|
||||||
},
|
},
|
||||||
|
dotActive: {
|
||||||
|
width: 22,
|
||||||
|
opacity: 1,
|
||||||
|
},
|
||||||
|
dotInactive: {
|
||||||
|
width: 8,
|
||||||
|
opacity: 0.3,
|
||||||
|
},
|
||||||
navRow: {
|
navRow: {
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
|
|||||||
Reference in New Issue
Block a user