import React from 'react'; import { View, Modal, TouchableOpacity, Text, StyleSheet, Platform } from 'react-native'; import { useTheme } from '../ThemeProvider'; export interface ContextMenuItem { label: string; icon: string; onPress: () => void; destructive?: boolean; } interface ContextMenuProps { visible: boolean; onClose: () => void; items: ContextMenuItem[]; position?: { x: number; y: number }; } export const ContextMenu: React.FC = ({ visible, onClose, items, position }) => { const { theme } = useTheme(); if (!visible) return null; return ( {items.map((item, index) => ( { item.onPress(); onClose(); }} > {item.label} ))} ); }; const styles = StyleSheet.create({ overlay: { flex: 1, backgroundColor: 'rgba(0, 0, 0, 0.5)', }, menuContainer: { position: 'absolute', minWidth: 150, borderRadius: 8, ...Platform.select({ web: { boxShadow: '0px 2px 8px rgba(0, 0, 0, 0.15)', }, default: { elevation: 4, shadowColor: '#000', shadowOffset: { width: 0, height: 2 }, shadowOpacity: 0.25, shadowRadius: 4, }, }), }, menuItem: { paddingVertical: 12, paddingHorizontal: 16, }, menuItemBorder: { borderBottomWidth: 1, }, menuItemText: { fontSize: 16, }, });