Skip to content

[ResizeObserver 2/3] Layout event emitter - #57722

Closed
paradowstack wants to merge 4 commits into
react:mainfrom
paradowstack:feat/LayoutEventEmitter
Closed

[ResizeObserver 2/3] Layout event emitter#57722
paradowstack wants to merge 4 commits into
react:mainfrom
paradowstack:feat/LayoutEventEmitter

Conversation

@paradowstack

Copy link
Copy Markdown
Contributor

Stack 2/3 — parent: feat/shadowTreeDidCommit. Review that first.

Summary:

onLayout events are emitted inline from ShadowTree::emitLayoutEvents, which forces ShadowTree to depend on ViewProps and BaseViewEventEmitter.

This moves that logic into a standalone LayoutEventEmitter that consumes the shadowTreeDidCommit hook (added in the parent PR) and is registered as a commit hook by Scheduler. Same filter (nodes with an onLayout prop), same timing (during commit), same BaseViewEventEmitter::onLayout call — behavior is unchanged.

After this, ShadowTree no longer references view props or event emitters, and the per-commit layout-change signal is shared with ResizeObserver instead of being duplicated.

Changelog:

[INTERNAL] [CHANGED] - Emit onLayout from a LayoutEventEmitter commit hook instead of inline in ShadowTree

Test Plan:

Behavior-preserving refactor. Existing onLayout tests pass and ShadowTree no longer includes ViewShadowNode/ViewProps. Verified in rn-tester that onLayout still fires on mount and on size changes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 28, 2026
@paradowstack
paradowstack force-pushed the feat/LayoutEventEmitter branch from 91b6fcb to a2ea9b2 Compare July 28, 2026 15:58
@paradowstack
paradowstack marked this pull request as ready for review July 28, 2026 16:00
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Jul 28, 2026
@rubennorte

Copy link
Copy Markdown
Member

Nice! 😄

@meta-codesync

meta-codesync Bot commented Jul 29, 2026

Copy link
Copy Markdown

@rubennorte has imported this pull request. If you are a Meta employee, you can view this in D114045065.

@meta-codesync meta-codesync Bot closed this in 55195ca Jul 30, 2026
@meta-codesync meta-codesync Bot added the Merged This PR has been merged. label Jul 30, 2026
@meta-codesync

meta-codesync Bot commented Jul 30, 2026

Copy link
Copy Markdown

@javache merged this pull request in 55195ca.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. p: Callstack Partner: Callstack Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants