Commit Graph

38536 Commits

Author SHA1 Message Date
Riccardo Cipolleschi 70c3b2dcff Fix release scripts to check npm packages (#49788)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49788

Release of 0.78 was successful but it failed to verify the package of NPM because of some error in the JS files.

Preparing for 0.79, I discovered some other issues in the NPM checking scripts.

This change should fix them.

## Changelog:
[Internal] - Fix publishing scripts

Reviewed By: fabriziocucci

Differential Revision: D70489717

fbshipit-source-id: 02a37d9a86fe108c7f7d2d634b8c0727dabb153d
2025-03-03 06:54:54 -08:00
Nicola Corti cee63397bf Remove unnecessary -Wno-error=cpp (#49746)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49746

This flag is no longer necessary since RN 0.73 so I'm cleaning it up.

Changelog:
[Internal] [Changed] -

Reviewed By: rshest

Differential Revision: D70386741

fbshipit-source-id: c2c8f998fa7b97985396b26345cfcf3474effc7b
2025-03-03 06:52:22 -08:00
Ruslan Lesiutin 81e490164f Update debugger-frontend from 3adf51a...97e9912 (#49784)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49784

Changelog: [Internal] - Update `react-native/debugger-frontend` from 3adf51a...97e9912

Resyncs `react-native/debugger-frontend` from GitHub - see `rn-chrome-devtools-frontend` [changelog](https://github.com/facebookexperimental/rn-chrome-devtools-frontend/compare/3adf51aa915c2deb26f5d373751a15b4d0c8f259...97e9912605ce73b06f67fc607c1a5c434a67d6de).

Reviewed By: huntie

Differential Revision: D70487787

fbshipit-source-id: 6f3b47a254f45b770798ff3af8ade1c9a6d7fc64
2025-03-03 06:08:30 -08:00
Oskar Kwaśniewski 515ff1e626 fix: return nullptr when USE_THIRD_PARTY_JSC is set to true (#49781)
Summary:
When setting `USE_THIRD_PARTY_JSC=1`, we don't return anything from createJSRuntimeFactory function:

![CleanShot 2025-03-03 at 13 05 24@2x](https://github.com/user-attachments/assets/090ca47a-77f8-4a1b-9171-79b5e4ce91fb)

It's meant to be overwritten, but we must satisfy the compiler.

## Changelog:

[IOS] [FIXED] - return nullptr when USE_THIRD_PARTY_JSC is set to true

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

Test Plan: CI Green

Reviewed By: cortinico

Differential Revision: D70486837

Pulled By: cipolleschi

fbshipit-source-id: c09622f75608dc203d41167fc375a000a2f12e37
2025-03-03 06:01:23 -08:00
Saad Najmi 6bc5ddea3e fix: avoid race condition crash in [RCTDataRequestHandler invalidate] (#49705)
Summary:
Upstreaming a fix by ntre that fixes a crash we saw internally related to `[_queue cancelAllOperations]`.

>Calling [_queue cancelAllOperations] will release all references to any active operations.
>If the blocks of those operations have a reference to itself, it will result in dangling pointers, which could conceptually trigger a later crash if there's a race between the operation completing and it being pulled out of the queue.
>
>Add explicit strong reference while block is running.
>For good measure, fix same pattern also in RCTFileRequestHandler.
>
>Note: separately, that this code is passing the op itself as a requestToken to [delegate URLRequest:] methods is suspect. That delegate can retain said token.

## Changelog:

[IOS] [FIXED] - avoid race condition crash in [RCTDataRequestHandler invalidate]

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

Test Plan: Tested internally, we no longer saw the crash after this fix.

Reviewed By: javache

Differential Revision: D70314889

Pulled By: cipolleschi

fbshipit-source-id: ebcecb4675bd1dda3d9ee60d69967feb4e05e11b
2025-03-03 05:58:07 -08:00
Jakub Piasecki 13ac1a9a88 Align FlatList types with OSS (#49713)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49713

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D70317013

fbshipit-source-id: f131cb204135a2a41aa7d3bafe13fc7b44446036
2025-03-03 04:06:39 -08:00
Dawid Małecki 569c01e141 Add Text to buildTypes and align Flow with TS (#49774)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49774

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

Reviewed By: huntie

Differential Revision: D70324061

fbshipit-source-id: 2a032317acdc0a119f5d33da86a40461f8c60ab1
2025-03-03 04:02:18 -08:00
Alex Hunt 2acb407562 Update references to relocated react-native-devtools-frontend repo (#49777)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49777

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D70485084

fbshipit-source-id: d6243b3bc607af39c67c3f1cebdf0b53a3502538
2025-03-03 03:49:04 -08:00
Oskar Kwaśniewski ae7bbe06c9 fix: make React Native work without AppDelegate window property (#49748)
Summary:
This PR makes React Native not relying on the `window` property in AppDelegate. When running in SwiftUI lifecycle mode / SceneDelegate mode there is window property on AppDelegate. This PR fixes crashes that happen because RN asserts window property is there.

## Changelog:

[IOS] [FIXED] - make React Native work without AppDelegate window property

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

Test Plan: CI Green

Reviewed By: javache

Differential Revision: D70389691

Pulled By: cipolleschi

fbshipit-source-id: fe39f123b47014ba91a080239ccd298192c92a6a
2025-03-03 03:47:46 -08:00
Riccardo Cipolleschi 7ccb1e1fb0 Avoid the creation of separate folders for separate artifacts (#49760)
Summary:
When downloading artifacts using a pattern, GHA, by default, creates a folder for each artifacts and copies the artifacts in that folder.
This breaks the maven publishing which expects the artifacts in the `artifact` folder and not i a subfolder.

The `merge-multiple` option allow for the artifacts to be downloaded in the specified folder, without the extra folder in the path

## Changelog:
[Internal] - Avoid the creation of intermediate folder when downloading the artifacts

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

Test Plan:
GHA

<img width="791" alt="Screenshot 2025-03-02 at 11 08 33" src="https://github.com/user-attachments/assets/cfc85b27-117f-4d21-97ef-67493615a5a1" />

Reviewed By: fabriziocucci

Differential Revision: D70462254

Pulled By: cipolleschi

fbshipit-source-id: ed310a90bcdea55e466d4d71942a25abc6e6986a
2025-03-03 02:10:15 -08:00
Vitali Zaidman 21c85ef52d batch debug logging for cdp messages (#49726)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49726

The `InspectorProxy` debug logging became incredibly spammy making it almost unuseful unless the output is manipulated so this commit batches all these cdp messages and only desplays how many were received in the span of 5s. If no messages are received, the throttle is not triggered.

To get the actual CDP messages logged, we still log these to `Metro:InspectorProxyCDPMessages`.

Changelog:
[General][Internal] batch debug logging for cdp messages

Reviewed By: robhogan

Differential Revision: D70324724

fbshipit-source-id: a269302f52e18af6c4be651758c042596abdbad8
2025-03-03 01:49:39 -08:00
Riccardo Cipolleschi 42a7c62a6a Ensure that the artifacts have the right extension (#49755)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49755

The artifacts are uploaded without the .tar.gz extension and the gradle script fails to upload them to sonatype.

This change adds the extensions.

## Changelog:
[Internal] -

Reviewed By: sammy-SC

Differential Revision: D70443149

fbshipit-source-id: c16d1842688b82ac216ffb90ecf2b75f562cca64
2025-03-01 13:05:59 -08:00
Riccardo Cipolleschi 0bb6243550 Compress xcframework to let sonatype sign it (#49753)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49753

Sonatype cannot sign folders. It needs a file to be signed.
To make it happen, we are compressing the xcframeworks and the dSYM with tar, and we are uploading those files instead of the folders

I also observed that the cache keys were not computed correctly, so I'm fixing them.

## Changelog:
[Internal] - use tar.gz instad of folders for dSYM and xcframeworks

Reviewed By: bvanderhoof, mofeiZ

Differential Revision: D70409314

fbshipit-source-id: 20a5ee4f24b644f4f087974ad6b0831d5769b1d9
2025-02-28 14:00:43 -08:00
Riccardo Cipolleschi 33c0112b63 Configure gradle to publish RNDependencies to Maven (#49749)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49749

This change configures gradle and CI to properly publish the RNDependencies artifacts to Maven Central

## Changelog
[Internal] - Configure gradle to publish on Maven Central

Reviewed By: cortinico

Differential Revision: D70390191

fbshipit-source-id: fc1e1070325240584cb07fb17e58118c4c583fa9
2025-02-28 09:05:37 -08:00
Riccardo Cipolleschi c99b2a4854 Connect the prebuild-ios workflow with other workflows (#49731)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49731

This change runs the prebuilds in all the workflows we need:
- test-all
- nightlies
- create-release

## Changelog:
[Internal] - connect the rebuild-ios workflow with the other workflows

Reviewed By: cortinico

Differential Revision: D70331579

fbshipit-source-id: 6505a32672d43d06e29e68d37bd0ceff21bd7386
2025-02-28 09:05:37 -08:00
Riccardo Cipolleschi 2ff0220c8e Add job to build the XCFramework for ios prebuilds (#49563)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49563

This change introduces a job to prebuild iOS XCFrameworks.

## Changelog:
[Internal] - Create prepare artifacts workflows

Reviewed By: cortinico

Differential Revision: D69924325

fbshipit-source-id: f2241b1db715ae7c42ce32eda55a54efa6985a9d
2025-02-28 09:05:37 -08:00
Riccardo Cipolleschi da88bf0030 Add job to build the slices for ios prebuilds (#49528)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49528

This change introduces a job to prebuild iOS slices.

## Changelog:
[Internal] - Create prepare artifacts workflows

Reviewed By: cortinico

Differential Revision: D69855542

fbshipit-source-id: 54d5b24b55f9e7bebdbb201073524dc4f3748e07
2025-02-28 09:05:37 -08:00
Riccardo Cipolleschi 3c03e2b9f5 Add prepare prebuild reusable workflow (#49530)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49530

This change introduces the workflow to prebuild iOS artifacts.

This will be a reusable workflow, so we can then call it as it is from test-all, nightlies and publish-release

## Changelog:
[Internal] - Create prepare artifacts workflows

Reviewed By: cortinico

Differential Revision: D69854568

fbshipit-source-id: 5dc532fa564fe7e0987ba5d133da42e04237c3cc
2025-02-28 09:05:37 -08:00
Jakub Piasecki 167a1a30da Improve text measurement for multiline TextInput on iOS (#49711)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49711

Changelog: [IOS][CHANGED] - Moved workaround for multiline text measurement with `maximumNumberOfLines` earlier in the pipeline

Reviewed By: huntie

Differential Revision: D70314397

fbshipit-source-id: ef7dbf0c4bb3d5053328d81b7d5b8208e92ee7f5
2025-02-28 07:52:03 -08:00
Samuel Susla 2b93377a9c add e2e test for AppState module (#49680)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49680

changelog: [internal]

add an end to end test for AppState module.

Reviewed By: rshest

Differential Revision: D70184850

fbshipit-source-id: ead1388ceb1018e7615e50f846f3c95224be97d0
2025-02-28 07:41:47 -08:00
Iwo Plaza 5fc2484440 Align useAnimatedValue with OSS types (#49643)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49643

## Motivation
Modernising the RN codebase to allow for modern Flow tooling to process it.

## This diff
Aligns `useAnimatedValue.js` with its manual .d.ts types.

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D70096210

fbshipit-source-id: c3cd517eccf1cb68400772ddde6e5891861c927d
2025-02-28 06:33:21 -08:00
Vitali Zaidman 0289e4061e fix race condition in getPages test for device disconnection (#49741)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49741

While the test delay `PAGES_POLLING_DELAY` is usually enough to be equal to `PAGES_POLLING_INTERVAL`, in some cases we need extra time to sync that with the polling in `Devices.js`.

Changelog:
[General][Internal] - fix test

Reviewed By: huntie

Differential Revision: D70384823

fbshipit-source-id: ccb18884d32dc27636dbbb3a9786412056f90830
2025-02-28 06:24:03 -08:00
Rubén Norte 84a1211773 Strip all "bom" types that are actually not defined in RN (#49730)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49730

Changelog: [internal]

This removes all the types from "bom" that are actually not implemented in RN. For now, we're just stripping whole interfaces and not looking into specific methods/properties in interfaces that we do implement but not 100%.

`Performance`, `PerformanceObserver`, `MutationObserver` and `IntersectionObserver` are implemented but not stable yet, so they aren't exposed as globals in the types.

Reviewed By: huntie

Differential Revision: D70329185

fbshipit-source-id: 63bac619e100ca66b41df071df80dfa73d0f9651
2025-02-28 05:58:45 -08:00
Rubén Norte 52713eeff3 Refactor IntersectionObserver, MutationObserver and PerformanceObserver options as interfaces (#49737)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49737

Changelog: [internal]

Just a minor change to align with similar other option bags and TypeScript definitions.

Reviewed By: huntie

Differential Revision: D70355669

fbshipit-source-id: 37c44338c7b358eb2d25e8a14c75a78545b34bf1
2025-02-28 05:58:45 -08:00
Rubén Norte eb877cba39 Remove references to service workers in RN globals (#49727)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49727

Changelog: [internal]

React Native doesn't define or use Service Workers, so this entire section for types is unnecessary.

Reviewed By: cortinico

Differential Revision: D70327703

fbshipit-source-id: b998eade21d19ed124824cb255a37cb9e805d151
2025-02-28 05:58:45 -08:00
Rubén Norte e808011b26 Move environment types (globals) from flow-typed/environment to src/types (#49724)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49724

Changelog: [internal]

This moves the type definitions for the globals defined by React Native from the repository root to the `react-native` package, in the same directory as the existing TypeScript definitions. This will make it easier for end users to configure the globals from RN using the right source of truth.

Reviewed By: huntie

Differential Revision: D70322032

fbshipit-source-id: 932df75ded0c254f2acb32e865cbbb9474c94159
2025-02-28 05:58:45 -08:00
Jakub Piasecki be59427448 Align ProgressBarAndroid types with OSS (#49663)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49663

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D70176068

fbshipit-source-id: 0a1febb390affc2a3123e49e88b039b390a34387
2025-02-28 05:46:48 -08:00
Iwo Plaza 42cea2dc9c (reattempt) Use implicit namespace to better align Animated module with OSS types (#49685)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49685

## Motivation
Modernising the RN codebase to allow for modern Flow tooling to process it.

## This diff
Renames `Animated.js` to `AnimatedExports.js`, and introduces an intermediate file that reexports `* as Animated` as a default. This should have equivalent runtime behavior, but allows for a common interface file: `Animated.js.flow` to reinterpret the module as having single exports. TypeScript treats this as a namespace.

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D70237239

fbshipit-source-id: f552490cb6bb721c6163272689ec9b6c68386574
2025-02-28 05:03:55 -08:00
Nicola Corti c4e952ea84 Temporarily disable Configuration Caching on CI (#49742)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49742

Seems like publishing jobs are not happy with Gradle Config Caching.
I'm disabling it for now till we find out what's the root cause.

Changelog:
[Internal] [Changed] -

Reviewed By: cipolleschi

Differential Revision: D70385662

fbshipit-source-id: 532c46ea1e578bab5f3e5d6814a7f7193e67a7ad
2025-02-28 04:25:58 -08:00
Dawid Małecki 8919fc3243 Set optional ref on View and split View Props (#49725)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49725

Changelog:
[Internal] - Set optional ref on View and split View Props

Reviewed By: huntie

Differential Revision: D70327820

fbshipit-source-id: 2021125b0aff1497df50c2be73c2ecfc7e8f1157
2025-02-28 01:15:07 -08:00
Shawn Dempsey d0a101fbea Add guard for custom module provider lookup in TMManager (#49738)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49738

**Context**

- D70012142 added TM module provider support
- This was causing RN MacOS to silently fail to load any platform modules since it didn't implement the delegate method

Changelog:
[iOS][Fixed] - Add guard for custom module provider lookup in TMManager

Reviewed By: sbuggay

Differential Revision: D70357542

fbshipit-source-id: 5b338616655ecb84cdb3c60e243fdb99444af657
2025-02-27 18:41:41 -08:00
generatedunixname89002005232357 587d849c23 Revert D70200854
Summary:
This diff reverts D70200854
To revert for S494669

#bypass-github-export-checks
bypass-github-export-checks

Reviewed By: NickGerleman

Differential Revision: D70347605

fbshipit-source-id: 454cb0a8f5a7562cd6602c32f4978b129821730c
2025-02-27 15:42:38 -08:00
Joe Vilches 144f44f653 Reorder the contents in ReactAccessibilityDelegate.java to be more logical (#49735)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49735

I always get confused when I open this file. One of the main reasons is the order of contents is quite random, so I decided to reorder things. I tried to find a style guide on this but the [google ones](https://google.github.io/styleguide/javaguide.html#s3.4.2-ordering-class-contents) really just say do something that is logical so...

In general what I did was

* All instance variables, class variables, class constants, etc. are at the top of the class
* The constructor, `setDelegate`, `resetDelegate` methods are at the top of the class since these all deal with creating or destroying instances of this class
* Nested enums towards the bottom of the class so they are not in the way of people trying to reason about the methods and other contents (they are quite long)
* Delete random extra spaces / unneeded comments
* Move some private methods to be closer to the public methods that call them

Changelog: [Internal]

Reviewed By: mlord93

Differential Revision: D70345882

fbshipit-source-id: a8425c7b90c5d4fbea5ee5daa3c4ff9f7f189ce5
2025-02-27 15:38:15 -08:00
Jorge Cabiedes Acosta 19c18eb995 Add prerelease staging API for Android (#49649)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49649

- Added a new template to React Native's Feature Flag's script for Canary and Experimental prerelease stages
- Added a parameter to `DefaultNewArchitectureEntryPoint.kt` to select prerelease stage

Changelog: [Android] [Added] - On `DefaultNewArchitectureEntryPoint` class add property to specify the desired release level for an application

Reviewed By: rubennorte, mdvacca

Differential Revision: D69412971

fbshipit-source-id: 1a76ac723e1e06b40aad5910604e0384b208d3a5
2025-02-27 12:38:03 -08:00
David Vacca ee7514cf49 Ensure Synchronous events are always dispatched from the UIThread (#49732)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49732

Ensure Synchronous events are always dispatched from the UIThread

changelog: [internal] internal

Reviewed By: lunaleaps, NickGerleman

Differential Revision: D70203460

fbshipit-source-id: 04fa02ae731bce579a231052e5ed7953852f61bc
2025-02-27 11:08:01 -08:00
Ruslan Lesiutin 8698ecad18 Emit synthetic Trace Events for non-bridgeless to fix trace representation (#49729)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49729

# Changelog: [Internal]

The only data source for non-bridgeless setup is JavaScript samples.

Chrome DevTools frontend is built around an assumption that thread should have at least single timeline or user timing event to be represented on a timeline view. They do it for filtering out unnecessary workers threads and other.

We will emit 2 synthetic Trace Events that should cover these requirements and recorded traces that contain only JavaScript samples should now be displayed correctly.

This is where trace bounds are calculated - https://github.com/facebookexperimental/rn-chrome-devtools-frontend/blob/3adf51aa915c2deb26f5d373751a15b4d0c8f259/front_end/models/trace/handlers/MetaHandler.ts#L169-L173

Reviewed By: huntie

Differential Revision: D70328681

fbshipit-source-id: 8eca0017d85de9ecbfb49074b439d5c4fee4aa56
2025-02-27 10:38:38 -08:00
Oskar Kwaśniewski 13177b3025 feat: warn about jsc moving to a separate repo (#49692)
Summary:
> [!NOTE]
> This PR is part of JavaScriptCore Extraction to this repository: https://github.com/react-native-community/javascriptcore

This PR warns about JavaScriptCore being moved in the postinstall phase:

![CleanShot 2025-02-26 at 13 35 54@2x](https://github.com/user-attachments/assets/f392f7a3-fb8b-4089-9375-2d88ba4cb60b)

as well as in the build logs:

![CleanShot 2025-02-26 at 13 35 45@2x](https://github.com/user-attachments/assets/481e44f2-c30e-43f2-8cbc-5006959a42fc)

## Changelog:

[IOS] [ADDED] - Inform users about JSC being moved to a different repo

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

Test Plan: CI Grene

Reviewed By: huntie

Differential Revision: D70321201

Pulled By: cipolleschi

fbshipit-source-id: 1a97f3bceb57079f0e63848745c1a973b6dd614d
2025-02-27 10:32:25 -08:00
Nick Lefever ed106640c3 Rename fantom_internal_flags pragma to fantom_react_fb_flags (#49728)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49728

See title.

Resolving https://www.internalfb.com/diff/D70242739?dst_version_fbid=1295747645054627&transaction_fbid=1285615715828636

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D70328653

fbshipit-source-id: c3e7377760f53bc37d1a6f3e25a0053e12d4f66e
2025-02-27 09:50:45 -08:00
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
Alex Taylor (alta) daed8e2f8c Deploy 0.262.0 to xplat (#49708)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49708

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D70277654

fbshipit-source-id: e215e392aa6e06181f2df03ce8b9b873807f3b86
2025-02-27 08:55:49 -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