Commit Graph

36819 Commits

Author SHA1 Message Date
Christian Falch e447e9aea7 [ios][prebuild] simplify logging in prebuild scripts
To reduce reduntant code by repeating the logging functionality in each JS module, this commit introduces a factory for creating a logger with a given prefix.

- Create factory `createLogger`
- Remove redundant log implementations
- Changed to use factory in hermes.js and ios-prebuild.js
2025-05-22 12:00:12 +02:00
Christian Falch 2dc20c5dc7 [ios][prebuild] fix wrong directory in hermes prebuild check
When checking if we should download hermes artifacts, the path to the folder we're checking was wrong, causing hermes to always be downloaded.

This commit fixes this by renaming it from `Libraries` -> `Library`
2025-05-22 11:52:07 +02:00
Christian Falch 554dbce652 [ios][prebuild] add missing React-RCTSettings
Added missing module React-RCTSettings to the Swift package.

This was found when testing intergrating with a bare bones React Native project.
2025-05-22 08:34:48 +02:00
Luna Wei b8a4fb2a4d Add docs about react flags and debugging (#51521)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51521

Changelog: [Internal] - Add docs about react flags and debugging

Reviewed By: lenaic

Differential Revision: D75152355

fbshipit-source-id: 4ef69d036e8b70a3903ba2d2dbda6530b1893d2b
2025-05-21 23:11:25 -07:00
generatedunixname89002005232357 089621ebbe Revert D65085733 (#51520)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51520
Changelog: [Internal] - revert Intersection Observer `root` due to bug

Reviewed By: lunaleaps

Differential Revision: D75186289

fbshipit-source-id: d644b1ef3261996596af6a243076f7172d500167
2025-05-21 21:08:11 -07:00
Panos Vekris 50ca7e5730 manual annotations in preparation of natural inference rollout in react-native, tools, etc.
Summary:
The Flow team is improving the way Flow infers type for primitive literals. This diff prepares the codebase for the new behavior by adding type annotations, or annotations of the form `'abc' as const`.

Changelog: [internal]

Reviewed By: marcoww6

Differential Revision: D75188179

fbshipit-source-id: be50990f23f79cf2d8dae7576af5190218adcafe
2025-05-21 20:06:46 -07:00
Yannick Loriot 12ced22f70 Improve error messages when enum members are missing (#51502)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51502

While working on a case for Editor on mac, it took me a while to figure out what enum was the root cause:

 {F1978470518}

Adding the blaming enum name in the error message would have made my life much easier.

## Changelog:

[GENERAL][Added] - Improve error messages when enum members are missing

Reviewed By: rshest

Differential Revision: D75141414

fbshipit-source-id: 3625d817b218788891252add225f8fffb99e3145
2025-05-21 14:31:25 -07:00
Jiawei Lü 5489e18abc Revert D74892330: Use HighResTimeStamp
Differential Revision:
D74892330

Original commit changeset: 514ca23dde8e

Original Phabricator Diff: D74892330

fbshipit-source-id: e7e2a778fb12ad5214217d3efb48c9f74dfb80f3
2025-05-21 14:12:16 -07:00
Jiawei Lü 65ef8fe6b8 Revert D72649815: Replace DOMHighResTimeStamp alias in ReactCommon with new abstractions
Differential Revision:
D72649815

Original commit changeset: 96bcfaf909d4

Original Phabricator Diff: D72649815

fbshipit-source-id: 491579e20fed41f0f31639f51d6051022ae9de55
2025-05-21 14:12:16 -07:00
Jiawei Lü cbfa2ecc9a Revert D75006354: Remove JSExecutor::performanceNow()
Differential Revision:
D75006354

Original commit changeset: d41bf73238e9

Original Phabricator Diff: D75006354

fbshipit-source-id: 99c60268d8d829ff87a8486b0ca67a47bfb198b4
2025-05-21 14:12:16 -07:00
Panos Vekris 1eebb5aa11 Back out "add 'as const' annotations in preparation of natural inference rollout in xplat/js [4/n]"
Summary:
Original commit changeset: 67ee5673816d

Original Phabricator Diff: D75114154

Reviewed By: SamChou19815

Differential Revision: D75161840

fbshipit-source-id: 144fc0e488154b957f4f2a549c077a2784124849
2025-05-21 12:03:51 -07:00
Ruslan Lesiutin 6e50603faa Remove JSExecutor::performanceNow() (#51481)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51481

# Changelog: [Internal]

This is replaced by `HighResTimeStamp::now()`, which is available in a dedicated smal `react/timing` module.

Reviewed By: lenaic

Differential Revision: D75006354

fbshipit-source-id: d41bf73238e9c6bf5c5a9509d60713ce11e6ea4a
2025-05-21 11:56:22 -07:00
Ruslan Lesiutin 84fa745be6 Replace DOMHighResTimeStamp alias in ReactCommon with new abstractions (#50585)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50585

# Changelog: [Internal]

Replaces `DOMHighResTimeStamp` alias completely in `ReactCommon` with `HighResTimeStamp`.

`DOMHighResTimeStamp` as a type is now expected to be used only in JavaScript.

I didn't update places where we explcitly use `std::chrono::high_resolution_clock`, since it is platform-specific and there is no guarantee that `std::chrono::high_resolution_clock` == `std::chrono::steady_clock`.

Also, places that are isolated and not part of the Web Performance APIs, such as Telemetry for Fabric, are not updates as part of this diff. Although these subsystems are also using `std::chrono::steady_clock` as a low-level representation, they are not sharing it with other parts of the React Native core.

Reviewed By: rubennorte

Differential Revision: D72649815

fbshipit-source-id: 96bcfaf909d4a7a5bb2ecfdd76f9939f1645fb69
2025-05-21 11:56:22 -07:00
Ruslan Lesiutin 0ec36c4073 Use HighResTimeStamp (#51454)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51454

# Changelog: [Internal]

There are multiple changes:
1. `PerformanceTracer` class, `TraceEvent` struct are moved to `tracing` namespace. These are parts of the Tracing subsystems of the jsinspector, this should bring more clarity and make things more explicit.
2. Added `Timing.h` class which defines conversion logic from `HighResTimeStamp` to absolute units that are expected by CDP.
3. `PerformanceTracer` will receive timestamps for Performance Web API entries in `HighResTimeStamp`.

Also, we will explicilty define a Tracking Clock time origin that will be epoch of the `steady_clock`. This aligns with the approach in Chromium and saves us from aligning custom DOMHighResTimeStamps that can be specified in performance.mark / performance.measure calls: these should not extend the timeline window. I've confirmed that this is the current behavior in Chromium.

Reviewed By: rubennorte

Differential Revision: D74892330

fbshipit-source-id: 514ca23dde8e23fbe07faf673e765674f328f60e
2025-05-21 11:56:22 -07:00
Ruslan Lesiutin 53ae567488 Add toChronoSteadyClockTimePoint and fromChronoSteadyClockTimePoint converters (#51455)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51455

# Changelog: [Internal]

The main idea is that subsystems who might use a different time origin (the starting point of the whole timeline of events), can use `toChronoSteadyClockTimePoint` method to get raw `std::chrono::steady_clock::time_point` and then offset it by some arbitrary epoch: be it unix time origin or `std::chrono::steady_clock::epoch`.

`fromChronoSteadyClockTimePoint` can be used to convert time stamps from external systems, like Hermes.

Reviewed By: rubennorte

Differential Revision: D74892329

fbshipit-source-id: 70f34ce99aead6e0552d87d310c4d6ea4653b8fe
2025-05-21 11:56:22 -07:00
David Vacca f44a0da019 Mark ReactRawTextManager as @LegacyArchitecture (#51506)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51506

ReactRawTextManager is not used in new architecture, this diff marks it as so

changelog: [internal] internal

Reviewed By: mlord93, cortinico

Differential Revision: D75150100

fbshipit-source-id: 868420e87dc80185d5a51299736ce2ed6a855fe9
2025-05-21 11:36:38 -07:00
Panos Vekris 2a068c6559 add 'as const' annotations in preparation of natural inference rollout in xplat/js [4/n] (#51488)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51488

The Flow team is improving the way Flow infers type for primitive literals.
Announcement: https://fb.workplace.com/groups/flowlang/permalink/1725180268087629/

This diff prepares the codebase for the new behavior by codemoding `as const` annotations.

## Repro steps

1/ Used steps in D73610163 to produce the code changes.

2/ Reverted files where `flow` errored:
```
flow status --show-all-errors > errors.log
node ~/fbsource/fbcode/flow/facebook/error-analyzer.js errors.log |
  awk -F':' '{ print $1 }' | sort -u | grep -v 'Total Error Count' |
  xargs hg revert --rev .
```

3/ Reverted files that did not improve error count in new Flow mode
```
# Run Flow before change
~/fbsource/fbcode/flow/facebook/flowd status --show-all-errors > errors-0.log
# Run Flow after change
~/fbsource/fbcode/flow/facebook/flowd status --show-all-errors > errors-1.log

# Compute error counts before and after
node ~/fbsource/fbcode/flow/facebook/error-analyzer.js errors-0.log | sort > errors-counts-0.log
node ~/fbsource/fbcode/flow/facebook/error-analyzer.js errors-1.log | sort > errors-counts-1.log

# Revert files with no change in error count
comm -12 errors-counts-0.log errors-counts-1.log | awk -F':' '{ print $1 }' | xargs hg revert --rev .~1
```

## Note to code owners

Due to the large number of errors involved in this rollout, adding `as const` was the most feasible large-scale automated solution. Ideally, a lot of these errors would be fixed by adding other appropriate type annotations. For example instead of annotating
```
type Shape = {type: 'circle', radius: number} | {type: 'square', side: number} | ...;
type ShapeKind = 'circle' | 'square' | 'triangle';
const circle = {
  type: "circle" as const,  // <-- annotation added here
  radius: 42,
};
shape.type as ShapeKind;
takesShape(circle);
```
a more appropriate annotation would be
```
const circle: Circle = { type: "circle"; radius: 42 };
...
```

Changelog: [Internal]

drop-conflicts

Reviewed By: SamChou19815

Differential Revision: D75114154

fbshipit-source-id: 67ee5673816da9625431e2a2466a1e0038386151
2025-05-21 08:42:30 -07:00
Ruslan Lesiutin 380dd59e80 Disable DevSupport for Profiling builds with Fusebox (#51495)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51495

# Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D75140274

fbshipit-source-id: 5793c3ec02282391c1d2aaa5e5c735ddb88cd889
2025-05-21 08:33:33 -07:00
Panos Vekris 5250b59ee2 manual annotations in preparation of natural inference rollout in xplat/js (#51487)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51487

The Flow team is improving the way Flow infers type for primitive literals. This diff prepares the codebase for the new behavior by adding type annotations, or annotations of the form `'abc' as const`.

Changelog: [internal]

Reviewed By: SamChou19815

Differential Revision: D75114156

fbshipit-source-id: e3175af85cdd2388c3b45af4beb314f334e3f9b5
2025-05-21 07:07:18 -07:00
Vitali Zaidman 9af86ab25b renamed CDPMessagesLogging to CdpDebugLogging (#51471)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51471

Changelog: [Internal] renamed CDPMessagesLogging to CdpDebugLogging

Reviewed By: robhogan

Differential Revision: D75062639

fbshipit-source-id: d5c51375ffe1f7275bc48cea514319ac97fe81d4
2025-05-21 06:53:25 -07:00
Vitali Zaidman c97853aeb1 log large cdp messages
Summary:
Running with
```
DEBUG=Metro:InspectorProxy DEV=1 js1 run --no-tty-print
```
When a message larger than 100kb is send over the cdp, log it.

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D75000887

fbshipit-source-id: 6f426ed4db7ac1996c4f26461a6e0d13c096e5cd
2025-05-21 06:53:25 -07:00
Riccardo Cipolleschi 36df97f500 Stop testing JSC (#51475)
Summary:
As next step of the JSC deprecation, we are removing the CI testing for the JSC engine

## Changelog:
[Internal] -

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

Test Plan: GHA

Reviewed By: NickGerleman

Differential Revision: D75089216

Pulled By: cipolleschi

fbshipit-source-id: 3839914cb58e872ddd82089bd7cb1391ddda20c1
2025-05-21 03:31:42 -07:00
Mateo Guzmán bcfa5ca474 Migrate TextAttributes to Kotlin (#51448)
Summary:
Migrate com.facebook.react.views.text.TextAttributes to Kotlin.

`TextTransform` is exposed in the `textTransform` var setter, and there doesn't seem to be a clean way to avoid having to make the `TextTransform` class public again. I have limited its companion to keep it internal as much as possible.

## Changelog:

[INTERNAL] - Migrate com.facebook.react.views.text.TextAttributes to Kotlin

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

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

Reviewed By: cortinico

Differential Revision: D74978129

Pulled By: rshest

fbshipit-source-id: ea0594f01738b8c8f4696434fe76974bbb9ff661
2025-05-21 03:25:11 -07:00
Chang Liu (RL) dc737cb909 Back out "Remove native animation fabric sync in JS and infinite animation loop workaround" (#51486)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51486

Original commit changeset: 5b313a5e8c07

Original Phabricator Diff: D74198568

Fix the issue that dropdown menus in HSR worlds menu are not clickable.

Reviewed By: xieswufe

Differential Revision: D75108344

fbshipit-source-id: d134ff9287929f8e1fc0995acf2b884d6a67131c
2025-05-20 20:58:50 -07:00
Luna Wei 3cb70bb6ad Introduce root to IntersectionObserver (#47394)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47394

## Changelog:

[General] [Added] - Support for observation `root` for Intersection Observer

Reviewed By: rubennorte

Differential Revision: D65085733

fbshipit-source-id: e67a74ace16c3f6f8ebba7eb811c1a9e0d559b0a
2025-05-20 14:20:25 -07:00
Ramanpreet Nara ff62ad1c04 Refactor RCTUnsafeExecute{On,Once}MainQueueSync utils (#51428)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51428

Just refactoring the control flow in these functions (in a separate diff). So, that the logic in subsequent diffs is easier to read: D74769326.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D74940681

fbshipit-source-id: 7aabc722948666a13993a1feff7eeca8ef1403cf
2025-05-20 14:18:57 -07:00
Tomasz Zawadzki bca7c5a553 Restore the possibility to extend LayoutAnimationController (#51479)
Summary:
In https://github.com/facebook/react-native/pull/50734, `LayoutAnimationController` was migrated to Kotlin and all of its methods are now marked as final.

However, this class is used and extended by `react-native-reanimated` in order to provide Layout Animations for Android on the Old Architecture. With all its methods being marked as final, the builds are failing.

This PR restores the possibility to extend `LayoutAnimationController`.

## Changelog:

[ANDROID] [FIXED] - Restored the possibility to extend `LayoutAnimationController`

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

Test Plan: I've checked that this PR fixes build errors caused by `LayoutAnimationController` in react-native-reanimated.

Reviewed By: cipolleschi, mdvacca

Differential Revision: D75079557

Pulled By: cortinico

fbshipit-source-id: beeb700cbad87362dda4b60941124562c4753815
2025-05-20 12:42:00 -07:00
Samuel Susla 580de87124 stop sending events to Paper if C++ Animated is enabled (#51477)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51477

changelog: [internal]

when using C++ Animated, no need to send events to Objective-C Native Animated.

Reviewed By: lenaic

Differential Revision: D75066259

fbshipit-source-id: 224d15ba2f707f2272a4fec56e5b2685694c7809
2025-05-20 11:09:47 -07:00
Rubén Norte b1e8729f4d Fix incorrect view flattening when using a specific not fully transparent color (#51379)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51379

Changelog: [General][Fixed] Fix incorrect flattening / non-rendering of views with backgroundColor set to `rgba(255, 255, 255, 127/256)`

Fixes #51378.

## Context

When testing some unrelated things with Fantom is realized that the color for some text that I wasn't explicitly defining was being set to `rgba(255, 255, 255, 127)`, like here:

https://github.com/facebook/react-native/blob/249a24ac756275eadbe3b4df1ff9c974af1671d2/packages/react-native-fantom/src/__tests__/Fantom-itest.js#L540-L542

When digging a bit more about why, I realized that was actually the value for `UndefinedColor`. When looking a bit deeper, I saw that the value for that constant was being set like this:

```
using Color = int32_t;

namespace HostPlatformColor {
static const facebook::react::Color UndefinedColor =
    std::numeric_limits<facebook::react::Color>::max();
}
```

I'm not sure what the logic could've been here:
- Defining it as a value out of bounds for all valid colors? In this case, it's a 32 bit value so all the range of values are actually valid RGBA colors.
- Defining it as a fully opaque white? Seems dangerous for a default because you wouldn't be able to distinguish a explicitly set white color from a non-set color, relevant if you're seeing a white background color in a view on top of another view with any other background color.

The result of this existing logic was actually setting `UndefinedColor` to `rgba(255, 255, 255, 127)` because the alpha channel is defined in the first bits of the value, and `Color` being a signed int with 32 bits, the largest value is `01111....1`, so extracting the first 8 bits, you get 127.

## Changes

This changes the value set for the `UndefinedColor` constant (which is used, among other things, to determine if a view sets a background color, or otherwise could potentially be flattened).

The new value, instead of white with a 127/256 opacity, is black with 0% opacity (or simply the number 0 in `int32_t`).

Reviewed By: javache

Differential Revision: D74869311

fbshipit-source-id: 5582b4803b0b5c72cb3c1b33720c4542c5e3f1de
2025-05-20 10:38:05 -07:00
Rubén Norte 6581c69e10 Fix structuredClone test and added test to clarify behavior in IntersectionObserver (#51476)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51476

Changelog: [internal]

When we added integration of IntersectionObserver in the event loop by default, we changed the timing of the observer notification:
- Before, it was scheduled synchronously from the `observe` call.  That means that, if you schedule another task immediately after the observe call, the order is IO callback then task.
- After, it was scheduled at the end of the current event loop tick. That means that, if you schedule another task immediately after the observe call, the order is task then IO callback.

This change in order wasn't accounted for in the tests for IO (which it's added here) and made a test for `structuredClone` break because it was using incorrect assumptions.

This fixes that test.

Reviewed By: rshest

Differential Revision: D75073118

fbshipit-source-id: 38ad2d03686891daf4caa836e1f597917910ddd0
2025-05-20 09:54:58 -07:00
Samuel Susla 0ac82ef83a use C++ Native Animated from JS if enabled (#51337)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51337

changelog: [internal]

When C++ Native Animated is used, we can't be using TurboModuleAnimated native module. This diff just add the check to make sure that if C++ Native Animated is used, it will be correctly referenced from JS.

Reviewed By: lenaic

Differential Revision: D74490166

fbshipit-source-id: 1b6de3227707168618052ff4ca6a02ca11337607
2025-05-20 06:48:11 -07:00
Samuel Susla 8672faef87 implement SchedulerDelegateProxy::schedulerShouldSynchronouslyUpdateViewOnUIThread (#51334)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51334

changelog: [internal]

Implement schedulerShouldSynchronouslyUpdateViewOnUIThread for C++ Native Animated. This simply passes along the data.

Reviewed By: zeyap

Differential Revision: D74739294

fbshipit-source-id: 7ef65e0b76004b9a2f6c3353169a6aa55ebeb44e
2025-05-20 06:48:11 -07:00
Samuel Susla 8d3e971baa introduce an option to drive animations with folly::dynamic (#51470)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51470

changelog: [internal]

To support C++ Native Animated and prevent unnecessary conversion between `folly::dynamic` <-> and `NSDictionary`, a method to apply `folly::dynamic` changes needs to be exposed on RCTMountingManager.

Previously I tried to change existing method `synchronouslyUpdateViewOnUIThread` to take folly::dynamic instead of `NSDictionary`. However this requires a change where we would expose C++ API to Objective-C class only, breaking build system in open source. This approach was backed out in  D74881580.

In this diff, I take an alternative approach and expose two methods to apply animation changes:
- Keep the existing API `synchronouslyUpdateViewOnUIThread` as is. This way, Objective-C Native Animated does not need to change.
- Introduce new method for `[RCTSurfacePresenter schedulerDidSynchronouslyUpdateViewOnUIThread]` which accepts `folly::dynamic`. This is used by C++ Native Animated only

Reviewed By: javache

Differential Revision: D74885607

fbshipit-source-id: 124b8800c01deeb6d57af8f4c47bea46cc1bcd66
2025-05-20 06:48:11 -07:00
Rubén Norte 4ae86e651c Enable enableIntersectionObserverEventLoopIntegration feature flag by default (#51472)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51472

Changelog: [internal]

This enables the integration of `IntersectionObserver` with the Event Loop by default.

Reviewed By: rshest, javache

Differential Revision: D74991641

fbshipit-source-id: 7f12d7d5413d12a6a7de53e9d6701195d48996dc
2025-05-20 05:40:00 -07:00
Rubén Norte 3aeba22dda Integrate IntersectionObserver in Event Loop (#51452)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51452

Changelog: [internal]

This implements a long planned refactor of `IntersectionObserver` to have a proper integration with the Event Loop, which unblocks `FragmentRef` in React Native.

The existing integration doesn't integrate with the Event Loop, so the intersection determination doesn't happen as a step in the event loop but in 2 different moments:
1. When you start observing a new target, we check if there are any pending transactions for that target, and otherwise determine the intersection immediately and queue the notifications.
2. Using mount hooks, when a transaction for a surfaceId is mounted, we check intersections for all the observers in that surface.

This has an important problem:
* If you attach a observer on a target before the target is attached to the tree (something that `FragmentRef` will start doing soon), we don't have a pending transaction so we determine intersections immediately. In that case, it's always "not visible" because it's not attached, and then we immediately trigger a transition when mounted in the same tick.

To fix this, we can implement a step in the Event Loop the same way that `IntersectionObserver` does on Web. We would still wait for pending transactions to be mounted to determine intersection timing (the same way we do now, but now checking at the end of the current Event Loop tick), but the dispatch of initial notifications for target that won't change is done at the end of the tick instead of synchronously.

It also refactors the list of active observers as a list of shared pointers to `IntersectionObserver` objects, instead of as list of `IntersectionObserver` objects directly. This is necessary to build the list of pending observers (with stable references) while making sure the ownership stays in the list of active observers.

Reviewed By: javache

Differential Revision: D74883214

fbshipit-source-id: 24accf1dba48d13b5773950a5cbf9ea38f4a1745
2025-05-20 05:40:00 -07:00
Oskar Kwaśniewski 50ce8c77a7 fix: make RCTScreenSize take horizontal orientation into account (#51444)
Summary:
This PR improves `RCTScreenSize` to handle horizontal orientations. This was causing a flicker whenever opening a Modal in horizontal orientation. Currently, `RCTScreenSize` is used to supply initial state for `ModalHostViewState`:

https://github.com/facebook/react-native/blob/f1697544cd720df21bd7dc8ca993d95a41321e3f/packages/react-native/ReactCommon/react/renderer/components/modal/ModalHostViewState.h#L31

This works great in portrait mode, but causes onLayout the be called twice in horizontal orientation (first with screen size and then with actual size..)

## Changelog:

[IOS] [FIXED] - make RCTScreenSize take horizontal orientation into account

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

Test Plan: Open modal in horizontal orientation

Reviewed By: cipolleschi

Differential Revision: D74978651

Pulled By: rshest

fbshipit-source-id: f026e727b3529766de38dd31059c51b255f33e78
2025-05-20 04:54:33 -07:00
Riccardo Cipolleschi f4250fa09e Refactor the prebuild script to use fetch instead of curl (#51398)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51398

As a followup after the comment of D74565936 (https://www.internalfb.com/diff/D74565936?dst_version_fbid=727294986523938&transaction_fbid=1121452289999956), I refactored the code to use `fetch` instead of `curl`.

## Changelog:
[Internal] - Refactor the code to use Fetch instead of curl

Reviewed By: NickGerleman

Differential Revision: D74886699

fbshipit-source-id: 843e915a5b13f420e9036c32a421d47beb5b5860
2025-05-20 04:32:46 -07:00
Christian Falch 9371e20192 fixed build type when downloading hermes artifacts (#51283)
Summary:
Hermes build-type was hardcoded to 'release' in the previous version of the prebuild scripts.

This commit fixes this so that we can provide a build-type for hermes when downloading prebuilt tarballs.

- Cleaned up parameters in hermes.js
- Updated with buildType parameter when suitable
- Fixed some function names
- Updated version file so that it contains build type
- Removed version file when using a local tarball

## Changelog:

[IOS] [FIXED] - Fixed resolving build type when downloading hermes artifacts

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

Test Plan: No test-plan yet

Reviewed By: cortinico

Differential Revision: D74882001

Pulled By: cipolleschi

fbshipit-source-id: cfeed934023712e70f7d04c137e8611164120cec
2025-05-20 04:32:46 -07:00
Christian Falch e2f6ce4ddf fixed defines in package.swift (#51284)
Summary:
Our Cocoapods config has a list of defines that are used mostly when setting up pods:

- RCT_FABRIC_ENABLED
- USE_HERMES
- RCT_AGGREGATE_PRIVACY_FILES
- RCT_NEW_ARCH_ENABLED
- APP_PATH
- REACT_NATIVE_PATH
- RCT_SKIP_CODEGEN
- SWIFT_ACTIVE_COMPILATION_CONDITIONS
- USE_FRAMEWORKS
- USE_THIRD_PARTY_JSC
- HERMES_ENABLE_DEBUGGER
- REACT_NATIVE_DEBUGGER_ENABLED
- REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY

Out of these, only the following are used in objective-c/c code:

- USE_HERMES
- HERMES_ENABLE_DEBUGGER
- REACT_NATIVE_DEBUGGER_ENABLED
- REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY

This commit adds the required defines to the correct targets.

## Changelog:

Pick one each for the category and type tags:

[IOS] [FIXED] - fixed defines in package.swift

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

Test Plan: No test-plan yet

Reviewed By: cortinico

Differential Revision: D74872272

Pulled By: cipolleschi

fbshipit-source-id: 5d9a68c1d819409bc7400ade622f62bb332d0896
2025-05-20 04:32:46 -07:00
Christian Falch ccbf878fb8 cleanup logging (#51243)
Summary:
Cleaned up logging

- Added `prebuildLog` function to harmonize output
- Reduced output from creating headers

bypass-github-export-checks

## Changelog:

[INTERNAL] [CHANGED] - cleaned up iOS-prebuild logging

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

Test Plan: No tests required.

Reviewed By: cortinico

Differential Revision: D74569484

Pulled By: cipolleschi

fbshipit-source-id: b41d336320762a6adcb82faec4e6d633c6a9a8a5
2025-05-20 04:32:46 -07:00
Christian Falch 41d2b5de0a add download/extract hermes prebuilts (#51216)
Summary:
When running the prebuild script:

`node scripts/ios-prebuild.js`

The script will now try to resolve and download a prebuilt version of hermes:

1. Hermes artifacts will be extracted to the `./build/artifacts/hermes` folder to ensure that Package.swift can find a version to link against.
2. The script checks the environment variable `HERMES_ENGINE_TARBALL_PATH` and tries do expand the tarball into the artifacts folder from 1
3. If not found, the script reads the hermes version from either the hidden environment-variable `HERMES_VERSION` and tries to download a release-tarball or a nightly tarball for this version. If the version does not exist, the script will fail.

Also added some extra logging features to the script.

bypass-github-export-checks

## Changelog:

[IOS] [ADDED] - Added downloading of hermes artifacts when pre-building for iOS.

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

Test Plan:
1. Delete the `packages/react-native/.build` folder
2. Run the build script (provide a valid HERMES_ENGINE_TARBALL_PATH or a valid Hermes version (or nightly version)
3. Verify that the script successfully exits
4. Build the Package.swift in Xcode and verify that it finds and links the relevant Hermes files, verifying is done by the build succeeding.

Reviewed By: NickGerleman

Differential Revision: D74565936

Pulled By: cipolleschi

fbshipit-source-id: 5bd231999da24cfcce446150ac0fc1b5a4b6a4ae
2025-05-20 04:32:46 -07:00
Pieter De Baets d6371bd6ac Improve naming of template args in bridging (#51418)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51418

Improve readability

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D74884371

fbshipit-source-id: 26b6966458097c8ac8d030629a1bee131418a34d
2025-05-20 03:57:43 -07:00
Mateo Guzmán 5596923189 Legacy Native Module e2e test (#51449)
Summary:
Found an issue with the legacy native module calls in old architecture (https://github.com/facebook/react-native/issues/51443) and got the idea of adding some simple e2e tests for the native modules so regressions like this can be captured moving forward.

This doesn't cover all methods, as not all of them are available for both Android and iOS, and also some of them are currently crashing, so it makes no sense to cover them all yet – but this can be used as a good starting point to increase coverage for essential APIs.

## Changelog:

[INTERNAL]  - Legacy Native Module e2e test

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

Test Plan:
```sh
cd packages/rn-tester && maestro test .maestro/legacy-native-module.yml -e APP_ID=com.facebook.react.uiapp
```

<img width="594" alt="image" src="https://github.com/user-attachments/assets/6237613d-f5dc-4d8a-9b12-0980177793eb" />

<img width="740" alt="image" src="https://github.com/user-attachments/assets/8bdef368-13ac-494c-a506-88fff01dc8d6" />

Reviewed By: cortinico

Differential Revision: D74978093

Pulled By: rshest

fbshipit-source-id: f9c7ba3ca5177eb3d3863d2b8252ac17f3d07aa0
2025-05-20 03:35:42 -07:00
React Native Bot 5d30829eb4 Add changelog for v0.80.0-rc.2 (#51463)
Summary:
Add Changelog for 0.80.0-rc.2

## Changelog:
[Internal] - Add Changelog for 0.80.0-rc.2

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

Test Plan: N/A

Reviewed By: cipolleschi

Differential Revision: D75050745

Pulled By: rshest

fbshipit-source-id: 91739212e3e646acdb33c01e65ed6fff4330cf7e
2025-05-20 03:27:32 -07:00
riteshshukla04 89e6c72fd4 Correct Link for Networking (#51396)
Summary:
I noticed the link to networking in new app screen is wrong. So correcting it here

## Changelog:
[GENERAL][FIXED] - Fix Networking URL in New app screen

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

Test Plan: Click on the link to open

Reviewed By: arushikesarwani94

Differential Revision: D74886240

Pulled By: cortinico

fbshipit-source-id: 19ccf63e64f0e40df4a0ab4082299c654926e35d
2025-05-20 03:07:42 -07:00
Krystof Woldrich 6399caef63 fix(types): Reference global.d.ts using path not types (#51104)
Summary:
After https://github.com/facebook/react-native/pull/49516 TSC would not find the global types.

Types reference expect a package name but was given a path to a declaration.

TS doc: https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html#-reference-path-

This PR changes `types` to `path` to fix the issue.

`dtslint` fails with `no-bad-reference` rule, but the `../src` lives in the same package in `react-native` package.

## Changelog:

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

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

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

[GENERAL] [FIXED] - Reference `global.d.ts` using `path` so they can be resolved by TSC

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

Test Plan:
Before the change with current RN 0.79.2 TSC would fail on resolving the global types (example from [Sentry RN SDK build](https://github.com/getsentry/sentry-react-native/commit/134d810cf95416091779806e00d3a3cc6cbace89)):

![Screenshot 2025-05-05 at 17 18 04](https://github.com/user-attachments/assets/b264c8da-aa21-49d8-9597-82586291a01a)

After the change to path TSC finds the global types.

Using TSC Version 4.9.5

Reviewed By: huntie

Differential Revision: D74208815

Pulled By: coado

fbshipit-source-id: 2fd51d79061ffb356c047604213cff7a425f167e
2025-05-20 00:52:43 -07:00
Nick Gerleman 9fe20d4ea3 Remove Measurement Placeholder Logic from Text ShadowNodes (#51465)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51465

Prior to D63303709 AttributedString could not represent formatting on an empty string, and so some text content was forcefully added to empty strings during measurement.

This is problematic in combination with Facsimile, where we directly render the layout we used during measurement, since empty text now has a random "I" in it.

Android's TextLayoutManager already knows how to interpret `baseTextAttributes`, and the placeholder is not needed. Other platforms should be updated to do the same, but that may be non-trivial to validate everywhere.

This diff removes logic from ShadowNodes to always inset a placeholder, and instead shims it in platform TextLayoutManagers which have not yet been updated to use `BaseTextAttributes`. That way, we don't force placeholders during measurement, and different platforms can incrementally unjank their code.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D74770916

fbshipit-source-id: 7cf19db1a9a5cf68137bbff81b14ce5288235b2b
2025-05-19 18:15:39 -07:00
Nick Gerleman 0cd6a29981 TextSharedExamples and empty text E2E test (#51464)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51464

Add a module of shared examples, like `TextInputSharedExamples`, to avoid copy/paste between these.

Modifies the empty test example a bit and adds an E2E test.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D74780847

fbshipit-source-id: 30c2830ef0b638680fe75b4bcf9f138f5c01e190
2025-05-19 18:15:39 -07:00
Ruslan Lesiutin ce4334233c Validate marks presense, if specified (#51389)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51389

# Changelog: [Internal]

This is the pre-requisite for the diff on top, which migrates performance-related classes to start using `HighResTimeStamp`.

We should be throwing `SyntaxError` if the specified mark name is not buffered. Like Chromium does:
 {F1978032319}

In this diff:
- `PerformanceEntryReporter::getMarkTime` is now public, ca be called by `NativePerformance` and returns `std::optional`.
- `NativePerformance` is responsible for validating that marks are present in the buffer, if their names are specified in `.measure()` call.
- Mark names take precedence over `startTime` and `endTime` values, so if they are specified and not available, then we will throw Error over `jsi` that will be catched on JavaScript side in `Performance.js`.

Reviewed By: rubennorte

Differential Revision: D74837812

fbshipit-source-id: ca2ba198c4c9e6e2d8d37f852affea667f1c174c
2025-05-19 15:24:36 -07:00
Nick Gerleman 5ac46bbb67 Fix random characters in comment in CSSTokenizer (#51417)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51417

tsia

Changelog: [Internal]

Created from CodeHub with https://fburl.com/edit-in-codehub

Reviewed By: joevilches

Differential Revision: D74837890

fbshipit-source-id: b07a30ea49c555f606dbb348c16d5c9f0a6e7b47
2025-05-19 13:58:54 -07:00