Commit Graph

12270 Commits

Author SHA1 Message Date
Vitali Zaidman 46f91fd34d Improved the description of the error shown when a previous debugger is closed when a new one is opened (#51296)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51296

Changelog: [General][Internal] Improved the description of the error shown when a previous debugger is closed when a new one is opened

Corresponding DevTools PR:
https://github.com/facebook/react-native-devtools-frontend/pull/162

Reviewed By: hoxyq

Differential Revision: D74657572

fbshipit-source-id: fa601aab22099bbf957e5e66420f94752f03b6f3
2025-05-14 07:23:45 -07:00
Nick Lefever 169525d33b Fix nativeID and testID prop diffing for View component (#51312)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51312

The nativeID and testID prop mapping on the native Java side use full caps `ID` in the setter mapping. Fixing the props diffing result to use the right key in the result for both.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D74724759

fbshipit-source-id: 4291a72cd3081981f4a25f16f8f2bef17230da54
2025-05-14 06:02:37 -07:00
Samuel Susla 4c0607ee36 add test for ViewCulling when sibling in FLatList resizes (#51311)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51311

changelog: [internal]

add a test case for view culling to cover a crash observed in production.

Reviewed By: lenaic, rubennorte

Differential Revision: D74720814

fbshipit-source-id: ed1246ccbaa0d0ab51a6073f20642c1c78872f30
2025-05-14 05:38:49 -07:00
Rubén Norte 7776122e2e Move playground tests to their own directory (#51310)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51310

Changelog: [internal]

Just a bit of separation between these and Fantom own tests.

Reviewed By: lenaic

Differential Revision: D74717487

fbshipit-source-id: f9d8667c823fcda7b1f3222803367c6b15d9309d
2025-05-14 04:01:31 -07:00
Ritesh Shukla 68d6ada448 Fixed borderBottomEndRadius on RTL (#51229)
Summary:
Fixes https://github.com/facebook/react-native/issues/51193
## Changelog:
[ANDROID][FIXED] Wrong borderBottomEndRadius on RTL

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

Test Plan:
Tested with Arabic (RTL) and English(LTR)

English
<img src="https://github.com/user-attachments/assets/5bd1eca9-194c-4d83-b75f-689bc13d827b" width=200>

Arabic
<img src="https://github.com/user-attachments/assets/459320a0-6bb2-4585-97bb-bd4ded6ec399" width=200>

Reviewed By: cortinico

Differential Revision: D74709219

Pulled By: NickGerleman

fbshipit-source-id: 885bb84d97d73324983d044fd2874a457b40f646
2025-05-14 03:54:04 -07:00
meg 777397667c fix issue #51297 which addresses allWarningsAsErrors type error (#51300)
Summary:
Resolved a build error [issue https://github.com/facebook/react-native/issues/51297](https://github.com/facebook/react-native/issues/51297) caused by assigning a Boolean to a Property<Boolean>.
Switched from direct assignment to using .set(...) to correctly configure allWarningsAsErrors from project properties.

## Changelog:

- Gradle fix: assign allWarningsAsErrors using .set() for Property<Boolean>

<!-- 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] - [ANDROID] [FIXED]

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

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

Test Plan:
Fixes build failure with React Native v0.79.2 and Gradle v8.0.
```
npm run start
npm run android
```
no more build errors

Reviewed By: cortinico

Differential Revision: D74706741

Pulled By: rshest

fbshipit-source-id: 31ec923f49a6da63fb5abb464bc38b99b1e8650a
2025-05-14 02:54:02 -07:00
Nick Gerleman 7f8b6566c4 Resubmit: Ensure that ShadowNode measure functions respect constraints (#51299)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51299

## Resubmit

This change was backed out, due to the WinUI Fabric TextLayoutManager not respecting minimum size constraints, causing early debug assert. D74494087 was confirmed to fix this.

For more safety, we limit fatal debug assertsions to `ParagraphShadowNode`, and only log a native error for other ShadowNodes.

## Original

Android's TextLayoutManager may return widths greather than the max measure constraint.

Yoga will clamp these, but this sort of issue points to a logic bug, and creates issues when we are looking at caching text measurements based on constraint reuse.

Let's debug assert that we don't do that, and fix a case of rounding up at a pixel boundary, to ensure that it doesn't go above max width. This should theoretically be safe, since Yoga is already doing this clamping, which is what dictates final size of the TextView.

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D74674460

fbshipit-source-id: 807d6629bb799a3b1a55e378a3243065055ce219
2025-05-13 19:49:20 -07:00
Nick Gerleman 1fe3ff86c3 Fix more text rounding bugs (#51303)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51303

We do a lot of incorrect `cei()` in text measurement, compensated later by other incorrect bits.

There are a couple of interesting bits here:

A "desired width" is how large a hypothetical text layout would like to be. It is a floating point value, and to avoid truncation, a container must be larger than the desired width. So ceiling this is correct.

We are also passed available width, which may be an exact specification, not at a subpixel boundary. Ceiling this is totally incorrect, since Yoga will disregard our ceiled version, and we just created a layout, larger than our actual measure will be.

We must instead floor `availableWidth`, and we create our layout based off of that, to not give an extra physical pixel, that may not be given to us, if later layout rounding doesn't go our way. We then ceil `desiredWidth` earlier.

Finally, when we have an exact measuremode, we create the layout so that it uses guaranteedWidth`, but act as if it takes the full available space, per-contract, which may be a subpixel size larger. This means we cannot create layouts which cause truncation.

I used this change as an opportunity to clean up `createLayout()`, since we are gating anyways, to remove the duplicated paths, and to avoid the unnecessary `TextDirectionHeuristic` work for BoringLayout case, and since `StaticLayoutBuilder` already defaults to the heuristic we are manually setting.

Changelog:
[Android][Fixed] - Fix more text rounding bugs

Reviewed By: joevilches

Differential Revision: D74685353

fbshipit-source-id: 3700df657958c6efb46bfbbe674051d16a2b7c26
2025-05-13 19:49:20 -07:00
Nick Gerleman 3391959fd8 Resubmit: Expose Unsnapped Dimensions (#51298)
Summary:
X-link: https://github.com/facebook/yoga/pull/1811

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

## Resubmit

This was backed out due to being up the stack from another change that was backed out, but should be safe by itself.

## Original

We want to know if an artifact created during measurement can fully be reused after final layout, but the final layout is allowed to be slightly larger due to pixel grid rounding (while still allowing reuse). It's hard to tell after the fact, whether it is larger because of this rounding (though the measure is used), or if it may be a pixel larger for valid reasons.

We can expose the unsnapped dimensions of a node to give us this information, and to correlate measurement artifacts.

This is most of the time the same as the layout's measured dimension, though I don't think it's safe to use this, since anything else measuring the node after could clobber this (I think `YGNodeLayoutGetOverflow` may also be prone to this as a bug).

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D74673119

fbshipit-source-id: 06d2eb21e28b76458ec88f4dfcaec809707d0390
2025-05-13 18:21:04 -07:00
Joe Vilches 79c47987b7 Fix issue where text inputs cannot blur on <= Android 8.1 (#51302)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51302

We got https://github.com/facebook/react-native/issues/51072#issue-3035616801 which demonstrates that if we have 2 text inputs on a screen we cannot blur them. If you try to blur any, focus jumps to the first one.

This seems to be a bug with Android's `clearFocus` per https://developer.android.com/reference/android/view/View#clearFocus(), this behavior is intended when we are not in touch mode, yet it happens regardless of what mode we are in on this version.

I modified this a bit to swallow `requestFocus` calls if we are in touch mode. This should be fine as no JS focus calls will go through this path. On hardware keyboard focus and focus from `clearFocus`

Changelog: [Android] [Fixed] - Fix bug where focus would jump to top text input upon clearing a separate text input.

Reviewed By: mlord93

Differential Revision: D74678847

fbshipit-source-id: 12dcaf0c9c350d3ed697ff81e8dfb205b7942119
2025-05-13 17:56:46 -07:00
Rubén Norte 5dd489190c Handle platform objects in structuredClone (#51257)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51257

Changelog: [internal]

Fixes the semantics for `structruredClone` when dealing with platform objects (cloning the supported ones and throwing exceptions for the rest).

Reviewed By: hoxyq

Differential Revision: D74574857

fbshipit-source-id: 71b99e9659cf3fb4bed8f431e9b54d2f9f514706
2025-05-13 14:29:01 -07:00
Rubén Norte 6454d2f0db Introduce concept of platform objects and serialization (#51256)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51256

Changelog: [internal]

This is just in preparation for `structuredClone` handling the cloning (or not) of platform objects correctly.

It marks all existing Web platform objects in RN as such, and defines the clone method for `DOMRectReadOnly`, `DOMRect` and `DOMException`.

Reviewed By: hoxyq

Differential Revision: D74574856

fbshipit-source-id: 9e9647fcaafcc1d32fb36e5ee40167871572c544
2025-05-13 14:29:01 -07:00
Rubén Norte 1bb8546698 Introduce better mechanism for non-serializable built-ins in structuredClone (#51255)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51255

Changelog: [internal]

Just a small refactor of how we handle non-serializable built-ins in structuredClone

Reviewed By: hoxyq

Differential Revision: D74398113

fbshipit-source-id: 26211920fcd4cf11c5da278e213eaa2b6b9aa1b5
2025-05-13 14:29:01 -07:00
Rubén Norte caaa5c93fb Optimize structuredClone (#51250)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51250

Changelog: [internal]

Optimizes the implementation of `structuredClone`.

Before:
| (index) | Task name                | Latency average (ns) | Latency median (ns) | Throughput average (ops/s) | Throughput median (ops/s) | Samples |
| ------- | ------------------------ | -------------------- | ------------------- | -------------------------- | ------------------------- | ------- |
| 0       | 'clone a string'         | '955.81 ± 1.45%'     | '902.00'            | '1095925 ± 0.01%'          | '1108647'                 | 1046239 |
| 1       | 'clone a basic array'    | '7684.79 ± 0.76%'    | '7542.00'           | '131980 ± 0.02%'           | '132591'                  | 130128  |
| 2       | 'clone a basic object'   | '6286.35 ± 0.53%'    | '6179.00'           | '161179 ± 0.02%'           | '161838'                  | 159075  |
| 3       | 'clone a complex object' | '22446.96 ± 0.32%'   | '22223.00'          | '44819 ± 0.03%'            | '44998'                   | 44550   |

After:

| (index) | Task name                | Latency average (ns) | Latency median (ns) | Throughput average (ops/s) | Throughput median (ops/s) | Samples |
| ------- | ------------------------ | -------------------- | ------------------- | -------------------------- | ------------------------- | ------- |
| 0       | 'clone a string'         | '793.81 ± 0.09%'     | '781.00'            | '1270316 ± 0.01%'          | '1280410'                 | 1259755 |
| 1       | 'clone a basic array'    | '5079.81 ± 2.13%'    | '4798.00'           | '206235 ± 0.03%'           | '208420'                  | 196858  |
| 2       | 'clone a basic object'   | '3823.37 ± 1.60%'    | '3636.00'           | '271030 ± 0.03%'           | '275028'                  | 261550  |
| 3       | 'clone a complex object' | '13095.13 ± 2.04%'   | '12499.00'          | '79701 ± 0.03%'            | '80006'                   | 76365   |

Reviewed By: hoxyq

Differential Revision: D74576514

fbshipit-source-id: f452dcfca6398dbfa40c5a41b77b0157777fa59b
2025-05-13 14:29:01 -07:00
Rubén Norte f7327bddb5 Add benchmark for structuredClone (#51249)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51249

Changelog: [internal]

This adds a basic benchmark for `structuredClone`, so we can optimize it in the following diff.

Baseline:

| (index) | Task name                | Latency average (ns) | Latency median (ns) | Throughput average (ops/s) | Throughput median (ops/s) | Samples |
| ------- | ------------------------ | -------------------- | ------------------- | -------------------------- | ------------------------- | ------- |
| 0       | 'clone a string'         | '955.81 ± 1.45%'     | '902.00'            | '1095925 ± 0.01%'          | '1108647'                 | 1046239 |
| 1       | 'clone a basic array'    | '7684.79 ± 0.76%'    | '7542.00'           | '131980 ± 0.02%'           | '132591'                  | 130128  |
| 2       | 'clone a basic object'   | '6286.35 ± 0.53%'    | '6179.00'           | '161179 ± 0.02%'           | '161838'                  | 159075  |
| 3       | 'clone a complex object' | '22446.96 ± 0.32%'   | '22223.00'          | '44819 ± 0.03%'            | '44998'                   | 44550   |

Reviewed By: hoxyq

Differential Revision: D71407319

fbshipit-source-id: ee1c89d6ba3fd2484b2f4115cc58dc4b08e04fa7
2025-05-13 14:29:01 -07:00
Rubén Norte 46b55d2146 Basic implementation of structuredClone (#51248)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51248

Changelog: [internal]

This implements an initial version of `structuredClone`, but only to be used internally (not exposed as a global yet).

The goal is to use this implementation to fix the semantics of the `detail` field in performance entries, which is meant to be cloned.

Reviewed By: hoxyq

Differential Revision: D71407320

fbshipit-source-id: c7ec1229f9c3414d8b95110da6f65828d74b8c8e
2025-05-13 14:29:01 -07:00
Rubén Norte 955c61c738 Implement DOMException (#51247)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51247

Changelog: [internal]

This implements an initial version of `DOMException`, but only to be used internally (not exposed as a global yet).

The goal is to make this available to `structuredClone`, which will be added after this.

Reviewed By: hoxyq

Differential Revision: D71407318

fbshipit-source-id: b28f11542749ceef6485ff934a712eed941a4545
2025-05-13 14:29:01 -07:00
Samuel Susla 34e9cba764 fix crash in view culling where differentiator creates create instruction for existing view (#51294)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51294

changelog: [internal]

Fix a crash where a node that is supposed to be culled doesn't get visited because culling context is not updated.
The differentiator would generate a create instruction for a view that already exists.

Stack trace for the crash:
```
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
  * frame #0: 0x0000000111740874 libsystem_kernel.dylib`__pthread_kill + 8
    frame #1: 0x00000001117aa2ec libsystem_pthread.dylib`pthread_kill + 264
    frame #2: 0x0000000180171ea8 libsystem_c.dylib`abort + 100
    frame #3: 0x00000001802b0144 libc++abi.dylib`abort_message + 128
    frame #4: 0x000000018029fe4c libc++abi.dylib`demangling_terminate_handler() + 296
    frame #5: 0x000000018006f220 libobjc.A.dylib`_objc_terminate() + 124
    frame #6: 0x00000001375d1964 INFRAFramework`meta_terminate() + 5468
    frame #7: 0x00000001802af570 libc++abi.dylib`std::__terminate(void (*)()) + 12
    frame #8: 0x00000001802b2498 libc++abi.dylib`__cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*) + 32
    frame #9: 0x00000001802b2478 libc++abi.dylib`__cxa_throw + 88
    frame #10: 0x0000000180093904 libobjc.A.dylib`objc_exception_throw + 384
    frame #11: 0x0000000180e6999c Foundation`-[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 268
    frame #12: 0x000000031a3bcfc8 XPLAT_6_Framework`-[RCTComponentViewRegistry dequeueComponentViewWithComponentHandle:tag:] + 528
    frame #13: 0x000000031a3ccdec XPLAT_6_Framework`RCTPerformMountInstructions(std::__1::vector<facebook::react::ShadowViewMutation, std::__1::allocator<facebook::react::ShadowViewMutation>> const&, RCTComponentViewRegistry*, RCTMountingTransactionObserverCoordinator&, int) + 356
    frame #14: 0x000000031a3ccc7c XPLAT_6_Framework`-[RCTMountingManager performTransaction:]::$_1::operator()(facebook::react::MountingTransaction const&, facebook::react::SurfaceTelemetry const&) const + 80
    frame #15: 0x000000031a3ccc20 XPLAT_6_Framework`decltype(std::declval<-[RCTMountingManager performTransaction:]::$_1&>()(std::declval<facebook::react::MountingTransaction const&>(), std::declval<facebook::react::SurfaceTelemetry const&>())) std::__1::__invoke[abi:ne190102]<-[RCTMountingManager performTransaction:]::$_1&, facebook::react::MountingTransaction const&, facebook::react::SurfaceTelemetry const&>(-[RCTMountingManager performTransaction:]::$_1&, facebook::react::MountingTransaction const&, facebook::react::SurfaceTelemetry const&) + 40
    frame #16: 0x000000031a3ccbc8 XPLAT_6_Framework`void std::__1::__invoke_void_return_wrapper<void, true>::__call[abi:ne190102]<-[RCTMountingManager performTransaction:]::$_1&, facebook::react::MountingTransaction const&, facebook::react::SurfaceTelemetry const&>(-[RCTMountingManager performTransaction:]::$_1&, facebook::react::MountingTransaction const&, facebook::react::SurfaceTelemetry const&) + 40
    frame #17: 0x000000031a3ccb94 XPLAT_6_Framework`std::__1::__function::__alloc_func<-[RCTMountingManager performTransaction:]::$_1, std::__1::allocator<-[RCTMountingManager performTransaction:]::$_1>, void (facebook::react::MountingTransaction const&, facebook::react::SurfaceTelemetry const&)>::operator()[abi:ne190102](facebook::react::MountingTransaction const&, facebook::react::SurfaceTelemetry const&) + 44
    frame #18: 0x000000031a3cba1c XPLAT_6_Framework`std::__1::__function::__func<-[RCTMountingManager performTransaction:]::$_1, std::__1::allocator<-[RCTMountingManager performTransaction:]::$_1>, void (facebook::react::MountingTransaction const&, facebook::react::SurfaceTelemetry const&)>::operator()(facebook::react::MountingTransaction const&, facebook::react::SurfaceTelemetry const&) + 44
    frame #20: 0x000000032f219804 XPLAT_1_Framework`std::__1::function<void (facebook::react::MountingTransaction const&, facebook::react::SurfaceTelemetry const&)>::operator()(this=0x000000016d4f0c78, __arg=0x000000016d4f0a10, __arg=0x000000016d4f0978) const at function.h:989:10
    frame #21: 0x000000032f219668 XPLAT_1_Framework`facebook::react::TelemetryController::pullTransaction(this=0x00000003f4680f00, willMount=0x000000016d4f0c98, doMount=0x000000016d4f0c78, didMount=0x000000016d4f0c58) const at TelemetryController.cpp:39:3
    frame #22: 0x000000031a3c5b28 XPLAT_6_Framework`-[RCTMountingManager performTransaction:] + 544
    frame #23: 0x000000031a3c5864 XPLAT_6_Framework`-[RCTMountingManager initiateTransaction:] + 456
    frame #24: 0x000000031a3c5240 XPLAT_6_Framework`__42-[RCTMountingManager scheduleTransaction:]_block_invoke + 308
    frame #25: 0x0000000131f81b84 BOTTOMFramework`__RCTExecuteOnMainQueue_block_invoke + 40
    frame #26: 0x000000018017c788 libdispatch.dylib`_dispatch_call_block_and_release + 24
    frame #27: 0x0000000180197278 libdispatch.dylib`_dispatch_client_callout + 12
    frame #28: 0x00000001801b2fcc libdispatch.dylib`_dispatch_main_queue_drain.cold.7 + 24
    frame #29: 0x000000018018c1c4 libdispatch.dylib`_dispatch_main_queue_drain + 1184
    frame #30: 0x000000018018bd14 libdispatch.dylib`_dispatch_main_queue_callback_4CF + 40
    frame #31: 0x0000000180427fec CoreFoundation`__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
    frame #32: 0x00000001804229f8 CoreFoundation`__CFRunLoopRun + 1920
    frame #33: 0x0000000180421e3c CoreFoundation`CFRunLoopRunSpecific + 536
    frame #34: 0x0000000190f62d00 GraphicsServices`GSEventRunModal + 164
    frame #35: 0x0000000185bcec98 UIKitCore`-[UIApplication _run] + 796
    frame #36: 0x0000000185bd3064 UIKitCore`UIApplicationMain + 124
    frame #37: 0x0000000115fbf0bc PRODUCTFramework`main + 200
    frame #38: 0x00000001114293d8 dyld_sim`start_sim + 20
    frame #39: 0x0000000111506b4c dyld`start + 6000
```

Reviewed By: rubennorte

Differential Revision: D74654157

fbshipit-source-id: 9181bcd28524c71d0ca4620bd630dc0baa172386
2025-05-13 13:59:51 -07:00
Tomasz Zawadzki 4a8fda83e3 Fix deprecation message for BindingsInstallerHolder (#51295)
Summary:
This PR replaces non-existent `BindingsInstaller` with `BindingsInstallerHolder` in deprecation message for old variant of `BindingsInstallerHolder`.

## Changelog:

[GENERAL] [FIXED] - Fixed deprecation message for `BindingsInstallerHolder`

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

Reviewed By: javache

Differential Revision: D74656439

Pulled By: cortinico

fbshipit-source-id: b29ffabbc8f8218e13d305e9f5143f084fea8dea
2025-05-13 12:47:14 -07:00
Vincent Riemer 49002fa0b4 Expose ShadowNodeFamily to RawEvent (#51267)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51267

Changelog: [Internal]

This diff exposes the corresponding target ShadowNodeFamily to a RawEvent through a weak pointer. This is necessary for the upcoming move of pointer event interception from the JS to main thread.

Reviewed By: javache

Differential Revision: D74500630

fbshipit-source-id: 3bcf32855a004e091be64b6171dc65127375534c
2025-05-13 11:23:17 -07:00
Ruslan Shestopalyuk 80eed4a4a7 Fix data race in usage of ShadowTreeRevisionConsistencyManager (#51293)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51293

# Changelog:
[Internal] -

Indirect consequence of https://github.com/facebook/react-native/pull/50484, TSAN started to detect a data race in some configurations.

It's possible to have the data race between the `ShadowTreeRevisionConsistencyManager` being set in `RuntimeScheduler` and it being already used in the executor thread (as these things are generally done from different threads).

Differential Revision: D74651070

fbshipit-source-id: bda49371d541815119f119e6986de39c21f9b374
2025-05-13 09:39:04 -07:00
Nicola Corti 1d5bbf1ccf Cleanup several warnings inside DisplayMetricsHolder (#51074)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51074

While working on this class I noticed there are a number of warnings. Let's clean them up.

Changelog:
[Internal] [Changed] -

Reviewed By: mdvacca

Differential Revision: D74001269

fbshipit-source-id: 7e86ffdaf9c82ff5a165618813fa700f8e850a74
2025-05-13 08:44:29 -07:00
Mateo Guzmán 2c1726a073 Suppress unused androidx.core.content.res.use warning (#51272)
Summary:
Follow up from https://github.com/facebook/react-native/pull/51170, static code analysis shows androidx.core.content.res.use as unused, it looked pretty harmless to remove it as there was no context about its usage, but it caused some crashes.

I'm suppressing the warning here, plus adding an explanation on why it is needed to prevent a future developer from touching this file and causing the same regression.

## Changelog:

[INTERNAL] - Suppress unused androidx.core.content.res.use warning

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

Test Plan: Static code analysis should not show the import as unused.

Reviewed By: cortinico

Differential Revision: D74642726

Pulled By: rshest

fbshipit-source-id: 14cec4fe92f06827636410df4b88a3b7088abe52
2025-05-13 08:02:22 -07:00
Vitali Zaidman f5fba73439 Update debugger-frontend from bc635fa...3d17e0f (#51292)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51292

Changelog: [Internal] - Update `react-native/debugger-frontend` from bc635fa...3d17e0f

Resyncs `react-native/debugger-frontend` from GitHub - see `rn-chrome-devtools-frontend` [changelog](https://github.com/facebook/react-native-devtools-frontend/compare/bc635fa428baf08a0667f89e3ee03f92c2f96416...3d17e0fd462dc698db34586697cce2371b25e0d3).

Reviewed By: hoxyq

Differential Revision: D74648171

fbshipit-source-id: d2c45b6d27ab71a933a7c6d6fedc07abc13cf3d2
2025-05-13 07:39:12 -07:00
Nick Lefever 4166cc0dd8 Fix NaN value comparison for paragraph props diffing (#51289)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51289

Because NaN is always different from NaN, these Float props were always included in the diff when set to NaN. This checks for the specific case where both the current and the prev prop value is NaN.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D74647582

fbshipit-source-id: 7941dcc6a96bed13c2e43232606bd1f9a9179606
2025-05-13 07:02:10 -07:00
Samuel Susla 3e3f8eade5 enable enableEagerAlternateStateNodeCleanup in tests (#51291)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51291

changelog: [internal]

enable enableEagerAlternateStateNodeCleanup in tests and remove workarounds.

Reviewed By: rubennorte

Differential Revision: D74643973

fbshipit-source-id: 00f9a6b36546fdea246b587e0e716c7aa76c6bbc
2025-05-13 07:00:26 -07:00
Nick Lefever 76ed662f1e Fix numberOfLines prop diffing for Paragraph component (#51277)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51277

The number of lines prop diffing was not being updated when enabling Props 2.0 and when set through the paragraph attributes. This diff fixes the typo that was causing the bug.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D74619497

fbshipit-source-id: 2ad7d1629106ff16d511760694dcef0cafd9a96e
2025-05-13 05:27:17 -07:00
Nick Lefever cde792ae5e Add getDiffProps for TextInput component - Android text input props (#51276)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51276

This diff adds the Android specific props to the `getDiffProps` implementation and enables `TextInput` components for Props 2.0 use in the Fabric mounting manager

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D74610303

fbshipit-source-id: c45abf2b272f5dfb50f4f1bad256e9130a808900
2025-05-13 05:27:17 -07:00
Nick Lefever 63c0287c83 Add getDiffProps for TextInput component - base text input props (#51275)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51275

See title

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D74610301

fbshipit-source-id: cbd3f8eab75838f8b68a668ec44d3e14aa591f25
2025-05-13 05:27:17 -07:00
Nick Lefever d08e668a1a Add getDiffProps for TextInput component - paragraph attributes (#51274)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51274

See title

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D74610302

fbshipit-source-id: ef1f946e0b7f7b51c06da167e5b8df2fc57933f6
2025-05-13 05:27:17 -07:00
Mateo Guzmán d7b056c198 Migrate JSTouchDispatcher to Kotlin (#51242)
Summary:
Migrate com.facebook.react.uimanager.JSTouchDispatcher to Kotlin.

## Changelog:

[INTERNAL] - Migrate com.facebook.react.uimanager.JSTouchDispatcher to Kotlin

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

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

Reviewed By: cortinico

Differential Revision: D74568593

Pulled By: rshest

fbshipit-source-id: 2ce0087ce96025fd85aab2d61806cc9ada1d68cd
2025-05-13 05:05:51 -07:00
Mateo Guzmán 436bddadda Migrate ModuleSpec to Kotlin (#51240)
Summary:
Migrate com.facebook.react.bridge.ModuleSpec to Kotlin.

## Changelog:

[INTERNAL] - Migrate com.facebook.react.bridge.ModuleSpec to Kotlin

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

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

Reviewed By: cortinico

Differential Revision: D74568550

Pulled By: rshest

fbshipit-source-id: 15cedc9e97f95aa2582ce12c9086336c12564371
2025-05-13 05:03:09 -07:00
Vitali Zaidman 9b4be02ae8 standardize error messages thrown from inspector proxy when connection is closed to debugger (#51227)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51227

Standardize error messages thrown from inspector proxy when connection is closed to debugger and link to where they are used in `react-native-devtools-frontend`

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D74484316

fbshipit-source-id: 7885bc5ea41397539814f97d764c9a376ef50eaa
2025-05-13 04:38:29 -07:00
Tim Yung 12b2b56102 RN: Enable Hermes GC on Memory Pressure Warning (iOS) (#51271)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51271

Deletes the feature flag that was gating the new logic to invoke Hermes GC when iOS emits a memory pressure warning.

Changelog:
[iOS][Changed] - Hermes GC is now triggered in response to iOS memory pressure warning.

Reviewed By: fkgozali

Differential Revision: D74605206

fbshipit-source-id: b0753b15f5a30f37ed17bfebff0b491c7e7a6b59
2025-05-12 20:22:54 -07:00
Mateo Guzmán d469cca4ba Make SoftAssertions internal (#51172)
Summary:
This class can be internalized as part of the initiative to reduce the public API surface. I've checked there are [no relevant OSS usages](https://github.com/search?type=code&q=NOT+is%3Afork+NOT+org%3Afacebook+NOT+repo%3Areact-native-tvos%2Freact-native-tvos+NOT+repo%3Anuagoz%2Freact-native+NOT+repo%3A2lambda123%2Freact-native+NOT+repo%3Abeanchips%2Ffacebookreactnative+NOT+repo%3AfabOnReact%2Freact-native-notes+NOT+user%3Ahuntie+NOT+user%3Acortinico+NOT+repo%3AMaxdev18%2Fpowersync_app+NOT+repo%3Acarter-0%2Finstagram-decompiled+NOT+repo%3Am0mosenpai%2Finstadamn+NOT+repo%3AA-Star100%2FA-Star100-AUG2-2024+NOT+repo%3Alclnrd%2Fdetox-scrollview-reproductible+NOT+repo%3ADionisisChytiris%2FWorldWiseTrivia_Main+NOT+repo%3Apast3l%2Fhi2+NOT+repo%3AoneDotpy%2FCaribouQuest+NOT+repo%3Abejayoharen%2Fdailytodo+NOT+repo%3Amolangning%2Freversing-discord+NOT+repo%3AScottPrzy%2Freact-native+NOT+repo%3Agabrieldonadel%2Freact-native-visionos+NOT+repo%3AGabriel2308%2FTestes-Soft+NOT+repo%3Adawnzs03%2FflakyBuild+NOT+repo%3Acga2351%2Fcode+NOT+repo%3Astreeg%2Ftcc+NOT+repo%3Asoftware-mansion-labs%2Freact-native-swiftui+NOT+repo%3Apkcsecurity%2Fdecompiled-lightbulb+com.facebook.react.bridge.SoftAssertions).

## Changelog:

[INTERNAL] - Make com.facebook.react.bridge.SoftAssertions internal

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

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

Reviewed By: rshest

Differential Revision: D74368288

Pulled By: arushikesarwani94

fbshipit-source-id: 50e9559f7f15700ea9adfb03a260615e3b397a0c
2025-05-12 17:22:24 -07:00
Mateo Guzmán 23e693ad67 Make ReactSoftExceptionLogger internal (#51173)
Summary:
This class can be internalized as part of the initiative to reduce the public API surface. I've checked there are [no relevant OSS usages](https://github.com/search?type=code&q=NOT+is%3Afork+NOT+org%3Afacebook+NOT+repo%3Areact-native-tvos%2Freact-native-tvos+NOT+repo%3Anuagoz%2Freact-native+NOT+repo%3A2lambda123%2Freact-native+NOT+repo%3Abeanchips%2Ffacebookreactnative+NOT+repo%3AfabOnReact%2Freact-native-notes+NOT+user%3Ahuntie+NOT+user%3Acortinico+NOT+repo%3AMaxdev18%2Fpowersync_app+NOT+repo%3Acarter-0%2Finstagram-decompiled+NOT+repo%3Am0mosenpai%2Finstadamn+NOT+repo%3AA-Star100%2FA-Star100-AUG2-2024+NOT+repo%3Alclnrd%2Fdetox-scrollview-reproductible+NOT+repo%3ADionisisChytiris%2FWorldWiseTrivia_Main+NOT+repo%3Apast3l%2Fhi2+NOT+repo%3AoneDotpy%2FCaribouQuest+NOT+repo%3Abejayoharen%2Fdailytodo+NOT+repo%3Amolangning%2Freversing-discord+NOT+repo%3AScottPrzy%2Freact-native+NOT+repo%3Agabrieldonadel%2Freact-native-visionos+NOT+repo%3AGabriel2308%2FTestes-Soft+NOT+repo%3Adawnzs03%2FflakyBuild+NOT+repo%3Acga2351%2Fcode+NOT+repo%3Astreeg%2Ftcc+NOT+repo%3Asoftware-mansion-labs%2Freact-native-swiftui+NOT+repo%3Apkcsecurity%2Fdecompiled-lightbulb+com.facebook.react.bridge.ReactSoftExceptionLogger).

## Changelog:

[INTERNAL] - Make com.facebook.react.bridge.ReactSoftExceptionLogger internal

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

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

Reviewed By: rshest

Differential Revision: D74368261

Pulled By: arushikesarwani94

fbshipit-source-id: 913d790eb64ffda6bb48ddf69dd5ab996cd363d9
2025-05-12 17:22:24 -07:00
HyunWoo Lee b2ffd34a39 Refactor ReactAndroid to use buildReadableMap, buildReadableArray DSL (#51145)
Summary:
This PR refactors the entire ReactAndroid package to replace manual `Arguments.createMap()…` and `Arguments.createArray()…` calls with the new Kotlin DSL helpers `buildReadableMap { … }` and `buildReadableArray { … }`. All eligible call sites have been migrated to the DSL, except in functions whose signatures explicitly declare or return WritableMap or WritableArray.

No runtime behavior changes are introduced; existing functionality and tests continue to pass unchanged.

## 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] [CHANGED] Apply Collections DSL on ReactAndroid package

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

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

Reviewed By: rshest

Differential Revision: D74401357

Pulled By: cortinico

fbshipit-source-id: 0f7b7dfbb7b495675bc4730bdf018666e9041884
2025-05-12 16:35:07 -07:00
Joe Vilches d362e496eb Fix string comparison when self has accessibility order reference (#51270)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51270

I was informed that we could not reference ourselves with accessibility order when using `useID`. The reason for that ended up being because of this if statement which uses `==`. Note this worked with a normal string like `"foo"` but `useID` has ids like `"<<r0>>"` so I imagine the < and > made this break.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D74601689

fbshipit-source-id: 25adc84248fbfcaff36607d18c170e6c8000cffb
2025-05-12 15:09:18 -07:00
Mofei Zhang af4cfbf03f repro edge cases for noEmit and module opt-outs (#33144)
Summary:
see test fixtures
 ---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/33144).
* #33146
* #33145
* __->__ #33144

DiffTrain build for [fbe7bc21b9aa00afa230132b3f7eee6d2b5c94a7](https://github.com/facebook/react/commit/fbe7bc21b9aa00afa230132b3f7eee6d2b5c94a7)

Reviewed By: jackpope

Differential Revision: D74404265

fbshipit-source-id: 8a2fc2856e2da9ca7c63d8d49191c4f9e6b015b9
2025-05-12 13:51:47 -07:00
Fabrizio Cucci 4918b30f49 Kotlinify ViewManagerRegistry (#51262)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51262

As per title.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D74571782

fbshipit-source-id: 4acec9b9c0801d863074b7a91fb116780f22929a
2025-05-12 13:50:10 -07:00
Ruslan Lesiutin 7430ee0b99 Define precise return types for toJs conversions, instead of generic jsi::Value (#51224)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51224

Changelog: [Internal]

We have a bunch of places where we rely on implicit conversion operators of `jsi::Value` and return some primitive type.

This doesn't work well with Bridging, because currently it doesn't take into account these implicit operator conversions: primitives won't be treated as primitivies, but rather as generic `jsi::Value`, which could be many things.

We should be explicit about return type in `toJs`, because it affects the type checking logic.

Reviewed By: javache

Differential Revision: D74478571

fbshipit-source-id: 0633159c5af3a02aafe14e2b137c133d4554a5f8
2025-05-12 12:38:58 -07:00
Ruslan Lesiutin e403b510d0 Support bridging for Class methods return types (#51223)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51223

Changelog:
[General][Added] - Added support for bridging Class methods return types

Previously, this wouldn't work, unless you define your C++ implementation of the TM to have primitive return type that can be converted to JavaScript's type.

Reviewed By: javache

Differential Revision: D74478572

fbshipit-source-id: 75c7f589559394704446be1ebac245d38a5c4b2b
2025-05-12 12:38:58 -07:00
Mohamed Salama 775c16d8b4 Revert D74567102: Migrate PromiseImpl to Kotlin
Differential Revision:
D74567102

Original commit changeset: 1a7a36a88c04

Original Phabricator Diff: D74567102

fbshipit-source-id: 30814137c711757079fdc574dd21715089b23a25
2025-05-12 10:11:02 -07:00
Pieter De Baets 5413304530 Convert com.facebook.react.runtime.ReactHostImpl to Kotlin (#51017)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51017

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D73846053

fbshipit-source-id: 98017000e8f10df4156b232bc8b5d6e132502ea5
2025-05-12 10:02:19 -07:00
Tim Yung 7e5a2663f9 RN: Simplify createAnimatedPropsHook-test.js (#51234)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51234

Since `createAnimatedPropsHook-test.js` no longer needs to override feature flags, clean up some of the extra logic.

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D74535116

fbshipit-source-id: 09dd4c5085f6ee1cbf7d87ab2b7c320119e69651
2025-05-12 09:15:43 -07:00
Rubén Norte 0766587b5d Add playground benchmark (#51259)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51259

Changelog: [internal]

We recently added `Playground-itest` as a quick way to test things with Fantom without committing them.

This does the same for benchmarks, so we can quickly answer questions like:

> is `key in obj` faster than `obj[key]`?

Without having to create a new benchmark manually.

Reviewed By: yungsters

Differential Revision: D74578297

fbshipit-source-id: d86604d459f15652d0c2e1ad16a99d011a1324ca
2025-05-12 07:59:59 -07:00
Evan Bacon eedd60b9e6 chore: convert View to React 19 (#51023)
Summary:
- Convert View implementation to React 19:
  - Remove legacy `forwardRef` in favor of built-in `ref` prop.
  - Use `use` API instead of `useContext`.
  - Drop the extraneous `.Provider` for `TextAncestor` context.
  - Remove `displayName` in favor of component name. I'm not 100% sure this is a full fallback but it is valid according to `react/display-name` eslint rule—https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/display-name.md
- Based on discussion with Nicola Carti and Riccardo Cipolleschi.
- I tried using flow `component` keyword but it's not enabled in this project. Given the `react-native` package is shipped untranspiled, it's probably safer to avoid newer flow types.
- Overall matched the component style of LogBox.
- It's unclear the exact right way to type a ref since it should be optional for external users of the component but required inside the component. Erring on the side of caution and using optional types so users don't get type errors when `ref` isn't defined.

## Changelog:

[GENERAL] [BREAKING] Upgrade `View` component to React 19.

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

Test Plan: - Type checks should pass.

Reviewed By: rshest

Differential Revision: D74546184

Pulled By: yungsters

fbshipit-source-id: b8257e3a75477c1117b19cd3f8e0843947b092ca
2025-05-12 07:14:22 -07:00
Samuel Susla 5d7f35cd7c add test for BaseTextProps.writingDirection (#51245)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51245

changelog: [internal]

Add test to prevent https://github.com/facebook/react-native/issues/51235 from happening in the future.

Reviewed By: cipolleschi, rubennorte

Differential Revision: D74571453

fbshipit-source-id: 49d8400543516a861c9034a8be562ee81b323c25
2025-05-12 06:14:14 -07:00
Jakub Piasecki c9f2055097 Fix generated types in @react-native/virtualized-lists being used without opt-in (#51246)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51246

Changelog: [General][Fixed] Fix generated types in react-native/virtualized-lists being used without opt-in

D71969602 introduces `exports` field to `package.json` files in `react-native` and `virtualized-lists`. In that diff, the `types` in `virtualized-lists` by default pointed to the new generated types without requiring the opt-in.

This fixes that by requiring the opt-in before using the generated types.

Reviewed By: huntie

Differential Revision: D74573321

fbshipit-source-id: fe05b0204a7200c1c91aac2614aa786bbbced2a5
2025-05-12 04:53:20 -07:00
Mateo Guzmán 25abb0acdf Migrate PromiseImpl to Kotlin (#51241)
Summary:
Migrate com.facebook.react.bridge.PromiseImpl to Kotlin.

## Changelog:

[INTERNAL] - Migrate com.facebook.react.bridge.PromiseImpl to Kotlin

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

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

Reviewed By: rshest

Differential Revision: D74567102

Pulled By: cortinico

fbshipit-source-id: 1a7a36a88c0499e5bc35dc37d276219aaf823c90
2025-05-12 04:48:28 -07:00