fix(mobile): decode XML entities for react-native-svg text rendering
This commit is contained in:
@@ -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 & < gibi entity'leri decode et
|
||||||
|
const clean = svgRaw
|
||||||
|
.replace(/<!--[\s\S]*?-->/g, "")
|
||||||
|
.replace(/&/g, "&")
|
||||||
|
.replace(/</g, "<")
|
||||||
|
.replace(/>/g, ">")
|
||||||
|
.replace(/'/g, "'")
|
||||||
|
.replace(/"/g, '"');
|
||||||
|
|
||||||
|
|
||||||
const startMarker = '<g id="qr-placeholder"';
|
const startMarker = '<g id="qr-placeholder"';
|
||||||
const startIdx = clean.indexOf(startMarker);
|
const startIdx = clean.indexOf(startMarker);
|
||||||
|
|||||||
Reference in New Issue
Block a user