Commit Graph

38287 Commits

Author SHA1 Message Date
Ruslan Lesiutin a2a73739d8 fix: use ThreadId when event is captured, not when transformed (#53411)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53411

# Changelog: [Internal]

This regressed after D80263154, when we introduced a local struct for PerforamanceTracerEvent.

We should use id of the thread where event was captured (registered), not where the transform to TraceEvent happened.

This makes sure that events like Event Loop tick or Microtasks phase tick are correctly point to JavaScript thread, not the thread where the transform could've taken place.

Reviewed By: sbuggay

Differential Revision: D80728931

fbshipit-source-id: d3af16e68adece9ebc37368fec2b8a17c1293b4b
2025-08-21 14:18:27 -07:00
Nicola Corti 046ff8e58b Make OnBatchCompleteListener interface internal (#53409)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53409

This interface is public and is part of Legacy Architecture.

Having this interface as `public` was a mistake, as users can't really do much with it.
There is only one old library that is going to be affected by this change:
https://github.com/spoke-ph/react-native-threads
The library appears unmaintained since RN 0.69 + no NewArch support so I won't consider this a breaking change
given this will land in 0.82.

I'm making it internal so we can remove it more easily later.

Changelog:
[Android] [Changed] - Make OnBatchCompleteListener interface internal

Differential Revision: D80715625

fbshipit-source-id: 94fe80eeba95222deab7ca89c5fcafca8fcee0b7
2025-08-21 14:05:47 -07:00
Nicola Corti fb114da8a4 Remove unused internal UIManagerModuleListener (#53404)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53404

This interface is part of Legacy Architecture. No one is using it either internally or externally,
so it's safe to remove now. Interface was also `internal` so this is not a breaking change.

Changelog:
[Internal] [Changed] -

Reviewed By: mdvacca

Differential Revision: D80714721

fbshipit-source-id: 82cc6152af7d7980119d2eda704ae50d8e81fd2b
2025-08-21 12:25:38 -07:00
Umar Mohammad 191ddc1ec7 Fix React Native Commands Export Validation in Coverage Mode (#53381)
Summary:
Changelog: [GENERAL] [FIXED] - Fixed babel plugin validation error when coverage instrumentation is enabled

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

### Problem

[Workplace post](https://fb.workplace.com/groups/235694244595999/permalink/1278937163605030/)

React Native tests were failing **only when coverage collection was enabled** with the error:

`'Commands' is a reserved export and may only be used to export the result of codegenNativeCommands.`

### Root Cause

The React Native Babel plugin's `codegenNativeCommands` validation logic only handled direct `CallExpression` AST nodes. When coverage instrumentation was enabled, it transformed:

**Normal code:**

`export const Commands = codegenNativeCommands<NativeCommands>({...})`

**With coverage:**

`export const Commands = (cov_xxx().s[0]++, codegenNativeCommands<NativeCommands>({...}))`

The plugin failed to recognize the valid `codegenNativeCommands` call wrapped in a `SequenceExpression` by coverage instrumentation.

### **Solution**

Added `isCodegenNativeCommandsDeclaration` function to handle:

1.  **Coverage instrumentation**: `SequenceExpression` nodes containing the function call
2.  **Flow type casts**: `TypeCastExpression` and `AsExpression`
3.  **TypeScript assertions**: `TSAsExpression`
4.  **Direct calls**: Original `CallExpression` (backward compatibility)

Reviewed By: andrewdacenko

Differential Revision: D80572666

fbshipit-source-id: 465f4312a0229d8a92e495c685f46b607ce326e4
2025-08-21 11:33:52 -07:00
Nicola Corti aaa7ba4ab3 HelloWorld should not use ReactNativeHost (#53399)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53399

We currently create application template that are still using `ReactNativeHost`.
As this is a legacy arch class, we should remove it from the template ASAP so that
users can organically migrate away from it.

I will also update https://github.com/react-native-community/template with
the same changes I'm applying here.

Changelog:
[Internal] [Changed] -

Reviewed By: mdvacca

Differential Revision: D80708461

fbshipit-source-id: e0d4a1f817e6fdddd93405decf77fd115956ec51
2025-08-21 11:16:20 -07:00
Nicola Corti 2689d4d372 RNTester should not use ReactNativeHost (#53398)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53398

ReactNativeHost is a legacy architecture class.
This migrates the app away from it and converts it to use DefaultReactHost instead.

Changelog:
[Internal] [Changed] -

Reviewed By: mdvacca

Differential Revision: D80708460

fbshipit-source-id: 7d88c440414c979a2968fc9c910e828f5851195c
2025-08-21 11:16:20 -07:00
Nicola Corti d35ddb5e59 Delete unused DefaultReactHost.getDefaultReactHost() overload (#53396)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53396

This overload for `getDefaultReactHost` is missing the last 2 parameters
and provides the same default as the full method.

In OSS is unused as we used the one with `ReactNativeHost`.
I'm removing it as it's causing an overload resolution failure internally.

This won't be a breaking change for Kotlin users are the signatures are compatibles,
but it will be breaking for Java users. I've verified that there are no OSS users.

Developers should use Kotlin default parameters + the method `getDefaultReactHost()`
with all the params + defaults for ease of use of this API.

Changelog:
[Android] [Removed] - Delete unused `DefaultReactHost.getDefaultReactHost()` overload

Reviewed By: mdvacca

Differential Revision: D80704987

fbshipit-source-id: 0b3a61aad3f18cde77bac78e3ba413d7f9166ede
2025-08-21 11:16:20 -07:00
Nicola Corti 8e514a8a10 Annotate ReactNativeJNISoLoader as InteropLegacyArchitecture (#53406)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53406

The `ReactNativeJNISoLoader` class (previously called BridgeSoLoader)
is actually a Legacy Architecture class.
However is used by `CxxModuleWrapperBase` which is needed by interop, so we need to keep it around.
I'm adding the annotation so we won't forget about it.

Changelog:
[Internal] [Changed] -

Reviewed By: cipolleschi

Differential Revision: D80710951

fbshipit-source-id: ed353e2b14c742b25962f0b81beba6dc90157709
2025-08-21 10:52:56 -07:00
Nicola Corti e28784d4b6 Remove unnecessary NativeArgumentsParseException (#53408)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53408

This class is internal + legacy arch so can safely be removed now.
I've replaced the throw/catch site with the superclass of this exception.

Changelog:
[Internal] [Changed] -

Reviewed By: mdvacca

Differential Revision: D80710950

fbshipit-source-id: 96615835588ce409de40d31ee83b82c88d3a07a0
2025-08-21 10:52:56 -07:00
Riccardo Cipolleschi 28275a0f7b Fix Crash when rendering Switch component (#53393)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53393

When implementing the changes for the Switch component for iOS 26, I didn't realize that the code in [`RCTIntance.mm`](https://www.internalfb.com/code/fbsource/[a54514baccf4e1f828ef46af8180555754c405d8]/xplat/js/react-native-github/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm?lines=344-375) was running behind a feature flag.
This means that all the users not in the experiment where the feature flag is turned on will experience a crash as soon as they navigate to a React Native screen that contains a Switch.

This change fixes the problem by adding a jump to the right queue and it also fixes a measurement issue with the Switch.

## Changelog:
[iOS][Fixed] - Fixed a crash when rendering the Switch component

bypass-github-export-checks

Reviewed By: GijsWeterings

Differential Revision: D80702245

fbshipit-source-id: 480ea061233d35e31679b4b30758dbc133ff0a77
2025-08-21 10:13:22 -07:00
Ruslan Shestopalyuk bcf76e8bb0 Add RN feature flag for ScrollView view recycling (#53373)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53373

# Changelog:
[Internal] -

Creates a RN feature flag for enabling/disabling view recycling for ScrollView native component on Android.

Reviewed By: lenaic

Differential Revision: D80625656

fbshipit-source-id: 23eae07512e0ba2ea014404e7afa19db900f7c47
2025-08-21 09:47:23 -07:00
Lauren Tan c2d96d3a5b Add flow suppression for Constant Condition rollout (#34243)
Summary: DiffTrain build for [83c7379b9601f25463826449256f0cd3d283702d](https://github.com/facebook/react/commit/83c7379b9601f25463826449256f0cd3d283702d)

Reviewed By: marcoww6

Differential Revision: D80661139

fbshipit-source-id: 8ccf2dccba9a07ffd38f50da2c1ded8ebfa78c89
2025-08-21 09:35:19 -07:00
Nicola Corti c557311ed8 Ship useNativeEqualsInNativeReadableArrayAndroid and useNativeTransformHelperAndroid to stable (#53372)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53372

We verified that those feature flags are not regressing the experience + we got confirmation from Software Mansion that the fix
is effectively mitigating the regression on Android mounting.

Hence we can ship this to production.

Fixes: https://github.com/facebook/react-native/issues/51869

Changelog:
[Android] [Fixed] - Fix mounting is very slow on Android by shipping native transform optimizations

Reviewed By: javache

Differential Revision: D80624739

fbshipit-source-id: 2e185434f08b5ea0339d59a6ea006017e5abeff2
2025-08-21 09:32:21 -07:00
Nicola Corti 3f74a87027 Reland: Remove deprecated DefaultReactHost.getDefaultReactHost() overload - part 1 & 2
Summary:
This is a reland of D80622058 + D80623826 + fixes for all the apps.

This method was deprecated in React Native 0.79. We should be able to remove it without impact in 0.82.
I also verified that there are no users of this API in OSS.

There is also a 1:1 replacement for this API which is the other non-deprecated `getDefaultReactHost()` method.

bypass-github-export-checks

Changelog:
[Internal] - Skipping changelog as main already contains a changelog entry

Reviewed By: javache

Differential Revision: D80704320

fbshipit-source-id: c9aa26b83dbd9f4bf97d0a9e9c6dcaa6eb0afdca
2025-08-21 09:31:30 -07:00
Christoph Purrer 9793542555 Align ImageManager and ImageFetcher requestImage API (#53382)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53382

changelog: [internal]

Reviewed By: rshest

Differential Revision: D80679608

fbshipit-source-id: 1a9b5f6a82b1f46e006983f5013272fca4e931bb
2025-08-21 08:46:32 -07:00
Rubén Norte b899e18d1c Do not report mount for mount items with empty surfaceId (#53391)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53391

Changelog: [internal]

Some mount items dispatched to Fabric don't have an associated surface ID (they use -1), which causes some log spam when we try to validate that the surface ID exist when we report mount for those surfaces.

This checks if the surface ID has a valid surface ID before adding it to the list of surfaces to report mount.

Reviewed By: rshest

Differential Revision: D80698363

fbshipit-source-id: 63dc13d53b8bbc2742171b1f444c80ce867e2351
2025-08-21 07:54:00 -07:00
Juan Penaloza aec35b8960 Revert D80622058: Remove deprecated DefaultReactHost.getDefaultReactHost() overload - part 1
Differential Revision:
D80622058

Original commit changeset: 4667683be151

Original Phabricator Diff: D80622058

fbshipit-source-id: c6c119df3b4f849a5c66fbbb619017ae837260c8
2025-08-21 06:26:35 -07:00
Juan Penaloza 3c79d7c18d Revert D80623826: Remove deprecated DefaultReactHost.getDefaultReactHost() overload - part 2
Differential Revision:
D80623826

Original commit changeset: f201e99f7cd4

Original Phabricator Diff: D80623826

fbshipit-source-id: 006bef0883f8cc82b333a68b9260b77afaae060f
2025-08-21 06:26:35 -07:00
Jakub Piasecki 7f051c5470 Change leftover references to hermes.framework (#53390)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53390

Changelog: [General][Fixed] - Change leftover references to `hermes.framework` to `hermesvm.framework`

Reviewed By: cipolleschi

Differential Revision: D80701257

fbshipit-source-id: 9c0e8e49e50f515941e48de2219fb7730d8896bd
2025-08-21 06:24:32 -07:00
Nicola Corti 8bdb34732b Delete internal ReactPackageLogger as no longer necessary (#53387)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53387

This interface was internal and legacy arch only, so it can safely be removed.
I've also removed the logic inside `ReactInstanceManager` that was using it as no longer necessary.

Changelog:
[Internal] [Changed] -

Reviewed By: mdvacca

Differential Revision: D80626639

fbshipit-source-id: b173e71b92e29cebbfc5ed589e01ac295eda2bf0
2025-08-21 05:31:55 -07:00
Nicola Corti 4583fbe052 Deprecate BridgelessReactContext.getCatalystInstance() (#53388)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53388

This method is deprecated and should not be invoked in NewArch, therefore I'm deprecating it now.

Changelog:
[Android] [Deprecated] - Deprecate `BridgelessReactContext.getCatalystInstance()` method

Reviewed By: cipolleschi

Differential Revision: D80626638

fbshipit-source-id: d4ed26021c376f54c732154c153bf60fea2bf5e3
2025-08-21 05:31:55 -07:00
Nicola Corti fbef891573 Fix build race condition with preparePrefab missing 3p headers (#53384)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53384

Occasionally, the `preparePrefab` task might run before other tasks that
are responsible of populating the 3p headers, such as `prepareNative3pDependencies`.

This was evident in the latest nightly which is missing the fast_float headers in the
Android prefab.

Adding a dependsOn fixes it.

Changelog:
[Internal] [Changed] -

Reviewed By: cipolleschi

Differential Revision: D80695212

fbshipit-source-id: 6e0dd17e5cf8c33d14812e5cb8fdc8b800897816
2025-08-21 05:31:40 -07:00
Nicola Corti bda6acf3b0 Remove deprecated DefaultReactHost.getDefaultReactHost() overload - part 2 (#53374)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53374

This method was deprecated in React Native 0.79. We should be able to remove it without impact in 0.82.
I also verified that there are no users of this API in OSS.

There is also a 1:1 replacement for this API which is the other non-deprecated getDefaultReactHost() method.

Changelog:
[Android] [Removed] - Remove deprecated DefaultReactHost.getDefaultReactHost() overload - part 2

Reviewed By: mdvacca

Differential Revision: D80623826

fbshipit-source-id: f201e99f7cd437a47919c36eced5637481151822
2025-08-21 04:51:13 -07:00
Nicola Corti 474f455a75 Remove deprecated DefaultReactHost.getDefaultReactHost() overload - part 1 (#53371)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53371

This method was deprecated in React Native 0.79. We should be able to remove it without impact in 0.82.
I also verified that there are no users of this API in OSS.

There is also a 1:1 replacement for this API which is the other non-deprecated `getDefaultReactHost()` method.

Changelog:
[Android] [Removed] - Remove deprecated DefaultReactHost.getDefaultReactHost() overload - part 1

Reviewed By: mdvacca

Differential Revision: D80622058

fbshipit-source-id: 4667683be151bc7ef1926a21306e088185695369
2025-08-21 04:51:13 -07:00
generatedunixname89002005287564 2ad87cdc50 Fix CQS signal modernize-use-designated-initializers in xplat/js/react-native-github/packages [A] [B] (#53385)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/53385

Reviewed By: rshest

Differential Revision: D80617317

fbshipit-source-id: b06cb66d93b90c571f17184fa78a54f79f43b8a3
2025-08-21 04:32:52 -07:00
generatedunixname89002005287564 5d41129ce1 Fix CQS signal modernize-use-designated-initializers in xplat/js/react-native-github/packages [A] [A] (#53386)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/53386

Reviewed By: rshest

Differential Revision: D80617203

fbshipit-source-id: c38c3e69eda4d09b416270d4a672cc087b203b6a
2025-08-21 04:23:44 -07:00
Jakub Piasecki 776fca1e7c Change hermes atrifact names (#53094)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53094

Changelog: [General][Changed] - Changed names of hermes binaries

Reviewed By: cipolleschi, cortinico

Differential Revision: D79163127

fbshipit-source-id: 54be34ba1f6ce90067768394ca9a6e9c4048be90
2025-08-21 04:00:04 -07:00
Alex Hunt 3d1d81cddc Remove Perf Monitor hooks from DevSupport API (#53349)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53349

Follows feedback on D78904767, refactoring how we pass data to `PerfMonitorOverlayViewManager` to avoid API additions on `DevSupport`.

New interfaces under `com.facebook.react.devsupport.perfmonitor`:

- `PerfMonitorUpdateListener` is implemented by the view class to receive updates from the C++ `HostTargetDelegate`.
- `PerfMonitorInspectorTargetBinding` exposes an API on `ReactHostInspectorTarget` to send CDP actions down to C++ (stub for now).
- `PerfMonitorDevHelper` allows us to use the internal `ReactHostImplDevHelper` to expose the `ReactHostInspectorTarget` instance from the runtime.

Changelog: [Internal]

Reviewed By: cortinico, rshest

Differential Revision: D80464093

fbshipit-source-id: b88e270c0211e4adf52c015ac700df7f44945a5a
2025-08-21 03:06:52 -07:00
Alex Hunt 62b8a7b4ef Switch Perf Monitor metric to Long Tasks (#53297)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53297

Pivots our display metric for the V2 Perf Monitor experiment by switching to Long Tasks.

- Implements a new "__ReactNative__LongTask" metrics event (note: prefixed, since this sits outside the Web Vitals spec).

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D79556595

fbshipit-source-id: 239cf44884f67bf62295b92e2262ae1811d17e4a
2025-08-21 03:06:52 -07:00
Nick Lefever 70d5c97ab4 Make Text shadow nodes uncullable on Android (#53376)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53376

When encountering embedded <Text> components, with the parent <Text> component setting event handlers, culling away the child <Text> components will break the assignment of the event handlers to the text spans on Android.

This diff disables view culling on <Text> components so that event handlers would be correctly assigned to the text fragments once rendered.

Changelog: [Internal]

Reviewed By: andrewdacenko

Differential Revision: D80631997

fbshipit-source-id: f835a249fef1b448b884999ccd75ee06041eca70
2025-08-20 17:35:00 -07:00
Sam Zhou 0ef21bf8ad Update prettier-plugin-hermes-parser in fbsource to 0.32.0 (#53380)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53380

Bump prettier-plugin-hermes-parser to 0.32.0.

Changelog: [internal]

Reviewed By: gkz

Differential Revision: D80644889

fbshipit-source-id: 2d3904db1a4d3952e34267cdb748eef021f93a7b
2025-08-20 16:37:19 -07:00
Sam Zhou b23c558a20 Kill $FlowExpectedError as a type across fbsource (#53378)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53378

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D80573556

fbshipit-source-id: 4d8fc85d563977deb83abdd278175c960f54fd13
2025-08-20 13:35:28 -07:00
Sam Zhou 89fd398342 Update hermes-parser and related packages in fbsource to 0.32.0 (#53377)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53377

Bump hermes-parser and related packages to [0.32.0](https://github.com/facebook/hermes/blob/static_h/tools/hermes-parser/js/CHANGELOG.md).

Changelog: [internal]

Reviewed By: gkz

Differential Revision: D80622389

fbshipit-source-id: d35ad5179eacbc83132517e6b9c9436fda972d28
2025-08-20 11:45:16 -07:00
Joe Vilches 9f2389f074 Move enableAccessibilityOrder feature flag to experimental (#53375)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53375

We have seen sufficient internal signal to be confident that we can move this to the experimental release channel. Soon I will publish some experimental documentation and let folks in OSS know about this.

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D80560366

fbshipit-source-id: 6a8cce39f823dfa313c8c51090eb88c31f1f9fd3
2025-08-20 10:35:11 -07:00
nishan (o^▽^o) 6da351a5ed fix(iOS)(Fabric) inline view alignment inside of a Text with line height (#53341)
Summary:
Addresses - https://github.com/facebook/react-native/issues/53092

Fixes inline `View` frame calculation that is nested inside of a `Text` with a `lineHeight`. The calculation for inline view frame is correct on [Paper](https://github.com/facebook/react-native/blob/25104de5c47845c0edbdfb38df30f8c406da832e/packages/react-native/Libraries/Text/Text/RCTTextShadowView.mm#L338). This PR uses the same calculation as Paper (use glyph height instead of baseline from layout manager).

jest_e2e[run_all_tests]

## Changelog:

[IOS] [FIXED] - Inline `View` alignment with `lineHeight` in Text

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests

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

Test Plan:
Make sure Text render is consistent on iOS and android and the View aligns with Text baseline with the provided [repro](https://github.com/facebook/react-native/issues/53092)

<img width="400" height="766" alt="Screenshot 2025-08-19 at 4 55 01 AM" src="https://github.com/user-attachments/assets/bc4e7473-8fe9-4596-a9ea-fd1204e4b3a3" />

Rollback Plan:

Reviewed By: christophpurrer

Differential Revision: D80525760

Pulled By: cipolleschi

fbshipit-source-id: 0152c35c56d8631942c0186f5dbe33c4a20a48c4
2025-08-20 07:40:54 -07:00
Rubén Norte 2ad845ccb2 Ship DOM APIs to stable (#53360)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53360

Changelog: [General][Breaking] -  Enable DOM APIs in host component refs

This ships DOM APIs to stable now that we have a cohesive API and it's been stable at Meta for a while.

This changes the `HostInstance` type (exported from the `react-native` package and used by all host components) from being an interface to being a class (`ReactNativeElement`).

**The API is backwards compatible** but given we're changing the definition of `HostInstance` from an interface to a class, this can be considered a **breaking change for TypeScript** (not at runtime).

## Previous API

- [`measure`](https://reactnative.dev/docs/the-new-architecture/layout-measurements#measurecallback)
- [`measureInWindow`](https://reactnative.dev/docs/the-new-architecture/layout-measurements#measureinwindowcallback)
- `measureLayout`
- [`setNativeProps`](https://reactnative.dev/docs/the-new-architecture/direct-manipulation-new-architecture#setnativeprops-to-edit-textinput-value)

## New API

From [`HTMLElement`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement):

- Properties
  - [`offsetHeight`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetHeight)
  - [`offsetLeft`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetLeft)
  - [`offsetParent`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent)
  - [`offsetTop`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetTop)
  - [`offsetWidth`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetWidth)
- Methods
  - [`blur`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/blur).
    - This method was also [available](/docs/next/legacy/direct-manipulation#blur) in the legacy architecture.
  - [`focus`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus).
    - This method was also [available](/docs/next/legacy/direct-manipulation#focus) in the legacy architecture.
    - The `options` parameter is not supported.

From [`Element`](https://developer.mozilla.org/en-US/docs/Web/API/Element):

- Properties
  - [`childElementCount`](https://developer.mozilla.org/en-US/docs/Web/API/Element/childElementCount)
  - [`children`](https://developer.mozilla.org/en-US/docs/Web/API/Element/children)
  - [`clientHeight`](https://developer.mozilla.org/en-US/docs/Web/API/Element/clientHeight)
  - [`clientLeft`](https://developer.mozilla.org/en-US/docs/Web/API/Element/clientLeft)
  - [`clientTop`](https://developer.mozilla.org/en-US/docs/Web/API/Element/clientTop)
  - [`clientWidth`](https://developer.mozilla.org/en-US/docs/Web/API/Element/clientWidth)
  - [`firstElementChild`](https://developer.mozilla.org/en-US/docs/Web/API/Element/firstElementChild)
  - [`id`](https://developer.mozilla.org/en-US/docs/Web/API/Element/id)
    - Returns the value of the `id` or `nativeID` props.
  - [`lastElementChild`](https://developer.mozilla.org/en-US/docs/Web/API/Element/lastElementChild)
  - [`nextElementSibling`](https://developer.mozilla.org/en-US/docs/Web/API/Element/nextElementSibling)
  - [`nodeName`](https://developer.mozilla.org/en-US/docs/Web/API/Element/nodeName)
  - [`nodeType`](https://developer.mozilla.org/en-US/docs/Web/API/Element/nodeType)
  - [`nodeValue`](https://developer.mozilla.org/en-US/docs/Web/API/Element/nodeValue)
  - [`previousElementSibling`](https://developer.mozilla.org/en-US/docs/Web/API/Element/previousElementSibling)
  - [`scrollHeight`](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollHeight)
  - [`scrollLeft`](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollLeft)
    - For built-in components, only `ScrollView` instances can return a value other than zero.
  - [`scrollTop`](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollTop)
    - For built-in components, only `ScrollView` instances can return a value other than zero.
  - [`scrollWidth`](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollWidth)
  - [`tagName`](https://developer.mozilla.org/en-US/docs/Web/API/Element/tagName)
    - Returns a normalized native component name prefixed with `RN:`, like `RN:View`.
  - [`textContent`](https://developer.mozilla.org/en-US/docs/Web/API/Element/textContent)
- Methods
  - [`getBoundingClientRect`](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect)
  - [`hasPointerCapture`](https://developer.mozilla.org/en-US/docs/Web/API/Element/hasPointerCapture)
  - [`setPointerCapture`](https://developer.mozilla.org/en-US/docs/Web/API/Element/setPointerCapture)
  - [`releasePointerCapture`](https://developer.mozilla.org/en-US/docs/Web/API/Element/releasePointerCapture)

From [`Node`](https://developer.mozilla.org/en-US/docs/Web/API/Node):

- Properties
  - [`childNodes`](https://developer.mozilla.org/en-US/docs/Web/API/Node/childNodes)
  - [`firstChild`](https://developer.mozilla.org/en-US/docs/Web/API/Node/firstChild)
  - [`isConnected`](https://developer.mozilla.org/en-US/docs/Web/API/Node/isConnected)
  - [`lastChild`](https://developer.mozilla.org/en-US/docs/Web/API/Node/lastChild)
  - [`nextSibling`](https://developer.mozilla.org/en-US/docs/Web/API/Node/nextSibling)
  - [`nodeName`](https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeName)
  - [`nodeType`](https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType)
  - [`nodeValue`](https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeValue)
  - [`ownerDocument`](https://developer.mozilla.org/en-US/docs/Web/API/Node/ownerDocument)
    - Will return the [document instance](/docs/next/document-instances) where this component was rendered.
  - [`parentElement`](https://developer.mozilla.org/en-US/docs/Web/API/Node/parentElement)
  - [`parentNode`](https://developer.mozilla.org/en-US/docs/Web/API/Node/parentNode)
  - [`previousSibling`](https://developer.mozilla.org/en-US/docs/Web/API/Node/previousSibling)
  - [`textContent`](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent)
- Methods
  - [`compareDocumentPosition`](https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition)
  - [`contains`](https://developer.mozilla.org/en-US/docs/Web/API/Node/contains)
  - [`getRootNode`](https://developer.mozilla.org/en-US/docs/Web/API/Node/getRootNode)
  - [`hasChildNodes`](https://developer.mozilla.org/en-US/docs/Web/API/Node/hasChildNodes)

### Legacy API

- [`measure`](https://reactnative.dev/docs/the-new-architecture/layout-measurements#measurecallback)
- [`measureInWindow`](https://reactnative.dev/docs/the-new-architecture/layout-measurements#measureinwindowcallback)
- `measureLayout`
- [`setNativeProps`](https://reactnative.dev/docs/the-new-architecture/direct-manipulation-new-architecture#setnativeprops-to-edit-textinput-value)

### New APIs

Additionally, this exposes access to document nodes and text nodes that were not available before.

This will be properly documented on the website at part of the release of 0.82, that will contain this changes.

Reviewed By: GijsWeterings

Differential Revision: D78562721

fbshipit-source-id: 139aee6969f3ecdc65cffcd31cd1754f367d9122
2025-08-20 07:18:00 -07:00
Riccardo Cipolleschi e04bbf0497 Fix E2E Tests by configuring git (#53357)
Summary:
E2E tests on iOS started failing yesterday because of some permission model that has changed in Github.

When creating a new app from the template, we initialize a git repository. The initialization started failing with the error:
```
debug Could not create an empty Git repository, error: , Error: Command failed with exit code 128: git commit -m Initial commit

Author identity unknown

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'runner@sat12-jr314_3f88162a-0f3d-4d26-80dc-58f431cca4c6-9A2607311B51.(none)')
```

This change fixes it by setting a default identity for git in the CI jobs that requires it.

## Changelog:
[Internal] -

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

Test Plan: GHA

Reviewed By: cortinico

Differential Revision: D80612345

Pulled By: cipolleschi

fbshipit-source-id: 85816057d910ed3619c5f683fdad724c3df8046b
2025-08-20 06:58:36 -07:00
Rubén Norte 78f089906c Use React Native built-in definitions for Event and EventTarget in Fantom (#53362)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53362

Changelog: [internal]

This just replaces the polyfills for `Event` and `EventTarget` that we're defining inline in Fantom with the implementations that already exist in RN.

Reviewed By: javache

Differential Revision: D80612067

fbshipit-source-id: 047c8f12cbb1f4afea2d05a5a1235d9dff2e25f9
2025-08-20 06:01:22 -07:00
Nicola Corti 8480386d50 Disable running ktfmtCheck due to diverging ktfmt versions (#53359)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53359

A new version of ktfmt broke the OSS CI build for React Native.
That's due to us running still on the older version of ktfmt, as the newer version hasn't been released yet.

I'm temporarly disabling the `ktfmtCheck` jobs because we primarly check formatting from within fbsource.

Changelog:
[Internal] [Changed] -

Reviewed By: cipolleschi

Differential Revision: D80610450

fbshipit-source-id: 846249780f979788356404205d8b8e37fc54a255
2025-08-20 05:42:32 -07:00
Rubén Norte 9910981d3a Simplify RendererImplementation (#53351)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53351

Changelog: [internal]

This refactors `RendererImplementation` to reduce boilerplate code from exporting existing methods from Fabric or Paper.

Reviewed By: lenaic

Differential Revision: D80532479

fbshipit-source-id: ae70bb50f0d2fbf7aee95efd39d9716f0c3a8a90
2025-08-20 03:53:44 -07:00
Nivaldo Bondança d1a1020a4a Codemod format for trailing commas change
Reviewed By: VladimirMakaev

Differential Revision: D80576929

fbshipit-source-id: 1310f77f5d9d489b780b14875454ebda7f7adfc9
2025-08-19 18:15:18 -07:00
David Vacca fb84932e48 Deprecate ReactInstanceManager and ReactInstanceManagerBuilder (#53150)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53150

ReactInstanceManager and ReactInstanceManagerBuilder are legacy architecture classes that will be deleted in the future, in this diff we are deprecating them

changelog: [Android][Changed] Deprecate legacy architecture classes ReactInstanceManager and ReactInstanceManagerBuilder, these classes will be deleted in a future release

Reviewed By: mlord93

Differential Revision: D79677828

fbshipit-source-id: 2d79736d94a55e44dd24056985f358e3650ddf6c
2025-08-19 16:51:43 -07:00
Alex Hunt 3f848e7a54 Fix test setup for flag used early in HostTarget, restore value (#53355)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53355

Follows D80000286, where this flag was forcibly disabled to fix tests.

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D80545210

fbshipit-source-id: 585122ff73e4979c398be6eb03000936d6bd5ce1
2025-08-19 11:40:24 -07:00
Alex Hunt df748ba083 Implement Perf Monitor event scoring and display timeout (#53169)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53169

Improves the experimental Perf Monitor UI sufficient for the initial MVP.

- Sets minimum duration threshold to display an event to 10ms.
- Impelements [responsiveness scoring](https://web.dev/articles/inp#good-score) linked to UI colour and display timeout.

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D79359131

fbshipit-source-id: f08d2b595e885342d841c3a02b9e02456502c926
2025-08-19 11:19:09 -07:00
generatedunixname89002005287564 defefb19e3 Fix CQS signal modernize-use-designated-initializers in xplat/js/react-native-github/packages (#53352)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/53352

Reviewed By: cipolleschi

Differential Revision: D80516836

fbshipit-source-id: 28d10e5d1b9d476924c8e73526e164ff98e12be1
2025-08-19 09:53:13 -07:00
Riccardo Cipolleschi ba51aeaa90 Fix Switch layout with iOS26 (#53247)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53247

Apple changed the sizes of the UISwitchComponent and now, if you build an iOs app using the <Switch> component, the layout of the app will be broken because of wrong layout measurements.
This has been reported also by [https://github.com/facebook/react-native/issues/52823](https://github.com/facebook/react-native/issues/52823).

The `<Switch>` component was using hardcoded values for its size.
This change fixes the problem by:
- Using codegen for interface only
- Implementing a custom Sadow Node to ask the platform for the Switch measurements
- Updating the JS layout to wrap the size around the native component.

## Changelog:

[iOS][Fixed] - Fix Switch layout to work with iOS26

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

Test Plan:
Tested locally with RNTester.

| iOS Version | Before | After |
| --- | --- | --- |
| < iOS 26 | https://github.com/user-attachments/assets/91d73ea3-30ba-4a5c-948e-ea5c63aa7c6d | https://github.com/user-attachments/assets/76061bc8-0f14-412a-a8fb-d1c3951772e6 |
| >= iOS 26 | https://github.com/user-attachments/assets/1abc477f-bc0a-4762-938e-98814fb2a054 | https://github.com/user-attachments/assets/77e562e1-b803-46ac-9cf6-102f062a1cd4 |

Rollback Plan:

Reviewed By: sammy-SC

Differential Revision: D79653120

Pulled By: cipolleschi

fbshipit-source-id: d99b353b7b7b5496b148779de4abe3e57dd38156
2025-08-19 06:53:44 -07:00
Rubén Norte 24657ad5c4 Optimize DOM APIs (#53332)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53332

Changelog: [internal]

This implements several optimizations to speed up DOM traversal APIs.

The main changes are:
1. Better caching of renderer methods in `RendererImplementation`.
2. Faster access to public instances from instance handles (avoids `instanceof` checks if the nodes are `ReactNativeElement`, which is the most common case).
3. Avoiding unnecessary function calls in `NativeDOM` but removing the proxy object.
4. Removal of private fields from `HTMLCollection` and `NodeList`, and reuse the object to define object properties.
5. Avoiding unnecessary array copies in `getChildNodes`.

Results:

| Property / method               | Latency before (ns) | Latency after (ns) | Difference |
| ----------------------- | ------------------------- | ------------------------ | ---------- |
| parentNode              | 3996                      | 2203                     | -44.87%   |
| parentElement           | 4347                      | 2524                     | -41.94%   |
| childNodes              | 6590                      | 3886                     | -41.03%   |
| children                | 6950                      | 4126                     | -40.63%   |
| firstChild              | 5008                      | 2975                     | -40.60%   |
| firstElementChild       | 5408                      | 3215                     | -40.55%   |
| lastChild               | 5048                      | 2974                     | -41.09%   |
| lastElementChild        | 5448                      | 3215                     | -40.99%   |
| childElementCount       | 5378                      | 3175                     | -40.96%   |
| previousSibling         | 12118                     | 6780                     | -44.05%   |
| previousElementSibling  | 12148                     | 6850                     | -43.61%   |
| nextSibling             | 12139                     | 6800                     | -43.98%   |
| nextElementSibling      | 12119                     | 6830                     | -43.64%   |
| offsetParent            | 5097                      | 3725                     | -26.92%   |
| isConnected             | 2774                      | 1733                     | -37.53%   |
| ownerDocument           | 691                       | 681                      | -1.45%    |
| getRootNode()           | 3195                      | 2154                     | -32.58%   |
| hasChildNodes()         | 4997                      | 2854                     | -42.89%   |

Reviewed By: mdvacca

Differential Revision: D80449030

fbshipit-source-id: 6b3abecbbf6aa23bc99ab65cf22ed33721dc5459
2025-08-19 06:06:52 -07:00
Rubén Norte b7b83cda0a Remove nullability from NativeDOM.setNativeProps (#53331)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53331

Changelog: [internal]

This change was shipped 3 months ago so we can assume the native method will always have this method and don't need to keep backwards compatibility.

Reviewed By: rshest

Differential Revision: D80449031

fbshipit-source-id: 4ff11b81478701ad712b4e097625e569829f6480
2025-08-19 06:06:52 -07:00
Rubén Norte 9301badec1 Remove nullability from NativePerformance module methods (#53330)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53330

Changelog: [internal]

These methods have been defined for a month, so it's safe to make then non-nullable already.

Reviewed By: GijsWeterings

Differential Revision: D80453413

fbshipit-source-id: 3fde076622dc9d510bad144300364401f2319507
2025-08-19 06:06:52 -07:00
Rubén Norte 14718b20c6 Prepare Flow types for change in HostInstance (#53318)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53318

Changelog: [internal]

This prepares the codebase for an eventual migration of `HostInstance` to `ReactNativeElement`, so the actual migration doesn't need to adjust so much existing code.

Reviewed By: rshest

Differential Revision: D80399739

fbshipit-source-id: 441d3e92ef6dff253343d1058b2027698e8ecb22
2025-08-19 06:06:35 -07:00