Fix splash screen on iOS

This commit is contained in:
Tomek Zawadzki
2026-07-22 15:46:04 +02:00
committed by Oleksii Bulenok
parent 54948e3586
commit 2f4aa06f94
+19 -40
View File
@@ -72,21 +72,26 @@ export function Splash(props: React.PropsWithChildren<Props>) {
const isDarkMode = colorScheme === 'dark' const isDarkMode = colorScheme === 'dark'
const logoAnimation = useAnimatedStyle(() => { const logoAnimation = useAnimatedStyle(() => {
const introScale = interpolate(intro.get(), [0, 1], [0.8, 1], 'clamp')
const outroScale =
reduceMotion === true
? 1
: interpolate(outroLogo.get(), [0, 0.08, 1], [1, 0.8, 500], 'clamp')
const introOpacity = interpolate(intro.get(), [0, 1], [0, 1], 'clamp')
const outroOpacity = interpolate(
outroAppOpacity.get(),
[0, 0.1, 0.2, 1],
[1, 1, 0, 0],
'clamp',
)
return { return {
opacity: introOpacity * outroOpacity,
transform: [ transform: [
{ {translateY: -(insets.top / 2)},
scale: interpolate(intro.get(), [0, 1], [0.8, 1], 'clamp'), {scale: 0.1 * outroScale * introScale},
},
{
scale: interpolate(
outroLogo.get(),
[0, 0.08, 1],
[1, 0.8, 500],
'clamp',
),
},
], ],
opacity: interpolate(intro.get(), [0, 1], [0, 1], 'clamp'),
} }
}) })
const bottomLogoAnimation = useAnimatedStyle(() => { const bottomLogoAnimation = useAnimatedStyle(() => {
@@ -94,27 +99,6 @@ export function Splash(props: React.PropsWithChildren<Props>) {
opacity: interpolate(intro.get(), [0, 1], [0, 1], 'clamp'), opacity: interpolate(intro.get(), [0, 1], [0, 1], 'clamp'),
} }
}) })
const reducedLogoAnimation = useAnimatedStyle(() => {
return {
transform: [
{
scale: interpolate(intro.get(), [0, 1], [0.8, 1], 'clamp'),
},
],
opacity: interpolate(intro.get(), [0, 1], [0, 1], 'clamp'),
}
})
const logoWrapperAnimation = useAnimatedStyle(() => {
return {
opacity: interpolate(
outroAppOpacity.get(),
[0, 0.1, 0.2, 1],
[1, 1, 0, 0],
'clamp',
),
}
})
const appAnimation = useAnimatedStyle(() => { const appAnimation = useAnimatedStyle(() => {
return { return {
@@ -180,8 +164,6 @@ export function Splash(props: React.PropsWithChildren<Props>) {
AccessibilityInfo.isReduceMotionEnabled().then(setReduceMotion) AccessibilityInfo.isReduceMotionEnabled().then(setReduceMotion)
}, []) }, [])
const logoAnimations =
reduceMotion === true ? reducedLogoAnimation : logoAnimation
// special off-spec color for dark mode // special off-spec color for dark mode
const logoBg = isDarkMode ? '#0F1824' : '#fff' const logoBg = isDarkMode ? '#0F1824' : '#fff'
@@ -224,17 +206,14 @@ export function Splash(props: React.PropsWithChildren<Props>) {
<Animated.View <Animated.View
style={[ style={[
StyleSheet.absoluteFillObject, StyleSheet.absoluteFillObject,
logoWrapperAnimation, logoAnimation,
{ {
flex: 1, flex: 1,
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
transform: [{translateY: -(insets.top / 2)}, {scale: 0.1}], // scale from 1000px to 100px
}, },
]}> ]}>
<Animated.View style={[logoAnimations]}> <Logo fill={logoBg} />
<Logo fill={logoBg} />
</Animated.View>
</Animated.View> </Animated.View>
)} )}
</> </>