import { useEffect, useRef } from 'react' import { Animated, StyleSheet, View } from 'react-native' import { useTheme } from 'react-native-paper' import { sharedStyles } from '../shared/styles' export default function AnimatedCrossView({ collapsed, calendar, calendarEdit, }: { calendar: any calendarEdit: any collapsed: boolean }) { const theme = useTheme() const calendarOpacity = useRef( new Animated.Value(collapsed ? 1 : 0) ) useEffect(() => { Animated.timing(calendarOpacity.current, { toValue: collapsed ? 1 : 0, duration: 250, useNativeDriver: true, }).start() }, [collapsed]) return ( {calendar} {calendarEdit} ) } const styles = StyleSheet.create({ calendarEdit: { position: 'absolute', left: 0, right: 0, }, })