UNPKG

react-native-feedback-hub

Version:

React Native feedback SDK with Slack, Jira, Discord and Microsoft Teams integration

30 lines 2.36 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import React, { useEffect, useState } from 'react'; import { View, Image, TouchableOpacity } from 'react-native'; import { X, Image as ImageIcon, Video as VideoIcon } from 'lucide-react-native'; import { generateThumbnail } from '../utils/generateThumbnail'; import { AttachmentStyles as styles } from '../Styles/AttachmentStyle'; import { colors } from '../tokens/colors'; const AttachmentPreview = ({ screenshotUri, recordingUri, onRemoveScreenshot, onRemoveRecording, }) => { const [videoThumbnail, setVideoThumbnail] = useState(null); useEffect(() => { const fetchThumbnail = async () => { if (recordingUri) { const response = await generateThumbnail(recordingUri); if (response) { setVideoThumbnail(response); } } }; fetchThumbnail(); }, [recordingUri]); const handleRemoveRecording = () => { setVideoThumbnail(null); onRemoveRecording === null || onRemoveRecording === void 0 ? void 0 : onRemoveRecording(); }; if (!screenshotUri && !recordingUri) return null; return (_jsxs(View, Object.assign({ style: styles.previewContainer }, { children: [screenshotUri && (_jsxs(View, Object.assign({ style: styles.previewBox }, { children: [_jsx(View, Object.assign({ style: styles.previewTypeIcon }, { children: _jsx(ImageIcon, { size: 16, color: colors.text.white }) })), _jsx(Image, { source: { uri: screenshotUri }, style: styles.previewImage, resizeMode: "cover" }), _jsx(TouchableOpacity, Object.assign({ style: styles.removeIcon, onPress: onRemoveScreenshot }, { children: _jsx(X, { size: 16, color: colors.text.white }) }))] }))), videoThumbnail && (_jsxs(View, Object.assign({ style: styles.previewBox }, { children: [_jsx(View, Object.assign({ style: styles.previewTypeIcon }, { children: _jsx(VideoIcon, { size: 16, color: colors.text.white }) })), _jsx(Image, { source: { uri: videoThumbnail }, style: styles.previewImage, resizeMode: "cover" }), _jsx(TouchableOpacity, Object.assign({ style: styles.removeIcon, onPress: handleRemoveRecording }, { children: _jsx(X, { size: 16, color: colors.text.white }) }))] })))] }))); }; export default React.memo(AttachmentPreview); //# sourceMappingURL=AttachmentPreview.js.map