import React, { useEffect, useRef, useState } from "react"; import { Dimensions, Image, KeyboardAvoidingView, Modal, Platform, Pressable, Text, TextInput, View, } from "react-native"; import { useTheme } from "../../contexts/ThemeContext"; interface ImageCaptionModalProps { visible: boolean; imageUri: string; onSend: (caption: string) => void; onCancel: () => void; } export function ImageCaptionModal({ visible, imageUri, onSend, onCancel }: ImageCaptionModalProps) { const { colors } = useTheme(); const [caption, setCaption] = useState(""); const inputRef = useRef(null); const { width, height } = Dimensions.get("window"); useEffect(() => { if (visible) { setCaption(""); setTimeout(() => inputRef.current?.focus(), 300); } }, [visible]); const handleSend = () => { onSend(caption.trim()); setCaption(""); }; return ( {/* Top bar with cancel */} Cancel {/* Image preview */} {/* Caption input + send */} {"\u2191"} ); }