import { useMemo } from 'react'; import { useWindowDimensions, View } from 'react-native'; import Svg, { Circle, Path, G } from 'react-native-svg'; import { useColors } from '../../lib/theme'; const TILE = 80; const OPACITY = 0.07; type Symbol = 'star' | 'heart' | 'check' | 'dot' | 'cloud' | 'wave' | 'diamond'; const SEQUENCE: Symbol[] = [ 'star', 'dot', 'heart', 'wave', 'check', 'dot', 'cloud', 'diamond', 'dot', 'star', 'check', 'heart', 'dot', 'wave', ]; function SymbolShape({ type, color }: { type: Symbol; color: string }) { switch (type) { case 'star': return ( ); case 'heart': return ( ); case 'check': return ( ); case 'dot': return ; case 'cloud': return ( ); case 'wave': return ( ); case 'diamond': return ( ); } } export function DmChatBackground() { const { width, height } = useWindowDimensions(); const colors = useColors(); const patternColor = colors.text; const cols = Math.ceil(width / TILE) + 1; const rows = Math.ceil(height / TILE) + 1; const symbols = useMemo(() => { const items: { x: number; y: number; type: Symbol; rotate: number }[] = []; let seq = 0; for (let r = 0; r < rows; r++) { for (let c = 0; c < cols; c++) { const offsetX = r % 2 === 0 ? 0 : TILE / 2; items.push({ x: c * TILE + offsetX + TILE / 2, y: r * TILE + TILE / 2, type: SEQUENCE[seq % SEQUENCE.length], rotate: [0, 15, -10, 30, -20, 5, -15][seq % 7], }); seq++; } } return items; }, [cols, rows]); return ( {symbols.map((s, i) => ( ))} ); }