Skip to content

fix(babel-plugin-transform-react-native-svg): support SVG filter elements - #1031

Open
exzos28 wants to merge 1 commit into
gregberge:mainfrom
exzos28:fix/react-native-svg-filter-elements
Open

fix(babel-plugin-transform-react-native-svg): support SVG filter elements#1031
exzos28 wants to merge 1 commit into
gregberge:mainfrom
exzos28:fix/react-native-svg-filter-elements

Conversation

@exzos28

@exzos28 exzos28 commented Aug 11, 2026

Copy link
Copy Markdown

Problem

react-native-svg has long supported the <Filter> and <Fe*> primitive
components (FeBlend, FeColorMatrix, FeComponentTransfer, FeComposite,
FeConvolveMatrix, FeDiffuseLighting, FeDisplacementMap, FeDistantLight,
FeDropShadow, FeFlood, FeFuncA, FeFuncB, FeFuncG, FeFuncR,
FeGaussianBlur, FeImage, FeMerge, FeMergeNode, FeMorphology,
FeOffset, FePointLight, FeSpecularLighting, FeSpotLight, FeTile,
FeTurbulence), but elementToComponent never included them. Any SVG that
uses a <filter> (drop shadows, inner shadows, blurs, etc.) silently loses
the filter when transformed with native: true — the elements just get
removed by replaceElement, with only a trailing comment noting they were
dropped.

Reported downstream in kristerkari/react-native-svg-transformer#434.

Fix

Add the missing SVG filter primitive tags to elementToComponent, mapping
each to its corresponding react-native-svg component (the same components
react-native-svg's own elements.js already exports).

Testing

Added a test case transforming a <filter> containing <feFlood> and
<feBlend>, asserting they're mapped to Filter/FeFlood/FeBlend and
imported from react-native-svg instead of being dropped.

Verified end-to-end against react-native-svg@15.15.5 — all of the added
element names are exported components in that version (checked
node_modules/react-native-svg/lib/commonjs/elements.js).

…ents

react-native-svg has long supported the <Filter> and <Fe*> primitive
components (FeBlend, FeColorMatrix, FeComponentTransfer, FeComposite,
FeConvolveMatrix, FeDiffuseLighting, FeDisplacementMap, FeDistantLight,
FeDropShadow, FeFlood, FeFuncA/B/G/R, FeGaussianBlur, FeImage, FeMerge,
FeMergeNode, FeMorphology, FeOffset, FePointLight, FeSpecularLighting,
FeSpotLight, FeTile, FeTurbulence), but elementToComponent never included
them, so every filter-based SVG (drop shadows, inner shadows, blurs, etc.)
silently lost its filter element when transformed for native.

Add the missing entries to elementToComponent so these elements are
mapped to their react-native-svg components instead of being dropped.
@vercel

vercel Bot commented Aug 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
svgr Error Error Aug 11, 2026 1:10pm

@vercel

vercel Bot commented Aug 11, 2026

Copy link
Copy Markdown

Deployment failed for project svgr with the following error:

The `vercel.json` schema validation failed with the following message: should NOT have additional property `public`

Learn More: https://vercel.com/docs/concepts/projects/project-configuration

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