fix(mobile): decode XML entities for react-native-svg text rendering

This commit is contained in:
AyrisAI
2026-08-21 00:07:43 +03:00
parent 3629f98855
commit ccd8c90267
+9 -1
View File
@@ -48,7 +48,15 @@ export default function QrScreen() {
// Yorum satırlarını temizle + iç içe <g> taglarını doğru saymak için depth tracking kullan // Yorum satırlarını temizle + iç içe <g> taglarını doğru saymak için depth tracking kullan
function buildSvgWithQr(svgRaw: string, pngBase64: string): string { function buildSvgWithQr(svgRaw: string, pngBase64: string): string {
// react-native-svg XML parser <!-- yorum satırlarını --> desteklemez // react-native-svg XML parser <!-- yorum satırlarını --> desteklemez
const clean = svgRaw.replace(/<!--[\s\S]*?-->/g, ""); // Ayrıca text node'lardaki &amp; &lt; gibi entity'leri decode et
const clean = svgRaw
.replace(/<!--[\s\S]*?-->/g, "")
.replace(/&amp;/g, "&")
.replace(/&lt;/g, "<")
.replace(/&gt;/g, ">")
.replace(/&apos;/g, "'")
.replace(/&quot;/g, '"');
const startMarker = '<g id="qr-placeholder"'; const startMarker = '<g id="qr-placeholder"';
const startIdx = clean.indexOf(startMarker); const startIdx = clean.indexOf(startMarker);