import * as Print from 'expo-print'; import * as Sharing from 'expo-sharing'; import { Platform } from 'react-native'; export async function sharePurchaseOfferPdf(params: { propertyTitle: string; address: string; maxBuyPriceEur: number; sellerName?: string; }): Promise { const html = `

Offre d'achat — ${escape(params.propertyTitle)}

${escape(params.address)}

Montant de l'offre : ${params.maxBuyPriceEur.toLocaleString('fr-FR')} €

(${params.sellerName ? `Destinataire : ${escape(params.sellerName)}` : 'À compléter'})

MDB-PREDATOR — modèle indicatif, valider avec votre notaire / juriste.

`; const { uri } = await Print.printToFileAsync({ html }); if (Platform.OS === 'web') return; if (await Sharing.isAvailableAsync()) { await Sharing.shareAsync(uri, { mimeType: 'application/pdf', dialogTitle: 'Offre d’achat' }); } } function escape(s: string): string { return s.replace(/&/g, '&').replace(/