Commit Graph

12270 Commits

Author SHA1 Message Date
Mohamed Moussa 08ecdee71c Fix missing setLeftTopRightBottom method (#44033)
Summary:
We were seeing errors due to `setLeftTopRightBottom` being called without a check for the Android version despite that method [being added in Android API level 29](https://developer.android.com/reference/android/view/View#setLeftTopRightBottom(int,%20int,%20int,%20int)). I've replaced it with the older API methods to fix the issue.

This issue originates from https://github.com/facebook/react-native/pull/38526

## Changelog:

[ANDROID] [FIXED] - Resolved error "No virtual method setLeftTopRightBottom"

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

Test Plan: Change is pretty trivial, but we tested it in our production app ([Tarteel](https://www.tarteel.ai/)) for a week and confirmed that the error is resolved.

Reviewed By: cortinico

Differential Revision: D56002098

Pulled By: NickGerleman

fbshipit-source-id: ff97d0be2703006b14c865dd148e40eb10069acb
2024-04-11 04:28:07 -07:00
Nick Gerleman 44d59ea6f9 Make new nodes dirty by default (#44010)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44010

X-link: https://github.com/facebook/yoga/pull/1641

Yoga has quirk where newly constructed nodes are clean, which isn't really correct. Normally never shows in in real code because setting a style or children  will dirty. Fabric doesn't use the public APIs that do this dirtying, so it ends up getting creative instead.

We should fix so that newly constructed nodes are dirty. Copy-constructed Nodes (also only a Fabric thing, will retain original dirty flag.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D55855328

fbshipit-source-id: be49efaf8ac29351f8e5ec509bd9912546944332
2024-04-10 22:15:25 -07:00
Fabrizio Cucci 3098613f6e Fix ReactImagePropertyTest (#44028)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44028

Changelog: [Internal]

While testing something completely unrelated (i.e. D55964787), I've noticed that [test_android](https://github.com/facebook/react-native/actions/runs/8635097933/job/23673157303?pr=44026) actually failed on Github with this error:

> Task :packages:react-native:ReactAndroid:compileDebugUnitTestKotlin
e: file:///__w/react-native/react-native/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/views/image/ReactImagePropertyTest.kt:62:38 Smart cast to 'CatalystInstance' is impossible, because 'catalystInstanceMock' is a mutable property that could have been changed by this time

Reviewed By: RSNara

Differential Revision: D55982797

fbshipit-source-id: a49e766ae95e22603293326da93007d78250da6a
2024-04-10 15:45:16 -07:00
Biki-das f7eaf63881 - added combining animted values example to the animated api example list (#43435)
Summary:
Added an example to add ```combining``` values with the animated API

## Changelog:

[General] [Added] - Add examples for Combining Animated Values with the Animated API

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

Test Plan:
https://github.com/facebook/react-native/assets/72331432/c4a0c1e2-df9d-4e73-8602-e4550a22b8dc

https://github.com/facebook/react-native/assets/72331432/d2f1196e-68b0-49d4-8d3d-2c53ee30652b

Reviewed By: cortinico

Differential Revision: D55917557

Pulled By: hoxyq

fbshipit-source-id: d4214323f2a8823b1b3fe0c8d90a7518d0953b48
2024-04-10 10:55:17 -07:00
Alan Lee 244eb42b33 add back @Deprecated in ViewUtil (#44011)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44011

Add back `Deprecated` annotation which was removed in D55651762

Changelog:
[Internal] internal

Reviewed By: javache

Differential Revision: D55955345

fbshipit-source-id: bc255983a57fa01e63b17400079cf4215de9a41f
2024-04-10 09:43:04 -07:00
Nicola Corti 80aa714630 Move reactperfloggerjni to INTERFACE library (#43998)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43998

Another library with an empty JNI_OnLoad method.
Moving it to `INTERFACE` so it exposes only the Header it has declared.
This removes the `libreactperfloggerjni.so` from the final APK.

Changelog:
[Internal] [Changed] - Move reactperfloggerjni to INTERFACE library

Reviewed By: javache

Differential Revision: D55919228

fbshipit-source-id: 634f4f6013825b0de8827b3143a012e6c880509d
2024-04-10 09:19:26 -07:00
Andrew Datsenko c8d5f0f1aa //xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/appearance:appearanceAndroid (#44006)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44006

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D55725334

fbshipit-source-id: 4d7ad2bb6395674d47fd5e3cd01a8515627f6cd4
2024-04-10 07:45:57 -07:00
Rubén Norte b9a2249fff Implement potential fix for mounting errors during synchronous state updates (#44015)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44015

Changelog: [internal]

## Context

When we introduced synchronous state updates in Fabric, we saw some crashes on coming from the mounting layer on Android.

It seems some of these crashes are caused by nested mount operations. When we're mounting some views, like [scroll views](https://github.com/facebook/react-native/blob/881c0bc8970b9e402df6b4f87e1759b238b24735/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java#L383), we dispatch state updates that end up doing more mutations. When we were doing these state updates asynchronously, all the original mutations were processed before these updates, but now that we do them synchronously, the mutations are interleaved causing errors.

## Changes

This introduces a new flag that will force all the mutations going through `MountItemExecutor` in `FabricUIManager` to be batched instead of executed synchronously. This fixes the issues I saw locally and I'm expecting this will unblock synchronous state updates in production.

Potentially, this might fix other crashes we've been seeing with a low frequency.

Reviewed By: sammy-SC

Differential Revision: D55942125

fbshipit-source-id: b8d9c145ec307de7318dbbed14880bc9a84fdb2a
2024-04-10 07:44:11 -07:00
Andrew Datsenko 54757ca017 //xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/imagehelper:imagehelperAndroid (#44001)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44001

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D55725532

fbshipit-source-id: 5fa4e774247e79b0e43d04f58dcb150d682de090
2024-04-10 07:41:29 -07:00
Rubén Norte ea566ad70d Remove unnecessary systrace section from UIManagerBinding (#44003)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44003

Changelog: [internal]

This systrace section isn't providing any value, as the durations are always negligible.

Reviewed By: christophpurrer

Differential Revision: D55921320

fbshipit-source-id: 95e1de3359ecc0cde3e913b6f77b567cdd126214
2024-04-10 05:50:30 -07:00
Moti Zilberman 403bbae1f2 Stub support for Tracing start/end methods and events (#44004)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44004

Changelog: [Internal]

Adds the minimal boilerplate needed to support taking an (empty) recording using Chrome DevTools's Performance panel.

Reviewed By: hoxyq

Differential Revision: D55925170

fbshipit-source-id: 8f5048bd545be3ef410b794573ef7b7bc92f73cc
2024-04-10 04:04:12 -07:00
Moti Zilberman 27ef6cdbaf Update debugger-frontend from b0a76fa...864bc72 (#44013)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44013

Changelog: [Internal] - Update `react-native/debugger-frontend` from b0a76fa...864bc72

Resyncs `react-native/debugger-frontend` from GitHub - see `rn-chrome-devtools-frontend` [changelog](https://github.com/facebookexperimental/rn-chrome-devtools-frontend/compare/b0a76fa92f6c34b524bc8aff5b611456f1537ca3...864bc721a3f0f26b94f5730e59739a25e3182ce5).

Reviewed By: hoxyq

Differential Revision: D55957651

fbshipit-source-id: a3a18bd18b729cef6f645eeeb0ab77771d6f1202
2024-04-10 02:29:39 -07:00
Soe Lynn f6b9a42985 Deprecate react_native_image_logging GK (#44009)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44009

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

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

Clean up RCTImageLoadingPerfInstrumentationEnabled as GK is 100%

Changelog:
[iOS][Breaking] Remove unused RCTImageLoadingPerfInstrumentationEnabled

Reviewed By: philIip

Differential Revision: D55769009

fbshipit-source-id: c99a7b7076597e65acc0ba97f5a4846719688401
2024-04-09 17:47:25 -07:00
Ruslan Shestopalyuk 881c0bc897 Unify DevLoadingView code on JS side to be platform-independent (#43992)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43992

# Changelog:
[Internal] -

While looking into implementing native DevLoadingView on non-Android/iOS platform, I realized that the current code inside `LoadingView.android.js`/`LoadingView.ios.js` is functionally identical, and can be transformed into each other with simple code transformations.

This diff:
* Renames `LoadingView` into `DevLoadingView` (as it's arguably more fitting name, given that it also relies on `NativeDevLoadingView` native module implementation)
* Merges the iOS/Android specific JS files into one
* Factors usage of the colors out of the actual logic, to better separate presentation from the business logic

From the perspective of public APIs there should be no changes.

Reviewed By: christophpurrer

Differential Revision: D55914787

fbshipit-source-id: 656311db80e5ee03f60ee7ffcf5f405ca99a9ce5
2024-04-09 13:21:05 -07:00
Dmitry Rykun 1cb0a3342a Add react-native-test-library package (#43068)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43068

This diff adds `react-native-test-library` package.
It contains native module and native component example, and targets both the new and the old architecture. It has structure similar to many OSS React Native libraries, and is supposed to be used to test the integration with third-party libraries.

It is integrated with RNTester as the **OSS Library Example** screen.

{F1457510909}

**Change Background** tests native commands.
**Set Opacity** tests native props.
**Get Random Number** tests native module.

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D50793835

fbshipit-source-id: ff6daefab10e6e9f13049e3013f8f63cfa8a929e
2024-04-09 11:35:43 -07:00
Riccardo Cipolleschi 30d6251b78 Avoid Snapshotting Modal too often (#43995)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43995

With a previous change, we started taking snapshots of the Modal every time a Fabric mounting event was happening. this might cause perf regression when a modal is presented, and there is no need to take a snapshot that often.

This change moves the snapshotting code right before the dismissal of the Modal.

## Changelog
[iOS][Changed] - Move the snapshotting code before the dismissal.

## Facebook
This should fix T179288585, T184520225

Differential Revision: D55914776

fbshipit-source-id: 6679babf7f72aef7254113497116d5482640e789
2024-04-09 11:32:46 -07:00
Nicola Corti a25004c86c Fix bridge mode by constructing ReactDelegate correctly. (#43999)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43999

Currently NewArch-BridgeMode is partially broken when creating views via `ReactDelegate`.
That's because we're using the ctor that doesn't account for `Boolean: fabricEnabled`.

That means that the `RootView` that it will be created are all having setIsFabric(FALSE).
This is causing problems like whitescreens on several reload + multiple warnings such as:
```
                         E  com.facebook.react.bridge.ReactNoCrashSoftException: Cannot get UIManager because the context doesn't contain an active CatalystInstance.
```

Fixes #43692

See for more context on this issues: https://github.com/facebook/react-native/issues/43692

Changelog:
[Android] [Fixed] - Fix bridge mode by constructing ReactDelegate correctly

Reviewed By: cipolleschi

Differential Revision: D55921078

fbshipit-source-id: 2c21d089a49538402d546177bcdb26c8d7d5fbc1
2024-04-09 10:10:04 -07:00
Blake Friedman 177f2bfc8f react-native-info - added simple copy of @react-native-community's implementation
Summary:
This current consists of a bunch of TypeScript code, which will be ported to Flow in the stack.

Changelog: [Internal]

bypass-github-export-checks

Reviewed By: huntie

Differential Revision: D55741526

fbshipit-source-id: 1dc30d2ab63e0526dd6fed17ccf7cce9f57bdbee
2024-04-09 10:00:14 -07:00
Fabrizio Cucci 51552e6a1e Kotlinify SoftAssertions (#43911)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43911

Changelog: [Internal]

As part of the Sustainability Week (see [post](https://fb.workplace.com/groups/251759413609061/permalink/742797531171911/)).

Reviewed By: tdn120

Differential Revision: D55797031

fbshipit-source-id: eb53ae671b0a7b5d277b931a11eb0fcd84c51a19
2024-04-09 09:10:50 -07:00
Riccardo Cipolleschi 8b8b85bb1f Fix Connect to Metro after Reload in Bridgeless mode (#43994)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43994

We received [this issue](https://github.com/facebook/react-native/issues/43764) from OSS where an app can't connect to Metro on reloads in the following scenario:

* Start the App when metro does not run.
* Observe the error screen
* Start Metro
* Press Reload
* Observe the error message again

While the desired behavior should be to connect to Metro now that this is running.

The root cause of the problem is that the RCTHost is initialized with a value of the `bundleURL` that is `nil`. Upon reload, the RCTHost is **not** recreated: the instance is restarted, but with the previous `bundleURL`, which is still `nil`.

The solution is to initialize the `RCTHost` with a closure that re-evaluate the `bundleURL` whenever it is invoked and to evaluate it only on `start`, to keep the initialization path light.
This way, when the app is started with Metro not running, the `bundleURL` is `nil`. But when it is reloaded with Metro starting, the `bundleURL` is properly initialized.

Note that the changes in this diff are not breaking as I reimplemented (and deprecated) the old initializer so that they should work in the same way.

## Changelog:
[iOS][Fixed] - Let RCTHost be initialized with a function to provide the `bundleURL` so that it can connect to metro on Reload when the url changes.

Reviewed By: dmytrorykun

Differential Revision: D55916135

fbshipit-source-id: 6927b2154870245f28f42d26bd0209b28c9518f2
2024-04-09 08:54:33 -07:00
Christoph Purrer a98c54f616 iOS Remove unused RCTUIManager from RCTRootView (#43978)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43978

Changelog: [Internal]

Seems to be un-used:

https://www.internalfb.com/code/search?q=filepath%3Areact-native-github%20repo%3Afbsource%20allocateRootTag

Reviewed By: javache

Differential Revision: D55874782

fbshipit-source-id: 8bea740e01942ac6684a19bd55025ea68067c4dc
2024-04-09 08:49:26 -07:00
Samuel Susla 3e73dfb535 remove enableFixForClippedSubviewsCrash experiment (#43963)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43963

changelog: [internal]

This experiment did work out. Let's clean it up

Reviewed By: cortinico

Differential Revision: D55797519

fbshipit-source-id: a5da97a7d31b9395b25bfd37db567054721599b0
2024-04-09 07:59:00 -07:00
Riccardo Cipolleschi 49b0d26d45 Fix Orientation listener in bridgeless mode (#43971)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43971

It turns out that we forgot to add a listener for the orientation change event in Bridgeless.

We used to have `UIApplicationDidChangeStatusBarOrientationNotification` but this is slightly unreliable because there might be use cases where the status bar has been hidden and, therefore, the event is not triggered.

This should fix an issue reported by OSS.

## Changelog:
[iOS][Fixed] - Make sure that the New Architecture listens to orientation change events.

Reviewed By: cortinico

Differential Revision: D55871599

fbshipit-source-id: c9b0634ec2126aa7a6488c2c56c87a9610fa1adf
2024-04-09 07:57:54 -07:00
Rubén Norte d35de2d043 Small refactor in RuntimeScheduler_Modern to favor references over shared_ptr for non-owning function args (#43852)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43852

Changelog: [internal]

Just a small refactor so we rely less on shared pointers within `RuntimeSCheduler_Modern`.

Reviewed By: javache

Differential Revision: D55646389

fbshipit-source-id: d01dcba7b1551d349d21717ba585828ed7fb3259
2024-04-09 07:51:03 -07:00
Rubén Norte d16f0f297c Decouple event logger from PerformanceEntryReporter and remove singleton (#43853)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43853

Changelog: [internal]

## Context

This is part of a refactor to decouple the performance entry reporter from the rendering infra and from the native module that uses it.

## Changes

This moves the logic to report the timing of events to a separate class (outside `PerformanceEntryReporter` that now is agnostic to the rendering infra).

Reviewed By: sammy-SC

Differential Revision: D55646392

fbshipit-source-id: 5032a36b23d0741b19fb74cb04f0af3d3d476ef0
2024-04-09 07:51:03 -07:00
Rubén Norte c61c80b5c3 Move PerformanceEntryReporter to its own target (#43854)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43854

Changelog: [internal]

## Context

This is part of a refactor to decouple the performance entry reporter from the rendering infra and from the native module that uses it.

## Changes

This moves the `PerformanceEntryReporter` and related classes to their own target in `ReactCommon/react/performance/timeline` that's not coupled with any rendering logic.

Reviewed By: sammy-SC

Differential Revision: D55646391

fbshipit-source-id: a759ed39c893a0bc14246c7ee608b1727e6ee4cd
2024-04-09 07:51:03 -07:00
Rubén Norte f5c9ed1ff4 Decouple PerformanceEntryReporter from NativePerformanceObserver (#43849)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43849

Changelog: [internal]

## Context

This is part of a refactor to decouple the performance entry reporter from the rendering infra and from the native module that uses it.

## Changes

This refactors `PerformanceEntryReporter` to make the class not depend on the native module that uses it. Instead of using the `RawPerformanceEntry` type from the native module, we define `PerformanceEntry` in `PerformanceEntryReporter` and use it as the source of truth in the native module instead.

Thanks to the bridging template sytem we have, we can convert the raw objects passed from JS to the C++ structs, defining how the enums are converted from and to JS.

Reviewed By: sammy-SC

Differential Revision: D55646394

fbshipit-source-id: 9cf5a7db6ecb221ca08320d0aaae7e7bc8d91804
2024-04-09 07:51:03 -07:00
Rubén Norte 0f43f86035 Add example of Event Timing API in RNTester examples (#43848)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43848

Changelog: [internal]

This makes it easier to see the behavior of the new Event Timing API in RN.

Reviewed By: sammy-SC

Differential Revision: D55646393

fbshipit-source-id: 441fed789a980211783f04095303a139e7b08483
2024-04-09 07:51:03 -07:00
Rubén Norte af27d29553 Fix problems in PerformanceObserver notifications (#43847)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43847

Changelog: [internal]

(This is an internal change because the API hasn't been released in OSS yet)

This fixes 2 problems in how we dispatch `PerformanceObserver` notifications:
1. If an observer callback throws an error, the remaining observers don't receive notifications.
2. We're notifying observers with an empty list of events when they don't match the filters.

Reviewed By: javache

Differential Revision: D55646390

fbshipit-source-id: 6511c7babd45517baf42076308268ea89afe1265
2024-04-09 07:51:03 -07:00
Andrew Datsenko 1ad3593167 //xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/debug:interfacesAndroid (#43921)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43921

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D55725389

fbshipit-source-id: 556b6d051fb0ed6f99bf585770c18a873e4edcee
2024-04-09 07:21:45 -07:00
Andrew Datsenko a3a5a60052 //xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/module/annotations:annotationsAndroid (#43937)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43937

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D55724728

fbshipit-source-id: 8536aa8eb1c8876fa1208932f5c706ef239d4212
2024-04-09 07:17:24 -07:00
Ruslan Shestopalyuk b23960ad99 Migrate TouchEvent to Kotlin (#43982)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43982

## Changelog:
[Internal] -

As in the title.

Reviewed By: javache

Differential Revision: D55877979

fbshipit-source-id: 63ca9b403509e08632ad1a3c0aa866f6df3f423b
2024-04-09 07:01:54 -07:00
Samuel Susla c24a9a9309 simplify StateReconciliationTest (#43993)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43993

changelog: [internal]

clean up tests. The logic is exactly the same, just renaming few variables and deleting unused ones.

Reviewed By: javache

Differential Revision: D55689499

fbshipit-source-id: fffef1051798f1787210cced5e681fa3fe47842b
2024-04-09 04:04:19 -07:00
Ruslan Shestopalyuk 2fcdab47f5 Kotlinify ReactSurfaceView (#43964)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43964

## Changelog:
[Internal] -

As in the title.

Reviewed By: alanleedev

Differential Revision: D55869113

fbshipit-source-id: 650304aee8aedc147b4f27b7c490fb4f64160c96
2024-04-09 02:21:18 -07:00
Alan Lee a7e9a222e7 convert DefaultStyleValuesUtil to Kotlin (#43884)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43884

convert Java to Kotlin: `/react/view/text/DefaultStyleValuesUtil.java`

Changelog:
[Internal] internal

Reviewed By: cortinico

Differential Revision: D55777322

fbshipit-source-id: 4cdbc82a636cb133f486ac3e22534f12daddfcee
2024-04-08 19:43:47 -07:00
Alan Lee f5f7ba0be0 add nullability annotation for DefaultStyleValuesUtil (#43980)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43980

add nullability annotation to DefaultStyleValuesUtil.java

Changelog:
[Internal] internal

Reviewed By: cortinico

Differential Revision: D55784913

fbshipit-source-id: f51b4a469f7fdcf59981675344995023cd8e6bec
2024-04-08 19:43:47 -07:00
Ramanpreet Nara 37eca5d6cd Refactor: ReactInstance: Make ctor more readable (#43984)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43984

Just improvemnts for readability.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D55563578

fbshipit-source-id: cb0ee311091db187bb938547c335c5583243116b
2024-04-08 19:36:04 -07:00
Ramanpreet Nara 2e3f2268dc Refactor: JsErrorHandler: Rename JsErrorHandlingFunc -> OnJsError (#43985)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43985

This is just personal preference.

The name "OnJsError" makes the intent of the abstraction clear: an instance of OnJsError is a function that gets called when a js error is caught.

The name "JsErrorHandlingFunc" is not as good.

Changelog: [General][Breaking] - JsErrorHandler: Rename JsErrorHandlingFunc to OnJsError

Reviewed By: christophpurrer

Differential Revision: D55563580

fbshipit-source-id: 4d20bc984e6633aeac6193b9276a88d76961df2c
2024-04-08 19:36:04 -07:00
Ramanpreet Nara c041b9f40f Refactor: JsErrorHandler: Rename handleJsError to handleFatalError (#43957)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43957

Right now, JsErrorHandler is only used to handle fatal exceptions.

So, let's just scope handleJsError down to handleFatalError.

Changelog: [General][Breaking] - JsErrorHandler: Rename handleJsError to handleFatalError

Reviewed By: cortinico

Differential Revision: D55547901

fbshipit-source-id: 261e0c8fea2852bc95e53c688d90d012d4abea34
2024-04-08 19:36:04 -07:00
Ramanpreet Nara ba3e078c04 Refactor: ReactInstance: Pull "fatal error" bool into JsErrorHandler (#43956)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43956

I think we should try to centralize all things js error handling related inside JsErrorHandler. So, I moved this bool into JsErrorHandler.

This makes ReactInstance easier to understand: it removes one member variable from ReactInstance.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D55547897

fbshipit-source-id: 73d1e0eedf3896c42cda4ce1013863960585da2c
2024-04-08 19:36:04 -07:00
Ramanpreet Nara bffc54d19e Refactor: ReactInstance: Store JsErrorHandler inside a shared_ptr (#43955)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43955

Just makes it easier to pass around JsErrorHandler.

We'll need this in D55547897, when we start storing the "has fataled" boolean inside the JsErrorHandler.

Changelog: [internal]

Reviewed By: cipolleschi

Differential Revision: D55547898

fbshipit-source-id: 162faaeff43bada0301de29111b2c17f7ef878c6
2024-04-08 19:36:04 -07:00
Ramanpreet Nara 3382b15f08 Refactor: RuntimeScheduler: Stop defaulting ctor args redundantly (#43954)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43954

Now, all the defaulting is in RuntimeScheduler.h.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D55547900

fbshipit-source-id: 53678c6a0c83a47e3b0c1a51e388daadfa6bff5e
2024-04-08 19:36:04 -07:00
Ramanpreet Nara 3094273e8b Refactor: RuntimeScheduler: Delete ErrorUtils.h (#43953)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43953

RuntimeScheduler's ErrorUtils.h is redundant.

Let's just remove it.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D55547905

fbshipit-source-id: 5263c9fca8ae32bbfc672f0e16b79ee177cdd421
2024-04-08 19:36:04 -07:00
Ramanpreet Nara 9ad71387e8 Noop: ReactInstance: Add todo above getRuntimeScheduler() (#43952)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43952

getRuntimeScheduler() allows things to schedule work on the js thread by bypassing main bundle buffering.

This is unsafe: almost everything should be using the buffered runtime executor, unless it sets up bindings used in the main bundle.

I filed a task for the investigation to see if there's any problems. And added it to the code in this diff.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D55547899

fbshipit-source-id: 7785b9777e93f36ea0278993332662ed45a20cf2
2024-04-08 19:36:04 -07:00
Andrew Datsenko 379a2729f1 //xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/unimplementedview:unimplementedviewAndroid (#43970)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43970

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D55725588

fbshipit-source-id: e7c5a9b0fad05c7de65115a69571725ce6b91640
2024-04-08 17:13:00 -07:00
Andrew Datsenko 2c680195bc //xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/clipboard:clipboardAndroid (#43861)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43861

Changelog: [Internal]
_____

## Why?
We recommend to use Kotlin for any new code and are actively migrating Java code to Kotlin. This codemod service attempts to migrate existing Java code to Kotlin.

## How was this diff generated?
This codemod service scans through qualified paths and looks for Java modules. Then it runs `kotlinator.sh` on each module, which generated this diff.

## What if I see problems in this diff?
We recommend commandeering and fixing the diff. If you reject or abandon the diff, the codemod service will regenerate it in a few days
- Script for easily commandeer & open diff: In fbandroid, `scripts/commandeer_and_checkout.sh <DIFF>`. It not only commandeer the diff, but also rebase & open diff in Android Studio.
- Report repeating issues in [Kotlinator Papercut](https://fburl.com/papercuts/1g4f4qas)

See more useful tips & scripts in [Kotlin Auto-Conversion Codemod Wiki](https://fburl.com/wiki/c68ka0pu)

_____

## Questions / Comments / Feedback?

**Your feedback is important to us! Give feedback about this diff by clicking the "Provide Feedback" button below.**

* Returning back to author or abandoning this diff will only cause the diff to be regenerated in the future.
* Do **NOT** post in the CodemodService Feedback group about this specific diff.

_____

## Codemod Metadata

NOTE: You won't need to read this section to review this diff.

https://www.internalfb.com/intern/sandcastle/job/22517999373069959/

|Oncall|[kotlin_in_fb4a](https://our.intern.facebook.com/intern/oncall3/?shortname=kotlin_in_fb4a)|
|CodemodConfig|[fbsource/kotlinator.json](https://www.internalfb.com/codemod_service/fbsource%2Fkotlinator.json)|
|ConfigType|configerator|

Rules run:
- CodemodTransformerFBSourceScript

This diff was created with [CodemodService](https://fburl.com/CodemodService).

Reviewed By: cortinico

Differential Revision: D55725451

fbshipit-source-id: fea231c0f11f41013bcf7a8a9b5cf65badf82503
2024-04-08 17:11:55 -07:00
Zeya Peng c3d45740cd Use semver to compare version in cli instead of custom function (#43744)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43744

## Changelog:
[General] [Changed] - Use semver to do version comparison in cli instead of custom fn `parseVersion`

~~adding test for PR change in https://github.com/facebook/react-native/pull/43712~~

Reviewed By: NickGerleman

Differential Revision: D55600458

fbshipit-source-id: eaffa3e89696b90fd354aefaba79e035d180a0b5
2024-04-08 17:10:59 -07:00
Andrew Datsenko 1e6f5a48a6 //xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager:DisplayMetricsAndroid (#43981)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43981

Changelog: [Internal]
_____

## Why?
We recommend to use Kotlin for any new code and are actively migrating Java code to Kotlin. This codemod service attempts to migrate existing Java code to Kotlin.

## How was this diff generated?
This codemod service scans through qualified paths and looks for Java modules. Then it runs `kotlinator.sh` on each module, which generated this diff.

## What if I see problems in this diff?
We recommend commandeering and fixing the diff. If you reject or abandon the diff, the codemod service will regenerate it in a few days
- Script for easily commandeer & open diff: In fbandroid, `scripts/commandeer_and_checkout.sh <DIFF>`. It not only commandeer the diff, but also rebase & open diff in Android Studio.
- Report repeating issues in [Kotlinator Papercut](https://fburl.com/papercuts/1g4f4qas)

See more useful tips & scripts in [Kotlin Auto-Conversion Codemod Wiki](https://fburl.com/wiki/c68ka0pu)

_____

## Questions / Comments / Feedback?

**Your feedback is important to us! Give feedback about this diff by clicking the "Provide Feedback" button below.**

* Returning back to author or abandoning this diff will only cause the diff to be regenerated in the future.
* Do **NOT** post in the CodemodService Feedback group about this specific diff.

_____

## Codemod Metadata

NOTE: You won't need to read this section to review this diff.

https://www.internalfb.com/intern/sandcastle/job/27021599000417439/

|Oncall|[kotlin_in_fb4a](https://our.intern.facebook.com/intern/oncall3/?shortname=kotlin_in_fb4a)|
|CodemodConfig|[fbsource/kotlinator.json](https://www.internalfb.com/codemod_service/fbsource%2Fkotlinator.json)|
|ConfigType|configerator|

Rules run:
- CodemodTransformerFBSourceScript

This diff was created with [CodemodService](https://fburl.com/CodemodService).

Reviewed By: cortinico

Differential Revision: D55725602

fbshipit-source-id: b8b77bf97de5a0eda5b077d6c5441b9af36fc26b
2024-04-08 16:37:57 -07:00
Andrew Datsenko 026361ddb4 //xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/devloading:devloadingAndroid (#43975)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43975

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D55725612

fbshipit-source-id: b597e906c8e2cdb571c8882e82083626a74a6d70
2024-04-08 16:09:49 -07:00
Andrew Datsenko 5b77df0199 Update package com.facebook.react.perflogger -> com.facebook.react.reactperflogger (#43873)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43873

Changelog: [Internal]
Addressing lint for package name com.facebook.react.perflogger

Reviewed By: alanleedev

Differential Revision: D55747967

fbshipit-source-id: 5d05a14e396d80f8b0bc88515333dcd708e8736a
2024-04-08 14:37:02 -07:00