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