better screen transitions

This commit is contained in:
Hailey
2024-06-12 00:44:27 -07:00
parent fada1ad32c
commit 276255dcf3
5 changed files with 47 additions and 8 deletions
@@ -0,0 +1,28 @@
import React from 'react'
import {StyleProp, ViewStyle} from 'react-native'
import Animated, {
FadeOut,
SlideInLeft,
SlideInRight,
} from 'react-native-reanimated'
export function ScreenTransition({
direction,
style,
children,
}: {
direction: 'Backward' | 'Forward'
style?: StyleProp<ViewStyle>
children: React.ReactNode
}) {
const entering = direction === 'Forward' ? SlideInRight : SlideInLeft
return (
<Animated.View
entering={entering}
exiting={FadeOut.duration(90)} // Totally vibes based
style={style}>
{children}
</Animated.View>
)
}