Skip to content

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

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

[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
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. 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.

1 participant