Commit Graph

12270 Commits

Author SHA1 Message Date
Ruslan Lesiutin 0aefeb06d2 Update debugger-frontend from 0db2088...3adf51a (#49299)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49299

Changelog: [Internal] - Update `react-native/debugger-frontend` from 0db2088...3adf51a

Resyncs `react-native/debugger-frontend` from GitHub - see `rn-chrome-devtools-frontend` [changelog](https://github.com/facebookexperimental/rn-chrome-devtools-frontend/compare/0db20882e348e426a298417ef8ab1b379ad2ef6e...3adf51aa915c2deb26f5d373751a15b4d0c8f259).

Reviewed By: huntie

Differential Revision: D69387439

fbshipit-source-id: e8cf7e4d9e9faca99187a19943b2549e6b6214ad
2025-02-11 06:38:14 -08:00
Ruslan Lesiutin 999f99b41f Update debugger-frontend from d126cc8...0db2088 (#49267)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49267

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

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

Reviewed By: robhogan

Differential Revision: D69307173

fbshipit-source-id: 400f8ec259264d3a6bbea43c3ad2f02440d4294a
2025-02-11 06:38:14 -08:00
Ruslan Lesiutin 5c88633035 Roll out 6.1.1 on fbsource (#49255)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49255

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

allow-large-files

Reviewed By: huntie

Differential Revision: D69302964

fbshipit-source-id: 80f7f720fc37564260435a23c9de7779ceab3668
2025-02-11 06:38:14 -08:00
Nicola Corti e6690cb4a7 Disable console logging for hermesc (#49301)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49301

The hermesc logging is extremely noisy and not relevant for the users. I'm disabling it for the task that runs metro+hermesc (only for the hermesc) part.

Changelog:
[Internal] [Changed] - Disable console logging for hermesc

Reviewed By: robhogan

Differential Revision: D69399156

fbshipit-source-id: e5f8722b33d30675aba5a8aa82c456be21254b0c
2025-02-11 06:11:08 -08:00
Riccardo Cipolleschi 444c7d4eff Allow multiple RN instances to run at the same time (#49300)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49300

With the refactor of the AppDelegate in favor ReactNativeFactory, the users can now instantiate multiple instances of react native.
However, currently, if you try to run multiple instances, the app will crash with the message:

```
libc++abi: terminating due to uncaught exception of type std::runtime_error: Feature flags cannot be overridden more than once
```

This happens also when the feature flags we would like to set are the same that we already applied. This should be an allowed scenario because reapplying the excatly same features flags should have no effect on React native and that's not the use case we want to forbid.

With this change, we are creating a static variable that checks whether we already apply that set of feature flags and it allows you to create multiple instances by keeping the same flags

## Changelog:
[iOS][Fixed] - Allow multiple RN instances to run at the same time

Reviewed By: rubennorte

Differential Revision: D69398441

fbshipit-source-id: a377c6a1402d38d66d348fa8c6a65e645973aadc
2025-02-11 05:54:39 -08:00
Jakub Piasecki f1a3ff0dd1 Update RCTDeviceEventEmitter singleton instantiation (#49085)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49085

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D68953499

fbshipit-source-id: ea469813593cc4bcb746345a78c68dc7b0b4d56d
2025-02-11 05:42:24 -08:00
Jakub Piasecki 7dbfc1099c Align EventEmitter definitions with TypeScript (#49206)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49206

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D68953500

fbshipit-source-id: 0e936e8423f8792db34d6b44b1620dde5bd13a47
2025-02-11 05:42:24 -08:00
Mateo Guzmán 9612241597 Make Overflow internal (#49235)
Summary:
As part of the initiative to reduce the public API surface, this class can be internalized. 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+com.facebook.react.uimanager.style.Overflow).

## Changelog:

[INTERNAL] - Make com.facebook.react.uimanager.style.Overflow internal

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

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

Reviewed By: cipolleschi

Differential Revision: D69307164

Pulled By: cortinico

fbshipit-source-id: 778e36456c673e6472458c3076638eb7fd70c1de
2025-02-11 05:38:46 -08:00
zhongwuzw 62831e740c RNTester: Fixes turbo module examples error in bridgeless mode (#48362)
Summary:
In https://github.com/facebook/react-native/issues/47598 , we removed `__turboModuleProxy ` in bridgeless mode, it would produce error in rntester turbomodule examples, fix it by change `__turboModuleProxy` to `nativeModuleProxy`. RSNara can you please help to review? :)

before:
![image](https://github.com/user-attachments/assets/bf8edc50-6dbc-4465-9936-36ec9112761b)

After:
![image](https://github.com/user-attachments/assets/2d5c1546-d758-4692-a9a7-5cf195edc015)

## Changelog:

[IOS] [FIXED] - RNTester: Fixes turbo module examples error in bridgeless mode

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

Test Plan: RNTester turbomodule examples in bridgeless can work as expected.

Reviewed By: shwanton

Differential Revision: D67603884

Pulled By: cortinico

fbshipit-source-id: d905fa0535da5fde5e7ebff1d453ea761be9f42f
2025-02-11 05:28:58 -08:00
Mateo Guzmán 18992d2ebe Make ReactPackageLogger internal (#49236)
Summary:
As part of the initiative to reduce the public API surface, this class can be internalized. 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+com.facebook.react.ReactPackageLogger).

## Changelog:

[INTERNAL] - Make com.facebook.react.ReactPackageLogger internal

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

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

Reviewed By: cipolleschi

Differential Revision: D69307159

Pulled By: cortinico

fbshipit-source-id: 397be796bc9cc7acd633b461d40fcf1989708b4c
2025-02-11 04:03:09 -08:00
Samuel Susla abb9f4f152 remove unused macros from Differentiator (#49310)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49310

changelog: [internal]

These macros were unused, let's remove them.

Reviewed By: NickGerleman

Differential Revision: D69402801

fbshipit-source-id: ac701eb3dbd942ae217725563723f3ebfecd06cc
2025-02-11 03:00:45 -08:00
Samuel Susla 022a0fb65a extract TinyMap into internal header (#49308)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49308

changelog: [internal]

move TinyMap class to its own file in internal folder.

Reviewed By: NickGerleman

Differential Revision: D69402458

fbshipit-source-id: e16d5f33ef0e704e3336cf6f13f510206d7f5e5d
2025-02-11 03:00:45 -08:00
Samuel Susla a1ed021dc3 refactor private parts of Differentiator.h to internal files (#49307)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49307

changelog: [internal]

There were parts of Differentiator that were leaking outside of "mounting" module. This diff moves them to "internal" folder and changes buck so they can't be imported from outside the module.

Reviewed By: NickGerleman

Differential Revision: D69401878

fbshipit-source-id: 8aa8c96e91b088dab4f9c8b9a5e6937e09be7eb4
2025-02-11 03:00:45 -08:00
Samuel Susla 174a0de1e1 handle transform in view culling (#49304)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49304

changelog: [internal]

View culling must take transform into account when calculating whether a frame is visible or not. This diff adds that.

Reviewed By: NickGerleman

Differential Revision: D69394909

fbshipit-source-id: 4c588a64f2c8e2d35fb7d606d26adc09d3502780
2025-02-11 03:00:45 -08:00
Ingrid Wang fffd6d75b4 Suppress deprecated status bar APIs in RCTStatusBarManager (#49315)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49315

Changelog: [iOS][Fixed] Suppressed iOS 13 deprecation warnings in RCTStatusBarManager

Reviewed By: NickGerleman

Differential Revision: D69334478

fbshipit-source-id: b643c52d928f95f33659a643d0cc1d7de1f65563
2025-02-10 18:44:22 -08:00
Joe Vilches f835b824f4 Ensure filterLayer, backgroundImageLayer, and backgroundColorLayer are the same size/shape as the owning View (#49278)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49278

The previous diff (https://github.com/facebook/react-native/pull/49272) fixed an issue where we used frame to get the size of a sublayer. This is problematic in that it scales things twice if a scaling transform is applied. I looked to see where else we do this and we have this problem (sometimes) with background color and filter.

To fix this in the general case I created a helper to size a layer to the same shape as the View's layer - so using bounds for the size, (0,0) for position on the frame, and cornerRadius/mask for border radius considerations. The only 3 layers that should be the exact same size are backgroundColorLayer, backgroundImageLayer, and filterLayer

Changelog: [iOS] [Fixed] - Fix cases where background color, filter, and background image were sized incorrectly if there was a scaling transform

Reviewed By: jorge-cab

Differential Revision: D69321790

fbshipit-source-id: 70b5d18fa01967896b1bfffdb5684c2c907f3549
2025-02-10 17:22:14 -08:00
Joe Vilches acaf94dc21 Fix issue where scaling transform + box shadow break the shadow (#49272)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49272

Turns out bounds does not account for the proper size if a scaling transform is applied while frame does. Using the example listed in https://github.com/facebook/react-native/issues/49134, the size of the frame is the expected 240, but the size of the bounds is 200.

We had a mismatch where we use bounds everywhere in shadow image creation, but use the frame when asking for the size of the box shadow layer. What ends up happening is we have a 240x240 layer that is getting scaled again.

I refactored the shadow creation to just take a CGSize instead of a whole CALayer (which we had only used for its size anyway) so that we can be consistent with frame and bounds, and use bounds everywhere so that we only scale once.

Changelog: [iOS] [Fixed] - Fix cases where background color, filter, and background image were sized incorrectly if there was a scaling transform

Reviewed By: jorge-cab

Differential Revision: D69320213

fbshipit-source-id: a913e0df91d78ec9665752acefcae755ab607ac8
2025-02-10 17:22:14 -08:00
Lauren Tan 7d3fee7730 Apply fixup patch to fbsource
Summary:
Changelog: [Internal]

This is an automatically generated fixup patch to bring fbsource back into sync with
facebook/react on GitHub. Please land this patch as soon as possible, as the difference
reflected on here is already on GitHub and future changes may depend on these
changes!

<< DO NOT EDIT BELOW THIS LINE >>
diff-train-skip-merge
diff-train-source-id: 7e59b47d91fda2c6ef8946499d9e4457522a90d5

Generated by: https://www.internalfb.com/intern/sandcastle/job/4503601290447444/

GitHub Repo: facebook/react

Reviewed By: mofeiZ

Differential Revision: D69418289

fbshipit-source-id: 48636ba5bedfef7a09e0802f2a640be0417cdb7c
2025-02-10 16:18:39 -08:00
Nick Gerleman 75edf3af50 CMake "react_render_" to "react_renderer_" (#49284)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49284

All of the CMake library names in the "renderer" directory use "render" for the name, missing the last two letters of the directory name.

eye_twitch

I don't think fixing that should be breaking, since 3p libraries need to rely on the merged library anyway, so let's fix that and find/replace all these.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D69338892

fbshipit-source-id: d3b306ad0ea191728dfbacf9e2aaa12b00caa619
2025-02-10 14:32:26 -08:00
Nick Gerleman c37a2e9aa8 Disable warnings for mismatched SVC processor when enableNativeCSSParsing() (#49313)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49313

When the flag is enabled, we expect legacy native viewconfigs to add processor, where SVCs do not, and instead parse in native. Don't emit warnings in this case.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D69337802

fbshipit-source-id: f4c354c3b7b6ecbe4a8a72a37ea6d60dcc336b67
2025-02-10 14:32:26 -08:00
Nick Gerleman 69c3c55ddb Add "enableNativeCSSParsing" feature flag (#49314)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49314

Add a flag which we will use to prefer Fabric CSS parser to ViewConfig processors. We will use this to experiment on iOS, where we are using Fabric props (until Props 2.0 for Android).

Changelog: [Internal]

Reviewed By: lenaic

Differential Revision: D69337803

fbshipit-source-id: e3d4faeecbadb138c0a58f3fca6dba79eb7b13fa
2025-02-10 14:32:26 -08:00
David Vacca c60f6fbb2a Make UIBlock.execute params non nullable
Summary:
Make UIBlock.execute params non nullable to avoid breaking changes for kotlin usages in OSS

changelog: [internal] internal

Reviewed By: NickGerleman

Differential Revision: D69407325

fbshipit-source-id: 5fc01fba9baba97e21a388d02cf98d5aebb5ac20
2025-02-10 14:12:32 -08:00
Riccardo Cipolleschi d4236791e2 Properly handle null values coming from JS (#49250)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49250

The TurboModule System decided to ignore the Null values when they are coming to JS. However, in iOS, null value can be mapped to `[NSNull null];` and this value is a valid value that can be used on the native side.

In the old architecture, when the user were sending a null value from JS to a native module, the Native side was receiving the value.

In the New Architecture, the value was stripped away.

This change allow us to handle the `null` value properly in the interop layer, to restore the usage of legacy modules in the New Arch.

I also tried with a more radical approach, but several tests were crashing because some modules do not know how to handle `NSNull`.

See discussion happening here: https://github.com/invertase/react-native-firebase/issues/8144#issuecomment-2548067344

## Changelog:
[iOS][Changed] - Properly handle `null` values coming from NativeModules.

Reviewed By: sammy-SC

Differential Revision: D69301396

fbshipit-source-id: be275185e2643092f6c3dc2481fe9381bbcf69e9
2025-02-10 10:14:08 -08:00
Iwo Plaza e74246bd66 Migrate files in Libraries/PermissionsAndroid and Libraries/PushNotificationIOS to use export syntax (#49046)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49046

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

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

Changelog:
[General][Breaking] - Deep imports to modules inside `Libraries/PermissionsAndroid` and `Libraries/PushNotificationIOS` with `require` syntax has to be appended with '.default'.

Reviewed By: huntie

Differential Revision: D68832494

fbshipit-source-id: 4c44667856f5ad76b32a27a603a6538704c3192c
2025-02-10 09:47:27 -08:00
Samuel Susla b8b586b649 remove unused feature flag: enableGranularShadowTreeStateReconciliation (#49292)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49292

changelog: [internal]

remove feature flag enableGranularShadowTreeStateReconciliation which was introduced in August 2023 and isn't rolled out.

Reviewed By: rshest

Differential Revision: D69393016

fbshipit-source-id: a1730f9811b1d8476d845e0303647b4d85f6b4a0
2025-02-10 08:08:35 -08:00
chrsmys e7556e921c Ensure the performance monitor stays on top of newly added views. (#49288)
Summary:
I noticed that the performance monitor UI gets hidden under newly presented UI. This change ensures that the performance monitor container is brought to the front of the window whenever stats are updated.

## Changelog:
[IOS] [FIXED] - Issue where performance monitor would be hidden under newly presented views.

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

Test Plan:
### Before

https://github.com/user-attachments/assets/b2d787a3-2fec-4863-87a6-2244d2727dee

### After

https://github.com/user-attachments/assets/0700e4af-3ca1-4e67-a5e1-19b13f6ca1c9

Reviewed By: rshest, cipolleschi

Differential Revision: D69394527

Pulled By: javache

fbshipit-source-id: 07fc0804f765c25046bd83a5f8549084973586dc
2025-02-10 07:45:17 -08:00
zhongwuzw f2c78af56a Reland: [iOS] [Fabric] Fixes crash of dynamic color when light/dark mode changed (#49265)
Summary:
Reland https://github.com/facebook/react-native/issues/48496 .

## Changelog:

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

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

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:

Reviewed By: javache

Differential Revision: D69309825

Pulled By: cipolleschi

fbshipit-source-id: 7a533a73ef343b071000388b653b2d1d0c54ae88
2025-02-10 06:44:43 -08:00
Oskar Kwaśniewski b1735bc593 fix: make React native compatible with Ruby 3.4.0 (#49293)
Summary:
Hey,

This PR fixes compatibility with Ruby 3.4.0 as it removed some libraries from the standard library.

When installing pods I encountered this error:

![CleanShot 2025-02-10 at 11 26 20@2x](https://github.com/user-attachments/assets/7f7dc302-7f54-45dc-a4d9-9f011d5cc003)

After adding those dependencies, the error is gone:

![CleanShot 2025-02-10 at 11 27 01@2x](https://github.com/user-attachments/assets/386315d4-c6bd-4722-b63d-61ec1f44846f)

## Changelog:

[IOS] [FIXED] - Compatibility with Ruby 3.4.0

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

Test Plan: Install pods on Ruby 3.4

Reviewed By: vzaidman

Differential Revision: D69397346

Pulled By: cipolleschi

fbshipit-source-id: 2e29c0529e5342b8d29f2d296bd11802cb5a2885
2025-02-10 06:38:26 -08:00
Alex Hunt 1cfc53bb70 Improve error log for failed open-debugger fetch (#49295)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49295

Motivated by https://github.com/facebook/react-native/issues/49287.

This improves on the less useful output of "fetch failed" currently. We expect failing to make a request to the dev server (made from the dev server!) to be a rare edge case, in which case we want to log as much info as possible.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D69395983

fbshipit-source-id: ee96d72ade5a887d190397c3b798a5b545152587
2025-02-10 06:01:48 -08:00
Pieter De Baets 4e2f5bd7ea Complete rollout of shouldSkipStateUpdatesForLoopingAnimations (#49296)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49296

Already fulled out by default in OSS and internally.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D69395210

fbshipit-source-id: 39b0d6f7a1a186d132d93105e360717835b442c5
2025-02-10 05:53:42 -08:00
Samuel Susla e692ae1506 avoid copy of shadowView in Differentiator (#49268)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49268

changelog: [internal]

ShadowView has three shared_ptr and copying those can be avoided here. Let's use std::move.

Reviewed By: NickGerleman

Differential Revision: D69303346

fbshipit-source-id: b13103369f6423610dd8f8ccb293e59f04acc5dc
2025-02-10 05:01:42 -08:00
Dawid Małecki 13f4b7619d Generate TS types for LogBox and Systrace (#49160)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49160

Changelog:
[Internal]

Reviewed By: robhogan

Differential Revision: D69053361

fbshipit-source-id: f877efe11aa9cd29257d3ac34b040e70ec8746d5
2025-02-10 04:09:03 -08:00
kewde 385dd59c0a perf: fast _getFreeIndex (#48925)
Summary:
The performance of `_getFreeIndex` is quite terrible since the `timersID` array can get quite large when you spawn a lot of promises or timers. We profiled our application for 28 seconds on RN 0.71.11 and noticed that the `indexOf` into this array was consuming almost a second.

The hermes version that we are using has a pretty slow  `indexOf` compared to other engines, and the static hermes will improve it by 12x but for the time being, this is a perf issue. https://github.com/facebook/hermes/pull/1447

We avoid having to use `indexOf` by maintaining a list of the free ids.

**Before - Samsung Galaxy A52 for 28 seconds of profiling**
![image](https://github.com/user-attachments/assets/e669ed62-58d8-4d11-8a85-a82816b3792d)

**After - Samsung Galaxy A52 for 28 seconds of profiling**
![image](https://github.com/user-attachments/assets/48cd369f-0887-4683-920c-43068d0228b0)

## Changelog:

[INTERNAL] [FIXED] - Improve performance of _getFreeIndex

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

Test Plan: -  Tests pass, promises resolve and reject correctly, setTimeout works as expected

Reviewed By: javache

Differential Revision: D69059102

Pulled By: cipolleschi

fbshipit-source-id: d7de2c4adcf4dfc1d15e597e2a801e23c8d652aa
2025-02-10 03:43:58 -08:00
Mateo Guzmán fd36a51456 Remove unnecessary RobolectricTestRunner usage (#49290)
Summary:
Was going through some tests and I notice several files that use `RobolectricTestRunner` unnecessarily. This PR cleans that up.

## Changelog:

[INTERNAL] - Remove unnecessary RobolectricTestRunner usage

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

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

Reviewed By: cipolleschi

Differential Revision: D69383948

Pulled By: cortinico

fbshipit-source-id: 6102319115240267ba83a086d03a850d1b7cdae5
2025-02-10 02:32:12 -08:00
David Vacca b45a3e5cd8 Introduce new BuildConfig to determine if the new architecture is fully enabled into an Android app (#49283)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49283

In this diff I'm introducing a new BuildConfig called UNSTABLE_ENABLE_MINIFY_LEGACY_ARCHITECTURE to determine if the new architecture is fully enabled into an Android app at build time, fully enabled means:
- no interop
- all view managers migrated to new API
- all native modules migrated to new API
- legacy architecture can be stripped

This BuildConfig is different from ReactNativeFeatureFlags.enableBridgelessArchitecture() because the latter is controlled at runtime, BuildConfig.UNSTABLE_ENABLE_MINIFY_LEGACY_ARCHITECTURE is used at the build system level and it can be accessed from proguard to optimize code that's unused when the app is fully running in the new architecture. Additionally we will use the BuildConfig to assert that some classes and methods are not loaded or executed.

changelog: [Android][Changed] Introduces BuildConfig.UNSTABLE_ENABLE_MINIFY_LEGACY_ARCHITECTURE to determine if the new architecture is fully enabled into an Android app

Reviewed By: cortinico

Differential Revision: D69206248

fbshipit-source-id: f60a059be8333d3051eb7d2efac79939a479f6f8
2025-02-09 02:17:38 -08:00
Nick Gerleman 7b7c45030b Filter function parsing (#49281)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49281

Adds `CSSFilterFunction`, decomposing to the various filter types, alongside `CSSFilterList`.

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D69212763

fbshipit-source-id: 8aade5ef4725aaad2548b6ef30d8aa1298803cd5
2025-02-07 18:14:42 -08:00
Nick Gerleman 8bd01c7d01 Fix incorrect tokenization of non-exponential numbers ending with "E" (#49280)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49280

We were incorrectly consuming an `E` at the end of number tokens, even if not followed by a digit, which breaks dimension tokens where the unit starts with "E", like `em`. Follow the spec the right way:

https://www.w3.org/TR/css-syntax-3/#consume-number

> If the next 2 or 3 input code points are U+0045 LATIN CAPITAL LETTER E (E) or U+0065 LATIN SMALL LETTER E (e), optionally followed by U+002D HYPHEN-MINUS (-) or U+002B PLUS SIGN (+), followed by a digit, then...

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D69330975

fbshipit-source-id: a9bd5bceac9efbf02c1b7fb60659093774bb7228
2025-02-07 18:14:42 -08:00
Nick Gerleman f40d69f06d Reduce transform parsing duplication (#49279)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49279

I ended up using this same pattern for filter parsing where the logic betweeen functions is very similar. Let's deduplicate the logic for transform parsing a bit. This also separates `rotate()` and `rotateZ()` types, to be handled the same at a different layer.

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D69326443

fbshipit-source-id: 9bf910c6d4e07748ff032433167576f9d58cd8d6
2025-02-07 18:14:42 -08:00
Sam Zhou 722f5ba786 Remove global React$ type references (#49276)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49276

This diff replaces the remaining `React$` global types in the codebase, in preparation for their removal in Flow.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D69322418

fbshipit-source-id: 058a2489ce8e6bf59df2ec4e61e9708f63561671
2025-02-07 18:01:43 -08:00
Thomas Nardone 94b5d4b53f Flip SurfaceMountingManager null view state SoftException to not crash (#49271)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49271

This error is somewhat expected, so causing the red box error popup is a bit too disruptive.  Flip it to a no-crash exception.

Changelog: [Internal]

Reviewed By: Abbondanzo

Differential Revision: D69125274

fbshipit-source-id: 0dc7ac59ac8637bdabde25bd8886b1aebf175395
2025-02-07 15:10:36 -08:00
Peter Abbondanzo 58e163c74e Replace magic number for unset child view id (#49277)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49277

Replaces the `-1` magic number representing unset children with a named constant

Changelog: [Internal]

Reviewed By: zeyap

Differential Revision: D69324509

fbshipit-source-id: 64fb6c920a7715f5d15d3955564a8bf2b6ce404a
2025-02-07 15:10:23 -08:00
David Vacca 847f8902ff Update non-codegen ViewManagerInterfaces to extend ViewManagerWithGeneratedInterface (#49274)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49274

In this diff I'm updating all the non-codegen ViewManagerInterfaces to extend ViewManagerWithGeneratedInterface to make it consistent with codenerated ViewManagerInterfaces

changelog: [internal] internal

Reviewed By: javache

Differential Revision: D69206247

fbshipit-source-id: 6a577d9ee7410be990a03e78847333b61b429e88
2025-02-07 14:28:12 -08:00
David Vacca 6e0e72df71 Update documentation for OSSReleaseStageValue
Summary:
Update documentation for OSSReleaseStageValue

changelog: [internal] internal

Reviewed By: cortinico, alanleedev

Differential Revision: D69268799

fbshipit-source-id: 9f2fa5fc8363c5afd159f9a785d9b613548d8734
2025-02-07 13:46:51 -08:00
Thomas Nardone 83fd1742da Lazily create args in ResponseUtil (#49270)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49270

Changelog: [Internal]

Reviewed By: Abbondanzo

Differential Revision: D69316855

fbshipit-source-id: 1c7f58cb9364540c5bf7309b6c2f81162efcc178
2025-02-07 12:39:11 -08:00
Rob Hogan fc15260f1c Update monorepo Jest to 29.7.0 (#49261)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49261

Update the version of Jest used in React Native and Metro's own tests from `^29.6.3` to `^29.7.0`

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D69307514

fbshipit-source-id: 686935ed4ba1334d445217fd2f8a303b774b6c4a
2025-02-07 11:27:18 -08:00
Samuel Susla 14540e6abf refactor Point.h and add unit tests (#49249)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49249

changelog: [internal]

- Make all Point methods inline as per [C++ core guidelines](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#f5-if-a-function-is-very-small-and-time-critical-declare-it-inline).
- Add unit tests for Point.
- Use default == and != operator.

Reviewed By: javache

Differential Revision: D69239807

fbshipit-source-id: c5926d587a7888f54895cb7b1a62a23dc26242a3
2025-02-07 09:37:55 -08:00
Samuel Susla 947d9c3897 introduce Fabric View Culling (#49198)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49198

changelog: [internal]

The work done on the main thread should scale with what is on the screen. React Native shouldn’t block the main thread for off screen elements that do not affect what is shown to the end user. When React schedules a commit, only views needed to achieve a screen full of content should be materialised and added to the host platform’s view hierarchy.

With Fabric View Culling, views that do not contribute pixels to the screen will not materialize and updates to them will be skipped. React Native will focus system resources on what is visible to the end user.

Fabric View Culling maximises benefits from view recycling. Each UI element such as text, image, or video is recycled individually. As soon as an item goes off screen, it can be reused anywhere in the UI and pieced together with other items to create new UI elements. Such recycling reduces the need of having multiple view types and improves memory usage and scroll performance.

In the example bellow, view B will not be mounted because the user can't see it.
 {F1974949953}

The difference in number of allocated views:
Please note, the screenshots below are from Xcode View Hierarchy debugger. To show how many views are allocated in memory, I disabled [removeClippedSubviews](https://reactnative.dev/docs/scrollview#removeclippedsubviews) flag globally.
|Before|After:
| {F1974949979}| {F1974949981}

# Disclaimer, this is not a complete implementation
This implementation is not complete and it is missing to handle edge cases.
Things that are missing:
- Transform style is not taken into account.
- removeClippedSubviews is not respected. Fabric View Culling happens unconditionally for every scroll view.
- Fabric View Culling does not respect when ScrollView has overflow set to visible.
- Fabric View Culling is only performant enough on iOS.
- [enableSynchronousStateUpdates](https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js#L248) must be enabled for Fabric View Culling to work correctly.

Reviewed By: javache

Differential Revision: D63458372

fbshipit-source-id: c93ec434081f2be8a446212e2c0681f8ae4e90f9
2025-02-07 09:37:55 -08:00
Samuel Susla 68a17f2651 add getOverflowInsetFrame to LayoutMetrics (#49197)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49197

changelog: [internal]

Adds new method to LayoutMetrics that calculates frame adjusted for overflow inset.

For example, for the following view hierarchy. it would produce a frame that would fully contain view A and view B.
```
┌─────────────┐
│<View A />   │
│     ┌───────┴─────┐
└─────┤<View B />   │
      │             │
      └─────────────┘
```

See tests for more details

Reviewed By: javache, lenaic

Differential Revision: D68775683

fbshipit-source-id: b8f7c42cfca7dba8dcae75cae5e6944bd1082957
2025-02-07 09:37:55 -08:00
Samuel Susla 4fa2064905 introduce feature flag for View Culling (#49196)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49196

changelog: [internal]

introduces feature flag for Fabric View Culling. Not used anywhere yet.

Reviewed By: christophpurrer

Differential Revision: D68775684

fbshipit-source-id: 612362dd142cea48f38e00e65e942bcfd8580da2
2025-02-07 09:37:55 -08:00
Tim Yung 5635d5c0a3 RN: Avoid Rejections in InteractionManagerStub (#49241)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49241

In auditing differences between `InteractionManager` and `InteractionManagerStub` (used to evaluate to entirely remove the former all together), I noticed a behavioral disparity with how errors are handled.

In `InteractionManager`, the promise that's returned is never rejected, whereas `InteractionManagerStub` propagates errors by rejecting the promise that's returned. This changes `InteractionManagerStub` to behave like `InteractionManager` for the purpose of comparing apples-to-apples.

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D69275495

fbshipit-source-id: 05439a0cadc1f76b34a3f1457f7db31d6bda2a90
2025-02-07 08:18:42 -08:00