Commit Graph

32309 Commits

Author SHA1 Message Date
Nicola Corti fba47de665 Remove extra dot from close-pr.yml 2024-07-15 14:41:28 +01:00
Blake Friedman f57740c0fb Remove sampling profiler from dev menu (#45431)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45431

This build samples using the legacy format, that have to be manually downloaded and translated by the [removed](https://github.com/react-native-community/cli/commit/aca901dba88cf58a20eef6bcc4fec932e942a99a) `npx react-native-community/cli profile-hermes` command.

Changelog: [Internal][Removed] Profiler option in Catalyst's (Bridge) dev menu

Reviewed By: cortinico

Differential Revision: D59686976

fbshipit-source-id: 90a787a98c91fb398abb10ede0cb27871ca315f9
2024-07-15 06:28:47 -07:00
Riccardo Cipolleschi d2773f0c19 Factor out build-hermesc-windows in separate action (#45432)
Summary:
This change factors out the build hermesc windows job into a separate action to reuse the code in different jobs

## Changelog:
[Internal] - Factor out build hermesc windows for code reuse

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

Test Plan: GHA are green

Reviewed By: blakef

Differential Revision: D59748955

Pulled By: cipolleschi

fbshipit-source-id: bb6b96c93ec7ba6af1a210511ec672907f237b45
2024-07-15 05:50:21 -07:00
Blake Friedman 4e14c5eeab publish template on publishing release (#45327)
Summary:
Call the react-native-community/template GHA to trigger a new release when we publish a react-native release. This then waits to confirm that the package is published.

See react-native-community/template#36 for the matching change

Changelog: [General][Added] trigger template publish

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

Test Plan: Not sure on the best way forward here.

Reviewed By: cipolleschi

Differential Revision: D59467829

Pulled By: blakef

fbshipit-source-id: 091269e7ecdae5801ac7c03a1ede54452ae99b24
2024-07-15 05:35:33 -07:00
Rob Hogan 3c7e307718 jsinspector: Fix various build warnings (#45423)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45423

I noticed while fixing some CI issues that `jsinspector` emits a bunch of warnings, making finding errors (especially in CI logs) awkward.

Also fix up a couple of stale comments from earlier designs of `NetworkIOAgent`.

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D59693730

fbshipit-source-id: d032150787bda320b9c38ccf2e95139411758f47
2024-07-15 04:36:25 -07:00
Blake Friedman 9aaadd9b2e remove rnc/cli-tools version & errors deps (#45380)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45380

Removed the use of version checking and error code that is in react-native-community/cli-tools.

Changelog:
[Internal] [Changed] - Removed community-cli-plugin version & error dependencies

Reviewed By: robhogan

Differential Revision: D59378012

fbshipit-source-id: b009edc615b873ff2bff31296ac5d87a4482944f
2024-07-15 04:35:26 -07:00
Blake Friedman 6547b157b5 Remove dependency on rnc/cli-tools logger (#45381)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45381

Removing the remaining dependencies from the react-native-community/*. This
inlines a copy of the logger.

Changelog:
[Internal][Changed] Removed react-native-community/cli-tools logger dependency

Reviewed By: cipolleschi

Differential Revision: D59378011

fbshipit-source-id: ef93d9fff1c623658e33c36b6329f5d548f649e8
2024-07-15 04:35:26 -07:00
Rubén Norte c7fab53e50 Replace BridgelessJSCallInvoker with RuntimeSchedulerCallInvoker everywhere (#45409)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45409

Changelog: [internal]

This removes `BridgelessJSCallInvoker` in favor of `RuntimeSchedulerCallInvoker`. This change should be transparent when not invoking JS callbacks using priorities, as both of them would just go directly to the scheduler using `scheduleWork`, but when priorities are specified, they'd now be honored in `RuntimeSchedulerCallInvoker`.

I realized this wasn't being used when I saw that `PerformanceObserver` callbacks were always scheduled with the highest priority, instead of with idle priority as specified in code.

Reviewed By: sammy-SC

Differential Revision: D59679512

fbshipit-source-id: 51d36d56ef1ff0b34e5157ed7b5e08de0a3884d2
2024-07-15 04:25:15 -07:00
Dmitry Rykun 2eb7bcb8d9 Prepare to using setNativeProps for Fabric native animations (#45387)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45387

This diff prepares an experiment to test `setNativeProps` for syncing the final state of native driven animations with Fabric.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D59634489

fbshipit-source-id: 453c5a2f0edfea695f7564e0c5ead58db21cf61e
2024-07-13 14:34:39 -07:00
Joe Vilches 65a3259f03 Inset box shadow impl (#45337)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45337

tsia. Some things to consider when reviewing:

* Made a new drawable for inset shadows
* The drawable in this class is the same size as the view with some padding. The padding is needed for 2 reasons
  * Blur near edges looks good
  * Blur artifacts can appear inside the view if the clear region barely exits the bounds of the view
* We draw the clear shape with another drawable, which solely exists so that we can get the border box path for the adjust border. We just use this path to clip out the shadow

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D59300215

fbshipit-source-id: 30acc7aafd82122aa278a42d06418bb1079ca71f
2024-07-12 17:17:00 -07:00
David Vacca 0b20ea9b25 Fix comment in LayoutableShadowNode (#45419)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45419

EZ fix comment in LayoutableShadowNode

changelog: [internal] internal

Reviewed By: christophpurrer

Differential Revision: D59691737

fbshipit-source-id: 452c166dd478ac6796ae55434fb557355f10fae1
2024-07-12 15:52:19 -07:00
Rubén Norte 0ca3ed87f3 Fix incorrect application of idle priority in RuntimeScheduler (#45408)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45408

Changelog: [General][Fixed] Fixed prioritization of idle priority tasks

We recently found out that idle priority tasks were never scheduled with the lowest priority possible. We didn't realize before because idle priority tasks weren't used, but now they are via `requestIdleCallback` and other mechanisms.

The problem was that the timeout for idle priority tasks was `std::chrono:milliseconds::max()`, and we compute the expiration time adding that to the current time. Doing that operation is always guaranteed to overflow, and the resulting expiration time was always in the past, resulting in the task having higher priority than any other tasks with any other priorities.

Instead of using `max()` we can just use a sensible value for idle priorities. In this case, 5 minutes should be more than enough.

Reviewed By: sammy-SC

Differential Revision: D59679513

fbshipit-source-id: 6c0f9e275818737ce804f05615c01f7ea6c126ab
2024-07-12 15:51:51 -07:00
David Vacca 9d8e52b835 Serialize TransformOrigin to folly::dynamic (#45396)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45396

This diff extends TransformOrigin with a new method to serialize this Struct into a folly::dynamic map (similar to Transform)

changelog: [internal] internal

Reviewed By: sammy-SC

Differential Revision: D59613247

fbshipit-source-id: 00e4a08d1a99fe9cabb67206e21712e65b355f7f
2024-07-12 15:19:25 -07:00
David Vacca 9df4239ff9 Introduce enablePropsUpdateReconciliationAndroid feature flag (#45397)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45397

This diff introduces the new feature flag named: "enablePropsUpdateReconciliationAndroid"

changelog: [internal] internal

Reviewed By: sammy-SC

Differential Revision: D59606118

fbshipit-source-id: 1c569a82e08873bdb0443f390757b526fd17e662
2024-07-12 15:19:25 -07:00
Rob Hogan 3603a22652 Include base64 in folly dependency, unbreak CI (#45417)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45417

Add sources for `folly::detail::base64` to our existing `folly` dependency for Android and iOS OSS build toolchains, now a (tiny) dependency of the JS debugger since D54309633, and already part of Folly's Buck sources.

Changelog: [Internal]

Reviewed By: cipolleschi, blakef

Differential Revision: D59685218

fbshipit-source-id: bac33402927f310bf867d2c47b4ebbb9276cf545
2024-07-12 11:13:44 -07:00
kunal.chavhan 18d6028ff9 fix: select text on auto focus for TextInput (#45004)
Summary:
Fixes: https://github.com/facebook/react-native/issues/43413

This pull request addresses an issue on Android where the text selection was not working when both `selectTextOnFocus` and `autoFocus` were set to true on TextInput.
`ReactTextInputManager` was calling `setSelectAllOnFocus` on `ReactEditText` before its onLayout is called causing text selection to not work on auto focus.

Changes Made

- Added logic to wait for the ReactEditText view's layout to be drawn before attempting to select the text.
On the first layout pass, the code now explicitly calls selectAll() to select the text.
- Implemented a check to ensure selectAll() is only called during the first layout pass, avoiding unnecessary calls on subsequent layout passes.

Impact
This change ensures that text selection is properly triggered when selectTextOnFocus and autoFocus are both enabled, improving the user experience and making text input behavior consistent and reliable.

## Changelog:

[ANDROID] [FIXED]: fixed select text on auto focus for TextInput

<!-- 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

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

Test Plan:
| Before | After |
|--------|--------|
| ![before](https://github.com/facebook/react-native/assets/61144478/02da975a-2c80-41b9-86c1-196d0324f437) | ![after](https://github.com/facebook/react-native/assets/61144478/fbe78758-04ab-460f-8ecb-b267ed07751a) |

Reviewed By: javache

Differential Revision: D59448600

Pulled By: cortinico

fbshipit-source-id: 8a594d3193f227ba2d64b808d905bab8b3d24e9b
2024-07-12 10:49:54 -07:00
Nicola Corti 44f8b08b8d Back out "Kotlinify NativeModule" (#45411)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45411

Original commit changeset: 6e096552750e

Original Phabricator Diff: D55792976

Changelog:
[Android] [Fixed] - Reverted "[react-native] Kotlinify NativeModule"

Reviewed By: fabriziocucci

Differential Revision: D59680321

fbshipit-source-id: f118f436dc4086676d3ed98fa8d8b28033d9cd47
2024-07-12 09:14:31 -07:00
Nicola Corti cff0d97017 AGP to 8.5.1 (#45406)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45406

Just keep our Android Gradle Plugin version up to date.

Changelog:
[Internal] [Changed] - AGP to 8.5.1

Reviewed By: cipolleschi

Differential Revision: D59677574

fbshipit-source-id: 5c80391f8c357f26a9452ac5ac059ee8f5aa569c
2024-07-12 09:00:39 -07:00
Nicola Corti b82d7e100c Gradle to 8.9 (#45407)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45407

This bumps to the latest minor of Gradle

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

Reviewed By: NickGerleman

Differential Revision: D59677575

fbshipit-source-id: 05b9afc6f32a9cd11461bc04522d1e522644867e
2024-07-12 09:00:39 -07:00
Peter Abbondanzo 80a3ed7d0c Fix Android AlertFragment Title Accessibility (#45395)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45395

## Changelog:

[Android] [Fixed] - Fix AlertDialog title accessibility
Pull Request resolved: https://github.com/facebook/react-native/pull/45048

Making title accessible for android AlertFragment

Reviewed By: blavalla, susnchen

Differential Revision: D58684576

fbshipit-source-id: 83c8cfe9e7aacdf587d325d957694c3c7daa360c
2024-07-12 07:50:05 -07:00
Peter Abbondanzo bac5f1ff3a Add feature flag to enable vector drawable support (#45394)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45394

Changelog: [Internal]

The current `Image` implementation does not support loading [vector drawables](https://developer.android.com/develop/ui/views/graphics/vector-drawable-resources) on Android, and support has been requested many times ([issue](https://github.com/facebook/react-native/issues/16651), [issue](https://github.com/facebook/react-native/issues/27502)). I am proposing to put support behind this feature flag in order to validate against performance regressions. Adding support will require reading files from disk to determine if the resource is actually an XML file.

Reviewed By: cortinico

Differential Revision: D59647903

fbshipit-source-id: 2445d71b6769266abe4c2dda521cc2be89bf4064
2024-07-12 07:34:01 -07:00
Blake Friedman ab485c6a94 Fix testID propogation in Fabric (#45379)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45379

Fixes an accessibility issue where these values weren't being propogated for RCTTextInputComponentView

See facebook/react-native#38709

Changelog:
[iOS] [Fixed] - testID wasn't propogating to accessibilityIdentifier

Reviewed By: cipolleschi

Differential Revision: D59594049

fbshipit-source-id: 89ec15f92b423b6e18b1a5eb9d32fc4013c039ba
2024-07-12 06:17:42 -07:00
Rob Hogan 193cdc36f7 Implement Network.loadNetworkResource etc in C++ (#44845)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44845

## Design
 - `NetworkIOAgent` is owned by the `HostAgent`.
 - `NetworkIOAgent` is passed any CDP requests not handled by the `HostAgent` itself, and before delegating to `InstanceAgent`.
 - It handles:
   - [`Network.loadNetworkResource`](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-loadNetworkResource)
   - [`IO.read`](https://chromedevtools.github.io/devtools-protocol/tot/IO/#method-read)
   - [`IO.close`](https://chromedevtools.github.io/devtools-protocol/tot/IO/#method-close)
 - `NetworkIOAgent.loadNetworkResource` creates a `Stream` corresponding to a single resource download/upload. A reference is held in a map `streams_` until an error, the agent is disconnected (destroyed) or it is discarded by the frontend with `IO.close`.
 - `delegate.loadNetworkResource` is called with a `stream`-scoped executor, which it uses to call back with headers, data and errors.
 - Callbacks for `IO.read` requests are held by the `Stream` until the incoming data is complete or enough data is available to fill the request (an implementation choice to optimise for fewest round trips). Any incoming data or error causes any pending requests to be rechecked.

 {F1719616688}

## Unimplemented platforms
 - Platforms may optionally implement `HostTargetDelegate.networkRequest` (as of this diff, none do). If they don't we report a CDP "not implemented" error, similar to the status quo where it was unimplemented by the C++ agent.

Changelog:
[General][Added] Debugging: implement common C++ layer of CDP `Network.loadNetworkResource`

Reviewed By: motiz88

Differential Revision: D54309633

fbshipit-source-id: 51e416e9d537b253f72693952d5fd520b6ae11b6
2024-07-12 05:21:02 -07:00
Samuel Susla 7d7d403ecf add number of instructions to systrace (#45384)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45384

changelog: [internal]

add a little more information to the mounting instructions block

Reviewed By: javache, rubennorte, mdvacca

Differential Revision: D59631537

fbshipit-source-id: 140ba1834172686998c51a9645ea1e66fff1879d
2024-07-12 04:10:31 -07:00
Nick Gerleman 47261bfb79 Fix main branch iOS prerelease constant (#45398)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45398

Accidentally left in a value (that Phabricator then hid) which I was using to test fixed prerelease constants in D59141948... On real releases, this is overwritten by the version stamping process.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D59668218

fbshipit-source-id: 3d04e52db75a5d8a53cf47d3a2f88b643030d94e
2024-07-12 03:43:29 -07:00
Riccardo Cipolleschi 1568a29144 Factor out build hermesc for Linux (#45402)
Summary:
This change factors out the Build HermesC for Linux job so that we can reuse the code in various workflows

## Changelog:
[Internal] - Factor out build-hermesc-linux for code reuse

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

Test Plan: GHA are green

Reviewed By: cortinico

Differential Revision: D59673895

Pulled By: cipolleschi

fbshipit-source-id: f5c680d523866442d25317e880b4803ac89c3741
2024-07-12 03:21:39 -07:00
zhongwuzw c5b87aba7c Don't set empty string when remove ccache (#45400)
Summary:
After `pod install`, it would set some empty flags, which seems useless. cc cipolleschi .

![image](https://github.com/user-attachments/assets/fb795c61-0838-4522-a34b-cde469467b3b)

## Changelog:

[IOS] [FIXED] - Don't set empty string when remove ccache

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

Test Plan: No empty flags should be set after we exec `pod install`.

Reviewed By: cortinico

Differential Revision: D59671357

Pulled By: cipolleschi

fbshipit-source-id: 26b55da9efaeed36876649cc27f09ecafaba412a
2024-07-12 02:52:22 -07:00
Wojciech Lewicki c16761da83 feat: expose prefabs for newly added targets (#45386)
Summary:
In recent commits, some new targets have been added, and they are not exposed as prefabs, yet are used in e.g. `TextLayoutManager`. They are needed then for `react-native-live-markdown`: https://github.com/Expensify/react-native-live-markdown/pull/428/commits/c1611cd98ed5009fd66c871b9999b55941086af0

## 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
-->

[ANDROID] [ADDED] - expose prefabs for newly added targets

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

Test Plan: It cannot be tested inside the repo, but try to build the `example` app with new arch enabled on `Android` in the `react-native-live-markdown` repo to see that those are needed.

Reviewed By: NickGerleman

Differential Revision: D59638801

Pulled By: cortinico

fbshipit-source-id: 3d09507d72a0c4d3dbb3a2a81b753625230a04a3
2024-07-12 02:10:05 -07:00
Pieter De Baets b1c5432b13 Revert D59519171: 【iOS】Fixes ellipsis carries background from trimmed text
Differential Revision:
D59519171

Original commit changeset: 87c985859e98

Original Phabricator Diff: D59519171

fbshipit-source-id: 1686b8a406d1a9b163eb6ad0cb9827f5a0724e89
2024-07-12 01:47:21 -07:00
Nick Gerleman d68a1771f0 Revert D59566611: Fix Android removeClippedSubviews in horizontal ScrollView in RTL
Differential Revision:
D59566611

Original commit changeset: a2eb12b984dc

Original Phabricator Diff: D59566611

fbshipit-source-id: 144c479c264b8f1ca25a571ae73cc0db241e075d
2024-07-11 20:52:29 -07:00
Nicola Corti 3f8340975b Undo a breaking change with ResourceDrawableIdHelper.instance (#45389)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45389

This undos a breaking change with ResourceDrawableIdHelper for Kotlin consumer.
I've re-added a `getInstance` method so that Kotlin libraries won't break.
The method is added as Deprecated as those libraries need to migrate to `.instance`
accessors as more idiomatic.

Changelog:
[Android] [Fixed] - Undo a breaking change with ResourceDrawableIdHelper.instance

Reviewed By: robhogan

Differential Revision: D59638043

fbshipit-source-id: ae2aab962e9a7676f0bfbae21f699e274502dc6a
2024-07-11 14:54:13 -07:00
Nicola Corti 221755c495 Undo a breaking change with I18nUtil.instance (#45390)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45390

This undos a breaking change with I18nUtil for Kotlin consumer.
I've re-added a `getInstance` method so that Kotlin libraries won't break.
The method is added as Deprecated as those libraries need to migrate to `.instance`
accessors as more idiomatic.

Changelog:
[Android] [Fixed] - Undo a breaking change with I18nUtil.instance

Reviewed By: alanleedev

Differential Revision: D59638044

fbshipit-source-id: 1c93a98676b5b01e89be3b974961c5f3ae919511
2024-07-11 14:54:13 -07:00
Nicola Corti b24d47a9a7 Undo breaking change for ReadableMap.entryIterator for Kotlin consumers. (#45388)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45388

This undos a breaking change we're about to ship in 0.75, where Kotlin users
where forced to update this callsite to be `.getEntryIterator`.

This re-introduces a `entryIterator` val so both Kotlin and Java compatibility are retained.

Changelog:
[Android] [Fixed] - Undo breaking change for ReadableMap.entryIterator for Kotlin consumers

Reviewed By: alanleedev

Differential Revision: D59637925

fbshipit-source-id: b674df86e056f17791d9cabe28557529886f1c93
2024-07-11 14:54:13 -07:00
Nicola Corti 5e31b45fc7 Undo breaking change on Dynamic.type and Dynamic.isNull (#45378)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45378

Kotlin consumers of those APIs are forced with this breaking change:

```
# Before thanks to Java property conversion
Dynamic.type
# After
Dynamic.getType()
```
This restores the old more idiomatic API by moving those 2 funcitons to be vals.

Changelog:
[Android] [Fixed] - Undo breaking change on Dynamic.type and Dynamic.isNull

Reviewed By: javache

Differential Revision: D59631783

fbshipit-source-id: 8d720af34e104ee0e4f3120302a4a84fc17a7b1c
2024-07-11 12:19:55 -07:00
David Vacca 384983025a Introduce Systrace.beginSection with args (#45392)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45392

In this diff I'm introducing a new overload of Systrace.beginSection to receive arguments by parameter

changelog: [Android][Added] Introduce Systrace.beginSection with arguments

Reviewed By: sammy-SC

Differential Revision: D59639329

fbshipit-source-id: 23d43e5dd48fdde9c7d49a1c10fa9ecc4c3b7196
2024-07-11 12:18:06 -07:00
Pieter De Baets b1405b5a81 Cleanup enableRemoveDeleteTreeInstruction experiment (#45385)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45385

We ran various experiments with this flag, and this does not turn out to provide any significant benefits at this point to make it worth the complexity and platform divergence it introduced.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D58355433

fbshipit-source-id: 4b857a5d0b8aa5915b4a880cbcae2526a16a08a9
2024-07-11 11:19:55 -07:00
zhongwuzw fcb6cdc710 【iOS】Fixes ellipsis carries background from trimmed text (#39408)
Summary:
Fixes https://github.com/facebook/react-native/issues/37926.

## Changelog:

[IOS] [FIXED] - Fixes ellipsis carries background from trimmed text

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

Test Plan:
Demo code:
```
<Text numberOfLines={1} ellipsizeMode={'tail'}>Long text <Text style={{backgroundColor: 'red'}}>Nested text</Text></Text>
```

Before fix:
![image](https://github.com/facebook/react-native/assets/5061845/05467128-a4f9-4f81-bb22-c1085a3bc721)

After fix:
![image](https://github.com/facebook/react-native/assets/5061845/b6b024ae-5329-47d3-a07c-1ba089802edd)

Reviewed By: cipolleschi

Differential Revision: D59519171

Pulled By: javache

fbshipit-source-id: 87c985859e9892fd2e4d6bb3d62b08627247df70
2024-07-11 08:46:26 -07:00
Pieter De Baets c4a6bbc8fd Do eager native module init on mqt_native thread (#45324)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45324

Improve concurrency during startup of bridgeless by concurrently initializing eager native modules and triggering bundle load.

Changelog: [Android][Changed] Modules marked with needsEagerInit = true will now be created on the mqt_native thread.

Reviewed By: mdvacca

Differential Revision: D59465977

fbshipit-source-id: 55cc0f0359bafcf32dc538f4346c6a5d5546f658
2024-07-11 07:47:10 -07:00
Nicola Corti 2ea9c360dc Undo breaking change on getJsCallInvokerHolder (#45376)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45376

This reduces one breaking change users are seeing on `CatalystInstance.getJsCallInvokerHolder`.
I had to specify:

```
Suppress("INAPPLICABLE_JVM_NAME")
get:JvmName("getJSCallInvokerHolder")
```

as the Kotlin compiler is unhappy with me setting a JvmName on a interface property.
More on this here: https://youtrack.jetbrains.com/issue/KT-31420

Changelog:
[Android] [Fixed] - Undo breaking change on `CatalystInstance.getJsCallInvokerHolder`

Reviewed By: javache

Differential Revision: D59631640

fbshipit-source-id: 4d5b3499e4e0e0bec1d380c4b7942ea28ae35465
2024-07-11 07:45:55 -07:00
Samuel Susla 33262c1717 remove gating for prevent double measure flag (#45375)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45375

changelog: [internal]

this is shipped, let's remove gating.

Reviewed By: javache

Differential Revision: D59585030

fbshipit-source-id: 05c76099c27010a7e2e2167c5af5bb5346a00f47
2024-07-11 05:26:27 -07:00
Riccardo Cipolleschi 6e2ba742ff Factor out the CXX language standard in a separate const (#45374)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45374

This change factors out the language standard in a separate constant so we can easily control it from a single place.

There are only 2 exception to this:
1. hermes-engine: the podspec is used in CI and it has no access to the rct_cxx_language_standard variable
2. Yoga: it can be used as a separate pod, outside of React Native, so it makes sense to leave it alone.

This change also fixes a problem where, in some setup, the language was set to C++14

## Changelog
[Internal] - Refactor Cxx language standard in a single constant

Reviewed By: dmytrorykun, blakef

Differential Revision: D59629061

fbshipit-source-id: 41eac64e47c14e239d8ee78bd88ea30af244d695
2024-07-11 05:25:38 -07:00
Pieter De Baets 2455a84db8 Simplify Java TurboModule lookup (#45322)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45322

Instead of using multiple weak_ptr and weak_ref, use a single weak_ref to the Java object and use that to get back to the original C++ instance, without the need for additional shared_ptr.

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D59465976

fbshipit-source-id: d410bdacf21a1886c6ed95d2c57ac8c6e17428e3
2024-07-11 04:48:18 -07:00
Riccardo Cipolleschi 7b424f090a Factor out build hermes Macos (#45371)
Summary:
Factor out the build-hermes-macos job to reuse the code

## Changelog:
[Internal] - Factor out build hermes macos action

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

Test Plan: GHA are green

Reviewed By: blakef

Differential Revision: D59627977

Pulled By: cipolleschi

fbshipit-source-id: 84226d8a2c036f816fa8ea949b467873a7eef37c
2024-07-11 03:50:15 -07:00
Miklós Fazekas 3782511350 fix: android autolinkLibrariesFromCommand should handle timeout or non zero exit code (#45333)
Summary:
Fixes: https://github.com/facebook/react-native/issues/45307

## Changelog:

[Android] [Fixed] - if `npx react-native-community/cli config` fails or timeouts proper error is shown and built is aborted, instead of leaving and empty autolinking.json

During build `npx react-native-community/cli config` is generated into autolinking.json. When command fails, we should error and should not leave and empty `autolinking.json`

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

Test Plan:
Output of the reproducer in https://github.com/facebook/react-native/issues/45307 looks like this:

```log
android % ./gradlew assembleDebug
Starting a Gradle Daemon (subsequent builds will be faster)
ERROR: autolinkLibrariesFromCommand: Failed to create /Users/boga/Work/OSS/RNMBGL/rn-fabric-boolattribute/ReproducerApp/android/build/generated/autolinking/autolinking.json - process npx react-native-community/cli config  exited with error code: 126

FAILURE: Build failed with an exception.

* Where:
Settings file '/Users/boga/Work/OSS/RNMBGL/rn-fabric-boolattribute/ReproducerApp/android/settings.gradle' line: 3

* What went wrong:
A problem occurred evaluating settings 'android'.
> ERROR: autolinkLibrariesFromCommand: Failed to create /Users/boga/Work/OSS/RNMBGL/rn-fabric-boolattribute/ReproducerApp/android/build/generated/autolinking/autolinking.json - process npx react-native-community/cli config  exited with error code: 126

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 10s
8 actionable tasks: 4 executed, 4 up-to-date
```

Output if you modify the package.json to be invalid looks like this:

```log
android % ./gradlew assembleDebug
ERROR: autolinkLibrariesFromCommand: process npx react-native-community/cli config  exited with error code: 1
JSONError: JSON Error in /Users/boga/Work/OSS/RNMBGL/rn-fabric-boolattribute/ReproducerApp/package.json:

  35 |     "node": ">=18"
  36 |   },
> 37 |   SOMETHING_NON_JSON
     |   ^
  38 |   "packageManager": "yarn@3.6.4",
  39 |   "resolutions": {
  40 |     "rtn-centered-text": "portal:../RTNCenteredText"

Unexpected token "S" (0x53) in JSON at position 1019 while parsing near "...ode\": \">=18\"\n  },\n  SOMETHING_NON_JSON\n ..."

  35 |     "node": ">=18"
  36 |   },
> 37 |   SOMETHING_NON_JSON
     |   ^
  38 |   "packageManager": "yarn@3.6.4",
  39 |   "resolutions": {
  40 |     "rtn-centered-text": "portal:../RTNCenteredText"

    at parseJson (/Users/boga/Work/OSS/RNMBGL/rn-fabric-boolattribute/ReproducerApp/node_modules/parse-json/index.js:29:21)
    at loadJson (/Users/boga/Work/OSS/RNMBGL/rn-fabric-boolattribute/ReproducerApp/node_modules/react-native-community/cli-config/node_modules/cosmiconfig/dist/loaders.js:48:16)
    at #loadConfiguration (/Users/boga/Work/OSS/RNMBGL/rn-fabric-boolattribute/ReproducerApp/node_modules/react-native-community/cli-config/node_modules/cosmiconfig/dist/ExplorerSync.js:116:36)
    at #loadConfigFileWithImports (/Users/boga/Work/OSS/RNMBGL/rn-fabric-boolattribute/ReproducerApp/node_modules/react-native-community/cli-config/node_modules/cosmiconfig/dist/ExplorerSync.js:87:54)
    at #readConfiguration (/Users/boga/Work/OSS/RNMBGL/rn-fabric-boolattribute/ReproducerApp/node_modules/react-native-community/cli-config/node_modules/cosmiconfig/dist/ExplorerSync.js:84:82)
    at search (/Users/boga/Work/OSS/RNMBGL/rn-fabric-boolattribute/ReproducerApp/node_modules/react-native-community/cli-config/node_modules/cosmiconfig/dist/ExplorerSync.js:50:63)
    at emplace (/Users/boga/Work/OSS/RNMBGL/rn-fabric-boolattribute/ReproducerApp/node_modules/react-native-community/cli-config/node_modules/cosmiconfig/dist/util.js:36:20)
    at ExplorerSync.search (/Users/boga/Work/OSS/RNMBGL/rn-fabric-boolattribute/ReproducerApp/node_modules/react-native-community/cli-config/node_modules/cosmiconfig/dist/ExplorerSync.js:78:42)
    at getUserDefinedOptionsFromMetaConfig (/Users/boga/Work/OSS/RNMBGL/rn-fabric-boolattribute/ReproducerApp/node_modules/react-native-community/cli-config/node_modules/cosmiconfig/dist/index.js:32:37)
    at mergeOptionsBase (/Users/boga/Work/OSS/RNMBGL/rn-fabric-boolattribute/ReproducerApp/node_modules/react-native-community/cli-config/node_modules/cosmiconfig/dist/index.js:60:31)

FAILURE: Build failed with an exception.

* Where:
Settings file '/Users/boga/Work/OSS/RNMBGL/rn-fabric-boolattribute/ReproducerApp/android/settings.gradle' line: 3

* What went wrong:
A problem occurred evaluating settings 'android'.
> ERROR: autolinkLibrariesFromCommand: process npx react-native-community/cli config  exited with error code: 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 2s
8 actionable tasks: 4 executed, 4 up-to-date
```

Reviewed By: cipolleschi

Differential Revision: D59582430

Pulled By: cortinico

fbshipit-source-id: bedb9563175cc5c46f5af80cf309769e56b803cc
2024-07-11 03:43:23 -07:00
Nick Gerleman 52dc7a8326 Make ReactImageView use standardized background drawing code (#45366)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45366

This updates ReactImageView to share the background drawing and clipping code used by other built-in components. This means manipulating a background drawable, and clippping at draw time, instead of using Fresco hierarchy background (in view foreground), and radii which manipulate the underlying bitmap.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D59495407

fbshipit-source-id: ce3c975e5ed323fa3d4610ec1515ef3c8dd8b2d1
2024-07-11 02:58:36 -07:00
Nick Gerleman ea6928fcb9 Fix Android removeClippedSubviews in horizontal ScrollView in RTL (#45356)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45356

Subview clipping was disabled for RTL on Android due to a bug where TextInputs automatically blur when selected. This bug is reintroduced when `set_android_layout_direction` is set.

When `set_android_layout_direction` is enabled, and we use View `getLayoutDirection()` instead of `I18nManager.isRTL()`, the layout direction is not known until layer in the mounting process. This defeats the check a `setRemoveClippedSubviews()` prop setter to ignore the prop if the view is RTL (since it doesn't invalidate when a new layout direction is set).

The root cause of the underlying RTL bug is due to updating clipping status triggered by `onSizeChanged()`, which is called before `onLayout()`, where `ReactHorizontalScrollContainerView` offsets content in RTL. This also seems potentially erroneous, as we do not update the clipping rect on position change (unless that is handled elsewhere).

I moved the check to `onLayout()`, called after ReactHorizontalScrollView will change metrics, which seems to fix the issue. I then removed the exclusion in `removeClippedSubviews` prop setter.

Changelog:
[Android][Fixed] - Fix Android removeClippedSubviews in RTL

Reviewed By: mdvacca

Differential Revision: D59566611

fbshipit-source-id: a2eb12b984dc78940756804b6b7a3950377af9de
2024-07-10 20:17:03 -07:00
Jakub Piasecki 2932c0f71f Implement baseline alignment function on the new architecture (#45102)
Summary:
On the new architecture, the setup that would allow Yoga to read the baseline of a node was missing. This PR adds it:
- adds new ShadowNode trait - `BaselineYogaNode` that marks a node as having a custom baseline function
- adds `yogaNodeBaselineCallbackConnector` that's responsible for allowing Yoga to call baseline function on the node
- changes signatures of `lastBaseline` and `firstBaseline` to accept `LayoutContext` as the first argument, which is necessary to build an attributed string
- adds implementation of `lastBaseline` that's invoked by `yogaNodeBaselineCallbackConnector`
- adds methods for calculating the last baseline in platform-specific `TextLayoutManagers`, using the same approach on both Android and iOS (this differs from the old architecture where calculations were different)

## Changelog:

[GENERAL] [FIXED] - Fixed `alignItems: 'baseline'` not working correctly on the new architecture

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

Test Plan:
Tested on the relevant part of RNTester:

### Android

|Old arch|New arch before|New arch after|
|-|-|-|
|<img width="426" alt="baseline-android-old-arch" src="https://github.com/facebook/react-native/assets/21055725/08550dfc-cf30-4938-8872-9bef916dc53c">|<img width="426" alt="baseline-android-new-arch-before" src="https://github.com/facebook/react-native/assets/21055725/9e3667f7-5c42-4e23-8972-fd2e994694a4">|<img width="409" alt="Screenshot 2024-07-02 at 16 40 38" src="https://github.com/facebook/react-native/assets/21055725/13379b11-b69e-4082-81cc-dec5e6d092f2">|

### iOS

|Old arch|New arch before|New arch after|
|-|-|-|
|<img width="519" alt="baseline-ios-old-arch" src="https://github.com/facebook/react-native/assets/21055725/da3956a1-5588-4933-87ce-4b5a9c256957">|<img width="519" alt="baseline-ios-new-arch-before" src="https://github.com/facebook/react-native/assets/21055725/09aef2c1-2eec-4710-b237-0f4a0c3d52d0">|<img width="519" alt="Screenshot 2024-07-02 at 16 40 29" src="https://github.com/facebook/react-native/assets/21055725/0a8a7251-1f6f-40db-81d7-4f37142932db">|

Reviewed By: NickGerleman

Differential Revision: D59323974

Pulled By: cortinico

fbshipit-source-id: e50882d399a0791a39ce8b416ed96d8fd3c48f23
2024-07-10 12:43:42 -07:00
Jakub Piasecki 83716298f8 Fix text shadow on TextInput on Android when backgroundColor is set (#45343)
Summary:
When setting a shadow on a `Text` inside a `TextInput`, the shadow was rendered with artifacts when `backgroundColor` was set on the `TextInput`.

This is caused by how attributed strings are constructed on the new architecture - all text attributes from the text input (including background color) are propagated onto the string. Then, it's converted to a `Spannable` on Android side, which includes `ReactBackgroundColorSpan` being set on the entire text when it doesn't have a background color set explicitly. Then Android tries to render the shadow not only for the text but also for the background rect which results in the artifacts.

This PR prevents background color from the `TextInput` from being propagated onto the attributed string, so the `ReactBackgroundColorSpan` is only applied when a text fragment has its background set explicitly.

## Changelog:

[ANDROID] [FIXED] - Fixed text shadow rendering with artifacts when `backgroundColor` was set on the `TextInput`

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

Test Plan:
Checked relevant examples on RNTester

|Old arch|New arch (before)|New arch (after)|
|-|-|-|
|<img width="436" alt="Screenshot 2024-07-09 at 14 44 52" src="https://github.com/facebook/react-native/assets/21055725/64005ec4-3e42-4327-9b09-f57d3c477fb6">|<img width="436" alt="Screenshot 2024-07-09 at 14 43 03" src="https://github.com/facebook/react-native/assets/21055725/f558ad26-08de-4231-acdf-92f596ec186c">|<img width="436" alt="Screenshot 2024-07-09 at 14 41 46" src="https://github.com/facebook/react-native/assets/21055725/6b4ff6ed-5267-4f1a-a895-1bbd760f73e5">|

Reviewed By: NickGerleman

Differential Revision: D59527817

Pulled By: cortinico

fbshipit-source-id: d03d4749e4435ef04e51b1018f046be0e5e0bca4
2024-07-10 11:54:30 -07:00
Riccardo Cipolleschi 0fd4a9447e Factor out hermes slice apple (#45359)
Summary:
Factor out build-apple-slices-hermes to a seprate action to reuse code

## Changelog:
[Internal] - Refactor the CI to reuse code

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

Test Plan: GHA are green

Reviewed By: cortinico

Differential Revision: D59575467

Pulled By: cipolleschi

fbshipit-source-id: 5d253f3dd523cb70b768c62db10fb7ff39fbd49f
2024-07-10 06:38:49 -07:00
Tomek Zawadzki 778fcecf35 Update comments for ~ShadowNodeWrapper() and ~ShadowNodeListWrapper() (#45357)
Summary:
This PR updates the comments for `~ShadowNodeWrapper()` and `~ShadowNodeListWrapper()` to align them with the actual implementation that now uses `jsi::NativeState` instead of `jsi::HostObject`.

## Changelog:

[GENERAL] [FIXED] - Updated comments for `~ShadowNodeWrapper()` and `~ShadowNodeListWrapper()`

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

Reviewed By: sammy-SC

Differential Revision: D59578988

Pulled By: javache

fbshipit-source-id: 1c46ce8407fc8b337f3a6762caee3b2e0e1edfc6
2024-07-10 04:57:42 -07:00