Commit Graph

31830 Commits

Author SHA1 Message Date
Alex Hunt
a1e8118541 Fix ANDROID_ID segment for inspector device ID
Summary:
Fixes a bug where page IDs would collide for multiple connected Android devices running the same React Native app. The `Secure.ANDROID_ID` key (not value!) was being substituted in the ID string (pre-hashing) — now this segment is fixed.

Changelog:
[Android][Changed] - Update constructor signature of `DevServerHelper`

Reviewed By: hoxyq

Differential Revision: D58134323

fbshipit-source-id: 859e2758108e266167205a777bb6a6e87ca0573b
2024-06-05 04:24:00 -07:00
Riccardo Cipolleschi
f71d7d7281 Exclude windows from React-Fabric
Summary:
## Changelog:
[Internal] - Exclude the windows folder from View in React-Fabric podspec

## Facebook:
The `platforms/windows` folder is internal only, not synched with OSS.

However, the C++ linking was picking up some files from that folder when running RNTester on iOS using the OSS pipeline.

bypass-github-export-checks

Reviewed By: dmytrorykun

Differential Revision: D58182437

fbshipit-source-id: 5397fadbe96d5c2c7980fbf5e74ffab7b237b912
2024-06-05 03:25:01 -07:00
Danny Su
bb61e07739 Don't strip TargetDelegate (#44790)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44790

Was seeing crash due to:
> Abort message: 'terminating due to uncaught exception of type facebook::jni::JniException: java.lang.NoSuchMethodError: no non-static method "Lcom/facebook/react/bridge/ReactInstanceManagerInspectorTarget$
TargetDelegate;.onSetPausedInDebuggerMessage(Ljava/lang/String;)V"

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D58165901

fbshipit-source-id: ceafd5776933fca5abb2e2edcac5e5f677cb7f7d
2024-06-04 23:43:07 -07:00
Rubén Norte
2d9e54bbb1 Re-enable event loop in OSS (#44788)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44788

We disabled the event loop in RN on the main branch after we found some issues in the implementation. Those have been resolved already so we can re-enable it again.

For context, it's already enabled in the latest branch so this is just for main.

Changelog: [internal]

Reviewed By: cortinico

Differential Revision: D58146393

fbshipit-source-id: ab908ecbd507d7087137a36cad5cc917eb7b1311
2024-06-04 16:21:44 -07:00
Pieter De Baets
627cdd5ddd Move MountingManagerTest to open-source (#44765)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44765

Noticed this was not shared with open-source. Needs to be converted to Kotlin still.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D58088583

fbshipit-source-id: 51d13f2faddc7bce297dda54f2dd23cefed6a588
2024-06-04 15:05:08 -07:00
Nicola Corti
3f3abf5b40 Kotlin to 1.9.24 (#44787)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44787

Another patch bump for our dependencies ahead of branch cut.

Changelog:
[Android] [Changed] - Kotlin to 1.9.24

Reviewed By: cipolleschi

Differential Revision: D58143548

fbshipit-source-id: 70654cb821c220ff0eed37e37ce3e68ff8e7d3a1
2024-06-04 14:51:39 -07:00
Nicola Corti
f6a490b036 AGP to 8.4.1 (#44785)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44785

Just another patch bump of our dependencies ahead of the branch cut

Changelog:
[Android] [Changed] - AGP to 8.4.1

Reviewed By: cipolleschi

Differential Revision: D58143546

fbshipit-source-id: 6356b444b4a1514cf8dce6eead0c80ba725e555e
2024-06-04 14:51:39 -07:00
Nicola Corti
f9b69cdb81 Gradle to 8.8 (#44786)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44786

Just bumping our deps before the 0.75 branch cut.

Changelog:
[Internal] [Changed] - Gradle to 8.8

Reviewed By: cipolleschi

Differential Revision: D58143547

fbshipit-source-id: 0762e36aabecda66ba637be8d02d8147d7e32d27
2024-06-04 14:51:39 -07:00
Nicola Corti
744024be7f Fresco to 3.2.0 (#44783)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44783

This resolves CVE-2018-14498 coming from libjpeg-turbo via Fresco.
https://github.com/facebook/fresco/issues/2728

Changelog:
[Android] [Changed] - Bump Fresco to 3.2.0 to fix CVE-2018-14498

Reviewed By: javache

Differential Revision: D58136396

fbshipit-source-id: 6889f082fac501d0915e444c4e1130bc08c66e6d
2024-06-04 11:04:36 -07:00
Alex Hunt
4d1fedc527 Add changelog for 0.74.2 (#44784)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44784

Changelog: [Internal]

Reviewed By: cortinico, cipolleschi

Differential Revision: D58143431

fbshipit-source-id: 3c189107f972685136cdca0af1bbb8f4ebcd71b7
2024-06-04 10:49:57 -07:00
Pieter De Baets
95c721646d Remove unused Bolts code from runtime (#44779)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44779

We forked a copy of Bolts when we open-sourced bridgeless, but it contains many features we don't require, since we only use Tasks to orchestrate the bridgeless startup path.

The only meaningful change I made is removing the fallback on stack overflow from the immediate executor, which is not something we expect to hit during startup, and would be better surfaced as a StackOverflowException.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D58087989

fbshipit-source-id: a4908723a04bf47fdc38d91bf47df928b91456f5
2024-06-04 10:36:09 -07:00
Edmond Chui
a9bcc0d46c Update debugger-frontend from 78d3771...94c8238 (#44781)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44781

Changelog: [Internal] - Update `react-native/debugger-frontend` from 78d3771...94c8238

Resyncs `react-native/debugger-frontend` from GitHub - see `rn-chrome-devtools-frontend` [changelog](78d377129a...94c8238595).

Reviewed By: motiz88

Differential Revision: D58090889

fbshipit-source-id: 61065d58c3ec6c05d098f6039ab79a47cd05080a
2024-06-04 08:16:48 -07:00
Alex Hunt
bb3f35f38a Back out "Remove legacy InspectorPackagerConnection"
Summary:
Revert of D58017460 + remove TODO comments.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D58132473

fbshipit-source-id: 81e14e5fc0ab461f11c4ecb64d3fee14986fe4f7
2024-06-04 07:35:05 -07:00
Moti Zilberman
6c2e1cf230 Add Java assertions for order of Host/Instance inspector target teardown (#44766)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44766

Changelog: [Internal]

There is currently a lifecycle bug in both the Bridge (`com.facebook.react.bridge`) and Bridgeless (`com.facebook.react.runtime`) integrations of Fusebox in React Native Android, whereby `HostTarget::unregisterInstance` gets called after the `HostTarget` has been destroyed. This manifests as a handful of related C++ crashes depending on the exact circumstances and build flags.

This diff makes the bug trigger a Java assertion instead of a C++ crash for ease of debugging. The next diff in the stack will actually fix the lifecycle issue.

Reviewed By: hoxyq

Differential Revision: D58031217

fbshipit-source-id: 9301b34edf5e526cbc72d86e78b328d29c9921b5
2024-06-04 07:02:37 -07:00
Riccardo Cipolleschi
f471b92b03 Remove publish bumped packages from CircleCI (#44778)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44778

We now have the Publish_bumped_packages in GHA, so we should not have two jobs in two different systems that perform the same publishing operation.

## Changelog:
[Internal] - Remove duplicated jobs from CCI

Reviewed By: cortinico

Differential Revision: D58131196

fbshipit-source-id: 408b0a76dff89e9d327fe56d1e6e4c13b55eb2bb
2024-06-04 05:58:10 -07:00
Jakub Piasecki
91c5a6d936 Fix border drawn over children on iOS (#44777)
Summary:
Fixes https://github.com/facebook/react-native/issues/44690

In the code responsible for drawing border on iOS there's a comment saying:
> iOS draws borders in front of the content whereas CSS draws them behind the content. For this reason, only use iOS border drawing when clipping or when the border is hidden.

The condition that follows checks whether the content is clipped and the width and alpha channel of the border: e0a2e86d03/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm (L643-L644).

The problem is when the color is not set at all - `colorComponentsFromColor(borderMetrics.borderColors.left).alpha` will be equal to 0 since the relevant `SharedColor` is `null`: e0a2e86d03/packages/react-native/ReactCommon/react/renderer/graphics/platform/ios/react/renderer/graphics/HostPlatformColor.mm (L76-L86)

Then it uses the path with the default iOS behavior (drawing the border on top of the content) instead of the custom one (with the border below) and it seems like it defaults to drawing black when the passed color is `nil`.

This PR simply adds one more check to make sure the color is actually set before choosing the default platform behavior.

## Changelog:

[IOS] [FIXED] - Fixed border being drawn over children when no color was set

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

Test Plan:
Tested on the code from the issue.

|Before|After|
|-|-|
|<img width="546" alt="Screenshot 2024-06-04 at 11 18 14" src="https://github.com/facebook/react-native/assets/21055725/f13250a9-2e99-41c5-a9bc-02d65c00a6c0">|<img width="546" alt="Screenshot 2024-06-04 at 11 17 38" src="https://github.com/facebook/react-native/assets/21055725/f4571a5f-dfc4-4191-854c-fd3faf698b29">|

Reviewed By: cortinico

Differential Revision: D58131337

Pulled By: cipolleschi

fbshipit-source-id: 7da247d81ecec586de6f0023e0cb399f9966213d
2024-06-04 05:57:33 -07:00
Sam Zhou
e0a2e86d03 Deploy 0.237.2 to xplat
Summary: Changelog: [Internal]

Reviewed By: alexmckenley

Differential Revision: D58120938

fbshipit-source-id: f789623005f47ab9d6dd134819a08bc832642a22
2024-06-03 21:27:39 -07:00
Nick Lefever
839ee0aae9 Add unit test for runtime reference updates on clone (#44758)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44758

Changelog: [Internal]

Adding a unit test to verify that the shadow node references are correctly updated to reference the new shadow node instance after cloning.

Reviewed By: sammy-SC

Differential Revision: D57893880

fbshipit-source-id: 6e36ca3d1b159f7bafb084246f714f3bfec58c1e
2024-06-03 20:25:46 -07:00
Nick Lefever
bb9917a580 Update runtime shadow node references only on layout (#44773)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44773

Changelog: [Internal]

Update runtime shadow node references for cloning happening within `YogaLayoutableShadowNode` during layout. This will update the JS references to shadow nodes with the latest layout metrics used to render the component and improve layout cache usage on the next commit.

Reviewed By: sammy-SC

Differential Revision: D58000071

fbshipit-source-id: 373d41f37a81e81ab8f23006491027473493de61
2024-06-03 20:25:46 -07:00
Nick Lefever
4806077457 Add feature flag for clone reference updates only on layout (#44771)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44771

Changelog: [Internal]

Adding a feature flag for enabling runtime shadow node reference updates only for clones happening within `YogaLayoutableShadowNode` to support layout data changes.

Reviewed By: sammy-SC

Differential Revision: D58000072

fbshipit-source-id: 204c0488edb992511a4b33d098b9df1b04001b9d
2024-06-03 20:25:46 -07:00
Nick Lefever
a643e191f6 Update runtime shadow node references when cloning within react native (#44770)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44770

Changelog: [Internal]

Any shadow node cloning happening outside the execution of the UIManagerBinding `cloneNode` function should update references held to the shadow node to reference the latest revision. All shadow node cloning not requested by the JS runtime should update the references to those shadow nodes within the JS runtime so that these would hold the latest state updated outside of the React renderer (i.e. state data and layout metrics).

This guarantees that the React renderer's current fiber tree holds references to the ShadowNode instances that acually were layed out and committed for rendering on the native side. Maintaining these references up to date on the JS current fiber tree allows to maximize layout cache usage on subsequent commits.

Reviewed By: sammy-SC

Differential Revision: D57860867

fbshipit-source-id: f13e3fa9ad501fb2c8a387fb58b6379d236d7c2d
2024-06-03 20:25:46 -07:00
Nick Lefever
cc37634937 Make runtime shadow node references updatable from native (#44772)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44772

Changelog: [Internal]

React native clones shadow nodes internally without providing the new instances to the React renderer (current fiber tree). To support updating the shadow node references held by the JS side, this diff wraps the returned shadow nodes and adds a link to the runtime reference on the shadow node instance.

This will allow for updating the shadow node references held within the JS runtime from the native side.

Reviewed By: sammy-SC

Differential Revision: D57860869

fbshipit-source-id: 1703f0cd0183e2760436920a122857e17fda8dbb
2024-06-03 20:25:46 -07:00
Nick Lefever
12411e9731 Add feature flag for shadow node reference updates (#44769)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44769

Changelog: [Internal]

Adding a feature flag to conditionally enable shadow node reference updates when cloning nodes within react native.

Reviewed By: sammy-SC

Differential Revision: D57860868

fbshipit-source-id: 5542257cd22d9020b3d98a53ca872b5bde3c5738
2024-06-03 20:25:46 -07:00
generatedunixname89002005232357
a6a7cdf0b7 Revert D57878119: Multisect successfully blamed "D57878119: [RN] [Android] Fix status bar height calculation for all cutout sizes" for one test failure
Summary:
This diff reverts D57878119
D57878119: [RN] [Android] Fix status bar height calculation for all cutout sizes by Abbondanzo causes the following test failure:

Tests affected:
- [xplat/endtoend/jest-e2e/apps/fb4a/__tests__/dating/onboarding/fb4aDatingOnboardingSessionImpressionLogging-e2e.js](https://www.internalfb.com/intern/test/562949977559606/)

Here's the Multisect link:
https://www.internalfb.com/multisect/5267005
Here are the tasks that are relevant to this breakage:
T189149205: 17 critical tests unhealthy for oncall dating_react_native_sop

The backout may land if someone accepts it.

If this diff has been generated in error, you can Commandeer and Abandon it.

Changelog: [Internal]

Reviewed By: Abbondanzo

Differential Revision: D58053899

fbshipit-source-id: c65a1094259f85c8e6084b2f191ca1e4cd149510
2024-06-03 09:45:15 -07:00
Edmond Chui
c43adb2134 Update debugger-frontend from bf5ec69...78d3771 (#44753)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44753

Changelog: [Internal] - Update `react-native/debugger-frontend` from bf5ec69...78d3771

Resyncs `react-native/debugger-frontend` from GitHub - see `rn-chrome-devtools-frontend` [changelog](bf5ec692e1...78d377129a).

Reviewed By: huntie

Differential Revision: D58069944

fbshipit-source-id: 8a5ce5644c208eb13cb3d5d839d00bd7657a52d1
2024-06-03 09:11:52 -07:00
Pieter De Baets
9d3bac6fd5 Integrate perfetto with UserTiming API (#44702)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44702

Based on bgirard initial changes in D53478653, this creates an initial integration of the Perfetto SDK with the User Timing API, allowing performance information to be logged from JS to Perfetto traces.

We only enable this for Android right now, but may be able to leverage this on other platforms too in the future.

The logic in `initializePerfetto` may need to moved to another common target (eg reactperflogger) once we want to make this usable in other components, but keeping it scoped to User Timing for now.

Changelog: [Internal]

Reviewed By: bgirard

Differential Revision: D57881823

fbshipit-source-id: 11ba09cbc01a102a72eee65ce6d6aeca508e864a
2024-06-03 08:55:48 -07:00
Riccardo Cipolleschi
84ff977b37 Fix GHA for Publish bumped packages (#44760)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44760

This change fixes the gha that should publish bumped packages.

## Changelog
[Internal] - Fix CI

Reviewed By: huntie

Differential Revision: D58084675

fbshipit-source-id: 16639f5413dbe2a7182561a1de911194ae52a161
2024-06-03 07:10:34 -07:00
Riccardo Cipolleschi
be38fbb3f8 Add publish_bumped_packages in GHA
Summary:
This change introduce the publish_bumped_packages job in GHA as this job was not ported before.

This is a porting of [this workflow](https://github.com/facebook/react-native/blob/main/.circleci/configurations/workflows.yml#L128-L135), which calls the [`find_and_publish_bumped_packages`](https://github.com/facebook/react-native/blob/main/.circleci/configurations/jobs.yml#L1278-L1289) which uses the [`build_packages`](https://github.com/facebook/react-native/blob/main/.circleci/configurations/commands.yml#L100-L104) command

## Changelog:
[Internal] - Add the `publish_bumped_packages` to GHA

Reviewed By: huntie

Differential Revision: D58016209

fbshipit-source-id: 3c8cf7bc50eeaf11b00850fc2251183b12b18d20
2024-06-03 06:14:58 -07:00
Alex Hunt
c144382316 Remove legacy InspectorPackagerConnection (#44746)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44746

Cleanup after this experiment's removal in D57730921.

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D58017460

fbshipit-source-id: f9328875d6ef9a76599ae560c58cef6caab87a57
2024-06-03 06:04:50 -07:00
Blake Friedman
ec1742a6bb build and bundle (#44720)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44720

Bug fixes to bootstrap, build and bundle on iOS.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D57915363

fbshipit-source-id: 1c82f0020572d7d9bf599a7c568dfc6f3a3292e8
2024-06-03 06:01:43 -07:00
Pieter De Baets
910cde6134 Remove types for removed onTextInput events (#44480)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44480

TextInputs' onTextInput callback was removed way back in React Native 0.62 with 3f7e0a2c96 , but remnants of the implementation exists.

Fully remove references on JS side now that no older clients are emitting this event

Changelog: [General][Removed] Remove viewconfigs for onTextInput callbacks

Reviewed By: cipolleschi

Differential Revision: D57092733

fbshipit-source-id: 62dae37d8e8f155969a1ca65131d4ee9a1d5f1c4
2024-06-03 05:05:58 -07:00
Riccardo Cipolleschi
31d6ed14d0 Remove Old Arch build jobs (#44729)
Summary:
Based on https://github.com/facebook/react-native/issues/44723.
This PR removes some Old Arch build only jobs on iOS.
Some of the recent changes where unifying the build process across archs, so we don't have to build Old and New Arch

## Changelog:
[Internal] - Remove OldArch jobs when they are not required

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

Test Plan: CCI is green

Reviewed By: cortinico

Differential Revision: D57975238

Pulled By: cipolleschi

fbshipit-source-id: ffd0ff0534f25019d501aa3862baee1442088784
2024-06-03 03:09:51 -07:00
Samuel Susla
033a55f7fb clarify systrace annotations in MountItemDispatcher (#44747)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44747

changelog: [internal]

Change names of systrace blocks to better reflect where the operation is happening.

Reviewed By: rubennorte

Differential Revision: D57969459

fbshipit-source-id: 3c857a66f060992e1792e18973caafea7c995c5b
2024-06-01 00:56:31 -07:00
Nick Gerleman
c046198cc9 Add more clipping examples (#44735)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44735

Add some more examples of overflow clipping for scrollview, text, textinput.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D57999676

fbshipit-source-id: dfede321b2c7c61dda3afaf2aea784f6c295c384
2024-05-31 12:06:33 -07:00
Nick Gerleman
a1f68dbfb4 Avoid returning mutable Path in CSSBackgroundDrawable (#44733)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44733

We are returning a Path to callers, which shouldn't be mutated. This isn't really safe. Return a copy to external callers instead, if they need a path to work with.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D57996157

fbshipit-source-id: 53cd95df6e2641d946f7c3fef40f6449b16ca5cb
2024-05-31 12:06:33 -07:00
Nick Gerleman
869eebe02d Fix CSSBackgroundDrawable.java Path accessor nullability (#44732)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44732

`getBorderBoxPath()` and `getPaddingBoxPath()` currently assume `updatePath()` will set a path, but this does not happen on Android 24 emulators where it seems like `onBoundsChanged` isn't called to set flag for needing update.

But, the current design tries to be lazy with path generation, and these are probably more expensive to clip, so we should really make these functions return nullable value, then fall back to rect, like the internals of `CSSBackgroundDrawable`, and how I misremembered these as working in the view code added originally in D57668976.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D57951852

fbshipit-source-id: 33bc8f738950597822ae9026408ab3a23b0923f3
2024-05-31 12:06:33 -07:00
Aakash Patel
a0237e96f1 Enable regenerator transform for hermes-canary (#44668)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44668

Enables regenerator for `hermes-canary`. Along with the previous diff, regenerator is the only difference between `hermes-stable` and `hermes-canary`.

Reviewed By: motiz88

Differential Revision: D57742907

fbshipit-source-id: ca14cb50fe976744c7fa2c0b3397e81661359f15
2024-05-31 12:03:04 -07:00
Aakash Patel
b5b497ff10 Align hermes-canary and hermes-stable profiles (#44728)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44728

This makes them identical so the diff that makes them diverge is clear.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D57970711

fbshipit-source-id: 8586ef202ad27796918378832fa62df1708a0218
2024-05-31 12:03:04 -07:00
Sam Zhou
f4325dac8e Replace direct React.createElement call with jsx in react-native (#44738)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44738

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D58004147

fbshipit-source-id: f42c939d92a876b8746703c134b246567846c3ee
2024-05-31 10:06:09 -07:00
Pieter De Baets
48f48f8e67 Handle Java exceptions without message correctly (#44744)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44744

Correctly handle TurboModule promise rejections when there is no Exception message.

Changelog: [Android][Fixed] Android exceptions without a message would lead to unexpected crashes

Reviewed By: fabriziocucci

Differential Revision: D58014797

fbshipit-source-id: c94042818a00669a1be2db8e89e84c6b616efbec
2024-05-31 09:48:22 -07:00
Peter Abbondanzo
cc485ccf7d Fix status bar height calculation for all cutout sizes (#44697)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44697

Google has discouraged attempting to read the `status_bar_height` resource [since 2017](https://youtu.be/_mGDMVRO3iE?si=qGQd7gLa_qTmfLGL&t=1079). With the introduction of display cutouts there can be a mismatch between the resource value and the true status bar size (and issues like [this one](https://github.com/facebook/react-native/issues/33612) popped up). The recommended approach is to instead call `getInsets` with the proper status bar and navigation flags provided by `WindowInsets`. On older APIs where `getInsets` is not supported, we have access to `systemWindowInsetTop`.

Changelog:
[Android][Fixed] - Fixed StatusBar.currentHeight calculations to honor all cutout sizes

Reviewed By: cipolleschi, alanleedev

Differential Revision: D57878119

fbshipit-source-id: 9fadd33d5f9b617a70a052c98dbd53fd29281650
2024-05-31 08:57:41 -07:00
Rubén Norte
db1043dfbf Continue running microtasks when parent task throws
Summary:
Changelog: [General][Fixed] Fixed LogBox not showing correctly on the New Architecture

We found an incorrect behavior in the event loop, where an error in a task would prevent its microtasks from running. This isn't spec compliant and should be fixed.

This caused LogBox to not work correctly, as error reporting is implemented via microtasks that would never execute.

Reviewed By: sammy-SC

Differential Revision: D58010521

fbshipit-source-id: 7901c5d6e83fb63af148e12ad6c32be490a3999d
2024-05-31 05:20:27 -07:00
Riccardo Cipolleschi
68d513bd21 Run GHA on main (#44723)
Summary:
In the previous months, we worked with a GH engineer to run our test workflow on PRs. The workflow was running properly, so we want to run it on main too.

## Changelog:
[Internal] - Run gha on main too

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

Test Plan: GHA is green

Reviewed By: cortinico, NickGerleman

Differential Revision: D57975230

Pulled By: cipolleschi

fbshipit-source-id: 89d06361ad6f2230b7000e05970e9b16539c9164
2024-05-31 02:52:52 -07:00
Kudo Chien
d999e9bf1e Add BindingsInstaller for TurboModules on Android (#44526)
Summary:
Add synchronous JS bindings installation for TurboModules. That would help some 3rd party JSI based modules to install JS bindings easier.
https://github.com/facebook/react-native/issues/44486 for Android

## Changelog:

[Android] [ADDED] - Add BindingsInstaller for TurboModules

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

Test Plan:
Added test in RN-Tester TurboModule test case

 {F1660267530}

 {F1660287029}

Reviewed By: javache

Differential Revision: D57223328

Pulled By: philIip

fbshipit-source-id: d4a69a16f6ce77c0a0fd63f008bea929b1964ab8
2024-05-30 20:43:27 -07:00
Nick Gerleman
c2c9b27ff2 Add extra logging for invalid Paragraph Attributes MapBuffer (#44709)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44709

Add some extra logging to try to figure out heisenbug, where we cannot find MapBuffer key that we should expect to be present, only during view preallocation.

ReadableMapBuffer toString() will itself iterate through MapBuffer entries, so this might not return something sane if underlying MapBuffer is corrupt or wrongly oriented, but should give us more context.

We also need to be careful here, to avoid logging the actual state mapbuffer or its binary which may contain text content. Only the paragraph attributes.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D57925730

fbshipit-source-id: cecca1a1fe53b4b417d520e65c30d47243cb2fb2
2024-05-30 17:33:43 -07:00
Soe Lynn
e880ed76fe DrawerLayoutAndroid fix for Layout inspector to select correct node (#44707)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44707

Changelog: [Internal]

For DrawerLayoutAndroid in New Architecture, when we use ReactDev Tools layout inspection, incorrect node is being shown in the inspector tools.

This is because pointerEvents is not set to either `box-none` or `none` based on the drawer open/close state for the drawer child wrapper `View`.

Reviewed By: hoxyq

Differential Revision: D57873834

fbshipit-source-id: b2b82633969922189a0b96feea2115ddc0b2ebb5
2024-05-30 17:09:25 -07:00
Rubén Norte
0bea4cd0cc Mark root view as attached after executing all pending operations (#44726)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44726

Changelog: [internal]

## Context

We ran an experiment to test synchronous state updates in Fabric and we saw some crashes on Android. Those crashes were caused by mounting operations not being applied in the correct order.

There were 2 root causes for that problem:
1. State updates triggered during mount would be committed and mounted synchronously during that specific mount operation. That caused problems like trying to clip views that weren't created already (as we were processing the state update for the content offset before we actually created the child views).
2. Same problem as before, but with mount operations that were processed when the root view wasn't available yet (this is a separate queue).

We tried to fix the problem in https://github.com/facebook/react-native/pull/44015, but the solution for 2) was incorrect, as we didn't account for those operations being in a different queue (it was reverted in https://github.com/facebook/react-native/pull/44724).

## Changes

I think the right solution for point 2) is that, instead of marking the root view as available and then process all pending operations, we flip those operations.

That was, if there are any mount operations as a side-effect of processing that queue, those will also be added to the same queue, instead of being processed immediately in `MountItemDispatcher`.

Reviewed By: sammy-SC

Differential Revision: D57968937

fbshipit-source-id: 93d10cdeced0c837d4301768aee8575d2c940b10
2024-05-30 12:37:17 -07:00
Rubén Norte
d1c72016c1 Allow recursive calls to schedulerShouldRenderTransactions without deadlocks (#44725)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44725

Changelog: [internal]

## Context

We're currently testing synchronous state updates in Fabric (committing shadow trees for state updates synchronously in the thread where they were dispatched, instead of always scheduling it in the JS thread).

In these experiments we saw a problem caused by a recent change in the Android mounting layer (done to fix a problem with the Event Loop) where we were doing the mount operations inside a mutex lock. The problem is that we didn't have recursive commit+mount operations (because we were dispatching state updates in the JS thread) but now that we do we get a deadlock here.

 {F1659804385}

These recursive commit+mount operations happen because it's possible to trigger state updates while we mount changes in the host platform (e.g.: we create the scroll view and we update the state to set the content offset). Those state updates trigger more mount operations, which deadlock in the mentioned place.

## Changes

This fixes the described issue by restricting the lock only to access the list of pending operations, but not to apply them. In the current implementation, `mountingManager->executeMount` is protected by the lock, whereas in the new version it isn't (so it can be safely called recursively). The synchronization of the mount operations is done directly at the mounting layer on Android.

Reviewed By: sammy-SC

Differential Revision: D57968936

fbshipit-source-id: 52f996d212cad691646610632b03b5223e7e90ca
2024-05-30 12:37:17 -07:00
Rubén Norte
958c2e840a Revert batching for mount operations accumulated before root view attached (#44724)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44724

Changelog: [internal]

Batching operations at this layer was wrong because these are the operations that were already flushed by the mounting layer but were accumulated in `SurfaceMountingManager` because the root view wasn't created.

These operations should be executed before anything else that's scheduled in the `MountItemDispatcher`, so we should never batch them. The problem this was trying to solve is solved in a different way in D57968937.

This was gated so this shouldn't affect any current usages.

Reviewed By: sammy-SC

Differential Revision: D57968939

fbshipit-source-id: e9131614cdc76e9d553540757611bc8b0736c927
2024-05-30 12:37:17 -07:00
Dmitry Rykun
c0692ab063 Re-land: Fix race condition in native module invalidation (#44727)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44727

This is a re-land of https://github.com/facebook/react-native/pull/44048

Reverting it caused even bigger regression, so my earlier assessment was wrong. The initial regression was caused by something else.

Changelog: [Internal] - Let's keep the changelog entry form the original diff.

Reviewed By: fkgozali

Differential Revision: D57970133

fbshipit-source-id: c683d661a805d44434f5491e89dd4b7218379bee
2024-05-30 11:42:22 -07:00