import * as React from "react"; import { useEffect, useRef, useState, memo } from "react"; import { BottomOptionsContainer, IconOptionContainer } from "./styled"; import Icon from "react-native-vector-icons/MaterialIcons"; import { Animated, Easing } from "react-native"; const share = ; const info = ; const exit = ; const minimize = ; const maximize = ; export type BottomOptionsProps = { show: boolean; onShare: () => void; onInfo: () => void; onExit: () => void; onMinimize: () => void; isMinimized: boolean; }; function BottomOptions({ onExit, onInfo, onMinimize, onShare, show, isMinimized, }: BottomOptionsProps) { const heightAnimation = useRef(new Animated.Value(0)).current; const [activeAnimation, setActiveAnimation] = useState(false); useEffect(() => { setActiveAnimation(true); Animated.parallel([ Animated.timing(heightAnimation, { useNativeDriver: false, toValue: show ? 50 : 0, duration: 200, easing: Easing.bezier(0.16, 1, 0.3, 1), }), ]).start(() => { if (!show) setActiveAnimation(false); }); }, [show]); if (!show && !activeAnimation) return null; return ( {share} {info} {exit} {isMinimized ? maximize : minimize} ); } export default memo(BottomOptions);