import { useEffect, useState } from 'react' import { View, Text, ActivityIndicator, TouchableOpacity, Share, StyleSheet, } from 'react-native' import { SafeAreaView } from 'react-native-safe-area-context' import { useLocalSearchParams, useRouter } from 'expo-router' import { ArrowLeft, Share2 } from 'lucide-react-native' import { WebView } from 'react-native-webview' import { apiFetch } from '@/lib/api' import { ENDPOINTS } from '@/lib/config' import { C } from '@/lib/theme' interface Note { id: string title: string content: string updatedAt: string notebookName?: string } // Le markdown est parsé côté WebView (JS natif) — évite tout problème Metro bundler function buildHtml(content: string, title: string) { // On passe le contenu comme JSON pour éviter les problèmes d'échappement const safeContent = JSON.stringify(content) const safeTitle = JSON.stringify(title || 'Sans titre') return `
` } export default function NoteScreen() { const { id } = useLocalSearchParams<{ id: string }>() const [note, setNote] = useState