fix: apply x and y props to nested Svg#2961
Open
vivekjm wants to merge 1 commit into
Open
Conversation
3d555c6 to
70b0335
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1283.
Nested
<Svg>elements acceptedxandyprops, 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
Svgcomponent path used by native platforms. I also made surexandyare 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.tsxThe 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 anotherSvg. The inner SVG should render offset by those values, and existing transforms should still be preserved.Compatibility
Checklist
README.md__tests__folder