Skip to content

Codegen: Generate fields to notify native if a JS event is being listened to#15721

Merged
acoates-ms merged 5 commits intomainfrom
eventProps
Mar 4, 2026
Merged

Codegen: Generate fields to notify native if a JS event is being listened to#15721
acoates-ms merged 5 commits intomainfrom
eventProps

Conversation

@acoates-ms
Copy link
Contributor

@acoates-ms acoates-ms commented Mar 3, 2026

Description

Currently native has no way to know if JS is listening for a specific event. This means that native must fire events even if the payload is expensive to generate.

With this change, components will now record which events are being listened for from JS, so that native can conditionality fire events.

Microsoft Reviewers: Open in CodeFlow

@acoates-ms acoates-ms requested a review from a team as a code owner March 3, 2026 23:38
@acoates-ms acoates-ms merged commit 3568fff into main Mar 4, 2026
31 checks passed
@acoates-ms acoates-ms deleted the eventProps branch March 4, 2026 03:14
acoates-ms added a commit to acoates-ms/react-native-windows that referenced this pull request Mar 4, 2026
…ened to (microsoft#15721)

* Generate fields to notify native if a JS event is being listened to

* Change files

* format

* lint fix
acoates-ms added a commit that referenced this pull request Mar 4, 2026
* Overflow implementation in Fabric as per Parity to Paper (#15338)

* Implement overflow property support for Fabric architecture

* Change files

* Subject: ETW Provider Registration - Route to Existing 1DS Aria Tenant

Hi OSG Instrumentation Team,

I'm working on React Native Windows telemetry. We currently have:

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EXISTING (working):
- JavaScript CLI telemetry via 1DS SDK
- Instrumentation Key: 49ff6d3ef12f4578a7b75a2573d9dba8-026332b2-2d50-452f-ad0d-50f921c97a9d-7145
- Data flows to: Aria → Kusto
- Kusto cluster: [YOU NEED TO TELL ME THIS]

NEW (want to add):
- Native C++ telemetry via ETW/TraceLogging
- Provider Name: Microsoft.ReactNativeWindows.Telemetry
- Provider GUID: [WILL GENERATE]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

QUESTION:
Can you register the new ETW provider GUID and route it to the SAME
Aria tenant as our existing 1DS instrumentation key?

Goal: Have both JavaScript (1DS) and C++ (ETW) telemetry appear in
the same Kusto database for unified querying.

Is this possible? If yes, what info do you need from me?

Thanks,
Harini Malothu
React Native Windows Team

* Remove overflowTest.tsx - will attach separately in PR

* Address review comment: make variables const

* Ensure visual is created before accessing m_contentVisual

* Fix formatting issues

* Fix E2E crash: use try_as instead of as for IVisualInterop

* Implement overflow:hidden with lazy m_contentVisual creation

- Only create m_contentVisual when overflow:hidden is set (performance optimization)
- Reparent children when m_contentVisual is created/removed
- Use try_as instead of as for IVisualInterop to prevent crashes
- Properly handle border radii for clipping

* Fix crash: use try_as for IVisualInterop

* Implement overflow clipping with m_contentVisual and try_as fix

* Fix crash: use try_as in ComponentView::updateClippingPath

* Implement lazy m_contentVisual creation for memory efficiency

* Fix crash: skip m_contentVisual creation for custom builder visuals

* Add null check for m_visual in applyShadowProps to prevent crash

* Fix build: Use Visual() instead of m_visual in ComponentView::applyShadowProps

* Fix E2E crash: Remove assert in Visual() that crashes before initialization

* Fix E2E: Make m_contentVisual truly lazy - only create for overflow:hidden

- Remove ensureContentVisual() calls from VisualToMountChildrenInto() and MountChildComponentView()
- m_contentVisual is now only created in updateLayoutMetrics when getClipsContentToBounds() is true
- Add null check in onThemeChanged() before accessing Visual()
- Restore original ensureVisual() call in MountChildComponentView()

* feat: Implement overflow:hidden for Fabric using on-demand children container

Implement proper overflow:hidden clipping for the Fabric Composition renderer,
matching iOS/Android behavior. Instead of clipping m_visual directly (which
also clips borders and background), a dedicated m_childrenContainer visual is
created on-demand as a child of m_visual, and only children are clipped.

Visual Tree (with overflow:hidden):
  m_outerVisual
    m_visual (background, opacity, transform, border-radius clip)
      Border Visuals x N
      m_childrenContainer (created on demand, clipped to bounds)
        <children>

Key design decisions:
- m_childrenContainer is created lazily only when overflow:hidden is set
- Existing children are moved from m_visual into m_childrenContainer
- Once created, m_childrenContainer is never destroyed (clip is just removed
  if overflow changes back to visible)
- Clipping uses outer border radii via D2D path geometry, matching iOS
- ScrollView overrides updateChildrenClippingPath as no-op since it manages
  its own visual tree via m_scrollVisual and inherently clips content

Also cleans up:
- Removed unnecessary null-checks on Visual() (ensureVisual guarantees it)
- Removed shadow mask workaround code (not related to overflow)
- Removed InsetClip-based overflow handling from updateProps
- Added assert(m_visual) in Visual() accessor
- Simplified updateClippingPath to only handle border-radius clipping

* Move shadow to OuterVisual, use RelativeSizeWithOffset for children container

* lint,format fixes

* update e2e snapshots for overflow changes

* Revert "update e2e snapshots for overflow changes"

This reverts commit 5e07f75.

* update e2e snapshots for overflow changes

---------

Co-authored-by: Nitin Chaudhary <nitchaudhary@microsoft.com>
Co-authored-by: Abhijeet Jha <74712637+iamAbhi-916@users.noreply.github.com>

* Fix ContentIsland.LocalToParentTransformMatrix within ScrollView

* Fix TextInput selection prop (#15672)

* Fix TextInput selection crash and feedback loop

* Change files

* add comment for the drawblock defer added

* Implement ReactNativeWindow (#15719)

* Implement ReactNativeWindow

* format

* Change files

* Codegen: Generate fields to notify native if a JS event is being listened to (#15721)

* Generate fields to notify native if a JS event is being listened to

* Change files

* format

* lint fix

* fix

---------

Co-authored-by: Nitin Chaudhary <31587527+Nitin-100@users.noreply.github.com>
Co-authored-by: Nitin Chaudhary <nitchaudhary@microsoft.com>
Co-authored-by: Abhijeet Jha <74712637+iamAbhi-916@users.noreply.github.com>
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.

2 participants