Skip to content

Conversation

kacperzolkiewski
Copy link
Collaborator

@kacperzolkiewski kacperzolkiewski commented Aug 11, 2025

Summary

This PR creates SvgOnLayoutEvent and replaces usage of OnLayoutEvent for Android because React Native Android team will remove this event from their codebase in near future.

Test Plan

Verified that the onLayout event emitted by Svg produces the same payload before and after this change.
Steps:

  1. Added console.log inside Svg’s onLayout handler.
  2. Logged event payload before the change.
  3. Applied change to use SvgOnLayoutEvent.
  4. Logged event payload after the change.

Result:
Event payload structure and values remained identical

Compatibility

OS Implemented
Android
iOS
MacOS

Checklist

  • I have tested this on a simulator

@kacperzolkiewski kacperzolkiewski marked this pull request as ready for review August 11, 2025 11:30
@jakex7 jakex7 self-requested a review August 11, 2025 11:50
@kacperzolkiewski kacperzolkiewski changed the title feat: replace OnLayoutEvent with SvgOnLayoutEvent Draft: feat: replace OnLayoutEvent with SvgOnLayoutEvent Aug 12, 2025
@kacperzolkiewski kacperzolkiewski changed the title Draft: feat: replace OnLayoutEvent with SvgOnLayoutEvent feat: replace OnLayoutEvent with SvgOnLayoutEvent Aug 12, 2025
@cortinico
Copy link

We'd love to see it merged as OnLayoutEvent is legacy arch and we're going to remove it soon-ish:

Copy link
Member

@piaskowyk piaskowyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rest of PR looks ok!

Comment on lines +308 to +311
x: Int32;
y: Int32;
width: Int32;
height: Int32;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure it should be Int instead of Float?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also when we look at the creation of SVGOnLayoutEvent inside VirtualView we pass to this event Ints:
https://github.com/software-mansion/react-native-svg/pull/2738/files#diff-b99e5fc93019444c57df66f6135a6ff9c28d881abe126fc0adb12773b24a7193R608

@kacperzolkiewski kacperzolkiewski force-pushed the removeOnLayoutEvent branch 2 times, most recently from 1996b31 to 62b9d78 Compare September 8, 2025 12:05
Copy link
Member

@jakex7 jakex7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@WoLewicki WoLewicki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Please make sure that it works on both archs and platforms and I think we are good with merging it.

@WoLewicki WoLewicki merged commit e6d5627 into software-mansion:main Sep 8, 2025
9 of 12 checks passed
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.

5 participants