Skip to content

fix: apply x and y props to nested Svg#2961

Open
vivekjm wants to merge 1 commit into
software-mansion:mainfrom
vivekjm:fix-nested-svg-position
Open

fix: apply x and y props to nested Svg#2961
vivekjm wants to merge 1 commit into
software-mansion:mainfrom
vivekjm:fix-nested-svg-position

Conversation

@vivekjm

@vivekjm vivekjm commented May 12, 2026

Copy link
Copy Markdown

Summary

Fixes #1283.

Nested <Svg> elements accepted x and y props, but those values did not affect the native SVG view position. This makes them behave like a view translation before any existing transform, which matches the usual SVG behavior and keeps the current transform path intact.

This impacts the shared Svg component path used by native platforms. I also made sure x and y are not forwarded as stray native view props once they have been converted into the transform.

Test Plan

Commands run locally:

yarn install --frozen-lockfile
yarn test
yarn jest __tests__/svg.test.tsx --runInBand --globalSetup= --globalTeardown=
npx prettier --check src/elements/Svg.tsx __tests__/svg.test.tsx

The Jest command disables the repo-level E2E websocket setup for this focused unit test; otherwise the runner waits for an example-app client connection.

What's required for testing (prerequisites)?

Install dependencies with yarn install --frozen-lockfile.

What are the steps to reproduce (after prerequisites)?

Render a nested <Svg x={20} y={30}> inside another Svg. The inner SVG should render offset by those values, and existing transforms should still be preserved.

Compatibility

OS Implemented
iOS
MacOS
Android
Web

Checklist

  • I have tested this on a device and a simulator
  • I added documentation in README.md
  • I updated the typed files (typescript)
  • I added a test for the API in the __tests__ folder

@vivekjm vivekjm force-pushed the fix-nested-svg-position branch from 3d555c6 to 70b0335 Compare May 12, 2026 20:03
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.

SVG in SVG does not have x/y props applied

1 participant