import React, {FC, useCallback, memo, useRef, useEffect} from 'react'; import {Props} from './types'; import {Container} from '../styles'; import {Button, Image, Video, Overlay} from './styles'; import DefaultVideo from 'react-native-video'; const LayoutItem: FC = ({ id, flex = 1, color = 'transparent', spacing = 0, borderRadius = 0, style, index, parentType, overlay, photo, video, visible, reverseX, reverseY, children, childrenProps, onPress, }) => { const videoRef = useRef(null); useEffect(() => { if (visible) { videoRef.current?.seek(0); } }, [visible]); const handlePress = useCallback(() => { const v = typeof video === 'object' ? video?.uri : undefined; onPress({itemId: id, photo: photo?.uri, video: v, childrenProps}); }, [onPress, id, photo, video]); return ( ); }; export default memo(LayoutItem);