Files
react-native/scripts
Kamil Paradowski 55195ca43f Layout event emitter (#57722)
Summary:
> Stack 2/3 — parent: `feat/shadowTreeDidCommit`. Review that first.

`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`

Pull Request resolved: https://github.com/react/react-native/pull/57722

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.

Reviewed By: christophpurrer

Differential Revision: D114045065

Pulled By: javache

fbshipit-source-id: 5b887537ad3e947f3a352fb9dd10b7d124f669df
2026-07-30 11:44:31 -07:00
..
2026-07-30 11:44:31 -07:00