Commit Graph

38536 Commits

Author SHA1 Message Date
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
Sam Zhou 785249d05b Use builtin libdefs from flow-typed (#49702)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49702

In the next version of Flow, we will stop bundling many of the builtin libdefs, and they have been moved to flow-typed. This diff checks in them to prepare for the deployment of the next version of Flow.

Changelog: [Internal]

Reviewed By: alexmckenley

Differential Revision: D70256694

fbshipit-source-id: 44e0772cc982add44723c252ea547a9cea0641e6
2025-02-26 10:55:54 -08:00
Riccardo Cipolleschi 9e64099df6 Cleanup script and move the index to release (#49666)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49666

This change moves the index.js file to the `releases` folder, giving it a meaningful name.

It also rename the prebuild folder to ios-prebuild to be more descriptive.

It finally removes the old scripts that this refactoring supersedes.

bypass-github-export-checks

## Changelog:

[INTERNAL] - Move the infdex.js to the prepare-ios-prebuilds script.

Reviewed By: cortinico

Differential Revision: D70176043

fbshipit-source-id: e0c3f3bd53adf97fa388c37a746d274fd678f690
2025-02-26 08:19:39 -08:00
Christian Falch 8b984ca2c4 Glue all the scripts together. (#49671)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49671

This change refactors the script to prebuild ios dependencies by adding a script that glues all the steps together.

bypass-github-export-checks

## Changelog:

[INTERNAL] - Add script to orchestrate all the steps

Test Plan:
Tested in this `AppDelegate.mm`:

Imports:

```obj-c
#import "AppDelegate.h"
#import <glog/logging.h>
#import <double-conversion.h>
#include <fmt/core.h>
#include <boost/assert.hpp>
#include <fast_float/fast_float.h>
#include <string>
#import <SocketRocket/SRWebSocket.h>
```

Code:
```obj-c
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  std::string input = "3.1416 xyz ";
  double_conversion::DoubleToStringConverter::EcmaScriptConverter();
  LOG(INFO) << "Hello from GLOG";
  fmt::print("Hello, world from FMT!\n");
  BOOST_ASSERT(100 == 100);
  double result;
  fast_float::from_chars(input.data(), input.data() + input.size(), result);
  LOG(INFO) << "Answer :" << result;

  NSArray *frameworks = [NSBundle allFrameworks];

  for (NSBundle *framework in frameworks) {
    NSString *frameworkName = framework.bundleURL.lastPathComponent;
    if ([frameworkName isEqualToString: @"ReactNativeDependencies.framework"]) {
      NSBundle *bundle = [NSBundle bundleWithURL:[framework bundleURL]];
      NSURL *bundleURL = [bundle URLForResource:@"ReactNativeDependencies_glog" withExtension:@"bundle"];
      NSBundle *resourceBundle = [NSBundle bundleWithURL:bundleURL];
      NSURL* url = [resourceBundle URLForResource:@"PrivacyInfo" withExtension:@"xcprivacy"];
      if (url == nil) {
        throw [NSException exceptionWithName:@"ResourceNotFoundException"
                                       reason:@"Could not find PrivacyInfo.xcprivacy in ReactNativeDependencies_glog bundle"
                                     userInfo:nil];
      }
      break;
    }
  }
  return YES;
}
```

Reviewed By: cortinico

Differential Revision: D70175842

Pulled By: cipolleschi

fbshipit-source-id: e4bb4ad5d12e7ceaaca0eeee7ce6dc7269aa7bad
2025-02-26 08:19:39 -08:00
Christian Falch 2fdb6c9832 Refactor compose-framework script (#49665)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49665

This change refactors the script to prebuild ios dependencies by factoring out the code that creates the XCFrameworks

bypass-github-export-checks

## Changelog:

[INTERNAL] - Factor out flow types, constants and gitignore

Test Plan:
Tested in this `AppDelegate.mm`:

Imports:

```obj-c
#import "AppDelegate.h"
#import <glog/logging.h>
#import <double-conversion.h>
#include <fmt/core.h>
#include <boost/assert.hpp>
#include <fast_float/fast_float.h>
#include <string>
#import <SocketRocket/SRWebSocket.h>
```

Code:
```obj-c
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  std::string input = "3.1416 xyz ";
  double_conversion::DoubleToStringConverter::EcmaScriptConverter();
  LOG(INFO) << "Hello from GLOG";
  fmt::print("Hello, world from FMT!\n");
  BOOST_ASSERT(100 == 100);
  double result;
  fast_float::from_chars(input.data(), input.data() + input.size(), result);
  LOG(INFO) << "Answer :" << result;

  NSArray *frameworks = [NSBundle allFrameworks];

  for (NSBundle *framework in frameworks) {
    NSString *frameworkName = framework.bundleURL.lastPathComponent;
    if ([frameworkName isEqualToString: @"ReactNativeDependencies.framework"]) {
      NSBundle *bundle = [NSBundle bundleWithURL:[framework bundleURL]];
      NSURL *bundleURL = [bundle URLForResource:@"ReactNativeDependencies_glog" withExtension:@"bundle"];
      NSBundle *resourceBundle = [NSBundle bundleWithURL:bundleURL];
      NSURL* url = [resourceBundle URLForResource:@"PrivacyInfo" withExtension:@"xcprivacy"];
      if (url == nil) {
        throw [NSException exceptionWithName:@"ResourceNotFoundException"
                                       reason:@"Could not find PrivacyInfo.xcprivacy in ReactNativeDependencies_glog bundle"
                                     userInfo:nil];
      }
      break;
    }
  }
  return YES;
}
```

Reviewed By: cortinico

Differential Revision: D70175797

Pulled By: cipolleschi

fbshipit-source-id: 8eb07fd3ff9f309d5f6e4b55156c5d5cbbd41235
2025-02-26 08:19:39 -08:00
Christian Falch 1cf751ed58 Refactor build script (#49669)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49669

This change refactors the script to prebuild ios dependencies by factoring out the script that builds the frameworks

bypass-github-export-checks

## Changelog:

[INTERNAL] - Factor out the script to build the frameworks.

Test Plan:
Tested in this `AppDelegate.mm`:

Imports:

```obj-c
#import "AppDelegate.h"
#import <glog/logging.h>
#import <double-conversion.h>
#include <fmt/core.h>
#include <boost/assert.hpp>
#include <fast_float/fast_float.h>
#include <string>
#import <SocketRocket/SRWebSocket.h>
```

Code:
```obj-c
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  std::string input = "3.1416 xyz ";
  double_conversion::DoubleToStringConverter::EcmaScriptConverter();
  LOG(INFO) << "Hello from GLOG";
  fmt::print("Hello, world from FMT!\n");
  BOOST_ASSERT(100 == 100);
  double result;
  fast_float::from_chars(input.data(), input.data() + input.size(), result);
  LOG(INFO) << "Answer :" << result;

  NSArray *frameworks = [NSBundle allFrameworks];

  for (NSBundle *framework in frameworks) {
    NSString *frameworkName = framework.bundleURL.lastPathComponent;
    if ([frameworkName isEqualToString: @"ReactNativeDependencies.framework"]) {
      NSBundle *bundle = [NSBundle bundleWithURL:[framework bundleURL]];
      NSURL *bundleURL = [bundle URLForResource:@"ReactNativeDependencies_glog" withExtension:@"bundle"];
      NSBundle *resourceBundle = [NSBundle bundleWithURL:bundleURL];
      NSURL* url = [resourceBundle URLForResource:@"PrivacyInfo" withExtension:@"xcprivacy"];
      if (url == nil) {
        throw [NSException exceptionWithName:@"ResourceNotFoundException"
                                       reason:@"Could not find PrivacyInfo.xcprivacy in ReactNativeDependencies_glog bundle"
                                     userInfo:nil];
      }
      break;
    }
  }
  return YES;
}
```

Reviewed By: cortinico

Differential Revision: D70175778

Pulled By: cipolleschi

fbshipit-source-id: 987ea8922ab566c6601a77084226df2b6456243f
2025-02-26 08:19:39 -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
Christian Falch 7aa5df32a4 Refactor setupDependencies script (#49670)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49670

This change refactors the script to prebuild ios dependencies by factoring out the code that setups native dependencies.

bypass-github-export-checks

## Changelog:

[INTERNAL] - Factor out code to setup native dependencies

Test Plan:
Tested in this `AppDelegate.mm`:

Imports:

```obj-c
#import "AppDelegate.h"
#import <glog/logging.h>
#import <double-conversion.h>
#include <fmt/core.h>
#include <boost/assert.hpp>
#include <fast_float/fast_float.h>
#include <string>
#import <SocketRocket/SRWebSocket.h>
```

Code:
```obj-c
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  std::string input = "3.1416 xyz ";
  double_conversion::DoubleToStringConverter::EcmaScriptConverter();
  LOG(INFO) << "Hello from GLOG";
  fmt::print("Hello, world from FMT!\n");
  BOOST_ASSERT(100 == 100);
  double result;
  fast_float::from_chars(input.data(), input.data() + input.size(), result);
  LOG(INFO) << "Answer :" << result;

  NSArray *frameworks = [NSBundle allFrameworks];

  for (NSBundle *framework in frameworks) {
    NSString *frameworkName = framework.bundleURL.lastPathComponent;
    if ([frameworkName isEqualToString: @"ReactNativeDependencies.framework"]) {
      NSBundle *bundle = [NSBundle bundleWithURL:[framework bundleURL]];
      NSURL *bundleURL = [bundle URLForResource:@"ReactNativeDependencies_glog" withExtension:@"bundle"];
      NSBundle *resourceBundle = [NSBundle bundleWithURL:bundleURL];
      NSURL* url = [resourceBundle URLForResource:@"PrivacyInfo" withExtension:@"xcprivacy"];
      if (url == nil) {
        throw [NSException exceptionWithName:@"ResourceNotFoundException"
                                       reason:@"Could not find PrivacyInfo.xcprivacy in ReactNativeDependencies_glog bundle"
                                     userInfo:nil];
      }
      break;
    }
  }
  return YES;
}
```

Reviewed By: cortinico

Differential Revision: D70175729

Pulled By: cipolleschi

fbshipit-source-id: 4e1c19b5482b4335ab66c2b605abcb9db47091d3
2025-02-26 08:19:39 -08:00
Christian Falch 339b0b5653 Add utils: CLI arg validation and folders utils (#49668)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49668

This change refactors the script to prebuild ios dependencies by:
- factoring out CLI validation in a separate file
- factoring out the folder utilities in a separate file

bypass-github-export-checks

## Changelog:

[INTERNAL] - Factor out CLI and folder utilities

Test Plan:
Tested in this `AppDelegate.mm`:

Imports:

```obj-c
#import "AppDelegate.h"
#import <glog/logging.h>
#import <double-conversion.h>
#include <fmt/core.h>
#include <boost/assert.hpp>
#include <fast_float/fast_float.h>
#include <string>
#import <SocketRocket/SRWebSocket.h>
```

Code:
```obj-c
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  std::string input = "3.1416 xyz ";
  double_conversion::DoubleToStringConverter::EcmaScriptConverter();
  LOG(INFO) << "Hello from GLOG";
  fmt::print("Hello, world from FMT!\n");
  BOOST_ASSERT(100 == 100);
  double result;
  fast_float::from_chars(input.data(), input.data() + input.size(), result);
  LOG(INFO) << "Answer :" << result;

  NSArray *frameworks = [NSBundle allFrameworks];

  for (NSBundle *framework in frameworks) {
    NSString *frameworkName = framework.bundleURL.lastPathComponent;
    if ([frameworkName isEqualToString: @"ReactNativeDependencies.framework"]) {
      NSBundle *bundle = [NSBundle bundleWithURL:[framework bundleURL]];
      NSURL *bundleURL = [bundle URLForResource:@"ReactNativeDependencies_glog" withExtension:@"bundle"];
      NSBundle *resourceBundle = [NSBundle bundleWithURL:bundleURL];
      NSURL* url = [resourceBundle URLForResource:@"PrivacyInfo" withExtension:@"xcprivacy"];
      if (url == nil) {
        throw [NSException exceptionWithName:@"ResourceNotFoundException"
                                       reason:@"Could not find PrivacyInfo.xcprivacy in ReactNativeDependencies_glog bundle"
                                     userInfo:nil];
      }
      break;
    }
  }
  return YES;
}
```

Reviewed By: cortinico

Differential Revision: D70175663

Pulled By: cipolleschi

fbshipit-source-id: 5c6653aed7054658c5e265675766a28415da3918
2025-02-26 08:19:39 -08:00
Christian Falch 6eac2bd5b9 Configure all the third party dependencies we need (#49667)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49667

This change refactors the script to prebuild ios dependencies by extracting all the dependencies' configurations in a separate file

bypass-github-export-checks

## Changelog:

[INTERNAL] - Factor out all the dependencies configurations in a separate file

Test Plan:
Tested in this `AppDelegate.mm`:

Imports:

```obj-c
#import "AppDelegate.h"
#import <glog/logging.h>
#import <double-conversion.h>
#include <fmt/core.h>
#include <boost/assert.hpp>
#include <fast_float/fast_float.h>
#include <string>
#import <SocketRocket/SRWebSocket.h>
```

Code:
```obj-c
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  std::string input = "3.1416 xyz ";
  double_conversion::DoubleToStringConverter::EcmaScriptConverter();
  LOG(INFO) << "Hello from GLOG";
  fmt::print("Hello, world from FMT!\n");
  BOOST_ASSERT(100 == 100);
  double result;
  fast_float::from_chars(input.data(), input.data() + input.size(), result);
  LOG(INFO) << "Answer :" << result;

  NSArray *frameworks = [NSBundle allFrameworks];

  for (NSBundle *framework in frameworks) {
    NSString *frameworkName = framework.bundleURL.lastPathComponent;
    if ([frameworkName isEqualToString: @"ReactNativeDependencies.framework"]) {
      NSBundle *bundle = [NSBundle bundleWithURL:[framework bundleURL]];
      NSURL *bundleURL = [bundle URLForResource:@"ReactNativeDependencies_glog" withExtension:@"bundle"];
      NSBundle *resourceBundle = [NSBundle bundleWithURL:bundleURL];
      NSURL* url = [resourceBundle URLForResource:@"PrivacyInfo" withExtension:@"xcprivacy"];
      if (url == nil) {
        throw [NSException exceptionWithName:@"ResourceNotFoundException"
                                       reason:@"Could not find PrivacyInfo.xcprivacy in ReactNativeDependencies_glog bundle"
                                     userInfo:nil];
      }
      break;
    }
  }
  return YES;
}
```

Reviewed By: cortinico

Differential Revision: D70175499

Pulled By: cipolleschi

fbshipit-source-id: c0eacb831e6551d39956c9835d15ab8d9e91d8f2
2025-02-26 08:19:39 -08:00
Christian Falch a860c55f38 Extract Flow types and constants (#49614)
Summary:
This change refactors the script to prebuild ios dependencies by:
- factoring out the constants
- factoring out the flow type definitions
- factoring out the .gitignore

bypass-github-export-check

## Changelog:

[INTERNAL] - Factor out flow types, constants and gitignore

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

Test Plan:
Tested in this `AppDelegate.mm`:

Imports:

```obj-c
#import "AppDelegate.h"
#import <glog/logging.h>
#import <double-conversion.h>
#include <fmt/core.h>
#include <boost/assert.hpp>
#include <fast_float/fast_float.h>
#include <string>
#import <SocketRocket/SRWebSocket.h>
```

Code:
```obj-c
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  std::string input = "3.1416 xyz ";
  double_conversion::DoubleToStringConverter::EcmaScriptConverter();
  LOG(INFO) << "Hello from GLOG";
  fmt::print("Hello, world from FMT!\n");
  BOOST_ASSERT(100 == 100);
  double result;
  fast_float::from_chars(input.data(), input.data() + input.size(), result);
  LOG(INFO) << "Answer :" << result;

  NSArray *frameworks = [NSBundle allFrameworks];

  for (NSBundle *framework in frameworks) {
    NSString *frameworkName = framework.bundleURL.lastPathComponent;
    if ([frameworkName isEqualToString: @"ReactNativeDependencies.framework"]) {
      NSBundle *bundle = [NSBundle bundleWithURL:[framework bundleURL]];
      NSURL *bundleURL = [bundle URLForResource:@"ReactNativeDependencies_glog" withExtension:@"bundle"];
      NSBundle *resourceBundle = [NSBundle bundleWithURL:bundleURL];
      NSURL* url = [resourceBundle URLForResource:@"PrivacyInfo" withExtension:@"xcprivacy"];
      if (url == nil) {
        throw [NSException exceptionWithName:@"ResourceNotFoundException"
                                       reason:@"Could not find PrivacyInfo.xcprivacy in ReactNativeDependencies_glog bundle"
                                     userInfo:nil];
      }
      break;
    }
  }
  return YES;
}
```

Reviewed By: cortinico

Differential Revision: D70172536

Pulled By: cipolleschi

fbshipit-source-id: 91589693fd24e2b0d6d67759fb9fbc86841f4d13
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
Nicola Corti 1fd3806ee9 Bump Node 18 -> 20 to build React Native in OSS (#49658)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49658

This bumps the version of Node that we use to build React Native from 18 to 20.
We'll still be supporting building with 20, but we'll moving our toolchain to Node 20 becuase 18 is at EOL soon.

Changelog:
[General] [Changed] - Bump Node 18 -> 20 to build React Native in OSS

Reviewed By: javache, cipolleschi

Differential Revision: D70168003

fbshipit-source-id: b64ee583b2d2e72d25393119ae9e9029a74d5b13
2025-02-26 04:08:12 -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
Iwo Plaza 9d92b277bf Optional post-transform pipeline for .d.ts files generated by build-types script (#49634)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49634

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D69992512

fbshipit-source-id: 7fc004e9460498de236a833aea5265a5fac5f490
2025-02-26 03:06:57 -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