Commit Graph

38536 Commits

Author SHA1 Message Date
Alex Hunt 0bde08fe67 Move Libraries/Inspector/ to src/private/ (#49022)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49022

These modules support the in-app Inspector Overlay.

Breaking change that's unlikely to hit any users. Unreferenced by Expo.

Changelog:
[General][Breaking] Move `Libraries/Inspector/` modules to `src/private/`

Reviewed By: cortinico

Differential Revision: D68781896

fbshipit-source-id: 8fcd72d56684319019f64a375c2e2ef317a47c13
2025-01-29 09:56:54 -08:00
Ian Elliott 9a9aa19387 Upgrade cross-spawn to 7.0.5 (#48750)
Summary:
Bump cross-spawn 7.0.5

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

Test Plan: Sandcastle

Reviewed By: huntie

Differential Revision: D68282390

Pulled By: ide-2

fbshipit-source-id: 1bc81b4fbda986c7820e214364dcc322f8729baa
2025-01-29 09:44:16 -08:00
Rubén Norte 8678d15892 Prepare ReactNativePrivateInterface for new React renderer calls to handle root/document nodes (#49010)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49010

Changelog: [internal]

This adds a stub method for `ReactNativePrivateInterface.createPublicRootInstance`, which just returns `null` for now, so we can synchronize the React renderer that will try to use it to create root instances.

Initially, this will not do anything and React will just pass the `null` value around. When we implement the document API, we will return a proper instance and React will pass it to `createPublicInstance` so we can link things at runtime.

Reviewed By: javache

Differential Revision: D68561173

fbshipit-source-id: 632a7c3523910059a1f63f35b5f0f52f5660a961
2025-01-29 09:39:49 -08:00
Rubén Norte 7cdc3d81ad Abstract away use of shadow nodes as native node references (#49009)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49009

Changelog: [internal]

Native APIs so far have returned instance handles from React to reference nodes in the rendered UI tree, but now that we're adding support for the document API, this isn't sufficient to represent all types of nodes. Both for the document and for its `documentElement`, we don't have an instance handle from React that links to the node, but we're going to represent that differently.

This is a refactor so the existing methods use a mostly opaque `NativeNodeReference` type so we can implement it as a union of React instance handles and the future types we're going to introduce to support document.

Reviewed By: javache

Differential Revision: D67704855

fbshipit-source-id: 0568143d9ce39be65986e1a4b92fdaebd79e4f66
2025-01-29 09:39:49 -08:00
Rubén Norte 591b0ffc0e Add basic benchmarks for rendering views (#49008)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49008

Changelog: [internal]

We're modifying some core APIs in the RN render in following diffs, so this adds a simple benchmark as a safety mechanism to verify those don't regress performance significantly.

Reviewed By: yungsters

Differential Revision: D68772175

fbshipit-source-id: 3bc446e68495dc04590b613297baa00589fb5f8d
2025-01-29 09:39:49 -08:00
Rickard Zrinski 97cf42f979 Fix maxFontSizeMultiplier prop on Text and TextInput components in new architecture (#47614)
Summary:
The `maxFontSizeMultiplier` prop for `Text` and `TextInput` was not handled in Fabric / New Architecture as documented in https://github.com/facebook/react-native/issues/47499.

bypass-github-export-checks

## Changelog:

[GENERAL] [FIXED] - Fix `maxFontSizeMultiplier` prop on `Text` and `TextInput` components in Fabric / New Architecture

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

Test Plan:
I have not added any automated tests for this change but try to do so if requested. I have however added examples to RN Tester for both the Text and TextInput components, as well as compared the behaviour with Paper / Old Architecture. Both on version 0.76.

Noticed now I didn't do exactly the same steps in both videos, oops! Be aware that reapplying changes made in the Settings are currently half-broken on the new architecture, thus I'm restarting the app on Android and iOS. But this issue is unrelated to my changes. I've tested on main branch and it has the same issue.

Here are comparison videos between Paper and Fabric on iOS *after* I've made my fix.

### Text
| Paper  | Fabric |
| ------------- | ------------- |
| <video src="https://github.com/user-attachments/assets/f4fd009f-aa6d-41ab-92fa-8dcf1e351ba1" /> | <video src="https://github.com/user-attachments/assets/fda42cc6-34c2-42a7-a6e2-028e7c866075" /> |

### TextInput
| Paper  | Fabric |
| ------------- | ------------- |
| <video src="https://github.com/user-attachments/assets/59b59f7b-25d2-4b5b-a8e2-d2054cc6390b" /> | <video src="https://github.com/user-attachments/assets/72068566-8f2a-4463-874c-45a6f5b63b0d" /> |

Reviewed By: Abbondanzo

Differential Revision: D65953019

Pulled By: cipolleschi

fbshipit-source-id: 90c3c7e236229e9ad9bd346941fafe4af8a9d9fc
2025-01-29 09:27:44 -08:00
Alex Hunt 97ee93fd5a Add Content-Type header to dev server requests (#49042)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49042

Minor fix to align with adjacent `/open-stack-frame` call: https://fburl.com/code/o9rwbmxr.

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D68830215

fbshipit-source-id: 87ef0c14bdedd34153014721b85bd24af24c1db7
2025-01-29 09:18:46 -08:00
Pieter De Baets 26afc804b7 Error when tests finish with pending tasks (#49032)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49032

Add a native API to validate the RuntimeScheduler has no pending tasks, and automatically validate after every test that there's no pending tasks left to execute.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D68797481

fbshipit-source-id: dbbef894a57bd29eb5a033ac8aaeedef770dcba2
2025-01-29 08:49:49 -08:00
Mateo Guzmán 2f6cb8ba08 Migrate com.facebook.react.uimanager.layoutanimation interfaces to Kotlin (#49026)
Summary:
Migrate com.facebook.react.uimanager.layoutanimation interfaces to Kotlin

## Changelog:

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

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

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

Reviewed By: NickGerleman

Differential Revision: D68794415

Pulled By: Abbondanzo

fbshipit-source-id: 690d69e8360fb51eb0232b2ed2b4676e0d1a9ee6
2025-01-29 07:09:04 -08:00
Pieter De Baets e4d1cf8ce9 Delete RawProps assignment operators (#49030)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49030

Overwriting another RawProps object via `operator=` is rarely what we want, and these objects should be considered immutable once constructed.

This will catch issues such as D68633985

Changelog: [General][Changed] Removed `RawProps::operator=`

Reviewed By: sammy-SC

Differential Revision: D68797484

fbshipit-source-id: 766a65db1dbf4485c78007f8f69cc9426d27a943
2025-01-29 06:16:20 -08:00
Jakub Piasecki 5d7fedacd0 Add flow definitions for Alert and align them with TypeScript (#49006)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49006

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D68774525

fbshipit-source-id: 509f26b0f5f0d309502681f3228ae519689d480a
2025-01-29 05:36:53 -08:00
Jakub Piasecki 8058aab0d6 Ignore implementation files when .flow.js file exists during type translation (#49039)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49039

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D68774523

fbshipit-source-id: 07776e7e0d551e3bad5a30eff1de8a76769e5761
2025-01-29 05:36:53 -08:00
Jakub Piasecki df6be9f665 Use alert to test type generation prototype (#49038)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49038

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D68774524

fbshipit-source-id: 791da64babebc8d08f671262fa63f67aff2c0942
2025-01-29 05:36:53 -08:00
Pieter De Baets 90c6f7eab8 Fix ScrollEvent DebugStringCovertible (#49029)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49029

This was never being compiled, because we didn't import the header that set `RN_DEBUG_STRING_CONVERTIBLE`

Will look at enabling `-Wundef` to catch these.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D68797482

fbshipit-source-id: 6a01192c799903b6f956f9b0acea94bd93183f3b
2025-01-29 05:05:04 -08:00
Nicola Corti 6307fe869f Remove unused methods from TurboModulePerfLogger (#49033)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49033

Those methods are not used at all in the codebase, let's clean them up.

Changelog:
[Internal] [Changed] -

Reviewed By: cipolleschi

Differential Revision: D68826893

fbshipit-source-id: 36e2f0ae247ed72305c1d9d346c6cf32cef6f8f2
2025-01-29 05:04:27 -08:00
Nicola Corti 71d39c5cfd Migrate TurboModulePerfLogger to Kotlin + internalize it. (#49034)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49034

This class was still in Java. I'm converting it to Kotlin + I'm making it internal.
As this class was inside the `com.facebook.react.internal.turbomodule.core` package,
we don't consider this a breaking change.

Changelog:
[Internal] [Changed] -

Reviewed By: cipolleschi

Differential Revision: D68826892

fbshipit-source-id: b1f7aea984ab333faea66a9e8ccbb1492767333e
2025-01-29 05:04:27 -08:00
Iwo Plaza e767dc3458 Migrate files in Libraries/Lists to export syntax (#49024)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49024

## Motivation
Modernising the RN codebase to allow for modern Flow tooling to process it.

## This diff
- Migrates files in `Libraries/Lists/*.js` to use the `export` syntax.
- Updates deep-imports of these files to use `.default`
- Updates the current iteration of API snapshots (intended).

Changelog:
[General][Breaking] - Deep imports to modules inside `Libraries/Lists` with `require` syntax may need to be appended with '.default'.

Reviewed By: huntie

Differential Revision: D68783945

fbshipit-source-id: 7563155254fed40b6fe7d280d9e040ea24a5c870
2025-01-29 04:15:30 -08:00
Ruslan Lesiutin dd240edd6d Explicitly check that Debugger domain is disabled before starting Tracing (#49007)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49007

# Changelog: [Internal]

Before sending `Tracing.start`, CDT will also send `Debugger.disable`.

You don't want to hit your breakpoints when you are profiling an appplication, this is by design.

We won't just delegate this to Hermes to handle. We will explicitly check that this condition is satisfied on React Native side. This is done to avoid regression in case the implementation details will change on CDT side.

Later in D68414421, we will also check that samples JavaScript stack don't contain debugger frames. This is necessary to distinguish garbage collector frames from debugger frames, which share the same type in Hermes VM - "Suspend".

We need garbage collector frames. If debugger frame was found we would throw an error, because this is unexpected after Debugger domain was disabled.

Right now Hermes is not disabling local VM Debugger on `Debugger.disable` method - this is a known bug, which I am addressing in a stack from D68772900.

Reviewed By: huntie

Differential Revision: D68776863

fbshipit-source-id: 4346ac5eb850578265a179b5fd687539ae7d15bc
2025-01-29 03:51:58 -08:00
Nicola Corti bd050ac191 Remove unused FallbackJSBundleLoader (#49005)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49005

This is essentially dead code. Not used at all but publicly exposed.
I found no meaningful usages in OSS so this is safe to remove:
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%3Apvinis%2Freact-native---investigation+NOT+repo%3Abeanchips%2Ffacebookreactnative+NOT+repo%3AfabOnReact%2Freact-native-notes+NOT+user%3Ahuntie+com.facebook.react.bridge.FallbackJSBundleLoader

Changelog:
[Internal] [Changed] -

Reviewed By: mdvacca

Differential Revision: D68773273

fbshipit-source-id: 96a028cb0caf95ee899db1488dbf5ae82cc567f9
2025-01-29 03:51:35 -08:00
Fabrizio Cucci 7377d57874 Add changelog entry for v0.78.0-rc.2 (#49031)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49031

As per title.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D68826401

fbshipit-source-id: ce2d6d95f41d6ce9059dbbba1fecd991fbafd0f3
2025-01-29 03:44:53 -08:00
Nick Gerleman 8e2de303e3 Disallow invalid unitless lengths in box shadows (#48988)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48988

The only unitless `<length>` value allowed is `0`, so most of the examples in the `processBoxShadow` unit tests are parse errors on web 🫠. Lets update the tests, and disallow these invalid values.

Changelog:
[General][Breaking] - Disallow invalid unitless lengths in box shadows

Reviewed By: jorge-cab

Differential Revision: D68740553

fbshipit-source-id: ea935819f773c5d516dd9b3367e5d2c808941c28
2025-01-28 22:47:40 -08:00
Nick Gerleman 3b5dc5626b Fix some CSSRatio Behavior (#48984)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48984

Noticed this in conjunction with another change, that I misinterpreted the ratio spec a bit. Ratios with a part less than zero are parse errors, while degenerate ratios are not (Chrome and Firefox both treat like this).

Removing usage of visitorless `consumeComponentValue()` here in preparation for next diff.

Changelog: [Internal]

Reviewed By: lenaic

Differential Revision: D68733519

fbshipit-source-id: 9afc7b7295b067a3e1469e2f80f5c9a6bea41fae
2025-01-28 17:38:50 -08:00
Nolan O'Brien 2ed0ba0722 Improve definitions in METAXXHashUtils (#49027)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49027

Make constants more specific to `METAHash` (avoid potential conflicts) and unify the APIs with a shared attribute definition (will be used to mark these APIs as unavailable from Swift).

## Changelog:

[iOS] [Changed] - Change prime constants to have prefix in order to avoid any potential conflicts

Reviewed By: adamjernst

Differential Revision: D68790450

fbshipit-source-id: 69c8b73063cf57d6a4ec25f6cd52a906c77694f0
2025-01-28 16:35:40 -08:00
Nicola Corti d797b7aa4d Minor Kotlin cleanup (#49000)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49000

Just found those nits around while looking at the codebase.
This clears things out and should have no runtime impact.

Changelog:
[Internal] [Changed] -

Reviewed By: mdvacca

Differential Revision: D68768384

fbshipit-source-id: bd3a30f1792a6f662d1f5b25855c89b6d43e72bb
2025-01-28 11:37:53 -08:00
Iwo Plaza c93bd436a5 Migrate Libraries/ReactNative/*.js to use export syntax. (#48650)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48650

## Motivation
Modernising the RN codebase to allow for modern Flow tooling to process it.

## This diff
- Migrates the `Libraries/ReactNative/*.js` files to use the `export` syntax.
- Updates deep-imports of these files to use `.default`
- Updates the current iteration of API snapshots (intended).

Changelog:
[General][Breaking] - Deep imports to modules inside `Libraries/ReactNative` with `require` syntax need to be appended with '.default'.

Reviewed By: huntie

Differential Revision: D68109193

fbshipit-source-id: 3444bf6b2152f7ed72d2923149a10041d718aaf0
2025-01-28 11:21:55 -08:00
zhongwuzw cbaff1c7aa Fabric: Fixes crash of dynamic color when light/dark mode changed (#48496)
Summary:
The reason is when light/dark mode changed, the `hash` value also changed because we used `color.getColor()`. leads to size balanced break.

```
Assertion failed: (index_.size() == lru_.size()), function size, file EvictingCacheMap.h, line 439.

(lldb) bt
* thread https://github.com/facebook/react-native/issues/1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
    frame #0: 0x00000001089a9108 libsystem_kernel.dylib`__pthread_kill + 8
    frame https://github.com/facebook/react-native/issues/1: 0x0000000105de3408 libsystem_pthread.dylib`pthread_kill + 256
    frame https://github.com/facebook/react-native/issues/2: 0x000000018016c4ec libsystem_c.dylib`abort + 104
    frame https://github.com/facebook/react-native/issues/3: 0x000000018016b934 libsystem_c.dylib`__assert_rtn + 268
  * frame https://github.com/facebook/react-native/issues/4: 0x00000001073e386c React_FabricComponents`folly::EvictingCacheMap<facebook::react::AttributedString, std::__1::shared_ptr<void>, folly::HeterogeneousAccessHash<facebook::react::AttributedString, void>, folly::HeterogeneousAccessEqualTo<facebook::react::AttributedString, void>>::size(this=0x0000600003900348) const at EvictingCacheMap.h:439:5
    frame https://github.com/facebook/react-native/issues/5: 0x00000001073e34f4 React_FabricComponents`void folly::EvictingCacheMap<facebook::react::AttributedString, std::__1::shared_ptr<void>, folly::HeterogeneousAccessHash<facebook::react::AttributedString, void>, folly::HeterogeneousAccessEqualTo<facebook::react::AttributedString, void>>::setImpl<facebook::react::AttributedString>(this=0x0000600003900348, key=0x000000016b9f20a8, value=nullptr, promote=true, pruneHook=folly::EvictingCacheMap<facebook::react::AttributedString, std::__1::shared_ptr<void>, folly::HeterogeneousAccessHash<facebook::react::AttributedString, void>, folly::HeterogeneousAccessEqualTo<facebook::react::AttributedString, void> >::PruneHookCall @ 0x000000016b9f1cc8) at EvictingCacheMap.h:674:27
    frame https://github.com/facebook/react-native/issues/6: 0x00000001073deb88 React_FabricComponents`folly::EvictingCacheMap<facebook::react::AttributedString, std::__1::shared_ptr<void>, folly::HeterogeneousAccessHash<facebook::react::AttributedString, void>, folly::HeterogeneousAccessEqualTo<facebook::react::AttributedString, void>>::set(this=0x0000600003900348, key=0x000000016b9f20a8, value=ptr = 0x60000024ae20 strong=2 weak=1, promote=true, pruneHook=folly::EvictingCacheMap<facebook::react::AttributedString, std::__1::shared_ptr<void>, folly::HeterogeneousAccessHash<facebook::react::AttributedString, void>, folly::HeterogeneousAccessEqualTo<facebook::react::AttributedString, void> >::PruneHookCall @ 0x000000016b9f1d98) at EvictingCacheMap.h:346:5
    frame https://github.com/facebook/react-native/issues/7: 0x00000001073d91dc React_FabricComponents`facebook::react::SimpleThreadSafeCache<facebook::react::AttributedString, std::__1::shared_ptr<void>, 256>::get(this=0x0000600003900348, key=0x000000016b9f20a8, generator= Lambda in File RCTTextLayoutManager.mm at Line 337) const at SimpleThreadSafeCache.h:40:12
    frame https://github.com/facebook/react-native/issues/8: 0x00000001073d9058 React_FabricComponents`-[RCTTextLayoutManager _nsAttributedStringFromAttributedString:](self=0x0000600003900340, _cmd="_nsAttributedStringFromAttributedString:", attributedString=AttributedString @ 0x000000016b9f20a8) at RCTTextLayoutManager.mm:337:42
    frame https://github.com/facebook/react-native/issues/9: 0x00000001073d6378 React_FabricComponents`-[RCTTextLayoutManager drawAttributedString:paragraphAttributes:frame:drawHighlightPath:](self=0x0000600003900340, _cmd="drawAttributedString:paragraphAttributes:frame:drawHighlightPath:", attributedString=AttributedString @ 0x000000016b9f23a8, paragraphAttributes=ParagraphAttributes @ 0x000000016b9f2378, frame=(origin = (x = 0, y = 0), size = (width = 92, height = 21.666748046875)), block=0x00000001061602d0) at RCTTextLayoutManager.mm:73:56
    frame https://github.com/facebook/react-native/issues/10: 0x000000010616020c RCTFabric`-[RCTParagraphTextView drawRect:](self=0x000000012beb9dc0, _cmd="drawRect:", rect=(origin = (x = 0, y = 0.000081380208335701809), size = (width = 92, height = 21.666666666666664))) at RCTParagraphComponentView.mm:346:3
    frame https://github.com/facebook/react-native/issues/11: 0x0000000186043e60 UIKitCore`-[UIView(CALayerDelegate) drawLayer:inContext:] + 584
    frame https://github.com/facebook/react-native/issues/12: 0x000000018af40080 QuartzCore`CABackingStoreUpdate_ + 244
    frame https://github.com/facebook/react-native/issues/13: 0x000000018b0bec88 QuartzCore`invocation function for block in CA::Layer::display_() + 108
    frame https://github.com/facebook/react-native/issues/14: 0x000000018b0b5524 QuartzCore`-[CALayer _display] + 1596
    frame https://github.com/facebook/react-native/issues/15: 0x000000018b0c7e74 QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 392
    frame https://github.com/facebook/react-native/issues/16: 0x000000018affca50 QuartzCore`CA::Context::commit_transaction(CA::Transaction*, double, double*) + 464
    frame https://github.com/facebook/react-native/issues/17: 0x000000018b02b260 QuartzCore`CA::Transaction::commit() + 652
    frame https://github.com/facebook/react-native/issues/18: 0x000000018b02c7b4 QuartzCore`CA::Transaction::flush_as_runloop_observer(bool) + 68
    frame https://github.com/facebook/react-native/issues/19: 0x0000000185ad6c1c UIKitCore`_UIApplicationFlushCATransaction + 48
    frame https://github.com/facebook/react-native/issues/20: 0x0000000185a07ccc UIKitCore`__setupUpdateSequence_block_invoke_2 + 352
    frame https://github.com/facebook/react-native/issues/21: 0x000000018505d28c UIKitCore`_UIUpdateSequenceRun + 76
    frame https://github.com/facebook/react-native/issues/22: 0x0000000185a07670 UIKitCore`schedulerStepScheduledMainSection + 168
    frame https://github.com/facebook/react-native/issues/23: 0x0000000185a06aa8 UIKitCore`runloopSourceCallback + 80
    frame https://github.com/facebook/react-native/issues/24: 0x000000018041b7c4 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
    frame https://github.com/facebook/react-native/issues/25: 0x000000018041b70c CoreFoundation`__CFRunLoopDoSource0 + 172
    frame https://github.com/facebook/react-native/issues/26: 0x000000018041ae70 CoreFoundation`__CFRunLoopDoSources0 + 232
    frame https://github.com/facebook/react-native/issues/27: 0x00000001804153b4 CoreFoundation`__CFRunLoopRun + 788
    frame https://github.com/facebook/react-native/issues/28: 0x0000000180414c24 CoreFoundation`CFRunLoopRunSpecific + 552
    frame https://github.com/facebook/react-native/issues/29: 0x000000019020ab10 GraphicsServices`GSEventRunModal + 160
    frame https://github.com/facebook/react-native/issues/30: 0x0000000185ad82fc UIKitCore`-[UIApplication _run] + 796
    frame https://github.com/facebook/react-native/issues/31: 0x0000000185adc4f4 UIKitCore`UIApplicationMain + 124
    frame https://github.com/facebook/react-native/issues/32: 0x0000000104521f68 RNTester.debug.dylib`main(argc=1, argv=0x000000016b9f5af8) at main.m:15:12
    frame https://github.com/facebook/react-native/issues/33: 0x00000001045b9410 dyld_sim`start_sim + 20
    frame https://github.com/facebook/react-native/issues/34: 0x0000000104796274 dyld`start + 2840
```

## Changelog:

[IOS] [FIXED] - Fabric: Fixes crash of dynamic color when light/dark mode changed

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

Test Plan:
RNTester -> PlatformColor example -> changed the dark/light mode  in the system settings -> go back to App and pop and push the PlatformColor example, it would crash:

![Simulator Screen Recording - iPhone 16 - 2025-01-05 at 15 46 08](https://github.com/user-attachments/assets/f6faaf80-ad03-49c6-9a56-b1117bdc2659)

Reviewed By: sammy-SC

Differential Revision: D68157559

Pulled By: cipolleschi

fbshipit-source-id: 01959845b742ce748186d3877b2792f0f9132ff5
2025-01-28 11:20:18 -08:00
Vitali Zaidman ff2e40371e don't inline sourceMapURL in Debugger.scriptParsed (#49001)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49001

In {D42973408}, `Debugger.scriptParsed` was tweaked to be intercepted in `inspector-proxy`, which:
1. Rewrote the `sourceMapURL` to be relative to debugger.
2. Attempted to fetch the contents of the source map from `sourceMapURL` after re-writing again to a server-relative URL, and if successful replaced `sourceMapURL` with a base64 data URL.

1 is still needed until we have `Network.loadNetworkResource`, but 2 was only needed for frontends that did not support http fetch, and is not needed with Fusebox.

Changelog: [General][Changed] `Debugger.scriptParsed` now includes the field `sourceMapURL` as a (rewritten) remote url as opposed to base64 data url

Reviewed By: robhogan

Differential Revision: D68708899

fbshipit-source-id: 95242582c79ce4e9a573d4a3e639b0dc3290869e
2025-01-28 11:09:32 -08:00
Nicola Corti 362a191aee Convert CxxCallbackImpl to Kotlin (#49004)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49004

This just converts yet another class to Kotlin.

Changelog:
[Internal] [Changed] -

Reviewed By: tdn120

Differential Revision: D68772336

fbshipit-source-id: 428cb3a0d54bf7a22f0e4eb07268cdc27ef6f2c3
2025-01-28 11:01:59 -08:00
Iwo Plaza 156ee5bee7 Migrate StyleSheet/processColorArray.js to use export syntax (#48905)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48905

## Motivation
Modernising the react-native codebase to allow for ingestion by modern Flow tooling.

## This diff
- Updates `Libraries/StyleSheet/processColorArray.js` to use `export` syntax.
- Appends `.default` to requires of the changed files.
- Updates test files.
- Updated View Config codegen (requires an MSDK bump).
- Updates the public API snapshot *(intented breaking change)*

Changelog:
[General][Breaking] - Files inside `Libraries/Text`, `Libraries/Share` and `Libraries/Settings` use `export` syntax, which requires the addition of `.default` when imported with the CJS `require` syntax.

Reviewed By: robhogan

Differential Revision: D68564304

fbshipit-source-id: 2fbd058be1a715cccfce4f2a68146118d8ac66ad
2025-01-28 09:46:50 -08:00
Iwo Plaza aac312da8e Migrate DrawerAndroid, ProgressBarAndroid, SafeAreaView, ScrollView, TextInput, ToastAndroid, UnimplementedView and View components to export syntax (#48807)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48807

## Motivation
Modernising the react-native codebase to allow for ingestion by modern Flow tooling.

## This diff
- Updates a handful of components in `Libraries/Components` to use `export` syntax
  - `export default` for qualified objects, many `export` statements for collections (determined by how it's imported)
- Appends `.default` to requires of the changed files.
- Updates test files.
- Updates the public API snapshot (intented breaking change)

Changelog:
[General][Breaking] - Files inside `Libraries/Components` use `export` syntax, which requires the addition of `.default` when imported with the CJS `require` syntax.

Reviewed By: huntie

Differential Revision: D68436127

fbshipit-source-id: e3496fe69d66932dd4ed82f41d810f3ef1f850f5
2025-01-28 09:06:57 -08:00
Ruslan Lesiutin 600d814381 Update debugger-frontend from 7727db8...d126cc8 (#48979)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48979

Changelog: [Internal] - Update `react-native/debugger-frontend` from 7727db8...d126cc8

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

Reviewed By: huntie

Differential Revision: D68717476

fbshipit-source-id: ac2fd0551b069ae9077646ecb6b22f066e3e567c
2025-01-28 08:36:10 -08:00
Ruslan Lesiutin 07860545f5 Roll out 6.1.0 on fbsource (#48963)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48963

# Changelog:
[General] [Changed] - upgrade React DevTools to 6.1.0.

allow-large-files

Reviewed By: robhogan

Differential Revision: D68705543

fbshipit-source-id: 293034cc3e4cb93fed6a05df905ee63ea5382562
2025-01-28 08:36:10 -08:00
Dawid Małecki 89af3e804f Add explicit type for Symbol.iterator in URLSearchParams (#48999)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48999

Changelog:
[General][Changed] - Added explicit type for Symbol.iterator in URLSearchParams

Reviewed By: cortinico

Differential Revision: D68766996

fbshipit-source-id: 47aeed737134628b838e9382b04e0bb95513bee0
2025-01-28 08:07:13 -08:00
Rubén Norte c925872e72 Throw an error when calling root.render outside of a task (#49003)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49003

Changelog: [internal]

I was adding a benchmark for rendering thousands of views and it was surprisingly fast, until I realized I wasn't wrapping the call to `root.render` in `runTask`, which means the benchmark wasn't really doing the rendering, only scheduling a microtask that was never executed.

This is a safety mechanism to prevent those mistakes.

Reviewed By: sammy-SC

Differential Revision: D68771170

fbshipit-source-id: 5bd8e6ba9e1168db2320572c99b3a01ebd6aeeed
2025-01-28 07:26:23 -08:00
Cedric van Putten 32fe244744 fix(react-native): pass the protocol from bundle URL to HMR client on Android (#48998)
Summary:
This is another attempt at fixing the Android HMR client for HTTPS proxied Metro instances. The previous one unintentionally [caused the following error](https://github.com/facebook/react-native/pull/48970#issuecomment-2617047184):

```
java.lang.AssertionError: Method overloading is unsupported: com.facebook.react.devsupport.HMRClient#setup
```

This PR removes the overloading, and only adds the `scheme` property as a parameter to the existing `.setup` method. Aligning with the exact behavior we have on iOS.

The alternative fix, which should NOT be backward breaking (if this is) - is to move this "infer the protocol from the bundle URL" to the JS side of the HMR client. Where we don't just always default to `http`, but instead default to `https IF port === 443, otherwise http`. It's a bit more hacky, but shouldn't cause any other issues. _**Ideally**_, we have the same working behavior on both Android and iOS without workarounds.

<details><summary>Alternative workaround</summary>

See [this change](https://github.com/facebook/react-native/compare/main...byCedric:react-native:patch-2).

<img width="1179" alt="image" src="https://github.com/user-attachments/assets/47c365bc-6df8-43e6-ad7d-5a667e350cd4" />

</details>

See full explanation on https://github.com/facebook/react-native/issues/48970

> We've noticed that the HMR on Android doesn't seem to be connecting when using a HTTPS-proxied Metro instance, where the proxy is hosted through Cloudflare. This is only an issue on Android - not iOS - and likely caused by the HMR Client not being set up properly on Android.
>
>- On Android, we run `.setup('android', <bundleEntryPath>, <proxiedMetroHost>, <proxiedMetroPort>, <hmrEnabled>)` in the [**react/devsupport/DevSupportManagerBase.java**](https://github.com/facebook/react-native/blob/53d94c3abe3fcd2168b512652bc0169956bffa39/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.java#L689-L691) file.
>- On iOS, we run `[self.callableJSModules invokeModule:@"HMRClient" method:@"setup" withArgs:@[ RCTPlatformName, path, host, RCTNullIfNil(port), @(isHotLoadingEnabled), scheme ]];` in the [**React/CoreModules
/RCTDevSettings.mm**](https://github.com/facebook/react-native/blob/53d94c3abe3fcd2168b512652bc0169956bffa39/packages/react-native/React/CoreModules/RCTDevSettings.mm#L488-L491) file.
>
>Notice how Android does not pass in the scheme/protocol of the bundle URL, while iOS actually does? Unfortunately, because the default protocol (`http`) mismatches on Android when using HTTPS proxies, we actually try to connect the HMR client over `http` instead of `https` - while still using port 443 - which is rejected by Cloudflare's infrastructure even before we can redirect or mitigate this issue. And the rejection is valid, as we basically try to connect on `http://<host>:443` (the source URL is `https`, so the port is infered as `443`).
>
>This change adds scheme propagation to Android, exactly like we do on iOS for the HMR Client.

## Changelog:

[ANDROID] [FIXED] Pass the bundle URL protocol when setting up HMR client on Android

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

Test Plan:
See full explanation on https://github.com/facebook/react-native/issues/48970

> It's a little bit hard to test this out yourself, since you'd need a HTTPS-based proxy and reject HTTP connections for HTTPS/WSS Websocket requests.
>
>You can set this up through:
>- `bun create expo@latest ./test-app`
>- `cd ./test-app`
>- `touch .env`
>- Set `EXPO_PACKAGER_PROXY_URL=https://<proxied-metro-hostname>` in **.env**
>- Set `REACT_NATIVE_PACKAGER_HOSTNAME=<proxied-metro-hostname>` in **.env**
>- `bun run start`
>
>Setting both these envvars, the bundle URL in the manifest is set to `https://...` - which triggers this HMR issue on Android. You can validate the **.env** setup through:
>
>```bash
>curl "http://localhost:8081" -H "expo-platform: android" | jq .launchAsset.url
>```
>
>This should point the entry bundle URL towards the `EXPO_PACKAGER_PROXY_URL`.

Reviewed By: cortinico

Differential Revision: D68768351

Pulled By: javache

fbshipit-source-id: 49bf1dc60f11b2af6e57177141270632d62ab564
2025-01-28 07:20:32 -08:00
Alex Hunt bb1e3cdb04 Update cli-server-api middleware imports (#48997)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48997

Follows https://github.com/react-native-community/cli/pull/2584.

- Also add FIXME comment flagging potential core APIs gap without CLI.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D68766565

fbshipit-source-id: 60747715f76c4323e306c39ab0613fb4818b4914
2025-01-28 07:11:13 -08:00
Eric Rozell 037504cc7b Fix durability of PerformanceObserver mark/measure example (#48940)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48940

The PerformanceObserver (marks and measures) example clears it's output each time a new PerformanceObserver event fires, which makes it not particularly useful.

This change makes it so the output is only updated if a non-empty list of performance events is observed.

## Changelog

[Internal]

Reviewed By: rubennorte

Differential Revision: D68634361

fbshipit-source-id: 71b97e1c66aabd090cae63d55c8fa0a425d0c2f4
2025-01-28 07:08:11 -08:00
Iwo Plaza 48d900b703 Migrate files in Libraries/Inspector to use export syntax (#48931)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48931

## Motivation
Modernising the react-native codebase to allow for ingestion by modern Flow tooling

## This diff
- Updates files in Libraries/Inspector to use `export` syntax
- Appends `.default` to requires of the changed files.
- Updates the public API snapshot (intented breaking change)

Changelog:
[General][Breaking] - Files inside `Libraries/Inspector` use `export` syntax, which requires the addition of `.default` when imported with the CJS `require` syntax.

Reviewed By: robhogan

Differential Revision: D68629285

fbshipit-source-id: ee0904ea5e8f9389aecfb197d05225c88137fb08
2025-01-28 06:13:07 -08:00
Mateo Guzmán 9572bcf028 Add OkHttpClientProvider tests (#48958)
Summary:
Currently, the class OkHttpClientProvider is still in Java. Adding some tests before migrating it to Kotlin

## Changelog:

[INTERNAL] - Add OkHttpClientProvider tests

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

Test Plan:
```bash
./gradlew :packages:react-native:ReactAndroid:test -Dtest.single=com.facebook.react.modules.network
```

Reviewed By: javache

Differential Revision: D68706173

Pulled By: cortinico

fbshipit-source-id: 7b4b1cbe17ff39d3775075682dcb8d253892e062
2025-01-28 06:04:05 -08:00
VidocqH 2ae45ec3ce fix TextInput dataDetectorTypes (#48952)
Summary:
Setting `dataDetectorTypes` has no effect. As I am new to the react native codebase, it seems like `dataDetectorTypes` has not implemented on new arch yet.

issue: https://github.com/facebook/react-native/issues/48951

## Changelog:

[IOS] [FIXED] - implement `dataDetectorTypes` in the same way as the old architecture

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

Test Plan: <img width="356" alt="image" src="https://github.com/user-attachments/assets/192a683c-f7b7-48ac-98cd-76866901f008" />

Reviewed By: javache

Differential Revision: D68715166

Pulled By: cipolleschi

fbshipit-source-id: 612119e7453da012e6f75e1fc3a22ddedcb569a4
2025-01-28 05:07:26 -08:00
Riccardo Cipolleschi 98b8f17811 Add extra parameter to define whether codegen is invoked by lib or app (#48995)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48995

This change adds an extra parameter to the codegen script that allow our users to trigger codegen for Apps or for Libraries.

When running codegen for Apps, we have to generate some extra files that are not needed by the Libraries. This is causing issues to our library maintainers and this change will provide more flexibility in the DevX of libraries.

The default value is App, so if the new parameter is not passed, nothing will change in the current behavior.

## Changelog:
[iOS][Added] - Add the `source` parameter to generate-codegen-artifacts to avoid generating files not needed by libraries.

Reviewed By: cortinico

Differential Revision: D68765478

fbshipit-source-id: 8030b4472ad4f5058e58b1c91089de5122a4f60a
2025-01-28 05:06:54 -08:00
Nicola Corti 08ddc11269 Stable API - Refactor and remove unnecessary RuntimeConfig (#48934)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48934

This class is publicly exposed but effectively unused at all (neither internally, nor externally).
I'm removing it as this should not affect anyone.

Changelog:
[Android] [Breaking] - Removed `RuntimeConfig` class for Hermes which was unused.

Reviewed By: tdn120

Differential Revision: D68631945

fbshipit-source-id: 6a62ccda9e62f4bae650c11bc17a95efc8c88baf
2025-01-28 04:58:35 -08:00
Alex Hunt 514ec4192f Remove hanging reference to Remote Debugging endpoint on Android (#48996)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48996

Follows https://github.com/react-native-community/discussions-and-proposals/discussions/872.

Changelog:
[Android][Removed] - Remove `DevSupportManagerFactory.launchJSDevtools` API

Reviewed By: hoxyq

Differential Revision: D68766564

fbshipit-source-id: a9dad3a81ecc3fc03f056d4ccac8aa3e489cf242
2025-01-28 04:55:49 -08:00
CHOIMINSEOK 541e655832 fix wrong cocoapods script on new_architecture.rb (#48992)
Summary:
It seems that the `new_architecture.rb` script has an incorrect dependency configuration. The decision to install either “hermes-engine” or “React-jsc” should depend on whether Hermes is enabled or not. However, in the current `new_architecture.rb` setup, the build script toggles between “hermes-engine” and “React-jsi”.

```
        if ENV["USE_HERMES"] == nil || ENV["USE_HERMES"] == "1"
            spec.dependency "hermes-engine"
        else
            spec.dependency "React-jsi" // <=  this must be "React-jsc", not "React-jsi"
        end
```
https://github.com/facebook/react-native/blob/701622506248022c3a2fcea1c0066bba6e80232a/packages/react-native/scripts/cocoapods/new_architecture.rb#L141

When you try to use reanimated in brownfield app, you can reproduce runtime exception by this.

Reproduce Repo: https://github.com/CHOIMINSEOK/FullScreenOverlayIssue
script patch for this issue : https://github.com/CHOIMINSEOK/FullScreenOverlayIssue/blob/main/rn-app/.yarn/patches/react-native-reanimated-npm-3.16.7-1e7cd6d376.patch

## Changelog:

[IOS] [FIXED] - fix wrong cocoapods script on new_architecture.rb

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

Test Plan: I have no idea how to test regression.

Reviewed By: cortinico

Differential Revision: D68763630

Pulled By: cipolleschi

fbshipit-source-id: 7c2a0ea48815be5d77be7ed7aceed6a5bf574349
2025-01-28 04:53:23 -08:00
zhongwuzw c8f1506f13 Clean up RCTBridgeDelegate to remove shouldBridgeUseCustomJSC method (#48948)
Summary:
`shouldBridgeUseCustomJSC` comes from https://github.com/zhongwuzw/react-native/commit/cb3e575deb8a2be972298b12761ed9ee8f0ae63d, seems it's not working anymore. So we can clean up it .

## Changelog:

[IOS] [REMOVED] - Clean up RCTBridgeDelegate to remove shouldBridgeUseCustomJSC method

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

Test Plan: Everything should works.

Reviewed By: christophpurrer

Differential Revision: D68728588

Pulled By: javache

fbshipit-source-id: 8a762b5f3d6272fa7be57e0b17cb655eba743b5d
2025-01-28 04:37:37 -08:00
Rubén Norte e8eae9448f Remove expected ESLint error (#48980)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48980

Changelog: [internal]

This will be properly removed soon, but disabling for now to avoid showing up in all PRs.

Reviewed By: cortinico

Differential Revision: D68719573

fbshipit-source-id: 6a631ba2556f1399d0ade52f19b79f5a3212e007
2025-01-28 03:32:15 -08:00
Mateo Guzmán 7016225062 Sync Modal system bars visibility with current activity (#48516)
Summary:
Fixes https://github.com/facebook/react-native/issues/37801

This PR fixes the system bars visibility not being in sync as with the activity it is displayed on.

Here I am also taking into account the feedback given in [this PR](https://github.com/facebook/react-native/pull/36854) which was also aiming to address this issue. Unfortunately, I tried in multiple ways to get this to work by simply extending the whole system bars behaviour in the dialog with the activity system bars behaviour but found out that that solution won't work as we [currently clear the flag "FLAG_NOT_FOCUSABLE"](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.kt#L314) and unless we remove that line, extending the behaviour won't work. Removing that line is not an option as it would cause other side effects in the dialog itself.

With the above said, I ended up doing this in a more explicit way, by checking whether the status or navigation bars are hidden in the activity and then hiding then as well in the dialog or otherwise, similar as we are currently doing with the status bars appearance.

## Changelog:

[ANDROID] [FIXED] - Sync Modal system bars visibility with current activity

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

Test Plan:
In order to test this, you need to trigger any method that hides or shows the system bars using `window.insetsController`. Here a very small example of it:

```kt
fun toggleSystemBarsVisibility(shouldHide: Boolean) {
  val window = currentActivity?.window
  val controller = window?.insetsController
  if (shouldHide) {
    controller?.hide(WindowInsets.Type.systemBars())
  } else {
    controller?.show(WindowInsets.Type.systemBars())
  }
}
```

You can do this optionally from JS to make testing different cases easier. Below is a screen recording of how the solutions looks like:

<details>
<summary>Screen recording showcasing the solution in the test plan</summary>

https://github.com/user-attachments/assets/c497c1cb-5e65-4f31-98cc-aefd2d7b0339
</details>

Reviewed By: mdvacca, Abbondanzo

Differential Revision: D67906071

Pulled By: alanleedev

fbshipit-source-id: cbb2d15520d7729a9e9eafb5f5efb8d20d796c60
2025-01-27 18:02:46 -08:00
Dmitry Rykun 409047bb6d Remove some code duplication in ConcreteComponentDescriptor::cloneProps (#48938)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48938

Simple cleanup. Move the instantiation of shadowNodeProps outside of the IF statement.

Changelog: [Internal]

Reviewed By: philIip

Differential Revision: D68634269

fbshipit-source-id: 40a103060fc96a5c74c7d81f7d6e8ac0565948c8
2025-01-27 16:24:27 -08:00
Jorge Cabiedes Acosta f8d5e3b3f0 Fix innerBoxShadows not getting border-radius applied (#48983)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48983

tsia

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D68734160

fbshipit-source-id: 05edb5c1f97353517ade58ca690d58cbe4bd1068
2025-01-27 16:03:13 -08:00
Jorge Cabiedes Acosta f7d78f81cc Fix elevation with border-radius set (#48982)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48982

We were missing a conversion to px on the `getOutline()` function of `CompositeBackgroundDrawable` which led to incorrect elevation prop rendering

Changelog: [Android][Fixed] - Elevation prop on android has incorrect border-radius

Reviewed By: NickGerleman

Differential Revision: D68724947

fbshipit-source-id: b3a7a4919bfd7c60fac7c3d6e3ba760e3f74d190
2025-01-27 14:41:16 -08:00