a22685c345
* Mark import sort/order/style rules as error * npm run lint -- --fix
32 lines
683 B
TypeScript
32 lines
683 B
TypeScript
import React from 'react'
|
|
import {StyleProp, ViewStyle} from 'react-native'
|
|
import Animated, {
|
|
FadeIn,
|
|
FadeOut,
|
|
SlideInLeft,
|
|
SlideInRight,
|
|
} from 'react-native-reanimated'
|
|
|
|
import {isWeb} from '#/platform/detection'
|
|
|
|
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={isWeb ? FadeIn.duration(90) : entering}
|
|
exiting={FadeOut.duration(90)} // Totally vibes based
|
|
style={style}>
|
|
{children}
|
|
</Animated.View>
|
|
)
|
|
}
|