Bluesky app fork with some witchin' additions 馃挮
1import {type StyleProp, type ViewStyle} from 'react-native'
2import Animated, {
3 Easing,
4 FadeIn,
5 FadeOut,
6 SlideInLeft,
7 SlideInRight,
8} from 'react-native-reanimated'
9
10import {IS_WEB} from '#/env'
11
12export function ScreenTransition({
13 direction,
14 style,
15 children,
16 enabledWeb,
17}: {
18 direction: 'Backward' | 'Forward'
19 style?: StyleProp<ViewStyle>
20 children: React.ReactNode
21 enabledWeb?: boolean
22}) {
23 const entering =
24 direction === 'Forward'
25 ? SlideInRight.easing(Easing.out(Easing.exp))
26 : SlideInLeft.easing(Easing.out(Easing.exp))
27 const webEntering = enabledWeb ? FadeIn.duration(90) : undefined
28 const exiting = FadeOut.duration(90) // Totally vibes based
29 const webExiting = enabledWeb ? FadeOut.duration(90) : undefined
30
31 return (
32 <Animated.View
33 entering={IS_WEB ? webEntering : entering}
34 exiting={IS_WEB ? webExiting : exiting}
35 style={style}>
36 {children}
37 </Animated.View>
38 )
39}