Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: do not parse id as number in any case #2563

Merged
merged 1 commit into from
Dec 5, 2024
Merged

Conversation

jakex7
Copy link
Member

@jakex7 jakex7 commented Dec 5, 2024

Summary

When using SvgXml or SvgCss, an id attribute gets converted into a number instead of a string, which causes a crash because the native side expects a string value.

import {SvgXml} from 'react-native-svg';
import {SvgCss} from 'react-native-svg/css';

Test Plan

This example should not crash:

import {SvgCss} from 'react-native-svg/css';

const svgXml = `
<svg width="100" height="100" viewBox="0 0 100 100">
  <filter x="0%" y="0%" width="100" height="100" id="0123456789">
    <feFlood flood-color="red" />
  </filter>
  <circle cx="50" cy="50" r="50" filter="url(#0123456789)" />
</svg>
`;

function Example() {
  return <SvgCss xml={svgXml} />;
}

@jakex7 jakex7 merged commit 4886135 into main Dec 5, 2024
1 of 3 checks passed
@jakex7 jakex7 deleted the @jakex7/fixParsingId branch December 5, 2024 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant