Commit Graph

12270 Commits

Author SHA1 Message Date
Riccardo Cipolleschi 6312360268 Improve Codegen to support automatic registration of Cxx TM (#49624)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49624

This change improves the iOS infra so that there is no need to modify the Swift AppDelegate or to create a Bridging Header.

## Problem
As of today, it is not possible to create a pure C++ TM and to register it through a Swift AppDelegate

## Solution
We can create a pod that can be imported in a Swift AppDelegate and that offer some pure Objective-C classes.

These classes contains a provider that can be instantiated in Swift.

The TurboModule manager delegate will ask the AppDelegate about the presence of some provider that can instantiate a pure C++ turbomodule with a given name.

The provider has an empty interface, but the implementation contains a function that can actually instantiate the TM. The function is implemented in an Objective-C++ class that imports the pure C++ turbomodule and creates it.

The TMManager extends the provider through a category to attaach the signature of the function that is implemented by the provider.

The last diff in this stack contains an exaple on how to implement this.

## Changelog:
[iOS][Added] - Wire codegen to the new TM provider to automatically register CXX modules.

Reviewed By: javache

Differential Revision: D70082999

fbshipit-source-id: 11d829450e1d17984d6f22ee5b8907073c59d008
2025-02-27 09:12:36 -08:00
Riccardo Cipolleschi 5d5d3708df Connect the classes for C++ Module registration to TMManagerDelegate (#49611)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49611

This Change connects the pod created previously to the `RCTTuboModuleManager` so that it can ask the delegate about the CxxTurboModuleProviders.

We had to introduce a `RCTFullTurboModuleManagerDelegate` that implements both the old `TurboModuleManagerDelegate` and the new Swift compatible one.

## Problem
As of today, it is not possible to create a pure C++ TM and to register it through a Swift AppDelegate

## Solution
We can create a pod that can be imported in a Swift AppDelegate and that offer some pure Objective-C classes.

These classes contains a provider that can be instantiated in Swift.

The TurboModule manager delegate will ask the AppDelegate about the presence of some provider that can instantiate a pure C++ turbomodule with a given name.

The provider has an empty interface, but the implementation contains a function that can actually instantiate the TM. The function is implemented in an Objective-C++ class that imports the pure C++ turbomodule and creates it.

The TMManager extends the provider through a category to attaach the signature of the function that is implemented by the provider.

The last diff in this stack contains an exaple on how to implement this.

## Changelog:
[iOS][Added] - Added the React-SwiftCompatibleNativeModules pod

Reviewed By: javache

Differential Revision: D70012142

fbshipit-source-id: db96c4cd3cdd1062b12f11131b7c6c51ecd74bc7
2025-02-27 09:12:36 -08:00
Nicola Corti 2062defb2d Bump AGP to 8.8.2 (#49712)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49712

Just keeping AGP up to date to the latest patch version

Changelog:
[Android] [Changed] - Bump AGP to 8.8.2

Reviewed By: cipolleschi

Differential Revision: D70316244

fbshipit-source-id: 6e447bd04841d09717a1c6153b7e5c977a10787c
2025-02-27 09:05:55 -08:00
Kudo Chien 90e27c2b4f show JSC removal message on Android (#49709)
Summary:
show build time jsc removal warning. https://github.com/facebook/react-native/issues/49692 but for android

![Screenshot 2025-02-27 at 3 41 43 PM](https://github.com/user-attachments/assets/a4fe6d52-5e05-45b0-a403-c71372dfba06)

## Changelog:

[ANDROID] [CHANGED] - Add a build time JSC lean core warning

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

Test Plan: - test on rn-tester. rn-tester has a jsc build variant. it shows the warning anyway. commenting out `enableHermesOnlyInVariants` will suppress the warning.

Reviewed By: rshest

Differential Revision: D70323283

Pulled By: cortinico

fbshipit-source-id: 632a8b9086c5d90d7f14ea705464356a1292bcad
2025-02-27 08:38:35 -08:00
Ruslan Lesiutin 13a0b4691a Use sampling profile serializer and emit profiles in traces (#48315)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48315

# Changelog: [Internal]

> NOTE: Some CI jobs are expected to fail, because changes in Hermes D67353585 should be landed first, and then grafted to Static Hermes.

Use newly added serializer and record Trace Events for profiles.

Reviewed By: huntie

Differential Revision: D67353586

fbshipit-source-id: f3738418ec1d47ef4435f00120823845ea5e2fe5
2025-02-27 08:32:12 -08:00
Ruslan Lesiutin 87d4300f14 Implement sampling profile serializer (#49191)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49191

# Changelog: [Internal]

In this diff we are adding another serializer, that will receive local sampling profile (in tracing domain), and will record corresponding Trace Events with `PerformanceTracer`.

It encapsulates the logic of transforming list of samples to `"Profile"` and `"ProfileChunk"` trace events, which will be parsed by Chrome DevTools later.

Reviewed By: huntie

Differential Revision: D68439735

fbshipit-source-id: 0b3f2b3aff5b79a921e0350759e93f5b05e34d8e
2025-02-27 08:32:12 -08:00
Ruslan Lesiutin 290f237cfa Expose API for registering profiles and profile chunks (#49084)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49084

# Changelog: [Internal]

> NOTE: Some CI jobs are expected to fail, because changes in Hermes D67353585 should be landed first, and then grafted to Static Hermes.

Added public methods to `PerformanceTracer` instance for registering `Profile` and `ProfileChunk` Trace Events.

Also created data structs in `TraceEvent.h` to simplify serialization process for objects like call frames / samples / etc.

Reviewed By: huntie

Differential Revision: D68558805

fbshipit-source-id: f5eca0435c56828909f99ec0b47841d24ee907b6
2025-02-27 08:32:12 -08:00
Ruslan Lesiutin 1aced32a1c Serialize Hermes Profile to Tracing Profile (#49082)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49082

# Changelog: [Internal]

> NOTE: Some CI jobs are expected to fail, because changes in Hermes D67353585 should be landed first, and then grafted to Static Hermes.

In this diff we will:
- Call newly added API in Hermes from `HermesRuntimeTargetDelegate.cpp`
- Define format for local Sampling Profile that will be used in Tracing domain
- Implement formatter for Hermes Profile -> Tracign Profile

Reviewed By: bgirard

Differential Revision: D68414421

fbshipit-source-id: 05d76e9bcff46f88a2338490a9d858cb121f72cc
2025-02-27 08:32:12 -08:00
Ruslan Lesiutin 067c5f9954 Record Event Loop tasks (#49436)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49436

# Changelog: [Internal]

We will record event loop ticks and register corresponding `"RunTask"` Trace Event with our Trace Event engine.

Since this is hot path, I've added some gating under macros that are being used for Fusebox initialization.

There are also plans to add a public method to `PerformanceTracer` to get tracing status, so we could avoid cost of serialization / saving timestamps if trace is not being recorded. I believe rubennorte had plans on this, we will add it on top of that.

> Q: Why not add this to TraceSection?

Long-term, we will have a solution that will be one layer above TraceSection and this `EventLoopTaskReporterRAII`, it is risky now to modify existing `TraceSection` and rely on event names and attempt to map them to Trace Events.

Reviewed By: rubennorte

Differential Revision: D69399955

fbshipit-source-id: b26ac0c376e7dcb5755f36a27bf00dcca6cbff60
2025-02-27 08:32:12 -08:00
Ruslan Lesiutin bf6852db2e Report JavaScript thread (#49395)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49395

# Changelog: [Internal]

Adding a new method to `RuntimeTarget` that will register it for Tracing.

In our case, it will schedule a callback on JS executor that will register JavaScript thread with `PerformanceTracer`.

Reviewed By: huntie

Differential Revision: D69530984

fbshipit-source-id: 58cffe9e9c4482b494cfcfd3405f7bffa40cdc56
2025-02-27 08:32:12 -08:00
Ruslan Lesiutin 72e745fc15 Scaffold support for Tracing by jsinspector (#48836)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48836

# Changelog: [Internal]

When `Tracing.start` CDP method is received, here is what happens next:
- `TracingAgent`, which intercepts the event will propagate this status to `Instance` by calling `startTracing()` on `InstanceAgent`.
- `InstanceAgent` will propagate it to `Runtime` entities. The only difference, there is no concept of tracing for Runtime, it will only have an API for starting sampling profiler.

When `Tracing.end` CDP method is received, it is propagated in the same order.

There is also `collect*()` methods for collecting profiles.

This has multiple benefits:
- We can control when `Runtime` or `Instance` are recreated and can ask them to start recording trace profiles right away. This may be required when we would add support for Reload and Profile from Performance panel.
- We might leverage this setup in the future, once we add instrumentation for Network panel. `InstanceAgent` will get notified when tracing started and will correspondingly notify other part of the infrastructure that will be responsible for recording network calls.
- We remain being fully agnostic to the actual `Runtime`, see corresponding `RuntimeTargetDelegate` for `V8`. We don't have the capacity for implementing and maintaining sampling profiler capabilities for it, but this approach unblocks it from technical perspective, if someone would want to invest into this.

`InstanceProfile` is a superset of `RuntimeSamplingProfile`. In the future, `InstanceProfile` may also include things like `NetworkProfile`, or similar stuff.

The definition for `RuntimeSamplingProfile` will be added in D68414421 and relies on the availability of new API for sampling profiler in Hermes.

Reviewed By: huntie

Differential Revision: D68327630

fbshipit-source-id: f8446057f88d87b4394fb692c28b89f1b8ce4eea
2025-02-27 08:32:12 -08:00
zhongwuzw fa6d5ca572 Fabric: Fixes TurboModule method parameter Int32 type not work (#49710)
Summary:
Fixes https://github.com/facebook/react-native/issues/49688 .

## Changelog:

[IOS] [FIXED] - Fabric: Fixes TurboModule method parameter Int32 type not work

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

Test Plan: Repro please see  https://github.com/facebook/react-native/issues/49688.

Reviewed By: cortinico

Differential Revision: D70314804

Pulled By: cipolleschi

fbshipit-source-id: 4f305b14bb735bd343ef7477b969df237418615d
2025-02-27 07:23:10 -08:00
Mateo Guzmán 63dea206ff Migrate CxxModuleWrapper & DefaultJSExceptionHandler to Kotlin (#49706)
Summary:
Migrating two more classes from com.facebook.react.bridge to Kotlin, `CxxModuleWrapper` & `DefaultJSExceptionHandler`.

## Changelog:

[INTERNAL] - Migrate CxxModuleWrapper & DefaultJSExceptionHandler to Kotlin

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

Test Plan:
```sh
yarn test-android
yarn android
```

Reviewed By: cortinico

Differential Revision: D70317975

Pulled By: javache

fbshipit-source-id: 642d96faa131dd859f18cd811a5a223acba4c722
2025-02-27 05:23:56 -08:00
Rubén Norte 3226c328bf Remove unnecessary package data-uri-to-buffer (#49714)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49714

Changelog: [internal]

This package was only needed for testing but it's actually not used.

Reviewed By: hoxyq

Differential Revision: D70318040

fbshipit-source-id: b57ec74932029368117520646972bfee83706017
2025-02-27 05:23:29 -08:00
Nick Lefever e2642d5567 Add support for setting internal feature flags (#49693)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49693

Allow setting the ReactNativeInternalFeatureFlags from a Fantom test using the `fantom_internal_flags` pragma.

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D70242739

fbshipit-source-id: 17a69edbd58b93f8b8060192b9881e62febf9635
2025-02-27 04:16:36 -08:00
Ruslan Lesiutin d8bc7c68c0 fix[LayoutableShadowNode::findNodeAtPoint]: consider layoutMetrics.overflowInset (#49701)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49701

# Changelog:
[General] [Fixed] - findNodeAtPoint now considers overflow area of the parent node

This may happen when the child overflows the parent without resizing it. For example, when child has `position: 'absolute'` and absolute coordinates.

See
- https://fb.workplace.com/groups/rn.debugger.feedback/posts/1075015864052657/
- https://fb.workplace.com/groups/rn.debugger.feedback/permalink/1180445730176336/
- https://fb.workplace.com/groups/ford.eng.discussions/permalink/1961390260971262/

for more context

Reviewed By: NickGerleman

Differential Revision: D63328182

fbshipit-source-id: 9d5ed3ec8d88d8d65455aa3664588dc7d7273888
2025-02-27 03:20:01 -08:00
Nicola Corti b95424d159 Gradle to 8.13 (#49689)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49689

X-link: https://github.com/facebook/yoga/pull/1790

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

I'm bumping Gradle to the latest minor.
https://docs.gradle.org/8.13/release-notes.html

I'm also changing the distribution from `all` to `bin` as
this reduces the download time of the distribution.

Changelog:
[Android] [Changed] - Gradle to 8.13

Reviewed By: NickGerleman

Differential Revision: D70239710

fbshipit-source-id: 89808242a93344f540bfe82f4178cf6db72597d1
2025-02-27 03:13:26 -08:00
Rubén Norte a6dd18c2a6 Expose new DOM classes in the global scope (#49697)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49697

Changelog: [internal]

These classes cannot be instantiated directly, but having access to them allows users to do `instanceof` checks, e.g.:

```
if (ref.current instanceof Element) {
  ref.current.getBoundingClientRect();
}
```

Reviewed By: yungsters

Differential Revision: D70244966

fbshipit-source-id: 3c1e3698b8851ef9ce3c2865e7435b000984c8f0
2025-02-27 03:07:54 -08:00
Rubén Norte 66495830c0 Type Node.textContent as non-nullable string (#49696)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49696

Changelog: [internal]

This is just a change for convenience, as Flow is currently typing `textContent` in `Node` as `string` instead of as `string | null` as we were doing.

Our behavior was more correct, as `Document` extends `Node` and it returns `null` in that case, but to ensure a smooth migration we'll adopt the existing definition.

Reviewed By: huntie

Differential Revision: D70244963

fbshipit-source-id: ad8325d6e00c221e858e4e2d45085666ff0a0ce7
2025-02-27 03:07:54 -08:00
Dawid Małecki 38e1444162 Add TouchableOpacity to buildTypes and align Flow with TS types (#49700)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49700

Changelog:
[Internal] - Added TouchableOpacity to buildTypes and aligned Flow with TS types

Reviewed By: huntie

Differential Revision: D69922731

fbshipit-source-id: 852b8afe99469512c0951d2fd3818fca744102fe
2025-02-27 03:02:16 -08:00
Jakub Piasecki 2bb65717b7 Fix onContentSizeChange being dispatched too often on iOS (#49695)
Summary:
Solves the iOS part of https://github.com/facebook/react-native/issues/47186.

`onContentSizeChanged` event is sent inside the `updateLayoutMetrics` method every time it's invoked. A change in layout metrics doesn't mean that the content size also changes, like changing the position of the input.

This PR adds a condition that the content size must have changed before sending the event.

|Before this change|After this change|
|-|-|
|<video src="https://github.com/user-attachments/assets/743e1502-e13e-474e-b4a6-ef6873bf9619">|<video src="https://github.com/user-attachments/assets/fe3d3ef5-3951-4ba2-b9a1-c41439ab455c">|

In the reproducer from the issue, `SafeAreaView` is used, which at first renders its content without any insets until its state is updated with the correct insets. Both of these layouts change the layout metrics of the text input, resulting in two events before this change and a single one after.

## Changelog:

[IOS] [FIXED] - Fixed TextInput's `onContentSizeChange` event being dispatched multiple times with the same size

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

Test Plan: Tested on the reproducer from the issue

Reviewed By: NickGerleman

Differential Revision: D70247460

Pulled By: j-piasecki

fbshipit-source-id: 8a1e0d0f55b6b3f8a6d0bb176ed50e47e3b51035
2025-02-27 00:58:35 -08:00
Mateo Guzmán 8a4a6231b7 Internalize and migrate DimensionPropConverter to Kotlin (#49676)
Summary:
As part of the initiative to reduce the public API surface, this class can be internalized. I've checked there are [no relevant OSS usages](https://github.com/search?type=code&q=NOT+is%3Afork+NOT+org%3Afacebook+NOT+repo%3Areact-native-tvos%2Freact-native-tvos+NOT+repo%3Anuagoz%2Freact-native+NOT+repo%3A2lambda123%2Freact-native+NOT+repo%3Abeanchips%2Ffacebookreactnative+NOT+repo%3AfabOnReact%2Freact-native-notes+NOT+user%3Ahuntie+NOT+user%3Acortinico+NOT+repo%3AMaxdev18%2Fpowersync_app+NOT+repo%3Acarter-0%2Finstagram-decompiled+NOT+repo%3Am0mosenpai%2Finstadamn+NOT+repo%3AA-Star100%2FA-Star100-AUG2-2024+NOT+repo%3Alclnrd%2Fdetox-scrollview-reproductible+NOT+repo%3ADionisisChytiris%2FWorldWiseTrivia_Main+NOT+repo%3Apast3l%2Fhi2+NOT+repo%3AoneDotpy%2FCaribouQuest+NOT+repo%3Abejayoharen%2Fdailytodo+NOT+repo%3Amolangning%2Freversing-discord+NOT+repo%3AScottPrzy%2Freact-native+NOT+repo%3Agabrieldonadel%2Freact-native-visionos+NOT+repo%3AGabriel2308%2FTestes-Soft+NOT+repo%3Adawnzs03%2FflakyBuild+NOT+repo%3Acga2351%2Fcode+NOT+repo%3Astreeg%2Ftcc+NOT+repo%3Asoftware-mansion-labs%2Freact-native-swiftui+NOT+repo%3Apkcsecurity%2Fdecompiled-lightbulb+com.facebook.react.bridge.DimensionPropConverter).

In this PR I'm also converting this class to Kotlin as it's needed to make it internal as per https://github.com/facebook/react-native/pull/49676#issuecomment-2683579829.

## Changelog:

[INTERNAL] - Internalize and migrate com.facebook.react.bridge.DimensionPropConverter to Kotlin

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

Test Plan:
```bash
yarn test-android
yarn android
```

Reviewed By: NickGerleman

Differential Revision: D70208912

Pulled By: arushikesarwani94

fbshipit-source-id: c74326ca1d82417457c2a438fa28e20f0a0eaa82
2025-02-26 17:48:07 -08:00
Rubén Norte 798f2e47aa Remove unnecessary extra prototype from ReactNativeElement (#49699)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49699

Changelog: [internal]

Just a minor optimization in `ReactNativeElement`, to stop creating an unnecessary object in the prototype chain for the `super()` removal optimization.

Reviewed By: huntie

Differential Revision: D70250804

fbshipit-source-id: 1f8104f8e17f12264326cd715e07877a371f9dc5
2025-02-26 13:22:00 -08:00
Sam Zhou bf17ace09a Move react type definitions back into global libdefs
Summary: Changelog: [Internal]

Reviewed By: panagosg7

Differential Revision: D70261002

fbshipit-source-id: 83c0f5b2e2717e19a211553bd4b07e9481ec7c65
2025-02-26 12:20:39 -08:00
Oskar Kwaśniewski a6607c07cd feat: js runtime switching C API for Swift (#49489)
Summary:
This PR implements a C API to switch JS Engines that can be used from Swift.

Here is an example:

```swift
import React
import React_RCTAppDelegate
import ReactAppDependencyProvider
import UIKit
import RCTRuntime

class ReactNativeDelegate: RCTDefaultReactNativeFactoryDelegate {
  override func sourceURL(for bridge: RCTBridge) -> URL? {
    self.bundleURL()
  }

  override func bundleURL() -> URL? {
    #if DEBUG
    RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
    #else
    Bundle.main.url(forResource: "main", withExtension: "jsbundle")
    #endif
  }

  override func createJSRuntimeFactory() -> JSRuntimeFactory {
    jsrt_create_jsc_factory() // Easily switch engines here
  }
}
```

## Changelog:

[IOS] [ADDED] -  js runtime C API for Swift

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

Test Plan: CI Green

Reviewed By: huntie

Differential Revision: D69976988

Pulled By: cipolleschi

fbshipit-source-id: 9333ec62ca99a28c3121f558bbff1ce0457779e3
2025-02-26 10:56:31 -08:00
Christian Falch f7970cddf2 Add code to generate the Swift Package
Summary:
This change refactors the script to prebuild ios dependencies by:
- remove the manually maintained Package.swift
- add script to generate it starting from the configurations that we have
bypass-github-export-checks
## Changelog:

[INTERNAL] - Factor out script to generate  Package.swift file

Reviewed By: cortinico

Differential Revision: D70175760

Pulled By: cipolleschi

fbshipit-source-id: a1b0fc6dcdc1860b04ab260697f259c297338f41
2025-02-26 08:19:39 -08:00
Ruslan Lesiutin 5fcb69e8b7 cleanup usage of HERMES_ENABLE_DEBUGGER and define set of build-time flags for Fusebox (#49673)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49673

## Changelog:
[General] [Breaking] - Deprecated usage of `HERMES_ENABLE_DEBUGGER` build-time flag for enabling React Native debugger in favour of `REACT_NATIVE_DEBUGGER_ENABLED` and `REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY`.

Reviewed By: huntie

Differential Revision: D70177232

fbshipit-source-id: 402adea7daa810c92015fd844430b26ae29bbf75
2025-02-26 07:47:03 -08:00
Pieter De Baets 4a055f36eb Fallback to fbsystrace when Perfetto is not available (#49657)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49657

For some use-cases we still want to log using the internal fbsystrace API which allows backdating of events.

This feels a bit weird putting it in `ReactPerfettoLogger`, but maybe we should rename that to something like `TraceLogger` (like we have `TraceSection`).

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D70109680

fbshipit-source-id: 7757b81ec5032e3800446a88198c7da135afdd0e
2025-02-26 07:43:18 -08:00
Jakub Piasecki 65242998ca Align Pressable types with OSS (#49631)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49631

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D70091770

fbshipit-source-id: 8a2fb448984fccf31c473002ffccd5ddb174b7e1
2025-02-26 07:21:43 -08:00
Rubén Norte f2c1f8b4e7 Provide access to document object in Fantom roots (#49691)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49691

Changelog: [internal]

This adds a new getter for `document` in the `Root` class in Fantom tests to easily access the document instance for the root.

This isn't very useful at the moment, but will be very useful when we introduce `document.getElementById`, so we can access arbitrary nodes very easily.

Reviewed By: javache

Differential Revision: D69307130

fbshipit-source-id: 2650bc03e143ee9f0b29d0f284a2f9079ab9f765
2025-02-26 07:09:15 -08:00
Rubén Norte e3141308bb Enable DOM APIs by default in Fantom tests (#49690)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49690

Changelog: [internal]

We're shipping this soon and most tests already using DOM APIs to make assertions, so it's easier if we just "ship" in tests.

Reviewed By: javache, sammy-SC

Differential Revision: D69307129

fbshipit-source-id: 75d0be013703cff7bc2bad5cd16c26bc6471e547
2025-02-26 07:09:15 -08:00
Mateo Guzmán 7e2487b6ce Migrate ProgressRequestBody to Kotlin (#49682)
Summary:
Migrate com.facebook.react.modules.network.ProgressRequestBody to Kotlin.

Note: To keep the logic the same as in Java, I had to make the params of RequestBodyUtil.createProgressRequest non-nullable again which were made nullable by mistake in https://github.com/facebook/react-native/pull/49584.

## Changelog:

[INTERNAL]- Migrate com.facebook.react.modules.network.ProgressRequestBody to Kotlin

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

Test Plan:
```bash
yarn test-android
yarn android
```

Reviewed By: rshest

Differential Revision: D70239855

Pulled By: cortinico

fbshipit-source-id: 03c5e0bd5c66a4d5df5e4304d4479ec576d350fd
2025-02-26 05:16:14 -08:00
Rubén Norte 1e4c0ded03 Rename INativeMethods as LegacyHostInstanceMethods (#49687)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49687

Changelog: [internal]

Just a minor type rename to better reflect what this type will become soon.

Reviewed By: cortinico

Differential Revision: D70185597

fbshipit-source-id: d5a67eda44dc88dd32a5290f1d0b292ed7014006
2025-02-26 05:13:08 -08:00
Rubén Norte cd072dca99 Migrate HostInstance to an interface (#49633)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49633

Changelog: [internal]

This replaces the definition of `HostInstance` to use an interface instead of an object, to better represent the underlying type (an instance of `ReactFabricHostComponent`) and simplify the migration to the new DOM API.

Reviewed By: huntie

Differential Revision: D70023947

fbshipit-source-id: bf312abf02fec48b2b5afb41053593ce542f7324
2025-02-26 05:13:08 -08:00
Dawid Małecki dbbdb985f5 Add SafeAreaView to buildTypes and align Flow with TS types (#49664)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49664

Changelog:
[Internal] - Added SafeAreaView to buildTypes and aligned Flow with TS types

Reviewed By: huntie

Differential Revision: D70176107

fbshipit-source-id: 5da4ef4751c2d4a57b3ffd736294587836babecf
2025-02-26 03:15:02 -08:00
Mateo Guzmán ac57ec4d0b Reland: Migrate ReactClippingViewGroup to Kotlin (#49413) (#49607)
Summary:
Reland of https://github.com/facebook/react-native/issues/49413 which was reverted due to an internal crash. I've attempted to do a solution to keep backwards compatibility but doesn't seem to work – keeping the original solution for now, perhaps something else can be cleaned up to avoid the breakage.

## Changelog:

[INTERNAL] - Migrate com.facebook.react.uimanager.ReactClippingViewGroup to Kotlin

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

Test Plan:
```bash
yarn test-android
yarn android
```

Verified that the update changes do not cause a crash.
Test flow:
- login to BizApp using Instagram account
- on home screen scroll down to Insights section
- it should show without crashing

Reviewed By: arushikesarwani94

Differential Revision: D70200000

Pulled By: alanleedev

fbshipit-source-id: 89bc948c1b91d9419d4b6e1885d949c4a3c20986
2025-02-26 00:32:01 -08:00
Samuel Susla ca49b512ad Back out "remove use of RCTUnsafeExecuteOnMainQueueSync and main thread setup from RCTDeviceInfo" (#49681)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49681

changelog: [internal]

Original commit changeset: e8280d2f5025

Original Phabricator Diff: D69747829

Reviewed By: NickGerleman

Differential Revision: D70200854

fbshipit-source-id: cbdd3746be4d43d320bb0f708cc1a790c010218b
2025-02-25 20:39:07 -08:00
Mateo Guzmán 0f12f99d6c Make SurfaceHandlerBinding internal (#49677)
Summary:
As part of the initiative to reduce the public API surface, this class can be internalized. I've checked there are [no relevant OSS usages](https://github.com/search?type=code&q=NOT+is%3Afork+NOT+org%3Afacebook+NOT+repo%3Areact-native-tvos%2Freact-native-tvos+NOT+repo%3Anuagoz%2Freact-native+NOT+repo%3A2lambda123%2Freact-native+NOT+repo%3Abeanchips%2Ffacebookreactnative+NOT+repo%3AfabOnReact%2Freact-native-notes+NOT+user%3Ahuntie+NOT+user%3Acortinico+NOT+repo%3AMaxdev18%2Fpowersync_app+NOT+repo%3Acarter-0%2Finstagram-decompiled+NOT+repo%3Am0mosenpai%2Finstadamn+NOT+repo%3AA-Star100%2FA-Star100-AUG2-2024+NOT+repo%3Alclnrd%2Fdetox-scrollview-reproductible+NOT+repo%3ADionisisChytiris%2FWorldWiseTrivia_Main+NOT+repo%3Apast3l%2Fhi2+NOT+repo%3AoneDotpy%2FCaribouQuest+NOT+repo%3Abejayoharen%2Fdailytodo+NOT+repo%3Amolangning%2Freversing-discord+NOT+repo%3AScottPrzy%2Freact-native+NOT+repo%3Agabrieldonadel%2Freact-native-visionos+NOT+repo%3AGabriel2308%2FTestes-Soft+NOT+repo%3Adawnzs03%2FflakyBuild+NOT+repo%3Acga2351%2Fcode+NOT+repo%3Astreeg%2Ftcc+NOT+repo%3Asoftware-mansion-labs%2Freact-native-swiftui+NOT+repo%3Apkcsecurity%2Fdecompiled-lightbulb+com.facebook.react.fabric.SurfaceHandlerBinding).

## Changelog:

[INTERNAL] - Make com.facebook.react.fabric.SurfaceHandlerBinding internal

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

Test Plan:
```bash
yarn test-android
yarn android
```

Reviewed By: mdvacca

Differential Revision: D70208973

Pulled By: arushikesarwani94

fbshipit-source-id: 12b548e97db27cdb1750c54ad52b8e656fa39446
2025-02-25 19:45:52 -08:00
Joe Vilches 375817402a Fix import lint in TextProps.js (#49675)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49675

tsia, lint warning

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D70189154

fbshipit-source-id: 6b4c18d6f677195c2a966c850165c44c72110bbb
2025-02-25 18:06:28 -08:00
Rubén Norte 52fb1dc3c7 Move definition of public instances to ReactNativePrivateInterface (#32446)
Summary:
## Summary

> [!NOTE]
> This only modifies types, so shouldn't have an impact at runtime.

Some time ago we moved some type definitions from React to React Native
in #26437.

This continues making progress on that so values that are created by
React Native and passed to the React renderer (in this case public
instances) are actually defined in React Native and not in React.

This will allow us to modify the definition of some of these types
without having to make changes in the React repository (in the short
term, we want to refactor PublicInstance from an object to an interface,
and then modify that interface to add all the new DOM methods).

## How did you test this change?

Manually synced `ReactNativeTypes` on top of
https://github.com/facebook/react-native/pull/49602 and verified Flow
passes.

DiffTrain build for [9dd378ff1222335ff133bab2d61001fcc84a1c56](https://github.com/facebook/react/commit/9dd378ff1222335ff133bab2d61001fcc84a1c56)

Reviewed By: poteto

Differential Revision: D70091830

fbshipit-source-id: 2cc49d8ed89e8ee2531dbc4094ef9720fc3040ad
2025-02-25 17:57:17 -08:00
Rubén Norte 3cd7359750 Suppress Flow errors that will be introduced by React sync
Summary: Changelog: [internal]

Reviewed By: huntie

Differential Revision: D70178780

fbshipit-source-id: 68a67a5fc3277df44a6ffffcc8989cd18fc4b83e
2025-02-25 17:57:17 -08:00
David Vacca 5019a2ec17 Fix lints and small refactor on sync events (#49679)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49679

Fix lints and small refactor on sync events

changelog: [internal] internal

Reviewed By: mlord93

Differential Revision: D70196311

fbshipit-source-id: c4c3280b7f58f09073f084b71dbbb9ae66d71e67
2025-02-25 16:59:03 -08:00
David Vacca 8b4bba8305 Mark SynchronousEventReceiver as UnstableReactNativeAPI (#49678)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49678

In this diff I'm undeprecating SynchronousEventReceiver and marking it as UnstableReactNativeAPI, to properly describe the status of this API.

changelog: [internal] internal

Reviewed By: mlord93

Differential Revision: D70193235

fbshipit-source-id: c4818c89eecef135e9e1f82d35e7f1e2d46b1637
2025-02-25 16:59:03 -08:00
Sam Zhou 61890fe864 Cleanup uses of internal Flow types (#49683)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49683

Use of these types will trigger `[internal-type]` error in the next version of Flow. This diff cleans them up ahead of the time.

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D70202028

fbshipit-source-id: 97b7217040b63514f20888fb20c86596235a82a6
2025-02-25 15:29:36 -08:00
Sam Zhou 7c2687ecc2 Eliminate usage of global React types in ReactNativeTypes.js (#32330)
Summary:
DiffTrain build for [70f1d766e8ae7ca3701193abb8c8a9f2fdbdaa9d](https://github.com/facebook/react/commit/70f1d766e8ae7ca3701193abb8c8a9f2fdbdaa9d)

bypass-github-export-checks

Reviewed By: rubennorte

Differential Revision: D69932024

fbshipit-source-id: 21a5973848c91373d2f528a88350fd04e998a4d2
2025-02-25 09:37:21 -08:00
Dawid Małecki 7856ef8409 Add Image and ImageBackground to buildTypes and align Flow with TS defs (#49659)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49659

Changelog:
[Internal] - Added Image and ImageBackground to buildTypes and aligned Flow with TS defs

Reviewed By: huntie

Differential Revision: D70099485

fbshipit-source-id: 6000fc7099a4f811c451a08c4d5cf505d84ec0c9
2025-02-25 09:12:52 -08:00
Samuel Susla 659004f16b add a flag to control if RCTTurboModuleManager._turboModuleManagerDelegateMutex is used (#49632)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49632

changelog: [internal]

Add gating to experiment with removal of `_turboModuleManagerDelegateMutex`.

# Why remove _turboModuleManagerDelegateMutex?
- It is not consistently used in the class. Here is a case where access to _delegate is not protected by the mutex: https://fburl.com/code/9tay04fn
- From inspecting individual implementations of RCTTurboModuleManagerDelegates, it is not needed to synchronise access.
- It may lead to deadlocks under following conditions:
  - **A)** JavaScript thread gets hold of the `_turboModuleManagerDelegateMutex` and then tries to dispatch a block on the main thread synchronously (calling `RCTUnsafeExecuteOnMainQueueSync`). For example, when a new native module is created lazily because JavaScript used it and the native module requires main thread setup.-
  - **B)** The main thread tries to get hold of `_turboModuleManagerDelegateMutex` when it is creating a native module ([[RCTModuleRegistry moduleForName:lazilyLoadIfNecessary:]](https://fburl.com/code/lioi5zei)) from Obj-C.

Reviewed By: javache, cipolleschi

Differential Revision: D70087779

fbshipit-source-id: 1780b2f48537dd578260a96f8f498dbe11529689
2025-02-25 07:00:21 -08:00
Mateo Guzmán dcd103e122 Migrate ProgressiveStringDecoder to Kotlin (#49149)
Summary:
Migrate com.facebook.react.modules.network.ProgressiveStringDecoder to Kotlin

## Changelog:

[INTERNAL]- Migrate com.facebook.react.modules.network.ProgressiveStringDecoder to Kotlin

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

Test Plan:
```bash
yarn test-android
yarn android
```

Reviewed By: cortinico

Differential Revision: D69114070

Pulled By: rshest

fbshipit-source-id: 9f6bfc606be0236fb64216f47d8945c73faf1d1f
2025-02-25 06:59:00 -08:00
Mateo Guzmán f7f3253998 Add ProgressResponseBody test cases (#48675)
Summary:
The class is still in Java and also lacks of some tests so adding them to make it safer to migrate or for future refactors.

## Changelog:

[INTERNAL]  - Add `ProgressResponseBodyTest` test cases

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

Test Plan:
```bash
yarn test-android
```

Reviewed By: alanleedev

Differential Revision: D68205423

Pulled By: rshest

fbshipit-source-id: edb1dcf4da34377b7b1dcfc68a6e08861421964b
2025-02-25 06:34:40 -08:00
Vitali Zaidman 05e94848bb report proxy idle state in heartbeat events (#49635)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49635

Changelog:
[General][Internal] - report proxy idle state in heartbeat events

The proxy is considered Idle if it didn't receive any messages for 10 seconds.

Reviewed By: robhogan

Differential Revision: D70078637

fbshipit-source-id: 5b8d9a3a6e3e2568e40b3ada0a41e76b277fe66d
2025-02-25 06:29:08 -08:00