Merge branch 'hailey/rm-masked-view' into hailey/upgrade-clean

This commit is contained in:
Hailey
2024-12-01 16:20:33 -08:00
2 changed files with 22 additions and 64 deletions
-1
View File
@@ -80,7 +80,6 @@
"@radix-ui/react-focus-guards": "^1.1.1", "@radix-ui/react-focus-guards": "^1.1.1",
"@radix-ui/react-focus-scope": "^1.1.0", "@radix-ui/react-focus-scope": "^1.1.0",
"@react-native-async-storage/async-storage": "1.23.1", "@react-native-async-storage/async-storage": "1.23.1",
"@react-native-masked-view/masked-view": "0.3.0",
"@react-native-menu/menu": "^1.1.0", "@react-native-menu/menu": "^1.1.0",
"@react-native-picker/picker": "2.6.1", "@react-native-picker/picker": "2.6.1",
"@react-navigation/bottom-tabs": "^6.5.20", "@react-navigation/bottom-tabs": "^6.5.20",
+22 -63
View File
@@ -18,9 +18,7 @@ import {useSafeAreaInsets} from 'react-native-safe-area-context'
import Svg, {Path, SvgProps} from 'react-native-svg' import Svg, {Path, SvgProps} from 'react-native-svg'
import {Image} from 'expo-image' import {Image} from 'expo-image'
import * as SplashScreen from 'expo-splash-screen' import * as SplashScreen from 'expo-splash-screen'
import MaskedView from '@react-native-masked-view/masked-view'
import {isAndroid} from '#/platform/detection'
import {Logotype} from '#/view/icons/Logotype' import {Logotype} from '#/view/icons/Logotype'
// @ts-ignore // @ts-ignore
import splashImagePointer from '../assets/splash.png' import splashImagePointer from '../assets/splash.png'
@@ -53,8 +51,6 @@ type Props = {
isReady: boolean isReady: boolean
} }
const AnimatedLogo = Animated.createAnimatedComponent(Logo)
export function Splash(props: React.PropsWithChildren<Props>) { export function Splash(props: React.PropsWithChildren<Props>) {
'use no memo' 'use no memo'
const insets = useSafeAreaInsets() const insets = useSafeAreaInsets()
@@ -152,8 +148,6 @@ export function Splash(props: React.PropsWithChildren<Props>) {
{duration: 400, easing: Easing.out(Easing.cubic)}, {duration: 400, easing: Easing.out(Easing.cubic)},
async () => { async () => {
// set these values to check animation at specific point // set these values to check animation at specific point
// outroLogo.set(0.1)
// outroApp.set(0.1)
outroLogo.set(() => outroLogo.set(() =>
withTiming( withTiming(
1, 1,
@@ -221,66 +215,31 @@ export function Splash(props: React.PropsWithChildren<Props>) {
</View> </View>
)} )}
{isReady && {isReady && (
(isAndroid || reduceMotion === true ? ( <>
// Use a simple fade on older versions of android (work around a bug) <Animated.View style={[{flex: 1}, appAnimation]}>
<> {props.children}
<Animated.View style={[{flex: 1}, appAnimation]}> </Animated.View>
{props.children}
</Animated.View>
{!isAnimationComplete && ( {!isAnimationComplete && (
<Animated.View <Animated.View
style={[ style={[
StyleSheet.absoluteFillObject, StyleSheet.absoluteFillObject,
logoWrapperAnimation, logoWrapperAnimation,
{ {
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 transform: [{translateY: -(insets.top / 2)}, {scale: 0.1}], // scale from 1000px to 100px
}, },
]}> ]}>
<AnimatedLogo <Animated.View style={[logoAnimations]}>
fill={logoBg} <Logo fill={logoBg} />
style={[{opacity: 0}, logoAnimations]}
/>
</Animated.View> </Animated.View>
)}
</>
) : (
<MaskedView
style={[StyleSheet.absoluteFillObject]}
maskElement={
<Animated.View
style={[
{
// Transparent background because mask is based off alpha channel.
backgroundColor: 'transparent',
flex: 1,
justifyContent: 'center',
alignItems: 'center',
transform: [{translateY: -(insets.top / 2)}, {scale: 0.1}], // scale from 1000px to 100px
},
]}>
<AnimatedLogo fill={logoBg} style={[logoAnimations]} />
</Animated.View>
}>
{!isAnimationComplete && (
<View
style={[
StyleSheet.absoluteFillObject,
{
backgroundColor: logoBg,
},
]}
/>
)}
<Animated.View style={[{flex: 1}, appAnimation]}>
{props.children}
</Animated.View> </Animated.View>
</MaskedView> )}
))} </>
)}
</View> </View>
) )
} }