Commit Graph

8202 Commits

Author SHA1 Message Date
Pieter De Baets
105f5f6000 Convert exceptions in com.facebook.react.bridge to Kotlin (#47493)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47493

Changelog: [Internal]

Reviewed By: tdn120

Differential Revision: D65597240

fbshipit-source-id: 8014c756d7730bea617f6d27eb1e56d75c9156cf
2024-11-08 09:31:12 -08:00
Alex Hunt
63ec67c591 Exclude Libraries/ReactPrivate/ from public-api-test
Summary:
As titled. This API is legacy / Meta-only.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D65666574

fbshipit-source-id: f9700486aec0306b305910bff14ae7f3df3fab7f
2024-11-08 09:16:21 -08:00
Sam Zhou
f5d7df6672 Pre-suppress errors to prepare for flow typing changes
Summary: Changelog: [Internal]

Reviewed By: cyan33

Differential Revision: D65633359

fbshipit-source-id: 7aaee2cab2d61b61eb5e1317d6b4ce58b6191fb8
2024-11-08 08:39:06 -08:00
Nicola Corti
7e268c9d52 Revert React 19RC to React 18.3.1 (#47380)
Summary:
While we're waiting for 19 stable, let's bring main back to 18.3.1 ahead of the 0.77 branch cut. We'll land this change just after 19 stable lands.

This is a cherry pick of b93b378fa0 which landed in 0.76 already

bypass-github-export-checks

## Changelog:

[INTERNAL] - Revert React 19RC to React 18.3.1

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

Test Plan: CI

Reviewed By: cipolleschi

Differential Revision: D65430775

Pulled By: cortinico

fbshipit-source-id: f0f211754c8ffe5d037fd299e4de52c29d1d7913
2024-11-08 08:27:37 -08:00
Pieter De Baets
8cb2ad6725 Improve robolectric shadows (#47460)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47460

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D65538979

fbshipit-source-id: 7a0b0f701968a9af9197246e6e89e0ccfd55653d
2024-11-08 06:14:13 -08:00
Fabrizio Cucci
697a422bf5 Migrate com.facebook.react.views.text.FontMetricsUtil to Kotlin (#47510)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47510

As per title.

Changelog: [Internal]

Reviewed By: tdn120

Differential Revision: D65598073

fbshipit-source-id: 401750f2df9bd434a8310f107f46a686bfa6601c
2024-11-08 06:10:22 -08:00
Nicola Corti
e64513bf4e RNGP - Do not attempt to substring to 1024 while logging. (#47509)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47509

Fixes https://github.com/facebook/react-native/issues/47504

Changelog:
[Android] [Fixed] - RNGP - Do not attempt to substring to 1024 while logging

Reviewed By: javache

Differential Revision: D65659586

fbshipit-source-id: 8fa16131cea96b8b6aa9c0224c7b990a4f51175f
2024-11-08 04:57:15 -08:00
Pieter De Baets
3c32da5bfe Convert com.facebook.react.bridge.NativeArray to Kotlin (#47456)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47456

Changelog: [Internal]

Reviewed By: tdn120

Differential Revision: D65486257

fbshipit-source-id: d18d38fd7e605918d79e370dda7df51abac2f23c
2024-11-08 04:31:46 -08:00
Pieter De Baets
fd72537202 Convert com.facebook.react.bridge.JavaOnlyArray to Kotlin (#47424)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47424

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D65479614

fbshipit-source-id: d2ab86eb0e8c68a5733c602652b4b8dccc09a0a1
2024-11-08 04:31:46 -08:00
Fabrizio Cucci
12180ca153 Migrate com.facebook.react.views.text.ReactTypefaceUtils to Kotlin (#47505)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47505

As per title.

Changelog: [Internal]

Reviewed By: tdn120

Differential Revision: D65596132

fbshipit-source-id: d08aea48ff293cc7f20ebc40a1d289dcb8158dcb
2024-11-08 04:03:46 -08:00
Tim Yung
f0ffcd4f5d RN: Enable enableAnimatedAllowlist and enableAnimatedPropsMemo (#47502)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47502

Enables the two following feature flags:

- `enableAnimatedAllowlist`
- `enableAnimatedPropsMemo`

The former enables the use of an experimental optimization to provide `unstable_createAnimatedComponentWithAllowlist` and `useAnimatedProps` an allowlist of props that reduces the set of props iterated over by to find props with `AnimatedNode` (e.g. `Animated.Value`) instance values.

The latter enables improved memoization logic in `Animated` so that its intenal state is invalidated less frequently, reducing the cost of updating `Animated` components.

Changelog:
[General][Changed] - Optimized the performance of updating `Animated` components.

Reviewed By: rozele

Differential Revision: D65645985

fbshipit-source-id: 85f9e53072f09a59589d76d0c096f4cedd17bb4b
2024-11-07 23:43:30 -08:00
Joe Vilches
cbab004eb9 Remove position type override on scroll view sticky headers (#47498)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47498

I am trying to help someone with creating a sticky header on a scrollview, specifically one that floats on the side of the scrollview instead of the top Currently we can't really do that, since utilizing `position: absolute` to layout this properly will get overriden by the header styles changed in this diff

This was only added since static was the default and we needed to apply zIndex. With proper static implementation that is no longer the case, so I think it makes sense to remove this to support this use case.

Changelog: [General] [Breaking] - `position` of sticky headers on `ScrollView` will now be taken into account

Reviewed By: rozele

Differential Revision: D65626544

fbshipit-source-id: 8d650ca7654918e692435935e7c1094c412fd9f6
2024-11-07 16:34:31 -08:00
Arushi Kesarwani
846c4b1ea2 Reducing visibility of ImageStoreManager (#47443)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47443

As part of sustainability week effort for switching to internal here:

https://fb.workplace.com/groups/251759413609061/permalink/872342228217440/

Reducing visibility of ImageStoreManager from public to internal

Changelog:
[Android] [Breaking] - Stable API - Make ImageStoreManager internal

Reviewed By: javache

Differential Revision: D65520953

fbshipit-source-id: 0207be6a5e0b92dbbaee534735fc829e9202727d
2024-11-07 15:32:43 -08:00
Thomas Nardone
d02da992a4 Convert + Internalize SwipeRefreshLayoutManager (#47470)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47470

Convert to Kotlin and formalize it being an internal class (some methods were already `protected` in Java)

Changelog:
[Android] [Breaking] - Stable API - Make SwipeRefreshLayoutManager internal

Reviewed By: cortinico

Differential Revision: D65481861

fbshipit-source-id: afc5c624373fbcd3ca2d28b2834d2682de672997
2024-11-07 11:39:35 -08:00
Ramanpreet Nara
8b053a4fca Implement always available js error handling (#47466)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47466

Now, when the useAlwaysAvailableJSErrorHandling feature flag is true, React Native will use the earlyjs c++ error reporting pipeline for handling all javascript errors!

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D64715159

fbshipit-source-id: 597a5278eb792f87dca10e06fa9816b3a8c47b84
2024-11-07 11:22:57 -08:00
Fabrizio Cucci
791afd3209 Migrate com.facebook.react.views.text.ReactFontManager to Kotlin (#47488)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47488

As per title.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D65594248

fbshipit-source-id: 5a21baefb768b1c6f8ec0c33158812d1de6113d5
2024-11-07 10:23:27 -08:00
Pieter De Baets
bcdf6ad1af Convert com.facebook.react.bridge.JavaOnlyMap to Kotlin (#47479)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47479

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D65595979

fbshipit-source-id: be8217ef1fd9f59af57a1e100a4d9e86b66d8027
2024-11-07 10:16:21 -08:00
Tim Yung
bf31c8f077 RN: Feature Flag to Disable InteractionManager (#47475)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47475

Creates a feature flag to evalute the impact of disabling `InteractionManager` and replacing its scheduling behavior with `setImmediate`.

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D65577455

fbshipit-source-id: c0dc2b4d062eff4929ef37c5e217fd194addd790
2024-11-07 09:29:44 -08:00
Riccardo Cipolleschi
0ee963ea65 Cleanup after Codegen refactoring (#47483)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47483

I relaized too late that there were a couple of comments on [#47458](https://github.com/facebook/react-native/pull/47458) to add some explanation/remove commented code.

This change applies those comments

## Changelog
[Internal] - Cleanup after landing [#47458](https://github.com/facebook/react-native/pull/47458)

Reviewed By: dmytrorykun

Differential Revision: D65597157

fbshipit-source-id: 238bb75e4b45efae9a8736a7b4feb10f5af5e3d9
2024-11-07 07:53:07 -08:00
Peter Abbondanzo
425093863c Log image load errors (#47419)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47419

Minor improvements to `ImageExample` so we log when images fail to load. Also replaces a `Text` component with `RNTesterText` so it's legible.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D65363864

fbshipit-source-id: 6c7ce8d5af6aabfed21479c784911bdcffe4684e
2024-11-07 07:53:01 -08:00
Nicola Corti
7817ab5de2 Reland: Undo breaking change of UiManager.eventDispatcher by solving circular dependency (#47478)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47478

That's a reland of D65540601

The `UIManager.eventDispatcher` return type is wrong and is causing a breaking change in 0.77

For 0.76 we fixed it in the release branch but we should fix it for good in main as well.
To solve it I had to fix the circular dependency between .bridge and .uimanager.

I wish I could have isolated the .events package better but as everythign is public, any
change we do is going to be a breaking change so I'm being over cautios here.

Changelog:
[Android] [Fixed] - Undo breaking change of UiManager.eventDispatcher return type

Reviewed By: javache

Differential Revision: D65595391

fbshipit-source-id: fc7f6dce78e531c5ec0cc493ed90c0012262b77f
2024-11-07 05:25:17 -08:00
Alex Hunt
4567e2a897 Remove redundant UnimplementedView export from BackHandler (#47461)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47461

As titled, is overwritten later in the file.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D65546370

fbshipit-source-id: 4ea71d24e429b7bbded3e7bb7c75015a2c9d95d8
2024-11-07 05:13:53 -08:00
Riccardo Cipolleschi
ffa159e147 Set ASSUME_NONULL in codegen files (#47481)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47481

The Codegenerated files has this option turned off.
This is causing Xcode to output hundreds of warnings due to missing nullability options. RThis fixes them.

## CHANGELOG
[Internal] - Set ASSUME_NONNULL regions in codegen'd files

Reviewed By: dmytrorykun

Differential Revision: D65596598

fbshipit-source-id: bbf664944e103c05ef593a7e07bf5b767445950c
2024-11-07 04:50:55 -08:00
Riccardo Cipolleschi
ace690aba9 Generate RN specific Files in RN (#47458)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47458

We are in a weird situation where React Native depends on some files that are generated by Codegen.

Codegen runs in the user project, so those dependencies are not available to React Native if we try to build it in isolation.

This is a problem and a blocker to prepare the prebuilds for iOS.

This image show the changes we are introducing:
On the right we have the current situation.
On the left the new one.

{F1954418630}

## Changelog:
[Internal] - Generate React Native specific code inside React Native

Reviewed By: cortinico, blakef

Differential Revision: D65541505

fbshipit-source-id: 1412d7f23c4d2230b795af41f1e832c8a70d5859
2024-11-07 04:08:58 -08:00
Oskar Kwaśniewski
5e18f7f788 fix: typo in spm.rb (#47480)
Summary:
This PR fixes a typo in spm.rb

## Changelog:

[IOS] [FIXED] - Typo in spm.rb

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

Test Plan: N/a

Reviewed By: GijsWeterings

Differential Revision: D65596339

Pulled By: cortinico

fbshipit-source-id: c318cec1422dbcb322e70dc5f189d86af42b626d
2024-11-07 04:01:20 -08:00
Alan Lee
fb69f406df Make IntentModule Nullsafe (#47430)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47430

Make IntentModule Nullsafe.
Fixed nullability warnings.

Changelog: [Internal]

Reviewed By: tdn120

Differential Revision: D65463226

fbshipit-source-id: 2da597e66ad170ec4a2a2949348e522bb361c209
2024-11-07 01:03:33 -08:00
Tim Yung
2dab7b078d ScrollView: Delete unstable_setEnableSyncOnScroll (#47399)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47399

Deletes `unstable_setEnableSyncOnScroll` which we are no longer experirmenting with in React Native.

Changelog:
[Internal] - Deleted `unstable_setEnableSyncOnScroll` on `ScrollView`, which was never part of the React Native Public API.

Reviewed By: tdn120, sammy-SC

Differential Revision: D65449039

fbshipit-source-id: 6608d5ccca477f1da5e0168c4a342cce17014b08
2024-11-07 00:00:14 -08:00
Yedidya Feldblum
f01b47257a let PointerValue::invalidate() be noexcept (#47354)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47354

`PointerValue::invalidate()` is called from `Pointer` destructor, which is implicitly `noexcept`, and from `Pointer` move-assignment operator, which is now `noexcept`.

Reviewed By: neildhar

Differential Revision: D65271399

fbshipit-source-id: 26fd9707e4389da78537d0d607adaef0c68690ca
2024-11-06 23:10:36 -08:00
Mathieu Acthernoene
7a6c7a462a feat(android): Edge-to-edge Modal (navigationBarTranslucent prop) (#47254)
Summary:
The future of Android is [edge-to-edge](https://github.com/react-native-community/discussions-and-proposals/discussions/827) and to make the React Native developer experience seamless in this regard, the ecosystem needs to transition from “opaque system bars by default” to “edge-to-edge by default.”

Currently, there's no easy way to have edge-to-edge modals, as they are implemented using `Dialog` instances (a separate `Window`) and only provide a `statusBarTranslucent` prop.

I tried to implement it in [`react-native-edge-to-edge`](https://github.com/zoontek/react-native-edge-to-edge) by listening to the `topShow` `UIManager` event. But if it works well when there's a defined animation, we can see a quick jump when there's none, because there's too much delay before the event, and edge-to-edge cannot be applied quick enough to the dialog window.

### react-native-edge-to-edge implem with animation (no jump)

https://github.com/user-attachments/assets/4933a102-87a5-40e4-98d9-47f8c0817592

### react-native-edge-to-edge implem without animation (jump)

https://github.com/user-attachments/assets/e4675589-08fe-44fe-b9d8-0a6b3552b461

 ---

For this reason, and because listening to event feels a bit hacky, I think it will be better to go for a new prop directly on RN Modal component: `navigationBarTranslucent`

> [!NOTE]
> `navigationBarTranslucent` cannot be used without `statusBarTranslucent`, as setting both enable edge-to-edge, like [AndroidX would do](https://github.com/androidx/androidx/blob/androidx-main/activity/activity/src/main/java/androidx/activity/EdgeToEdge.kt) and it would requires extra (and unecessary, given the direction Android is taking) work to find a way to keep the status bar opaque but the navigation bar transparent that work on Android 6 to 15+

### Additional infos

- Colors used for the buttons navigation bar in the PR are the default Android ones ([light](https://github.com/androidx/androidx/blob/androidx-main/activity/activity/src/main/java/androidx/activity/EdgeToEdge.kt#L37) and [dark](https://github.com/androidx/androidx/blob/androidx-main/activity/activity/src/main/java/androidx/activity/EdgeToEdge.kt#L42))
- Compared to the Google implementation, the light scrim is applied from `O_MR1` to `Q` (and not `O` to `Q`) as the [`android:windowLightNavigationBar`](https://developer.android.com/reference/android/R.attr#windowLightNavigationBar) style attribute is not available on `O` (it can only be applied programmatically on API 26).

## Changelog:

[ANDROID] [ADDED] - Add navigationBarTranslucent prop to Modal component

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

Test Plan:
Run the tester app, toggle `navigationBarTranslucent`:

https://github.com/user-attachments/assets/286d173b-35a5-4951-9105-f9f7562d6764

-----
did some additional testing with RNTester using different justification

|flex-start|flex-end|
|https://pxl.cl/5Rd20|https://pxl.cl/5Rd21|

Reviewed By: javache

Differential Revision: D65103501

Pulled By: alanleedev

fbshipit-source-id: ef6473ecd785976d3e26c77bbc212222ec96c9f2
2024-11-06 21:09:36 -08:00
Liron Yahdav
61e660b40e Expose some VirtualizedList functions to allow creating VirtualizedListContextProvider outside of VirtualizedList (#47463)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47463

Note this is just a temporary approach which will be cleaned up later.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D65514902

fbshipit-source-id: f722031c5cd34eb1400b3f732fd94c0b03d5434d
2024-11-06 20:15:08 -08:00
Nicola Corti
46526fc2fe Stable API - Make classes inside com.facebook.react.views.progressbar internal (#47376)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47376

This makes several classes inside `com.facebook.react.views.progressbar` internal:
- ReactProgressBarViewManager
- ProgressBarShadowNode
- ProgressBarContainerView

Those classes should have not been exposed in the first place and users should not depend on them directly.
Marked as Breaking but verified that there are no meaningful usages in OSS.

Changelog:
[Android] [Breaking] - Stable API - Make classes inside `com.facebook.react.views.progressbar` internal

Reviewed By: javache

Differential Revision: D65423290

fbshipit-source-id: dc98fdca996eb648593adb2c32787cbf0d878e3e
2024-11-06 18:32:38 -08:00
Sam Zhou
0ca2ba082d Fix final few problematic React.ElementRef in react-native (#47473)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47473

For example,

```
declare function C<T>(ref: React.RefSetter<Set<T>>): React.Node;

type T = React.ElementRef<typeof C>
```

Previously Flow will evaluate `T` to `Set<mixed>`, by automatically replacing generic types with their upper bounds. But in the future it might be replaced with `empty`.

This diff cleans up instances like this in react-native codebase.

Changelog: [Internal]

Reviewed By: alexmckenley

Differential Revision: D65562571

fbshipit-source-id: bca2f4f022a5a23a5aa40886f5661899cb315f2e
2024-11-06 18:14:19 -08:00
Phillip Pan
8e375f0505 introduce internal API to reload bridgeless without surface restart (#47404)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47404

Changelog: [Internal]

introducing an internal API to reload without starting up the surfaces that were stopped at time of reload

Reviewed By: sammy-SC

Differential Revision: D65461606

fbshipit-source-id: 9e58bebdc3e03ead7f91376b7aaba5c7944bddcf
2024-11-06 18:13:34 -08:00
David Vacca
bc3ea5c957 Revert migration of ReactHorizontalScrollContainerViewManager to use ViewManagerInterface (#47472)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47472

using ViewManagerDelegates for ReactHorizontalScrollContainerViewManager which extends ReactClippingViewManager will introduce a bug (not updating props that are managed by ReactClippingViewManager)

I'm reverting the migration and we should fix the bug in codegen

This diff is a revert of D65428646

changelog: [internal] internal

Reviewed By: sammy-SC, Abbondanzo

Differential Revision: D65564730

fbshipit-source-id: ff183876321d4d36e51da8f38ff6f381207c7c3a
2024-11-06 18:04:31 -08:00
Ramanpreet Nara
50b3c2272f ExceptionsManager: Fix soft error reporting (#47465)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47465

When you do @(NO), in objc, it creates an NSNumber.

So this if condition actually evaluates to true:

```
if (@(NO))
```

This means that all soft errors will get logged as fatals on ios.

Changelog: [Internal]

Created from CodeHub with https://fburl.com/edit-in-codehub

Reviewed By: realsoelynn

Differential Revision: D65551648

fbshipit-source-id: 99b5bcb5fa1b0b5dc8055a3c86fc983863a25526
2024-11-06 17:58:27 -08:00
Alan Lee
e6090df7dc xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/perftest/PerfTestConfig.java (#47440)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47440

Removing file as it does not seem to be used

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D65457514

fbshipit-source-id: 39efa12176fe65a491fa4285099134f2bf753159
2024-11-06 15:43:58 -08:00
Alan Lee
c53d3e1901 xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/util/ReactFindViewUtil.java (#47431)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47431

Convert Java to Kotlin

Changelog: [Internal]

Reviewed By: tdn120

Differential Revision: D65430703

fbshipit-source-id: a1fcab2dd577fe67a1507c330466dabe7483c843
2024-11-06 15:19:38 -08:00
Grace Nichols
147e6c3458 Revert D65540601: Undo breaking change of UiManager.eventDispatcher by solving circular dependency
Differential Revision:
D65540601

Original commit changeset: 4b1f62806baa

Original Phabricator Diff: D65540601

fbshipit-source-id: 9abc3a663882634bb7d42b16bc95d8c2934a2ca5
2024-11-06 12:58:27 -08:00
Adam Woods-Mccormick
e603fde886 Revert D65478448: Convert com.facebook.react.bridge.JavaOnlyMap to Kotlin
Differential Revision:
D65478448

Original commit changeset: 24e6732a80f5

Original Phabricator Diff: D65478448

fbshipit-source-id: fffd2259aa2757b816373bfded96948b3e6dfeba
2024-11-06 12:49:38 -08:00
Nicola Corti
dbe509a23a Undo breaking change of UiManager.eventDispatcher by solving circular dependency (#47457)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47457

The `UIManager.eventDispatcher` return type is wrong and is causing a breaking change in 0.77

For 0.76 we fixed it in the release branch but we should fix it for good in main as well.
To solve it I had to fix the circular dependency between .bridge and .uimanager.

I wish I could have isolated the .events package better but as everythign is public, any
change we do is going to be a breaking change so I'm being over cautios here.

Changelog:
[Android] [Fixed] - Undo breaking change of UiManager.eventDispatcher return type

Reviewed By: tdn120

Differential Revision: D65540601

fbshipit-source-id: 4b1f62806baac5f6c3ffdd51b8628ef088447604
2024-11-06 11:50:28 -08:00
Arushi Kesarwani
abd118a719 Reducing visibility of OkHttpCallUtil (#47439)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47439

As part of sustainability week effort for switching to internal here:
https://fb.workplace.com/groups/251759413609061/permalink/872342228217440/

Reducing visibility of OkHttpCallUtil from `public` to `internal`

Changelog:
[Android] [Breaking] - Stable API - Make OkHttpCallUtil internal

Reviewed By: javache

Differential Revision: D65506859

fbshipit-source-id: 4ad55d9112da3b3f04b734f41c5a263f4eabfefb
2024-11-06 10:31:21 -08:00
Alex Hunt
0c21db360c Remove unused ReactFabricInternals API (#47454)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47454

As far as I can tell, this module is now unused both within the codebase and externally. Delete to reduce our public API surface (deep module is an accessible import path).

Changelog:
[General][Breaking] - Remove ReactFabricInternals module

Reviewed By: cortinico

Differential Revision: D65535378

fbshipit-source-id: 25ee16ccc637815ffe1c69a5fc546bd3e11d1689
2024-11-06 10:27:31 -08:00
Pieter De Baets
1be0387796 Convert com.facebook.react.bridge.JavaOnlyMap to Kotlin (#47416)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47416

Changelog: [Internal]

Reviewed By: tdn120

Differential Revision: D65478448

fbshipit-source-id: 24e6732a80f5ee858fec5dbb38617e7dfad63f58
2024-11-06 10:27:28 -08:00
Arushi Kesarwani
3dec672398 Reducing visibility of SimpleSettableFuture (#47438)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47438

As part of sustainability week effort for switching to `internal` here:
https://fb.workplace.com/groups/251759413609061/permalink/872342228217440/

Reducing visibility of SimpleSettableFuture from `public` to `internal`

Changelog:
[Android] [Breaking] - Stable API - Make SimpleSettableFuture internal

Reviewed By: javache

Differential Revision: D65502193

fbshipit-source-id: 4bdd9b43684c8bc075271d76856ef848c52e6b12
2024-11-06 10:26:16 -08:00
Mateo Guzmán
17c164621d test(image): [android] improving image property test cases (#47433)
Summary:
I've doing some enhancements around the Image component for Android, and in the process of understanding the codebase I saw some opportunity to improve the test cases as there is no much coverage around the underlying functionality.

## Changelog:

[INTERNAL] [ADDED] - Improving Android Image property test cases

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

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

Reviewed By: javache

Differential Revision: D65530813

Pulled By: cortinico

fbshipit-source-id: b314eaf7493c6f3c859b7cb0d06771c109e5e854
2024-11-06 09:19:27 -08:00
qnnp
0244710c4b refactor(PermissionsAndroid): Use the TypeScript key in syntax to restrict permissions and types of results (#47299)
Summary:
Changelog:
[General][Added] Use the TypeScript key in syntax to restrict permissions and types of results

 - Use key in 'GRANTED' | 'DENIED' | 'NEVER_ASK_AGAIN for RESULTS constants to ensure that only these values are allowed

 - Use a detailed list of permission names for PERMISSIONS constants to restrict the type of key

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

Reviewed By: yungsters

Differential Revision: D65480410

Pulled By: tdn120

fbshipit-source-id: ec23750d72ede0ba6ed96e80c35242da08b2508e
2024-11-06 08:45:18 -08:00
Blake Friedman
e0be2efe4e fix/cli start (#47450)
Summary:
When decoupling the community-cli-plugin from the react-native-community/cli-server-api (https://github.com/facebook/react-native/issues/45311), a middleware stub was created to allow a runtime stub to be used in this case. This middleware should be used so as not to break when the optional cli-server-api dependency isn't present.

Changelog:
[General][Fixed] - Fix npm react-native start when cli-server-api isn't installed

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

Test Plan:
Forced a runtime exception simulating the package not being dependent and was able to build rn-tester.

![CleanShot 2024-11-06 at 10 49 58@2x](https://github.com/user-attachments/assets/c040ec5b-7000-43bd-ba54-52a672ff3675)

Reviewed By: cipolleschi

Differential Revision: D65532486

Pulled By: blakef

fbshipit-source-id: 2b380607de63ac2da906ef0cb1e48b9ef263cb68
2024-11-06 07:26:30 -08:00
Pieter De Baets
b04f5fbfba Add Binding.h header back for backwards compat (#47453)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47453

`react-native-screens` [depends on this header](https://github.com/software-mansion/react-native-screens/blob/main/android/src/main/cpp/NativeProxy.cpp#L2) and this is an unnecessary API breakage.

Changelog: [Android][Fixed] Added back `<react/fabric/Binding.h>` header.

Reviewed By: fabriziocucci

Differential Revision: D65534176

fbshipit-source-id: ce252f29be1c5322f44e20b6e36ab51db9c7a8ef
2024-11-06 06:38:47 -08:00
Pieter De Baets
5b41c7a84b Convert com.facebook.react.views.text.TextTransform to Kotlin (#47412)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47412

Changelog: [Internal]

Reviewed By: cortinico, fabriziocucci

Differential Revision: D65478027

fbshipit-source-id: e65019b7a90b696c3764e1deaf94f5f8bb0a7a95
2024-11-06 06:38:29 -08:00
Nicola Corti
10f6d5adb5 Stable API - Make ClipboardModule internal (#47413)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47413

This class should not be accessed directly, therefore I'm making it internal.
Technically breaking but I verified that there are no meaningful usages in OSS:
https://github.com/search?type=code&q=NOT+is%3Afork+NOT+org%3Afacebook+com.facebook.react.modules.clipboard.ClipboardModule

Changelog:
[Android] [Breaking] - Stable API - Make `ClipboardModule` internal

Reviewed By: mdvacca

Differential Revision: D65479065

fbshipit-source-id: 1c534cafffdb27b808553eec7346e21fe4f38c24
2024-11-06 04:16:43 -08:00
kunal.chavhan
92f51c009f add e2e test for empty case in flatlist (#47444)
Summary:
Part of https://github.com/facebook/react-native/issues/46757
Solves: ME2E0010

## Changelog:

[INTERNAL][ADDED] - add e2e test for empty case in flatlist

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

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

Reviewed By: cortinico

Differential Revision: D65531064

Pulled By: cipolleschi

fbshipit-source-id: 700c2fd6d43c24671021b6c3c5a4218e5699c7d9
2024-11-06 04:07:01 -08:00
David Vacca
fddf7aaad1 Migrate ReactHorizontalScrollContainerViewManager to use ViewManagerInterface (#47395)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47395

Migrate ReactHorizontalScrollContainerViewManager to use ViewManagerInterface

changelog: [internal] internal

Reviewed By: cortinico

Differential Revision: D65428646

fbshipit-source-id: 7e36f3642ac31aa747c2b7f21c251173516fffad
2024-11-06 00:01:07 -08:00
David Vacca
bed778fa5a Migrate ReactUnimplementedViewManager to use ViewManagerInterface (#47392)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47392

Migrate ReactUnimplementedViewManager to use ViewManagerInterface

changelog: [internal] internal

Reviewed By: cortinico

Differential Revision: D65428644

fbshipit-source-id: 011d06b6cb06c4fcc5e072b625b943ec6b7f1a62
2024-11-06 00:01:07 -08:00
David Vacca
b4a24a163c Migrate DebuggingOverlayManager to use ViewManagerDelegate (#47393)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47393

Migrate DebuggingOverlayManager to use ViewManagerDelegate

changelog: [internal] internal

Reviewed By: cortinico

Differential Revision: D65428645

fbshipit-source-id: 9cf6932a209935b6e85b7d8870a7aa610c45aded
2024-11-06 00:01:07 -08:00
David Vacca
496b0a8729 Migrate ReactVirtualTextShadowNode to kotlin and make it internal (#47434)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47434

Migrate ReactVirtualTextShadowNode to kotlin and make it internal

changelog: [Android][Breaking] Reduce visibility of ReactVirtualTextShadowNode to internal

Reviewed By: shwanton

Differential Revision: D65493927

fbshipit-source-id: 2b5997d000b5dc489ba93edb226455ef0855b98b
2024-11-05 21:44:38 -08:00
David Vacca
4a119c4c3a Migrate ReactVirtualTextViewManager to kotlin and reduce visibility tointernal (#47402)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47402

Migrate ReactVirtualTextViewManager to kotlin and reduce visibility tointernal

changelog: [Android][Breaking] Reduce visibility of ReactVirtualTextViewManager to internal

Reviewed By: cortinico

Differential Revision: D65462051

fbshipit-source-id: fa6daef4e557d527d594616ca032ebf0180cbba2
2024-11-05 21:44:38 -08:00
David Vacca
5c3c1524dd Exclude $$PropSetter classes from public API (#47432)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47432

In this diff we are excluding the $$PropSetter classes from public API, we do this by adding the UnstableReactNativeAPI annotation on all $$PropSetter classes

changelog: [internal] internal

Reviewed By: cortinico

Differential Revision: D65488026

fbshipit-source-id: 9f1bbe7b25fa69c0a40f6cb0ff38a8ae6ee8d97d
2024-11-05 21:44:38 -08:00
Phillip Pan
b7ec7523cc clean up contextContainer->insert("ReactNativeConfig") from oss (#47350)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47350

Changelog: [Internal]

we don't need any of these now since no one is calling `contextContainer_->at<std::shared_ptr>("ReactNativeConfig")` anymore

Reviewed By: NickGerleman

Differential Revision: D65304976

fbshipit-source-id: 5f835ab9ac429aa1942cc8d9669812c1ac994238
2024-11-05 17:43:18 -08:00
Nicola Corti
39dfbadd5d Stable API - Make classes in com.facebook.react.views.safeareaview internal (#47375)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47375

This makes the following class internal:
- ReactSafeAreaView
- ReactSafeAreaViewManager

Those classes should have not been exposed in the first place. Marked as breaking but no
meaningful usages are available in OSS:
https://github.com/search?type=code&q=NOT+is%3Afork+NOT+org%3Afacebook+com.facebook.react.views.safeareaview.ReactSafeAreaView

Changelog:
[Android] [Breaking] - Stable API - Make classes in `com.facebook.react.views.safeareaview` internal

Reviewed By: javache

Differential Revision: D65422197

fbshipit-source-id: d245155c7c92a408cfbb2a7a0015a73fd1d9f9b8
2024-11-05 16:38:17 -08:00
Ramanpreet Nara
ef6b6f315c earlyjs: Attach js build to all errors (#46868)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46868

jsBuild prasing was done at the js level.

But, for the c++ pipeline, we have to parse the js build in native.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D63927093

fbshipit-source-id: ce7ee46714ee0e72e450003330dbca78acb264a3
2024-11-05 16:15:09 -08:00
Soe Lynn
120a12f01a Convert [bridge_ reload] to RCTReloadCommand (#47400)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47400

Changelog [Internal]:

Convert `[bridge_ reload]` to RCTReloadCommand

Reviewed By: cipolleschi

Differential Revision: D65455862

fbshipit-source-id: 5d5e504cc0b4151a2fb4c86c08e84dbd7040ed68
2024-11-05 15:45:22 -08:00
Yedidya Feldblum
2dcffef5c4 let Pointer be nothrow-move-constructible (#47331)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/47331

Reviewed By: Gownta

Differential Revision: D65271354

fbshipit-source-id: cd3ff9db94f2ad332afd68dae438c404f8807f70
2024-11-05 15:44:57 -08:00
Nicola Corti
a72c35f98c Stable API - Make VibrationModule internal (#47414)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47414

This class should not be accessed directly, therefore I'm making it internal.
Technically breaking but I verified that there are no meaningful usages in OSS:
https://github.com/search?type=code&q=NOT+is%3Afork+NOT+org%3Afacebook+com.facebook.react.modules.vibration.VibrationModule

Changelog:
[Android] [Breaking] - Stable API - Make ClipboardModule internal

Reviewed By: mdvacca

Differential Revision: D65479292

fbshipit-source-id: 383790e6432c3c8c6f47289d2156099d263cc8ca
2024-11-05 15:41:41 -08:00
Nicola Corti
bbe714e487 Undo a breaking change on ReactViewGroup constructor (#47423)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47423

cipolleschi found out that we broke the `ReactViewGroup` constructor when making this class Nullsafe.

Specifically now users would need to pass a `Context` and not a `Context?` as libraries will break (and this will break a lot of them).
So I'm undoing this change by annotating this parameter as Nullable.

Changelog:
[Android] [Changed] - Undo a breaking change on ReactViewGroup constructor

Reviewed By: tdn120

Differential Revision: D65483379

fbshipit-source-id: 43f7bcab5f10b1b8b5601de1dab314d7bbb1eefe
2024-11-05 13:59:31 -08:00
David Vacca
72bd840dd3 Deprecate BridgelessCatalystInstance class (#47385)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47385

BridgelessCatalystInstance class is deprecated, please to migrate to new architecture using [com.facebook.react.defaults.DefaultReactHost] instead.

changelog: [Android][Changed] Deprecate BridgelessCatalystInstance class

Reviewed By: cortinico

Differential Revision: D65430789

fbshipit-source-id: 011b372c93c39862d5821713aa8f673084b52c2a
2024-11-05 12:34:51 -08:00
Soe Lynn
2168dca4ac Fix warning for adjustImageWhenDisabled (#47401)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47401

Changelog [Internal]:

Replace deprecated `adjustImageWhenDisabled` with `UIButtonConfiguration`

Reviewed By: cipolleschi

Differential Revision: D65457771

fbshipit-source-id: ffb5b4fc629ba671cb6fec1dc333bf693e4be8ea
2024-11-05 12:11:51 -08:00
Mateo Guzmán
d8cfd98070 feat(image): support for resizeMode and objectFit value of 'none' (#47110)
Summary:
As part of https://github.com/facebook/react-native/issues/34425, `objectFit` value of `'none'` needs to be supported for the Image component.

In order to support this, a new value must also be added to support the equivalent in `resizeMode`. With this new value, the image will not be resized at all and keeping it in the initial position within a container (see in the screenshots).

In this PR the support is added for both Fabric and Paper.

## Changelog:

[GENERAL] [ADDED] - image `resizeMode` and `objectFit` support for `'none'`.

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

Test Plan:
Using the `rn-tester`, there is a new image example for both `resizeMode` and `objectFit`.

See below the results for both Android and iOS:

<details>
<summary>Fabric screenshots</summary>

**Android:**

| Resize Mode | Object Fit |
| --------- | ---------- |
| ![Screenshot_1729232899](https://github.com/user-attachments/assets/ea765afc-9f85-4ac3-96ab-229b3f1def20) | ![Screenshot_1729232912](https://github.com/user-attachments/assets/75033e76-5faa-438d-81b1-4bf8436f9ef2) |

**iOS:**

| Resize Mode | Object Fit |
| --------- | ---------- |
| ![Simulator Screenshot - iPhone 16 Pro Max - 2024-10-18 at 08 16 37](https://github.com/user-attachments/assets/ade02ba9-4792-4760-aada-6ea56b591801) | ![Simulator Screenshot - iPhone 16 Pro Max - 2024-10-18 at 08 16 55](https://github.com/user-attachments/assets/abf68db9-841a-4ee5-b5db-64fe84a69089) |

</details>

<details>
<summary>Paper screenshots</summary>

**Android:**

| Resize Mode | Object Fit |
| --------- | ---------- |
| ![Screenshot_1729286528](https://github.com/user-attachments/assets/88e89191-d70a-4013-8380-2ecefd9532b4) | ![Screenshot_1729286542](https://github.com/user-attachments/assets/43d84ae0-2ed3-47ad-a725-ac6aea0b3245) |

**iOS:**

| Resize Mode | Object Fit |
| --------- | ---------- |
| ![Simulator Screenshot - iPhone 16 Pro Max - 2024-10-18 at 22 21 22](https://github.com/user-attachments/assets/e14a81de-3a69-4e73-8c85-ec08ac30b04f) | ![Simulator Screenshot - iPhone 16 Pro Max - 2024-10-18 at 22 21 16](https://github.com/user-attachments/assets/595f9f5e-96a6-4f6b-9614-f6c236837ba8) |

</details>

Reviewed By: fabriziocucci

Differential Revision: D65420002

Pulled By: javache

fbshipit-source-id: df3bc8fc931b88cde5fe51d89685bf327e30ed9f
2024-11-05 11:36:27 -08:00
Nicola Corti
d7d5de9f96 Stable API - Make NativeModulePerfLogger internal (#47415)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47415

This class should not be accessed directly, therefore I'm making it internal.
Technically breaking but I verified that there are no meaningful usages in OSS:
https://github.com/search?type=code&q=NOT+is%3Afork+NOT+org%3Afacebook+com.facebook.react.reactperflogger.NativeModulePerfLogger

Changelog:
[Android] [Breaking] - Stable API - Make NativeModulePerfLogger internal

Reviewed By: mdvacca

Differential Revision: D65479550

fbshipit-source-id: 545c33e2c526e396084af65fc19314f59c8a74f8
2024-11-05 11:35:12 -08:00
Alan Lee
d1fb01cd85 Make FrescoBasedReactTextInlineImageViewManager Nullsafe (#47425)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47425

Make FrescoBasedReactTextInlineImageViewManager Nullsafe.

Changelog: [Internal]

Reviewed By: tdn120

Differential Revision: D65456481

fbshipit-source-id: c841494ba933be149a2124a461d6a5011ce7d993
2024-11-05 11:31:37 -08:00
Nick Gerleman
19b0acf754 Minor display: contents optimizations (#47358)
Summary:
X-link: https://github.com/facebook/yoga/pull/1736

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

`LayoutableChildren<yoga::Node>::Iterator` showed up to a surprising extent on a recent trace. Part of this was during pixel grid rounding, which does full tree traversal (we should fix that...), where the iterator is the first thing to read from the node.

I ran Yoga microbenchmark with Yoga compiled with `-O2`, where we saw a regression of synthetic performance by ~10%, but it turns out this build also had ASAN and some other heavy bits enabled, so the real impact was quite lower (~6%).

I was able to make some optimizations in the meantime against that, which still show some minor wins, reducing that overhead to ~4% in the properly optimized build (and a bit more before that). This is still measurable on the beefy server, and the code is a bit cleaner, so let's commit these!

Note that, in real scenarios, measure functions may dominate layout time, so display: contents does not mean end-to-end 4% regression, even after this change.

This change makes a few different optimizations
1. Removes redundant copies
2. Removes redundant index keeping
3. Mark which branches are likely vs unlikely
4. Shrink iterator size from 6 pointers to 3 pointers
5. Avoid usage in pixel grid rounding (so we don't need to have cache read for style)

In "Huge nested layout" example

| Before display: contents support | After display: contents support | After optimizations |
| 9.77ms | 10.39ms | 10.17ms |

Changelog: [Internal]

Reviewed By: rozele

Differential Revision: D65336148

fbshipit-source-id: 01c592771ed7accf2d87dddd5a3a9e0225098b56
2024-11-05 11:28:37 -08:00
Luna Wei
06071c68d5 Remove experimental types (#47405)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47405

Changelog: [Internal] - With New Architecture out, delete experimental type definition and move types back to relevant definition files

Reviewed By: cortinico, jorge-cab

Differential Revision: D65462903

fbshipit-source-id: bd7fc5bb689eb054b3a30ec7b388e0f455ff1c93
2024-11-05 10:24:13 -08:00
Riccardo Cipolleschi
ba41228a66 Back out "Add png extension only if file exist when load local image" (#47417)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47417

Backing out this change as it was breaking an internal app. I'll reland this next week when I have more time.

## Changelog:
[iOS][Changed] - Revert fix that checks whether an image is present on disk.

## Facebook:
This is breaking twilight.

Differential Revision: D65479912

fbshipit-source-id: dcd5ac5f3d98ba2f10b9519f09d3eb1fd454da61
2024-11-05 10:06:35 -08:00
Luna Wei
f489944051 Convert PanResponder example into functional component (#47381)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47381

Convert PanResponder example into functional component

Changelog: [Internal] Update PanResponder example to functional component

Reviewed By: lyahdav

Differential Revision: D65430973

fbshipit-source-id: 0db09ce12a8c59ec74beaf2ee10326c984fa682c
2024-11-05 09:30:30 -08:00
Nicola Corti
8c50bf0beb Stable API - Make DevLoadingModule internal (#47368)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47368

This class should be internal and has no meaningful usages outside of React Native.
See https://github.com/search?type=code&q=%22DevLoadingModule%3A%3Aclass%22

So technically breaking but I expect no impact for OSS at all.

Changelog:
[Android] [Breaking] - Make `DevLoadingModule` internal

Reviewed By: javache

Differential Revision: D64725164

fbshipit-source-id: 5f39e609c611662c71cc08bffa195f7bea5db5bd
2024-11-05 07:35:36 -08:00
Nicola Corti
287e200332 Stable API - Convert to Kotlin and make internal NotThreadSafeViewHierarchyUpdateDebugListener (#47371)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47371

This interface should have not been exposed in the first place.
I'm converting it to Kotlin + making it `internal`.
I found no meaningful usage in OSS so I expect no breakages.

Changelog:
[Android] [Breaking] - Stable API - Convert to Kotlin and make internal `NotThreadSafeViewHierarchyUpdateDebugListener`

Reviewed By: javache

Differential Revision: D65420912

fbshipit-source-id: 5afdb013f588a5698b4e7467a7f1096c24d1733e
2024-11-05 04:11:48 -08:00
Nicola Corti
1f62529dc4 Properly handle paths with spaces in autolinking (#47388)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47388

Fixes https://github.com/facebook/react-native/issues/47364
Fixes https://github.com/facebook/react-native/issues/47377
Fixes https://github.com/facebook/react-native/issues/37124

We're having problems is a path contains a space ' ' because when autolinking,
the `add_subdirectory()` function of CMake consider the path with space as 2 parameters.

This fixes it by properly quoting the path.

Changelog:
[Android] [Fixed] - Properly handle paths with spaces in autolinking

Reviewed By: cipolleschi

Differential Revision: D65434413

fbshipit-source-id: b9147482f98f7e222405cc8d9e6f3c17a5f4ed02
2024-11-05 03:32:16 -08:00
Nicola Corti
3956955eaa Use absolute path when compiling appmodules.so sources (#47379)
Summary:
Fixes https://github.com/facebook/react-native/issues/47352

This fixes a bug when the user is providing its own CMakeLists.txt file say because they want to compile more C++ code than we actually provide.

Previously the `*.cpp` will evalute file in the current directory, meaning that the app's default `OnLoad.cpp` file would be ignored.

## Changelog:

[ANDROID] [FIXED] - Use absolute path when compiling appmodules.so sources

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

Test Plan:
Tested against the reproducer provided in:
- Use absolute path when compiling appmodules.so sources

Reviewed By: cipolleschi

Differential Revision: D65428676

Pulled By: cortinico

fbshipit-source-id: 7f3e4d470da0fffc5191c1a2c7e8fec517fee496
2024-11-05 03:27:59 -08:00
Riccardo Cipolleschi
d7d5535fe1 Suppres CC_MD5 warning (#47378)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47378

The RCTMD5Hash in RCTUtils is using CC_MD5 function which is deprecated. unfortunately we can't really change it or we will break many apps that use it in the AsyncStorage.

Those app wlll have to do a migration to use a different function. Meanwhile we are suppressing the warning

## Changelog
[Internal] - Suppress CC_MD5 warning

Reviewed By: cortinico

Differential Revision: D65424309

fbshipit-source-id: e0258ae68482f6c4a3a865bb52920f87bc5ada21
2024-11-05 02:48:49 -08:00
Ramanpreet Nara
0e7ba9094e Make redboxes resilient to react native preloading (#47391)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47391

React Native can preload before the activity is available.

Preloading will execute the js bundle. If the js bundle throws an error, it'll try to render a redbox.

If the activity isn't available, and hasn't been set on the react instance yet, the redbox will just render nothing.

## Changes
In this diff, just re-try displaying the redbox after the application sets the activity on the react instance (i.e: calls onHostResume(activity)).

Changelog: [Android][Breaking] - Rename DevSupportManagerBase.getCurrentContext() -> getCurrentReactContext()

Reviewed By: mdvacca

Differential Revision: D65352596

fbshipit-source-id: 7750f6ca493fc50405119958e0f2908fc24f1cb4
2024-11-04 18:46:35 -08:00
Ramanpreet Nara
5a6a42c7d0 DevSupportManagerBase: Rename getCurrentContext() -> getCurrentReactContext() (#47390)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47390

getCurrentContext() is very ambiguous.

Changelog: [Android][Breaking] - Make DevSupportManagerBase.getCurrentReactContext() public

Reviewed By: mdvacca

Differential Revision: D65433217

fbshipit-source-id: a739d206de8085fc5b47b2a31c7e94fe6e71852f
2024-11-04 18:46:35 -08:00
David Vacca
fe656be26e Reduce visibility of ReactUnimplementedViewManager to internal (#47396)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47396

Migrate ReactUnimplementedViewManager to internal visibility

verified and there are usages on OSS

changelog: [Android][Breaking] Reduce visibility of ReactUnimplementedViewManager to internal

Reviewed By: cortinico

Differential Revision: D65444514

fbshipit-source-id: 11ff2acc96098bc4e53be7ef3059e4a5c112c43e
2024-11-04 17:46:14 -08:00
Joe Vilches
c9a96715ef Update public API for intrinsic sizing setters (#46939)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46939

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

tsia! opted for one function for each keyword just like auto. This is kinda annoying and not the most sustainable, so maybe it makes more sense to make a new enum here and just add one function

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D64002837

fbshipit-source-id: f15fae9fc0103175e1d85850fc9aa68579989fd3
2024-11-04 16:02:37 -08:00
Joe Vilches
027b8032c2 Modify private apis to set, store, and get intrinsic sizing keywords (#46938)
Summary:
X-link: https://github.com/facebook/yoga/pull/1721

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

The private internals of how we store styles needed to change a bit to support 3 new keyword values. Right now the only other keyword that can be stored is `auto`. As a result there isn't much fancy logic to support storing this and its just stored as a specific type inside of `StyleValueHandle`. There are only 3 bits for types (8 values), so it is not sustainable to just stuff every keyword in there. So the change writes the keyword as a value with a new `keyword` `Type`.

I chose not to put `auto` in there even though it is a keyword since it is a hot path, I did not want to regress perf when I did not need to.

I also make a new `StyleSizeValue` class to store size values - so values for `width`, `height`, etc. This way these new keywords are kept specific to sizes and we will not be able to create, for example, a margin: `max-content`.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D63927512

fbshipit-source-id: 7285469d37ac4b05226183b56275c77f0c06996c
2024-11-04 16:02:37 -08:00
Eli White
35f0e1cca2 Fix CodegenSchema Enum type to not export array (#47324)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47324

I need to reference this type somewhere else, but not an array of the type.

Generally we prefer that all exported types are the object itself, and it used as a member type of arrays when used.

Changelog: [Internal]

Reviewed By: makovkastar

Differential Revision: D65259014

fbshipit-source-id: 35fb5fe03a44bed61ad87337d0fc5c198744c0e9
2024-11-04 12:58:49 -08:00
Eli White
dd472101b7 Add NumberLiteralTypeAnnotation support (#47323)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47323

This change adds support for number literals as a type.

The codegen already has parsing support for these types
```
  +passNumber: (arg: number) => void;
  +passString: (arg: string) => void;
  +passStringLiteral: (arg: 'A String Literal') => void;
```

This change now also supports
```
  +passNumberLiteral: (arg: 4) => void;
```

On the native side this is treated the same as `number`. It could be strengthened in the future.

This is a pre-requisite for number literal unions and enums.

Changelog: [Added] Codegen: Added support for Number literals in native module specs

Reviewed By: makovkastar

Differential Revision: D65249334

fbshipit-source-id: 98b051d2a6bd1ad5cc6473ac88acfcbe82bd5c7d
2024-11-04 12:58:49 -08:00
Nicola Corti
623d481991 Make ReactDebugOverlayTags, DebugOverlayTags, Printer, PrinterHolder, NoopPrinter internal
Summary:
Those 2 classes are not supposed to be exposed externally, so I'm making them internal.
The were never part of the public API so I'm not marking this commit as [BREAKING]

Changelog:
[Android] [Changed] - Make ReactDebugOverlayTags, DebugOverlayTags, Printer, PrinterHolder, NoopPrinter internal

Reviewed By: fabriziocucci

Differential Revision: D65420257

fbshipit-source-id: b870274e84d9c3202b9f21360c29eeb995a8d52b
2024-11-04 12:20:50 -08:00
Nicola Corti
cba1d4bae7 Stable API - Make InteropModuleRegistry internal (#47374)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47374

I've converted this class to Kotlin + made it `internal` as it should not be exposed publicly.
This class is part of the iterop layer for the New Architecture.
Marked as breaking but I expect no meaningful breakages here.

Changelog:
[Android] [Breaking] - Stable API - Make InteropModuleRegistry internal

Reviewed By: javache

Differential Revision: D65421965

fbshipit-source-id: 207be5379ebe3a31530cfea75b4623787f5ae7cf
2024-11-04 11:01:46 -08:00
zhongwuzw
44f2a08371 Add png extension only if file exist when load local image (#46971)
Summary:
FIxes https://github.com/facebook/react-native/issues/46870.

To avoid many breaking changes, I modified the logic to add the PNG extension only if the file exists.

## Changelog:

[IOS] [FIXED] - Add png extension only if file exist when load local image

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

Test Plan: Demo in https://github.com/facebook/react-native/issues/46870 .

Reviewed By: blakef

Differential Revision: D65276409

Pulled By: cipolleschi

fbshipit-source-id: 9e03a36b229f7c336632b5b76a92d9f749c59835
2024-11-04 10:26:55 -08:00
Nicola Corti
d7550293a2 Stable API - Make ReactDevToolsSettingsManagerModule and ReactDevToolsRuntimeSettingsModule internal (#47373)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47373

Users should not depend on `ReactDevToolsSettingsManagerModule` directly hence I'm making it internal.
I expect to breakages in OSS as there no usages at all:
https://github.com/search?type=code&q=NOT+is%3Afork+NOT+org%3Afacebook+com.facebook.react.modules.reactdevtoolssettings.ReactDevToolsSettingsManagerModule
https://github.com/search?type=code&q=NOT+is%3Afork+NOT+org%3Afacebook+com.facebook.react.modules.devtoolsruntimesettings.ReactDevToolsRuntimeSettingsModule

Changelog:
[Android] [Breaking] - Stable API - Make ReactDevToolsSettingsManagerModule and ReactDevToolsRuntimeSettingsModule internal

Reviewed By: javache

Differential Revision: D65421030

fbshipit-source-id: e9d701af6cde25133f7b3ff9b07b678a7710852c
2024-11-04 10:26:47 -08:00
oddlyspaced
cc1d2853fb feat(Android): add support for invert colors check on android accessibility (#47341)
Summary:
This PR provides a fix for the long existing issue of missing check for invert color in accessibility options on Android.
Reference Issue : https://github.com/facebook/react-native/issues/30870

## Changelog:
- Added native module code to check for invert color settings value
- Updated js module to return a proper promise instead of default false for isInvertColorsEnabled()

Pick one each for the category and type tags:

[ANDROID] [FIXED] - Missing isInvertColorsEnabled implementation for Android

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

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

Test Plan: Tested on OnePlus 12 with Android 14 and Pixel 6 with Android 15. The try catch exists because in some cases if the switch hasn't been toggled before the android system raises the missing settings exception.

Reviewed By: cortinico, fabriziocucci

Differential Revision: D65419632

Pulled By: javache

fbshipit-source-id: ddb103445a9d0f318e52ba9d23750140ce5a7ed0
2024-11-04 10:06:10 -08:00
Mateo Guzmán
dc9db01665 feat(image): [android] adding only-if-cached cache control option (#47348)
Summary:
Following up from https://github.com/facebook/react-native/issues/47182, as basic caching control is already in place in Android, it can be extended to include the `only-if-cached` option.

We check whether the image is in the cache. If it is, we proceed to load it. Otherwise, we do nothing.

## Changelog:

[ANDROID] [ADDED] - Image `only-if-cached` cache control option

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

Test Plan:
In the `rn-tester`, I added a third example for Android where the third image will never be loaded as the cache policy is set to `only-if-cached` and the image has not been loaded before.

<details>
<summary>Video demonstrating how the `only-if-cached` options behaves</summary>

https://github.com/user-attachments/assets/45669e81-5414-4103-8931-138bffa81447

</details>

<details>
<summary>Error from image not found in cache example</summary>

<img width="807" alt="image" src="https://github.com/user-attachments/assets/6b79d811-1809-437c-b2fe-c86d3da7c58d">

</details>

Reviewed By: rshest

Differential Revision: D65384639

Pulled By: Abbondanzo

fbshipit-source-id: f4a72694f45eb3d7097c350f4a4008a0abf0a1ab
2024-11-04 08:37:59 -08:00
Samuel Susla
91df5a4a0f surface setup issues in EventBeat and Scheduler (#47355)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47355

changelog: [internal]

Reviewed By: rshest

Differential Revision: D65333695

fbshipit-source-id: 854dbc3ae52db0093961cbeb81f1f96934eca40d
2024-11-04 08:15:12 -08:00
Parsa Nasirimehr
4da586ead9 chore(Android): Migrate DebugOverlayTag and ReactDebugOverlayTag to Kotlin (#47362)
Summary:
I believe these two were the last items under `com.facebook.debug` that were still Java.

I thought about making DebugOverlayTag a Data class, but i will leave it up to the reviewer to decide if it would be needed or not.

## Changelog:

[INTERNAL] [FIXED] - Migrate DebugOverlayTag and ReactDebugOverlayTag to Kotlin

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

Test Plan:
`./gradlew test`:
<img width="1265" alt="Screenshot 2024-11-02 at 18 45 45" src="https://github.com/user-attachments/assets/405e77bc-1287-4329-b230-9f46eadb3580">

Reviewed By: javache

Differential Revision: D65417984

Pulled By: cortinico

fbshipit-source-id: e39224e40bde281498fdbed1609a03b264967396
2024-11-04 06:57:47 -08:00
Marc Rousavy
de3c1ee097 feat: Trigger Java GC on reload (#43813)
Summary:
While we (Margelo) were developing a new C++ 3D library for react-native, we noticed that Java often keeps a lot of dead instances in memory, making it hard to debug memory allocations (or actually _de_-allocations), especially since we use `jsi::HostObject` and `jni::HybridClass` in conjunction. Having two garbage-collected languages retain an object is a bit tricky, and making sure that we aren't doing anything wrong with our allocations and references was not easy - but manually calling `System.gc()` on app reloads helped us see that much better.

Before this, we needed to wait multiple minutes until some Java objects are actually freed from the GC. Our use-case was a `facebook::jni::HybridClass`, which was held strong in a `facebook::jsi::HostObject` (so again, two GC'd languages).

There _should_ be no change in behaviour with this PR, just two things to note:

1. Memory might be free'd more eagerly in full reloads (dev builds) - makes sense for library developers, especially when working with C++ modules.
2. `System.gc()` only _suggests_ garbage collection, it does not _force_ it. But when it runs, it might impact performance, although we haven't noticed any impact of that at all. The garbage collector runs anyways - better during a reload than later when exceuting the app normally.

## 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] [ADDED] - Trigger Java GC on app reload

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

Test Plan:
Open an app, create a Java module that holds a few objects, add `finalize()` methods to those objects and log their deletion.

Reload the app to see the logs, compare before vs after.

Reviewed By: rshest

Differential Revision: D65418163

Pulled By: javache

fbshipit-source-id: 7597548790577dfc542b57f59578ae48df543b14
2024-11-04 06:53:07 -08:00
Nicola Corti
e1a1cead43 AGP to 8.7.2 (#47369)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47369

This just bumps the AGP patch version to the latest stable.

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

Reviewed By: tdn120

Differential Revision: D65336357

fbshipit-source-id: 9a7464304ba29f6b752f41b252bde9cb0eca0e9a
2024-11-04 05:57:22 -08:00
Peter Abbondanzo
7211119d23 Add cache control check to multisource (#47357)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47357

`MultiSourceHelper` should not yield an `ImageSource` that has its cache control policy set to `RELOAD`. This change skips such sources when computing the bestCached item (but not best item)

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D65337414

fbshipit-source-id: bdd0d55f4a65128b141a1c7a132dba085232fa11
2024-11-01 15:26:58 -07:00
Chi Tsai
6ab7b70241 Add utf16 method to JSI (#47356)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47356

Add utf16 method to JSI. This change will add the default implementation
for all VMs by calling UTF8 and manually convert it to UTF16. A later
change will be added for Hermes to use internal VM information to get
the UTF16 string.

Changelog: [Internal]

Reviewed By: neildhar

Differential Revision: D64918244

fbshipit-source-id: 6fc0c44fc397c2f8bb40a4262596b178ee4f1f29
2024-11-01 13:52:46 -07:00
zhongwuzw
af384a914a FIxes CornerRadiiAreEqualAndSymmetrical error when check topLeftHorizontal == topLeftVertical (#47338)
Summary:
FIxes CornerRadiiAreEqualAndSymmetrical error when check topLeftHorizontal == topLeftVertical cc. jorge-cab

## Changelog:

[IOS] [FIXED] - FIxes CornerRadiiAreEqualAndSymmetrical error when check topLeftHorizontal == topLeftVertical

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

Test Plan: N/A

Reviewed By: jorge-cab

Differential Revision: D65281958

Pulled By: cipolleschi

fbshipit-source-id: f79fced7282bf75201d9dc99c82eeaddade0d314
2024-11-01 08:12:29 -07:00
Mateo Guzmán
566d30f88a fix(rn-tester): playground description not visible in dark mode (#47346)
Summary:
The informational description in the `RNTesterPlayground` is not visible in dark mode. To address this, the `RNTesterText`, which takes into account the theme, is used.

## Changelog:

[INTERNAL] [FIXED] -  `RNTesterPlayground` description not visible in dark mode

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

Test Plan:
| Before  | After |
  | ---------- | ---------- |
  | ![Screenshot_1730414376](https://github.com/user-attachments/assets/a42e1a99-de61-41b5-b677-ea3e2b4956fc) | ![Screenshot_1730414393](https://github.com/user-attachments/assets/885ed334-8277-4ba8-a033-477b9afef7b6) |

Reviewed By: cortinico

Differential Revision: D65319138

Pulled By: Abbondanzo

fbshipit-source-id: ff541be9705fb799cc4aa3624a9e2966a76a0f8d
2024-11-01 07:36:05 -07:00
Alex Hunt
4afc47a588 Revert to @babel/eslint-parser in eslint-config (#47333)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47333

Motivated by https://github.com/facebook/hermes/issues/1549. This was originally changed in https://github.com/facebook/react-native/pull/46696, as our internal Flow support had diverged from `babel/eslint-parser` (https://github.com/facebook/react-native/issues/46601).

We effectively have three flavours of JavaScript in support:
- Flow@latest for the `react-native` package, shipped as source — uses `hermes-parser`.
- TypeScript for product code (community template, Expo) — uses `babel/plugin-syntax-typescript`.
- Plain JavaScript or Flow in product code, *which may be extended with additional user Babel plugins and needs lenient parsing* — uses `babel/plugin-syntax-flow` via `babel/eslint-parser` (**this change**).

I'd love to simplify this 😅.

Switching to `hermes-eslint` for the RN monorepo codebase (D63541483) is unchanged.

Changelog: [Internal]

Reviewed By: robhogan, cipolleschi

Differential Revision: D65272156

fbshipit-source-id: 3a2bbe3fcf8ed6057f6d994a0be4985e6bf46fa9
2024-11-01 05:31:37 -07:00
Alan Lee
2cd48ef351 fix Modal content being cut off when Android Activity is edge-to-edge (#47339)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47339

Fixing issue raised in https://github.com/facebook/react-native/issues/47307

This is a follow up from D62286026.
It appears there was a line that went missing while trying to refactor the code.

`fitsSystemWindows = true` is needeod for < API 30 to avoid content rendering under the system bars when Modal is shown with Activity that is edge-to-edge.

Changelog:
[Android][Fixed] Fix Regression - Modal content rendering below system bar on < API 30 when activity is edge-to-edge

Reviewed By: cortinico

Differential Revision: D65280014

fbshipit-source-id: 616ff739be55635f1295ef3bf8b997a27ef769ae
2024-11-01 01:27:40 -07:00
Alan Lee
65cdd5b82c Enable 16KB page size binaries for RN libraries + hermes (#47042)
Summary:
X-link: https://github.com/facebook/hermes/pull/1557

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

Add native build flags to support 16KB page size

- https://developer.android.com/guide/practices/page-sizes#compile-r27-higher

Changelog:
[Android][Added] add cmake arguments to support 16KB page size for native libraries

Reviewed By: cortinico

Differential Revision: D64446876

fbshipit-source-id: 5c6b7874a8837c7ebc9b3e9267ce11fb152bf535
2024-10-31 18:45:31 -07:00
Samuel Susla
66a2f1d312 Back out "delete redundant EventEmitter::dispatchEvent overload" (#47347)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47347

changelog: [internal]

Original commit changeset: cffdc3ef0424

Original Phabricator Diff: D65040505

Reviewed By: lunaleaps

Differential Revision: D65305763

fbshipit-source-id: 4c9e4b4acd9c5f9530af428402b106272a4e0054
2024-10-31 18:42:07 -07:00
Nolan O'Brien
79d55542aa Move FBHashKit to LayerZero/METAHash (#47343)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47343

Moving `FBHashKit` to *LayerZero* as `METAHash`

## Changelog

[Internal][Change] Move `FBXXHashUtils`

Reviewed By: adamjernst

Differential Revision: D65256846

fbshipit-source-id: 6e24a78925367e83e94e7c67a235cda924edd28e
2024-10-31 18:01:57 -07:00
Nolan O'Brien
f8fc90e754 Modernize in preparation for move to Layer Zero (#47342)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47342

There are things we can do to modernize `FBHashKit` to make it ready for prime time, aka Layer Zero.

  * Consolidate down to a singular `meta_hash(...)` generic macro (supports all primitives for hashing)
  * Eliminate the unnecessary C++
  * Deprecate legacy FB APIs
  * Make logic (and interfaces) explicit for 32 vs 64 bit inputs and 32 vs 64 bit outputs
  * Introduce robust unit tests
  * Have unit tests actually testable for 32-bit hashes

## Changelog

[Internal][Change] Prep to move `FBXXHashUtils`

Reviewed By: cipolleschi

Differential Revision: D65245787

fbshipit-source-id: 311404068fd9df2a77d1ae4850b8a785466e73f0
2024-10-31 18:01:57 -07:00
Parsa Nasirimehr
ec4ead59e1 fix(iOS): small test fix for RCTViewTests (#47314)
Summary:
Depracated usage of scrollInsets + an unused param.

## Changelog:

[INTERNAL] [FIXED] - Switch to verticalScrollIndicatorInsets and mark unused value as __unused in test file

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

Test Plan:
Running the specific test itself, it passes:
<img width="1092" alt="Screenshot 2024-10-30 at 18 02 08" src="https://github.com/user-attachments/assets/e3ed27c6-9f00-4777-a72c-92f0da93a79f">

Reviewed By: NickGerleman

Differential Revision: D65231365

Pulled By: philIip

fbshipit-source-id: eed795ad65bd837fb9f38175081d961245ff3932
2024-10-31 16:24:41 -07:00
Jakub Piasecki
fd273f83e0 Add RNTester examples for display: contents (#47201)
Summary:
Adds a page dedicated to `display: contents` to RNTester APIs section. Those can be used to verify that it's working correctly visually.

Needs https://github.com/facebook/react-native/pull/47194

## Changelog:

[INTERNAL] [ADDED] - Added `display: contents` examples to RNTester

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

Test Plan:
Row styles are ignored in new arch and TextInputs as leaf are hidden

https://www.internalfb.com/compare-screenshots-from-diff/D65248256

Reviewed By: javache

Differential Revision: D65248256

Pulled By: NickGerleman

fbshipit-source-id: 90410e1380e4cdb22cb4cac5c8c21e08a088ce69
2024-10-31 16:12:46 -07:00
Nicola Corti
ecd138e267 Enable warningAsErrors for hermes-engine (#47320)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47320

I've solved all the warnings on ReactAndroid/hermes-engine.
This enables warningsAsErrors for that part of the codebase so we can make sure
no further warnings get introduced.

Changelog:
[Internal] [Changed] - Enable warningAsErrors for hermes-engine

Reviewed By: NickGerleman

Differential Revision: D65243753

fbshipit-source-id: 17c22d1a7a32d2c684d7f236f7554f6e26469e99
2024-10-31 15:05:12 -07:00
Sam Zhou
b91a449e7f Cleanup problematic React.ElementRef (#47340)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47340

This diff cleans up some problematic `React.ElementRef<T>` when T is generic type.

Changelog: [Internal]

Reviewed By: alexmckenley

Differential Revision: D65280467

fbshipit-source-id: 71172b16320a10cbc7a8b46dae5d3dd0eb00ba0c
2024-10-31 13:30:17 -07:00
Pieter De Baets
6ba7cb3102 Fix potential race in FabricMountingManager (#47337)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47337

We call `onSurfaceStart` after calling `surfaceHandler.start()`. In theory it's possible for the React surface to start generating commits before we've informed the mounting manager of the surface having started, which could cause us to not accurately track views allocated for that surface so far.

Changelog: [Android][Fixed] Addressed race condition in surface start.

Reviewed By: rshest

Differential Revision: D65269674

fbshipit-source-id: 2927220bc17e61125dabcdd75f5325a0ca77e60b
2024-10-31 12:33:13 -07:00
Mateo Guzmán
e5dd7d68bf feat(image): enabling basic cache control for android (#47182)
Summary:
Fixes https://github.com/facebook/react-native/issues/12606

Previously, `Image` cache control options were not functional on Android, even though they were being passed to the native component via the `source` prop. This PR addresses that by implementing logic to manage cache behaviour on Android.

When the `reload` option is explicitly set, the image is now evicted from both memory and disk caches before a new request is made. This ensures the image is always fetched from the source, aligning the caching behaviour between Android and iOS for the `default` and `reload` options.

## Changelog:

[ANDROID][ADDED] - Enabling basic `Image` cache control for Android

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

Test Plan:
Added a new example to the `rn-tester`, where we can notice that the image on the right is reloaded if rendered or re-rendered as the cache policy is set to `reload`. The image on the left has the cache policy set to `default` and won't be re-rendered as the image is already in the cache.  See the video below:

https://github.com/user-attachments/assets/88bc1d2d-0239-4deb-bcde-fe0ce521ff4d

Also tested on both old and new architecture.

Reviewed By: NickGerleman

Differential Revision: D64915440

Pulled By: Abbondanzo

fbshipit-source-id: 32e1c55dd20bf96ab0f69ef900d821c3c2552ef7
2024-10-31 09:07:40 -07:00
Samuel Susla
a12036f7be delete redundant EventEmitter::dispatchEvent overload (#47231)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47231

changelog: [internal]

`EventEmitter::dispatchEvent` and `EventEmitter::dispatchUniqueEvent` that were accepting shared_ptr are not needed. Their functionality is covered by other methods. Let's get rid of them to keep the API of EventEmitter slim.

Reviewed By: rubennorte

Differential Revision: D65040505

fbshipit-source-id: cffdc3ef042418178c5e2e5714779dfd0b61455e
2024-10-31 08:15:21 -07:00
Pieter De Baets
3e46cb384c Downgrade fatal error in FabricMountingManager (#47329)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47329

Downgrading from fatal (introduced in D63148523). It's not yet clear why this is firing, and may point at deeper underlying issues, as the re-ordering we do in `disableMountItemReorderingAndroid` only occurs at a later point in `FabricMountingManager`.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D65267936

fbshipit-source-id: cb32b149a77c9e5a3ac6350baaeae9c7215df01b
2024-10-31 06:47:13 -07:00
HyunWoo Lee
667ba76aef Click basic button & scroll down until item 600 is visible (#46804)
Summary:
This pr is part of issue https://github.com/facebook/react-native/issues/46757 solving a task - [ME2E0008] [ME2E0009]

- Set up a test
  - Starts the app
  - Scrolls until flatlist is visilbe and clicks on flatlist
  - Click basic button
  - Scroll down until item 600 is visible

## Changelog:

[Internal] [Added] - Add e2e-test logic that click button & scroll down until specific item is visible

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

Test Plan:
### Test Locally

- iOS

```bash
yarn install
cd packages/rn-tester
yarn e2e-build-ios
```

- Android

```bash
yarn install
cd packages/rn-tester
yarn e2e-build-android
```

### Start Maestro

- iOS

```bash
 cd packages/rn-tester
 yarn e2e-test-ios
```

- Android

```
cd packages/rn-tester
yarn e2e-test-android
```

### Test in CI

To test in CI, just add a comment on your PR with the text:

```
/test-e2e
```

Reviewed By: cortinico

Differential Revision: D63829274

Pulled By: cipolleschi

fbshipit-source-id: f7b4342ed353a48123f87dcfd8d503009f65637c
2024-10-31 04:33:13 -07:00
hexboy
9a3958a619 fix(Android, iOS): Fix AnsiHighlight Style in RTL Layout (#47230)
Summary:
This pull request fixes a style bug in the AnsiHighlight component when the application is in Right-To-Left (RTL) mode. The adjustments ensure that text highlighting is visually consistent and functions properly across all layout modes.

### Before
| Android RTL | iOS RTL | Android LTR | iOS LTR |
|----------|----------|----------|----------|
|  ![Before-RTL-Android](https://github.com/user-attachments/assets/059e30e7-f6da-4a07-9c91-08d952c6a4b6) | ![Before-RTL-iOS](https://github.com/user-attachments/assets/a325c838-1510-4415-bd1f-c419ce75e7e2) | ![Before-LTR-Android](https://github.com/user-attachments/assets/26494fb1-71dd-4fae-a75c-381eead211de)  | ![Before-LTR-iOS](https://github.com/user-attachments/assets/72bba2d8-f70f-4e16-b771-4af995370d26) |

### After
| Android RTL | iOS RTL | Android LTR | iOS LTR |
|----------|----------|----------|----------|
| ![After-RTL-Android](https://github.com/user-attachments/assets/d2f674c2-7aec-454f-903a-33fcd3e93240) | ![After-RTL-iOS](https://github.com/user-attachments/assets/e3735e79-7323-48e8-8213-f0871bec0ca5) | ![After-LTR-Android](https://github.com/user-attachments/assets/18c80754-8743-4282-8f95-1e9772d51a36) | ![After-LTR-iOS](https://github.com/user-attachments/assets/068f4bd8-df4e-420b-8949-c20dff9c2bc8) |

## Changelog:
[GENERAL] [Fixed] - AnsiHighlight style in RTL layout

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

Test Plan:
To test the changes, open LogBox while the app is in RTL mode. The modifications ensure that any error messages display correctly. I have verified that the changes function properly in both LTR and RTL modes, and all existing functionality remains unaffected.

This is an example component to throw an error to show LogBox.

```tsx
import React from 'react';
import {Alert, Button, I18nManager, StyleSheet, Text, View} from 'react-native';

function SampleError() {
  return (
    <View>
      <Button
        title="Change to RTL"
        onPress={() => {
          I18nManager.allowRTL(true);
          I18nManager.forceRTL(true);
          Alert.alert('Restart app to apply changes');
        }}
      />
      <Button
        title="Change to LTR"
        onPress={() => {
          I18nManager.allowRTL(false);
          I18nManager.forceRTL(false);
          Alert.alert('Restart app to apply changes');
        }}
      />

      <Text style={styles.text}>
        isRTL: {I18nManager.isRTL ? 'true' : 'false'}
      </Text>

      <Button
        title="Show Error"
        onPress={() => {
          console.error('sample خطا');
        }}
      />
    </View>
  );
}

const styles = StyleSheet.create({
  text: {
    fontSize: 24,
    textAlign: 'center',
    paddingVertical: 20,
  },
});

export default SampleError;
```

Reviewed By: sammy-SC

Differential Revision: D65145991

Pulled By: NickGerleman

fbshipit-source-id: cbca106813e587ed223be48b75ee5279072c2da0
2024-10-31 01:32:39 -07:00
Phillip Pan
4d90f84869 clean up unused callsites to contextContainer->at (#47322)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47322

Changelog: [Internal]

these callsites were causing crashes in new bridgeless integrations, it appears they are not used, so cleaning up. after this, we can remove all callsites that insert ReactNativeConfig to the contextContainer.

Reviewed By: javache

Differential Revision: D65191733

fbshipit-source-id: 94e694ef27249773c2a39bd77f316f8f5cc2b1fb
2024-10-31 00:56:21 -07:00
Phillip Pan
3a68f14ac2 cleanup enabled_automatic_interop_android (#47321)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47321

Changelog: [Internal]

this seems to be the last callsite where we read the ReactNativeConfig from the contextContainer. i don't think this killswitch should block cleanup of the ReactNativeConfig, so maybe we can just remove this?

Reviewed By: cortinico

Differential Revision: D65192744

fbshipit-source-id: d8b595edb6fecce05e67abc257d98805daa16a9a
2024-10-31 00:56:21 -07:00
Nolan O'Brien
b98846c2e3 Fix up designated initializers 8/x (#47316)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47316

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

In preparation of enabling `-Wobjc-designated-initializers` error

## Changelog:

[iOS][Fixed] - Fix numerous class interfaces having incorrect designated initializer patterns

Reviewed By: caodoan

Differential Revision: D65180118

fbshipit-source-id: 6f977816ede0397225ec681a5357241c28e83f6c
2024-10-30 21:08:32 -07:00
Nolan O'Brien
13b93cfdda Remove implicit "start", then clean up callsites (#47313)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47313

We're going to fix up a bunch of designated initializers.  `RCTSurfaceHostingProxyRootView` is particularly problematic because different initializers will do different things even though reading the code it looks like they should be equivalent.  Remove the encapsulated "start" to the provided "surface", and require it to be explicit at the callsite.

## Changelog:

[iOS][Changed] - `RCTSurfaceHostingProxyRootView` no longer has different behavior (whether it calls `start` on the provided *surface*) depending on which initializer is used.  Call `start` yourself on the *surface* instead.

Reviewed By: cipolleschi

Differential Revision: D65214656

fbshipit-source-id: 179d5220d4f866b4452561e1bb6e2051020c8a11
2024-10-30 21:08:32 -07:00
Sam Zhou
3a01a0c9c5 Fix signature of VirtualizedSectionList (#47318)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47318

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D65239931

fbshipit-source-id: c09eaad8d63f6c415e5d07a4d00dd0acc636c6b9
2024-10-30 18:15:03 -07:00
David Vacca
d79dc48abd Delete RCTConstants.RCTGetMemoryPressureUnloadLevel (#47297)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47297

In this diff I'm proposing to remove configuration for RCTConstants.RCTGetMemoryPressureUnloadLevel API in iOS

changelog: [iOS][Breaking] Delete experimental API RCTConstants.RCTGetMemoryPressureUnloadLevel

Reviewed By: rubennorte, philIip

Differential Revision: D65181556

fbshipit-source-id: c435bec6ed03562b53f1924add7b69ab517b190b
2024-10-30 13:32:04 -07:00
Samuel Susla
8bd1f3fbfa Back out "surface setup issues in EventBeat and Scheduler" (#47312)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47312

changelog: [internal]

Original commit changeset: 5e044e1e6b02

Original Phabricator Diff: D65001802

Reviewed By: rshest

Differential Revision: D65210838

fbshipit-source-id: 90d9db256374f32d2efc366fe120bf677639e67e
2024-10-30 12:06:27 -07:00
zhongwuzw
2d9933e616 automaticallyAdjustKeyboardInsets not shifting scrollview content (#46732)
Summary:
Fixes https://github.com/facebook/react-native/issues/46595 . It seems https://github.com/facebook/react-native/issues/37766 broke the `automaticallyAdjustKeyboardInsets` when input accessory view become first responder.

## Changelog:

[IOS] [FIXED] - automaticallyAdjustKeyboardInsets not shifting scrollview content

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

Test Plan: Repro please see in #https://github.com/facebook/react-native/issues/46595 .

Reviewed By: cipolleschi

Differential Revision: D65072478

Pulled By: javache

fbshipit-source-id: 7d5d7566438d4bb0e1d50074a953b18866e324d3
2024-10-30 12:01:10 -07:00
Oskar Kwaśniewski
ec0dbb729d feat: introduce RCTArchConfiguratorProtocol (#47306)
Summary:
This PR introduces `RCTArchConfiguratorProtocol` for better separation of concerns inside of RCTAppDelegate.

It's also a prerequisite for https://github.com/facebook/react-native/issues/46298

Discussed with cipolleschi

## Changelog:

[IOS] [ADDED] - introduce RCTArchConfiguratorProtocol

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

Test Plan:
- CI Green
- Test if methods can be overriden

Reviewed By: realsoelynn

Differential Revision: D65212703

Pulled By: cipolleschi

fbshipit-source-id: 9850fec31c421f0c6230e7e23d7a208d823d828f
2024-10-30 11:24:19 -07:00
Nicola Corti
50e38cc9f1 Bump serve-static to 1.16.2 to fix CVE-2024-43800 (#47289)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47289

Bump serve-static to 1.16.2 to fix CVE-2024-43800

Changelog:
[General] [Changed] - Bump serve-static to 1.16.2 to fix CVE-2024-43800

Reviewed By: cipolleschi

Differential Revision: D65146027

fbshipit-source-id: 2876a78f195230cc4cdaa14b0076ecbecc1ee6e4
2024-10-30 09:08:55 -07:00
Samuel Susla
a85955a446 resume image download if previously cancelled (#47302)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47302

changelog: [internal]

The original cancellation logic cancelled image request when RCTImageComponentView was recycled but the image request was never resumed.

So in case the request was cancelled and later the same shadow node representing the image view was showed, the image request was never fulfilled and it stayed blank. It entered invalid state from where it would never recover. The image would go from state: Loading -> Cancelled and Cancelled is terminal state.

This diff adds a "resume" mechanism. If image goes from Loading -> Cancelled and something subscribes to the image state, the image request will be started again.
So we can go from Loading -> Cancelled -> Loading -> Completed.
This diff also moves the resume/cancel mechanism to ImageResponseObserverCoordinator. Where we can observe if anything is observing result of the image response.

Even though this case was highly unlikely, with <Activity /> component in React Native, it may occur.

Reviewed By: lyahdav

Differential Revision: D65149804

fbshipit-source-id: d59c1793785a367bb92602f6438666fa53db4ceb
2024-10-30 06:01:03 -07:00
qy
758892a7d8 bugfix(image): add ts definition of resizeMethod attribute. (#47227)
Summary:
in the `image component`, add the ts definition with the `resizeMethod` attribute value as `none`.

## Changelog:

[Android][Fixed] - the definition of ts of resizeMethod attribute is none.

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

Test Plan: <img width="579" alt="image" src="https://github.com/user-attachments/assets/e91dc47a-22c4-4d47-a4c2-6497d47cb842">

Reviewed By: javache

Differential Revision: D65058737

Pulled By: Abbondanzo

fbshipit-source-id: a077e4e4786a72ebffaf0698217809b1e7fde226
2024-10-30 05:06:18 -07:00
Rubén Norte
1108b4d97b Clean up API of PerformanceMark and PerformanceMeasure (#47241)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47241

Changelog: [internal]

The options for the internal constructor of `PerformanceMeasure` shouldn't be optional. This just cleans that up.

Reviewed By: rshest

Differential Revision: D64480048

fbshipit-source-id: d0275276b11bd329aa2e4667646c67608d562299
2024-10-30 04:58:04 -07:00
Pieter De Baets
0dcbebd285 Fix lint failure in Github CI (#47301)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47301

Lint wasn't reported on diff / seems like our internal linter config is not aligned.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D65201683

fbshipit-source-id: 879e87aafff849f9247cf1d807da092fa17d0337
2024-10-30 04:57:24 -07:00
Oskar Kwaśniewski
8850736188 feat(iOS): introduce RCTUIConfiguratorProtocol (#47139)
Summary:
This PR introduces `RCTUIConfiguratorProtocol` for better separation of concerns inside of RCTAppDelegate.

It's also a prerequisite for https://github.com/facebook/react-native/issues/46298

Discussed with cipolleschi

## Changelog:

[IOS] [ADDED] - introduce RCTUIConfiguratorProtocol

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

Test Plan:
- CI Green
- Test if methods can be overriden

Reviewed By: blakef

Differential Revision: D65063839

Pulled By: cipolleschi

fbshipit-source-id: b63766e245d57f369ab94bd8047d5de9a3447b3e
2024-10-30 04:32:17 -07:00
Nick Gerleman
41265bac6b Reimplement Android lineHeight positioning/determination (#47271)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47271

Let's keep the recent goals of centering (instead of arbitrary prioritizing ascent), ala spec, and make some changes to allow overlapping interior line-boxes, and make the implementation a lot simpler, instead of the cruft it has been accumulating.

The new simple versions is implemented as the only `CustomLineHeightSpan`. This replaces the code used when `enableAndroidLineHeightCentering` is enabled (which is now the default).

Legacy path is renamed to `LegacyLineHeightSpan`, slated to be deleted if rollout goes well.

We cannot yet cause text to overflow the bounds of the underlying TextView until potentially large later work related to ReactTextView reimplementation.

There's a somewhat arbitrary choice here, when rounding, to whether we ceil ascent vs descent when pixels don't evenly split. This does result in a visual difference, and for sake of avoiding breakage of screenshots, I left the same choice as before.

Changelog:
[Android][Fixed] - Reimplement Android lineHeight positioning/determination

Reviewed By: javache

Differential Revision: D64716557

fbshipit-source-id: 5a947377df7cfee9dff4484c840939f527caf94b
2024-10-29 17:53:16 -07:00
Nick Gerleman
7cb9fa9737 Add lineHeight screenshot tests (#47270)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47270

Lets add some screenshot tests, along with one more example, and fixing some silly typos in test IDs.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D65094482

fbshipit-source-id: a5f3e06c4737158bf6419364d05668c3feb1bd5e
2024-10-29 17:53:16 -07:00
Joe Vilches
9f73edee2d Fix issue where text would truncate sometimes (#47294)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47294

TextView will set `setUseLineSpacingFromFallbacks` to `true` for their `StaticLayout`s while we ignore it in this case (`false` default). The docs even recommend setting it to `true`: https://developer.android.com/reference/android/text/StaticLayout.Builder#setUseLineSpacingFromFallbacks(boolean)

We set this in the `StaticLayout` builder below, but not up here so lets do that.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D65171352

fbshipit-source-id: aa7fd116898c6af9378d71c5c570c790e6ab415f
2024-10-29 17:49:41 -07:00
Nick Gerleman
bfca7cfe7a Fix legacy arch RTL horizontal ScrollView regression (#47282)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47282

D63318754 fixed a class of issues with RTL horizontal scrollviews by moving logic from native Android view layer to Fabric ShadowNode layer.

I realized quite a bit later this is problematic for legacy arch, since it now never runs RTL translation code, and all our RTL screenshot tests are against new arch.

It's tricky to port Fabric ShadowNode related code to Paper since its shadownodes are more coupled to Yoga nodes, and the existing solution for contextual layout direction didn't quite work, so I went with the original logic we had for this, where we use global layout direction to determine whether to offset, and disable removeClippedSubviews, and this is applied via onLayout. This is wrong in several ways, but not a regression compared to previous legacy arch behavior. The fully correct behavior will require new arch.

Changelog:
[Android][Fixed] - Fix legacy arch RTL horizontal ScrollView regression

Reviewed By: rshest

Differential Revision: D65139747

fbshipit-source-id: 5662c0744c3c402efe583e602b2272662b4d5476
2024-10-29 16:29:36 -07:00
Nick Gerleman
0df59d4f03 Fix RTL ScrollView position when content smaller than container (#47280)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47280

Noticed in the screenshots of https://github.com/facebook/react-native/pull/47230 that Android's logic of setting scroll content origin to zero, then right aligning scroll offset, won't correctly handle case where content is smaller than scrolling container. We can fix that by only resetting the origin when content overflows container, since we otherwise are not scrollable, and scroll adjustment will not translate.

Changelog:
[Android][Fixed] - Fix RTL ScrollView position when content smaller than container

Reviewed By: rshest

Differential Revision: D65136654

fbshipit-source-id: 2818ff6360cbfac64d7e57bdcbbe8c0a9b4bbb97
2024-10-29 16:29:36 -07:00
Eric Rozell
0d664100bb Avoid null reference exception when fetching ReactRootView in bridgeless (#47284)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47284

If the surface hasn't been set up yet, attempting to fetch the ReactRootView will throw a null reference exception. Since the result is already nullable, it's perhaps better to just return null when the surface has not yet been initialized.

## Changelog

[Android][Fixed] Avoid null reference exception in bridgeless ReactDelegate

Reviewed By: javache

Differential Revision: D65141137

fbshipit-source-id: 9b002b0520a7eeea61767cb8934e9bb8d049fc6a
2024-10-29 15:55:56 -07:00
Eric Rozell
e3f03269c5 Minor typo in ReactHostImpl comment (#47290)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47290

Fixes a comment typo.

## Changelog

[General][Fixed] Fixes typo in ReactHostImpl

Reviewed By: cortinico

Differential Revision: D65149529

fbshipit-source-id: b419241f861ab28b2c4a512b27f33b94e7929b81
2024-10-29 15:18:09 -07:00
Ramanpreet Nara
cc6f75bb75 earlyjs: Integrate c++ pipeline with console.error
Summary:
## Changes
If the c++ pipeline is active:

If someone calls console.error:
- The c++ pipeline will report it as a soft error

If someone reports an error:
- The c++ pipeline will log it via console.error

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D64506069

fbshipit-source-id: 293cd1774f19ee03d7eb61572b7b1f03a47a4756
2024-10-29 14:24:27 -07:00
Ramanpreet Nara
5b53c07329 earlyjs: Integrate c++ pipeline with all ios apps
Summary:
Now, all ios apps will just be integrated with the c++ error reporting pipeline, with zero configuration.

Changelog: [Internal]

Reviewed By: javache, philIip

Differential Revision: D64615457

fbshipit-source-id: db9d98115238d9a42563e39a4780234a9bc3c034
2024-10-29 14:24:27 -07:00
Ramanpreet Nara
eb3977eccf earlyjs: Introduce flag for always available js error handling
Summary:
This diff introduces ReactNativeFeatureFlags.useAlwaysAvailableJSErrorHandling.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D64791786

fbshipit-source-id: 81cf3ed1fc7057638d7d817f1fea5fc371b53646
2024-10-29 14:24:27 -07:00
Dawid
08e8f6adfd fix(Android) drawing additional empty line when 'textAlign' is set to 'justify' (#47122)
Summary:
Fixes https://github.com/facebook/react-native/issues/46908

The `justificationMode` is not set for multiline text without unicode characters with known width on both architectures. This caused the issue of drawing additional empty line at the end of `TextView` because Yoga thought that text takes 5 lines and falsely calculated it's height.

Currently, on the old architecture, the `justificationMode` is set only on text that is not boring (contains unicode characters) with unknown width. I am not sure why is that, so I am opening this as a draft for now as I am still checking if it doesn't break anything.

## 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] [FIXED] - fix generating empty line at the end of multiline text view when `textAlign` is set to `justify`

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

Test Plan: I've tested on both architectures on repro provided in the issue.

Reviewed By: javache

Differential Revision: D65002386

Pulled By: NickGerleman

fbshipit-source-id: 0187956c88e6eb1e637c24e82b3052cc82581a64
2024-10-29 14:22:59 -07:00
Samuel Susla
dacada7750 use move semantics in TouchEventEmitter (#47232)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47232

changelog: [internal]

TouchEventEmitter APIs take ownership of TouchEvent and PointerEvent, the use of const & qualifiers is misleading and may lead it unnecessary copy.

Reviewed By: rubennorte

Differential Revision: D65040506

fbshipit-source-id: 941e2eab6a057e31066751e26387604858f03e51
2024-10-29 13:18:50 -07:00
Phillip Pan
6fc500ee99 hook up useNativeViewConfigsInBridgelessMode feature flag (#47265)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47265

Changelog: [iOS][Breaking]

This was originally landed before as part of the effort to coalesce configurations with the feature flag infra, but got reverted due to a build issue. I'm pretty sure it was just because the legacy configuration methods were not cleaned up from the header (RCTConstants.h). I fixed that here.

Reviewed By: javache

Differential Revision: D65092536

fbshipit-source-id: 5012ba54b0314c487f2ef488c2eb30a3c4133cb5
2024-10-29 12:42:26 -07:00
Hanno J. Gödecke
0fc2e954be add example for dynamic sized text input (#46976)
Summary:
This PR adds an example showcasing a TextInput whose width gets resized dynamically based on the text content width.
This example was added for this PR, which tries to address a flickering bug with dynamic sized TextInputs:

- https://github.com/facebook/react-native/pull/46973

## 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
-->

[INTERNAL] [ADDED] Added dynamic content width TextInput example

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

Test Plan:
Test in RNTester app:

https://github.com/user-attachments/assets/7571b80b-7035-47df-b840-4218ab0802b5

Reviewed By: NickGerleman

Differential Revision: D64271454

Pulled By: arushikesarwani94

fbshipit-source-id: 28fe7bd93891ffe5284340d73e9ee947654f1788
2024-10-29 12:40:09 -07:00
Abdelhafidh Belalia
e8f8ee3c0f Resume frame callback on host resume (#47264)
Summary:
When the app goes into background the frame callback is ignored by setting the `mShouldStop` flag to `true` 3111473d57/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/FabricEventDispatcher.java (L174)
However this flag is never reset even after the app is back on foreground. This made the `AndroidEventBeat` not ticking in as much as expected causing events not being dispatched in time. In our case the `onLayout` was not being dispatched unless we tap on screen invoking a manual tick.

## Changelog:

[ANDROID] [FIXED] - Fix Frame Callback not being called after Host Resume

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

Test Plan:
1. Add log line `__android_log_print(ANDROID_LOG_DEBUG, "s77rt", "AndroidEventBeat::tick");` in `packages/react-native/ReactAndroid/src/main/jni/react/fabric/AndroidEventBeat.cpp` (tick method)
2. Open RN-Tester
3. Verify `AndroidEventBeat::tick` is logged for every frame
4. Put app into background
5. Verify no `AndroidEventBeat::tick` is logged
6. Open app again
7. Verify `AndroidEventBeat::tick` is logged for every frame

| Before | After |
|:------:|:-----:|
|     <video src="https://github.com/user-attachments/assets/9667ed49-3a56-4c30-992f-9e6426f5d08e" />   |     <video src="https://github.com/user-attachments/assets/548ae199-d9a2-497c-bba7-b89c4d684836" />  |
|     <video src="https://github.com/user-attachments/assets/e14851aa-0609-4b36-bf1e-dfd5d2ee8512" />   |     <video src="https://github.com/user-attachments/assets/db5a9fe6-dfc1-4b3c-92b0-359b4b68ac5c" />  |

Reviewed By: NickGerleman

Differential Revision: D65136338

Pulled By: javache

fbshipit-source-id: 0a101be2a7588cbbb5a55ee4d420082f85566c1b
2024-10-29 11:53:02 -07:00
Rubén Norte
e51c32d7cf Improve intersection observer errors when trying to observe nullish targets (#47291)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47291

Changelog: [internal]

Small devx improvement to distinguish problems caused by calling `IntersectionObserver.observe` with null or undefined, vs. other values not supported by the API (like legacy refs).

Differential Revision: D65150750

fbshipit-source-id: b9452ff19d35ccd0dc2d47ee2d5a0e933e0ae180
2024-10-29 11:31:30 -07:00
Alan Lee
97622a5caa RedBoxDialogSurfaceDelegate crash fix (#47249)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47249

- It is likely that Dialog is being dismissed from an invalid state causing an exception
- apply similar changes from D63712422 which is to add try/catch around and ignore the exception as we are dismissing the dialog anyway

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D65066186

fbshipit-source-id: 03ebbc3fec3adf6100e36ea38b43f410d98a5297
2024-10-29 11:19:02 -07:00
Mateo Guzmán
c19fd11ccf fix(examples): fixing XMLHttpRequest file download example (#47152)
Summary:
The `XMLHttpRequest` example with a single file download doesn't seem to be working anymore. The test case is quite old so it seems like something changed in between with the example URLs.

- Changing the URL for the example. Using another file from `filesamples.com` as it's already being used in the chunk file download example as well.
- Adding an `onerror` callback as it was loading infinitely when something went wrong.

## Changelog:

[INTERNAL] [FIXED] - fixing `XMLHttpRequest` file download example

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

Test Plan:
Using the `rn-tester`, see the before and after for comparison

<details>
<summary>Before and after videos</summary>

**Before**:

https://github.com/user-attachments/assets/01f89cd9-0f5e-4ddb-9ff2-c3e053be5413

**After**:

https://github.com/user-attachments/assets/59ef161c-d5ba-43e3-827e-e250cc663276

</details>

Reviewed By: cipolleschi

Differential Revision: D65126952

Pulled By: NickGerleman

fbshipit-source-id: 7a4b2187570fd85d4444bfe63ae7bc77b09af261
2024-10-29 11:18:34 -07:00
Pieter De Baets
7a265d2406 Remove unused __inspectorLog (#47276)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47276

This dates back all the way to D4021502 and is unused by any of our modern debugger tools.

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D65134285

fbshipit-source-id: 44d8bf2553b28558755e9a603b8ddc8f7dd79b20
2024-10-29 10:34:00 -07:00
Nicola Corti
19813642f1 Move com/facebook/react/devsupport/AndroidManifest to Internal (#47279)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47279

This file is used by BUCK only and should have not been exposed in the first place.
Fixes https://github.com/facebook/react-native/issues/47223

Changelog:
[Internal] [Changed] - Move `com/facebook/react/devsupport/AndroidManifest` to Internal

Reviewed By: NickGerleman

Differential Revision: D65136247

fbshipit-source-id: 01f1e3aed55e932e842132312166b786fd39e7ce
2024-10-29 10:25:46 -07:00
Rubén Norte
9792d5e2d1 Quick print of feature flags definitions (#47240)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47240

Changelog: [internal]

Adding a new option for the feature flags script to print the current definitions of feature flags.

```
yarn featureflags --print
```

```
┌────────────────────────────────────────────────────────────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────┬─────────┬──────────────┐
│ (index)                                                    │ Description                                                                                               │ Purpose │ Date added   │
├────────────────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────┼─────────┼──────────────┤
│ commonTestFlag                                             │ 'Common flag for testing. Do NOT modify.'                                                                 │ '🔨'    │ undefined    │
│ commonTestFlagWithoutNativeImplementation                  │ 'Common flag for testing (without native implementation). Do NOT modify.'                                 │ '🔨'    │ undefined    │
│ enableFabricLogs                                           │ 'This feature flag enables logs for Fabric.'                                                              │ '🔨'    │ undefined    │
│ jsOnlyTestFlag                                             │ 'JS-only flag for testing. Do NOT modify.'                                                                │ '🔨'    │ undefined    │
│ traceTurboModulePromiseRejectionsOnAndroid                 │ 'Enables storing js caller stack when creating promise in native module. This is useful in case of Pr...' │ '🔨'    │ undefined    │
│ batchRenderingUpdatesInEventLoop                           │ 'When enabled, the RuntimeScheduler processing the event loop will batch all rendering updates and di...' │ '🚀'    │ undefined    │
│ disableEventLoopOnBridgeless                               │ 'The bridgeless architecture enables the event loop by default. This feature flag allows us to force ...' │ '🚀'    │ undefined    │
│ enableAccessToHostTreeInFabric                             │ 'Enables access to the host tree in Fabric using DOM-compatible APIs.'                                    │ '🚀'    │ undefined    │
│ enableBridgelessArchitecture                               │ 'Feature flag to enable the new bridgeless architecture. Note: Enabling this will force enable the fo...' │ '🚀'    │ undefined    │
│ enableFabricRenderer                                       │ 'Enables the use of the Fabric renderer in the whole app.'                                                │ '🚀'    │ undefined    │
│ enableFabricRendererExclusively                            │ 'When the app is completely migrated to Fabric, set this flag to true to disable parts of Paper infra...' │ '🚀'    │ undefined    │
│ enableLayoutAnimationsOnAndroid                            │ 'When enabled, LayoutAnimations API will animate state changes on Android.'                               │ '🚀'    │ undefined    │
│ enableLayoutAnimationsOnIOS                                │ 'When enabled, LayoutAnimations API will animate state changes on iOS.'                                   │ '🚀'    │ undefined    │
│ enableLongTaskAPI                                          │ 'Enables the reporting of long tasks through `PerformanceObserver`. Only works if the event loop is e...' │ '🚀'    │ undefined    │
│ enableMicrotasks                                           │ 'Enables the use of microtasks in Hermes (scheduling) and RuntimeScheduler (execution).'                  │ '🚀'    │ undefined    │
│ enableReportEventPaintTime                                 │ 'Report paint time inside the Event Timing API implementation (PerformanceObserver).'                     │ '🚀'    │ undefined    │
│ fuseboxEnabledDebug                                        │ 'Flag determining if the React Native DevTools (Fusebox) CDP backend should be enabled in debug build...' │ '🚀'    │ undefined    │
│ fuseboxEnabledRelease                                      │ 'Flag determining if the React Native DevTools (Fusebox) CDP backend should be enabled in release bui...' │ '🚀'    │ undefined    │
│ isLayoutAnimationEnabled                                   │ 'Function used to enable / disabled Layout Animations in React Native.'                                   │ '🚀'    │ undefined    │
│ useFabricInterop                                           │ 'Should this application enable the Fabric Interop Layer for Android? If yes, the application will be...' │ '🚀'    │ undefined    │
│ useModernRuntimeScheduler                                  │ 'When enabled, it uses the modern fork of RuntimeScheduler that allows scheduling tasks with prioriti...' │ '🚀'    │ undefined    │
│ useTurboModules                                            │ 'When enabled, NativeModules will be executed by using the TurboModule system'                            │ '🚀'    │ undefined    │
│ allowRecursiveCommitsWithSynchronousMountOnAndroid         │ 'Adds support for recursively processing commits that mount synchronously (Android only).'                │ '🧪'    │ '2024-05-30' │
│ animatedShouldDebounceQueueFlush                           │ 'Enables an experimental flush-queue debouncing in Animated.js.'                                          │ '🧪'    │ '2024-02-05' │
│ animatedShouldUseSingleOp                                  │ 'Enables an experimental mega-operation for Animated.js that replaces many calls to native with a sin...' │ '🧪'    │ '2024-02-05' │
│ completeReactInstanceCreationOnBgThreadOnAndroid           │ 'Do not wait for a main-thread dispatch to complete init to start executing work on the JS thread on ...' │ '🧪'    │ '2024-07-22' │
│ enableAlignItemsBaselineOnFabricIOS                        │ 'Kill-switch to turn off support for aling-items:baseline on Fabric iOS.'                                 │ '🧪'    │ '2024-07-10' │
│ enableAndroidLineHeightCentering                           │ 'When enabled, custom line height calculation will be centered from top to bottom.'                       │ '🧪'    │ '2024-09-11' │
│ enableAnimatedAllowlist                                    │ 'Enables Animated to skip non-allowlisted props and styles.'                                              │ '🧪'    │ '2024-09-10' │
│ enableAnimatedClearImmediateFix                            │ 'Enables an experimental to use the proper clearIntermediate instead of calling the wrong clearTimeou...' │ '🧪'    │ '2024-09-17' │
│ enableAnimatedPropsMemo                                    │ 'Enables Animated to analyze props to minimize invalidating `AnimatedProps`.'                             │ '🧪'    │ '2024-09-11' │
│ enableCleanTextInputYogaNode                               │ 'Clean yoga node when <TextInput /> does not change.'                                                     │ '🧪'    │ '2024-04-06' │
│ enableCppPropsIteratorSetter                               │ 'Enable prop iterator setter-style construction of Props in C++ (this flag is not used in Java).'         │ '🧪'    │ '2024-09-13' │
│ enableDeletionOfUnmountedViews                             │ 'Deletes views that were pre-allocated but never mounted on the screen.'                                  │ '🧪'    │ '2024-09-13' │
│ enableEagerRootViewAttachment                              │ 'Feature flag to configure eager attachment of the root view/initialisation of the JS code.'              │ '🧪'    │ '2024-07-28' │
│ enableEventEmitterRetentionDuringGesturesOnAndroid         │ 'Enables the retention of EventEmitterWrapper on Android till the touch gesture is over to fix a bug ...' │ '🧪'    │ '2024-08-08' │
│ enableGranularShadowTreeStateReconciliation                │ 'When enabled, the renderer would only fail commits when they propagate state and the last commit tha...' │ '🧪'    │ '2024-05-01' │
│ enableIOSViewClipToPaddingBox                              │ 'iOS Views will clip to their padding box vs border box'                                                  │ '🧪'    │ '2024-08-30' │
│ enableNewBackgroundAndBorderDrawables                      │ 'Use BackgroundDrawable and BorderDrawable instead of CSSBackgroundDrawable'                              │ '🧪'    │ '2024-09-24' │
│ enableOptimisedVirtualizedCells                            │ 'Removing unnecessary rerenders Virtualized cells after any rerenders of Virualized list. Works with ...' │ '🧪'    │ '2024-08-21' │
│ enablePreciseSchedulingForPremountItemsOnAndroid           │ 'Moves execution of pre-mount items to outside the choregrapher in the main thread, so we can estimat...' │ '🧪'    │ '2024-09-19' │
│ enablePropsUpdateReconciliationAndroid                     │ 'When enabled, Android will receive prop updates based on the differences between the last rendered s...' │ '🧪'    │ '2024-07-12' │
│ enableSynchronousStateUpdates                              │ 'Dispatches state updates synchronously in Fabric (e.g.: updates the scroll position in the shadow tr...' │ '🧪'    │ '2024-04-25' │
│ enableTextPreallocationOptimisation                        │ 'Text preallocation optimisation where unnecessary work is removed.'                                      │ '🧪'    │ '2024-09-12' │
│ enableUIConsistency                                        │ 'Ensures that JavaScript always has a consistent view of the state of the UI (e.g.: commits done in o...' │ '🧪'    │ '2024-04-25' │
│ enableViewRecycling                                        │ 'Enables View Recycling. When enabled, individual ViewManagers must still opt-in.'                        │ '🧪'    │ '2024-07-31' │
│ excludeYogaFromRawProps                                    │ 'When enabled, rawProps in Props will not include Yoga specific props.'                                   │ '🧪'    │ '2024-07-22' │
│ fixMappingOfEventPrioritiesBetweenFabricAndReact           │ 'Uses the default event priority instead of the discreet event priority by default when dispatching e...' │ '🧪'    │ '2024-06-18' │
│ fixMountingCoordinatorReportedPendingTransactionsOnAndroid │ 'Fixes a limitation on Android where the mounting coordinator would report there are no pending trans...' │ '🧪'    │ '2024-08-27' │
│ forceBatchingMountItemsOnAndroid                           │ 'Forces the mounting layer on Android to always batch mount items instead of dispatching them immedia...' │ '🧪'    │ '2024-04-10' │
│ initEagerTurboModulesOnNativeModulesQueueAndroid           │ 'Construct modules that requires eager init on the dedicate native modules thread'                        │ '🧪'    │ '2024-07-11' │
│ lazyAnimationCallbacks                                     │ 'Only enqueue Choreographer calls if there is an ongoing animation, instead of enqueueing every frame...' │ '🧪'    │ '2024-05-01' │
│ loadVectorDrawablesOnImages                                │ 'Adds support for loading vector drawable assets in the Image component (only on Android)'                │ '🧪'    │ '2024-07-12' │
│ scheduleAnimatedEndCallbackInMicrotask                     │ 'Changes the completion callback supplied via `Animation#start` to be scheduled in a microtask instea...' │ '🧪'    │ '2024-09-27' │
│ setAndroidLayoutDirection                                  │ 'Propagate layout direction to Android views.'                                                            │ '🧪'    │ '2024-05-17' │
│ shouldSkipStateUpdatesForLoopingAnimations                 │ 'If the animation is within Animated.loop, we do not send state updates to React.'                        │ '🧪'    │ '2024-07-25' │
│ shouldUseAnimatedObjectForTransform                        │ 'Enables use of AnimatedObject for animating transform values.'                                           │ '🧪'    │ '2024-02-05' │
│ shouldUseRemoveClippedSubviewsAsDefaultOnIOS               │ 'removeClippedSubviews prop will be used as the default in FlatList on iOS to match Android'              │ '🧪'    │ '2024-02-05' │
│ shouldUseSetNativePropsInFabric                            │ 'Enables use of setNativeProps in JS driven animations.'                                                  │ '🧪'    │ '2024-03-05' │
│ shouldUseSetNativePropsInNativeAnimationsInFabric          │ 'Enables use of setNativeProps in Native driven animations in Fabric.'                                    │ '🧪'    │ '2024-03-05' │
│ useImmediateExecutorInAndroidBridgeless                    │ 'Invoke callbacks immediately on the ReactInstance rather than going through a background thread for ...' │ '🧪'    │ '2024-06-06' │
│ useInsertionEffectsForAnimations                           │ 'Changes construction of the animation graph to `useInsertionEffect` instead of `useLayoutEffect`.'       │ '🧪'    │ '2024-09-12' │
│ useNativeViewConfigsInBridgelessMode                       │ 'When enabled, the native view configs are used in bridgeless mode.'                                      │ '🧪'    │ '2024-04-03' │
│ useOptimisedViewPreallocationOnAndroid                     │ 'Moves more of the work in view preallocation to the main thread to free up JS thread.'                   │ '🧪'    │ '2024-07-23' │
│ useOptimizedEventBatchingOnAndroid                         │ 'Uses an optimized mechanism for event batching on Android that does not need to wait for a Choreogra...' │ '🧪'    │ '2024-08-29' │
│ useRefsForTextInputState                                   │ 'Enable a variant of TextInput that moves some state to refs to avoid unnecessary re-renders'             │ '🧪'    │ '2024-07-08' │
│ useRuntimeShadowNodeReferenceUpdate                        │ 'When enabled, cloning shadow nodes within react native will update the reference held by the current...' │ '🧪'    │ '2024-06-03' │
│ useTurboModuleInterop                                      │ 'In Bridgeless mode, should legacy NativeModules use the TurboModule system?'                             │ '🧪'    │ '2024-07-28' │
└────────────────────────────────────────────────────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────┴─────────┴──────────────┘
Summary
┌─────────────────┬────────┐
│ (index)         │ Values │
├─────────────────┼────────┤
│ Total           │ 68     │
│ Common          │ 51     │
│ JS Only         │ 17     │
│ Operational     │ 5      │
│ Release         │ 17     │
│ Experimentation │ 46     │
└─────────────────┴────────┘
Done in 1.62s.
```

```
yarn featureflags --print --json
```

```
{"common":{"commonTestFlag":{"defaultValue":false,"metadata":{"description":"Common flag for testing. Do NOT modify.","purpose":"operational"}},"commonTestFlagWithoutNativeImplementation":{"defaultValue":false,"metadata":{"description":"Common flag for testing (without native implementation). Do NOT modify.","purpose":"operational"},"skipNativeAPI":true},"allowRecursiveCommitsWithSynchronousMountOnAndroid":{"defaultValue":false,"metadata":{"dateAdded":"2024-05-30","description":"Adds support for recursively processing commits that mount synchronously (Android only).","purpose":"experimentation"}},"batchRenderingUpdatesInEventLoop":{"defaultValue":false,"metadata":{"description":"When enabled, the RuntimeScheduler processing the event loop will batch all rendering updates and dispatch them together at the end of each iteration of the loop.","purpose":"release"},"skipNativeAPI":true},"completeReactInstanceCreationOnBgThreadOnAndroid":{"defaultValue":false,"metadata":{"dateAdded":"2024-07-22","description":"Do not wait for a main-thread dispatch to complete init to start executing work on the JS thread on Android","purpose":"experimentation"}},"disableEventLoopOnBridgeless":{"defaultValue":false,"metadata":{"description":"The bridgeless architecture enables the event loop by default. This feature flag allows us to force disabling it in specific instances.","purpose":"release"}},"enableAlignItemsBaselineOnFabricIOS":{"defaultValue":true,"metadata":{"dateAdded":"2024-07-10","description":"Kill-switch to turn off support for aling-items:baseline on Fabric iOS.","purpose":"experimentation"}},"enableAndroidLineHeightCentering":{"defaultValue":false,"metadata":{"dateAdded":"2024-09-11","description":"When enabled, custom line height calculation will be centered from top to bottom.","purpose":"experimentation"}},"enableBridgelessArchitecture":{"defaultValue":false,"metadata":{"description":"Feature flag to enable the new bridgeless architecture. Note: Enabling this will force enable the following flags: `useTurboModules` & `enableFabricRenderer.","purpose":"release"}},"enableCleanTextInputYogaNode":{"defaultValue":false,"metadata":{"dateAdded":"2024-04-06","description":"Clean yoga node when <TextInput /> does not change.","purpose":"experimentation"}},"enableCppPropsIteratorSetter":{"defaultValue":false,"metadata":{"dateAdded":"2024-09-13","description":"Enable prop iterator setter-style construction of Props in C++ (this flag is not used in Java).","purpose":"experimentation"}},"enableDeletionOfUnmountedViews":{"defaultValue":false,"metadata":{"dateAdded":"2024-09-13","description":"Deletes views that were pre-allocated but never mounted on the screen.","purpose":"experimentation"}},"enableEagerRootViewAttachment":{"defaultValue":false,"metadata":{"dateAdded":"2024-07-28","description":"Feature flag to configure eager attachment of the root view/initialisation of the JS code.","purpose":"experimentation"}},"enableEventEmitterRetentionDuringGesturesOnAndroid":{"defaultValue":false,"metadata":{"dateAdded":"2024-08-08","description":"Enables the retention of EventEmitterWrapper on Android till the touch gesture is over to fix a bug on pressable (#44610)","purpose":"experimentation"}},"enableFabricLogs":{"defaultValue":false,"metadata":{"description":"This feature flag enables logs for Fabric.","purpose":"operational"}},"enableFabricRenderer":{"defaultValue":false,"metadata":{"description":"Enables the use of the Fabric renderer in the whole app.","purpose":"release"}},"enableFabricRendererExclusively":{"defaultValue":false,"metadata":{"description":"When the app is completely migrated to Fabric, set this flag to true to disable parts of Paper infrastructure that are not needed anymore but consume memory and CPU. Specifically, UIViewOperationQueue and EventDispatcherImpl will no longer work as they will not subscribe to ReactChoreographer for updates.","purpose":"release"}},"enableGranularShadowTreeStateReconciliation":{"defaultValue":false,"metadata":{"dateAdded":"2024-05-01","description":"When enabled, the renderer would only fail commits when they propagate state and the last commit that updated state changed before committing.","purpose":"experimentation"}},"enableIOSViewClipToPaddingBox":{"defaultValue":false,"metadata":{"dateAdded":"2024-08-30","description":"iOS Views will clip to their padding box vs border box","purpose":"experimentation"}},"enableLayoutAnimationsOnAndroid":{"defaultValue":false,"metadata":{"description":"When enabled, LayoutAnimations API will animate state changes on Android.","purpose":"release"}},"enableLayoutAnimationsOnIOS":{"defaultValue":true,"metadata":{"description":"When enabled, LayoutAnimations API will animate state changes on iOS.","purpose":"release"}},"enableLongTaskAPI":{"defaultValue":false,"metadata":{"description":"Enables the reporting of long tasks through `PerformanceObserver`. Only works if the event loop is enabled.","purpose":"release"}},"enableMicrotasks":{"defaultValue":false,"metadata":{"description":"Enables the use of microtasks in Hermes (scheduling) and RuntimeScheduler (execution).","purpose":"release"},"skipNativeAPI":true},"enableNewBackgroundAndBorderDrawables":{"defaultValue":false,"metadata":{"dateAdded":"2024-09-24","description":"Use BackgroundDrawable and BorderDrawable instead of CSSBackgroundDrawable","purpose":"experimentation"}},"enablePreciseSchedulingForPremountItemsOnAndroid":{"defaultValue":false,"metadata":{"dateAdded":"2024-09-19","description":"Moves execution of pre-mount items to outside the choregrapher in the main thread, so we can estimate idle time more precisely (Android only).","purpose":"experimentation"}},"enablePropsUpdateReconciliationAndroid":{"defaultValue":false,"metadata":{"dateAdded":"2024-07-12","description":"When enabled, Android will receive prop updates based on the differences between the last rendered shadow node and the last committed shadow node.","purpose":"experimentation"}},"enableReportEventPaintTime":{"defaultValue":false,"metadata":{"description":"Report paint time inside the Event Timing API implementation (PerformanceObserver).","purpose":"release"}},"enableSynchronousStateUpdates":{"defaultValue":false,"metadata":{"dateAdded":"2024-04-25","description":"Dispatches state updates synchronously in Fabric (e.g.: updates the scroll position in the shadow tree synchronously from the main thread).","purpose":"experimentation"}},"enableTextPreallocationOptimisation":{"defaultValue":false,"metadata":{"dateAdded":"2024-09-12","description":"Text preallocation optimisation where unnecessary work is removed.","purpose":"experimentation"}},"enableUIConsistency":{"defaultValue":false,"metadata":{"dateAdded":"2024-04-25","description":"Ensures that JavaScript always has a consistent view of the state of the UI (e.g.: commits done in other threads are not immediately propagated to JS during its execution).","purpose":"experimentation"}},"enableViewRecycling":{"defaultValue":false,"metadata":{"dateAdded":"2024-07-31","description":"Enables View Recycling. When enabled, individual ViewManagers must still opt-in.","purpose":"experimentation"}},"excludeYogaFromRawProps":{"defaultValue":false,"metadata":{"dateAdded":"2024-07-22","description":"When enabled, rawProps in Props will not include Yoga specific props.","purpose":"experimentation"}},"fixMappingOfEventPrioritiesBetweenFabricAndReact":{"defaultValue":false,"metadata":{"dateAdded":"2024-06-18","description":"Uses the default event priority instead of the discreet event priority by default when dispatching events from Fabric to React.","purpose":"experimentation"}},"fixMountingCoordinatorReportedPendingTransactionsOnAndroid":{"defaultValue":false,"metadata":{"dateAdded":"2024-08-27","description":"Fixes a limitation on Android where the mounting coordinator would report there are no pending transactions but some of them were actually not processed due to the use of the push model.","purpose":"experimentation"}},"forceBatchingMountItemsOnAndroid":{"defaultValue":false,"metadata":{"dateAdded":"2024-04-10","description":"Forces the mounting layer on Android to always batch mount items instead of dispatching them immediately. This might fix some crashes related to synchronous state updates, where some views dispatch state updates during mount.","purpose":"experimentation"}},"fuseboxEnabledDebug":{"defaultValue":true,"metadata":{"description":"Flag determining if the React Native DevTools (Fusebox) CDP backend should be enabled in debug builds. This flag is global and should not be changed across React Host lifetimes.","purpose":"release"}},"fuseboxEnabledRelease":{"defaultValue":false,"metadata":{"description":"Flag determining if the React Native DevTools (Fusebox) CDP backend should be enabled in release builds. This flag is global and should not be changed across React Host lifetimes.","purpose":"release"}},"initEagerTurboModulesOnNativeModulesQueueAndroid":{"defaultValue":false,"metadata":{"dateAdded":"2024-07-11","description":"Construct modules that requires eager init on the dedicate native modules thread","purpose":"experimentation"}},"lazyAnimationCallbacks":{"defaultValue":false,"metadata":{"dateAdded":"2024-05-01","description":"Only enqueue Choreographer calls if there is an ongoing animation, instead of enqueueing every frame.","purpose":"experimentation"}},"loadVectorDrawablesOnImages":{"defaultValue":false,"metadata":{"dateAdded":"2024-07-12","description":"Adds support for loading vector drawable assets in the Image component (only on Android)","purpose":"experimentation"}},"setAndroidLayoutDirection":{"defaultValue":true,"metadata":{"dateAdded":"2024-05-17","description":"Propagate layout direction to Android views.","purpose":"experimentation"}},"traceTurboModulePromiseRejectionsOnAndroid":{"defaultValue":false,"metadata":{"description":"Enables storing js caller stack when creating promise in native module. This is useful in case of Promise rejection and tracing the cause.","purpose":"operational"}},"useFabricInterop":{"defaultValue":false,"metadata":{"description":"Should this application enable the Fabric Interop Layer for Android? If yes, the application will behave so that it can accept non-Fabric components and render them on Fabric. This toggle is controlling extra logic such as custom event dispatching that are needed for the Fabric Interop Layer to work correctly.","purpose":"release"}},"useImmediateExecutorInAndroidBridgeless":{"defaultValue":false,"metadata":{"dateAdded":"2024-06-06","description":"Invoke callbacks immediately on the ReactInstance rather than going through a background thread for synchronization","purpose":"experimentation"}},"useModernRuntimeScheduler":{"defaultValue":false,"metadata":{"description":"When enabled, it uses the modern fork of RuntimeScheduler that allows scheduling tasks with priorities from any thread.","purpose":"release"},"skipNativeAPI":true},"useNativeViewConfigsInBridgelessMode":{"defaultValue":false,"metadata":{"dateAdded":"2024-04-03","description":"When enabled, the native view configs are used in bridgeless mode.","purpose":"experimentation"}},"useOptimisedViewPreallocationOnAndroid":{"defaultValue":false,"metadata":{"dateAdded":"2024-07-23","description":"Moves more of the work in view preallocation to the main thread to free up JS thread.","purpose":"experimentation"}},"useOptimizedEventBatchingOnAndroid":{"defaultValue":false,"metadata":{"dateAdded":"2024-08-29","description":"Uses an optimized mechanism for event batching on Android that does not need to wait for a Choreographer frame callback.","purpose":"experimentation"}},"useRuntimeShadowNodeReferenceUpdate":{"defaultValue":false,"metadata":{"dateAdded":"2024-06-03","description":"When enabled, cloning shadow nodes within react native will update the reference held by the current JS fiber tree.","purpose":"experimentation"}},"useTurboModuleInterop":{"defaultValue":false,"metadata":{"dateAdded":"2024-07-28","description":"In Bridgeless mode, should legacy NativeModules use the TurboModule system?","purpose":"experimentation"}},"useTurboModules":{"defaultValue":false,"metadata":{"description":"When enabled, NativeModules will be executed by using the TurboModule system","purpose":"release"}}},"jsOnly":{"jsOnlyTestFlag":{"defaultValue":false,"metadata":{"description":"JS-only flag for testing. Do NOT modify.","purpose":"operational"}},"animatedShouldDebounceQueueFlush":{"defaultValue":false,"metadata":{"dateAdded":"2024-02-05","description":"Enables an experimental flush-queue debouncing in Animated.js.","purpose":"experimentation"}},"animatedShouldUseSingleOp":{"defaultValue":false,"metadata":{"dateAdded":"2024-02-05","description":"Enables an experimental mega-operation for Animated.js that replaces many calls to native with a single call into native, to reduce JSI/JNI traffic.","purpose":"experimentation"}},"enableAccessToHostTreeInFabric":{"defaultValue":false,"metadata":{"description":"Enables access to the host tree in Fabric using DOM-compatible APIs.","purpose":"release"}},"enableAnimatedAllowlist":{"defaultValue":false,"metadata":{"dateAdded":"2024-09-10","description":"Enables Animated to skip non-allowlisted props and styles.","purpose":"experimentation"}},"enableAnimatedClearImmediateFix":{"defaultValue":true,"metadata":{"dateAdded":"2024-09-17","description":"Enables an experimental to use the proper clearIntermediate instead of calling the wrong clearTimeout and canceling another timer.","purpose":"experimentation"}},"enableAnimatedPropsMemo":{"defaultValue":false,"metadata":{"dateAdded":"2024-09-11","description":"Enables Animated to analyze props to minimize invalidating `AnimatedProps`.","purpose":"experimentation"}},"enableOptimisedVirtualizedCells":{"defaultValue":false,"metadata":{"dateAdded":"2024-08-21","description":"Removing unnecessary rerenders Virtualized cells after any rerenders of Virualized list. Works with strict=true option","purpose":"experimentation"}},"isLayoutAnimationEnabled":{"defaultValue":true,"metadata":{"description":"Function used to enable / disabled Layout Animations in React Native.","purpose":"release"}},"scheduleAnimatedEndCallbackInMicrotask":{"defaultValue":false,"metadata":{"dateAdded":"2024-09-27","description":"Changes the completion callback supplied via `Animation#start` to be scheduled in a microtask instead of synchronously executed.","purpose":"experimentation"}},"shouldSkipStateUpdatesForLoopingAnimations":{"defaultValue":false,"metadata":{"dateAdded":"2024-07-25","description":"If the animation is within Animated.loop, we do not send state updates to React.","purpose":"experimentation"}},"shouldUseAnimatedObjectForTransform":{"defaultValue":false,"metadata":{"dateAdded":"2024-02-05","description":"Enables use of AnimatedObject for animating transform values.","purpose":"experimentation"}},"shouldUseRemoveClippedSubviewsAsDefaultOnIOS":{"defaultValue":false,"metadata":{"dateAdded":"2024-02-05","description":"removeClippedSubviews prop will be used as the default in FlatList on iOS to match Android","purpose":"experimentation"}},"shouldUseSetNativePropsInFabric":{"defaultValue":true,"metadata":{"dateAdded":"2024-03-05","description":"Enables use of setNativeProps in JS driven animations.","purpose":"experimentation"}},"shouldUseSetNativePropsInNativeAnimationsInFabric":{"defaultValue":false,"metadata":{"dateAdded":"2024-03-05","description":"Enables use of setNativeProps in Native driven animations in Fabric.","purpose":"experimentation"}},"useInsertionEffectsForAnimations":{"defaultValue":false,"metadata":{"dateAdded":"2024-09-12","description":"Changes construction of the animation graph to `useInsertionEffect` instead of `useLayoutEffect`.","purpose":"experimentation"}},"useRefsForTextInputState":{"defaultValue":false,"metadata":{"dateAdded":"2024-07-08","description":"Enable a variant of TextInput that moves some state to refs to avoid unnecessary re-renders","purpose":"experimentation"}}}}
```

Reviewed By: mdvacca

Differential Revision: D64406244

fbshipit-source-id: 6f82da64d1212faf6d5a82862a71fbc1d168134b
2024-10-29 08:02:54 -07:00
Rubén Norte
66ffa5ee4d Small improvement in types for feature flags definitions in JS (#47239)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47239

Changelog: [internal]

Small refactor of the types for feature flags in JS to make objects read-only.

Reviewed By: mdvacca

Differential Revision: D65058612

fbshipit-source-id: 0d72df2f4afebf0426b9ac76a8f8b195c74fea52
2024-10-29 08:02:54 -07:00
Rubén Norte
66df63d3b5 Generalize feature flags script (#47208)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47208

Changelog: [internal]

Small change to unify the yarn commands for feature flags into a single `featureflags` command with options.

Reviewed By: NickGerleman, mdvacca

Differential Revision: D64982509

fbshipit-source-id: 3f9d7ac35f61950bd03fef243e1a95625144a0cd
2024-10-29 08:02:54 -07:00
Samuel Susla
63f8c3dcd6 batch sync events based on event beats second try (#47255)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47255

changelog: [internal]

Batching sync events into a single JavaScript task. The batching mechanism uses EventBeat's induce method.

Reviewed By: javache

Differential Revision: D64930580

fbshipit-source-id: dd68444ae5679155bb360353eec9e38dceb604ce
2024-10-29 07:50:29 -07:00
Samuel Susla
741ae296d9 ship optimisation enableTextPreallocationOptimisation (#47257)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47257

changelog: [internal]

Reviewed By: NickGerleman, rshest

Differential Revision: D65068406

fbshipit-source-id: 2e54e0e42e9d30f14c139ac039378d3cb4897067
2024-10-29 07:20:16 -07:00
Samuel Susla
21b99d9981 delete stale flag enableCleanTextInputYogaNode (#47256)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47256

changelog: [internal]

no plans to ship this. Let's delete the feature flag for now.

Reviewed By: rshest

Differential Revision: D65068295

fbshipit-source-id: 0b68e331c54c4989e6227d3e40a3bade30aa49d1
2024-10-29 07:20:16 -07:00
Rubén Norte
5f45f8a71c Remove unused flags for Hermes VM (#47244)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47244

Changelog: [internal]

Reviewed By: rshest

Differential Revision: D65062303

fbshipit-source-id: 7372536643636b8a1923d9e1194ebca45f856e57
2024-10-29 06:20:13 -07:00
Pieter De Baets
f503fe3f10 Reduce public API for DevToolsReactPerfLogger (#47275)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47275

Changelog: [Android][Removed] DevToolsReactPerfLogger stats gathering now uses an internal API

Reviewed By: cortinico, fabriziocucci

Differential Revision: D65133420

fbshipit-source-id: 360e86b69b1e4ba757090ae3fb87fc82d49163e7
2024-10-29 05:19:02 -07:00
Parsa Nasirimehr
c1e964aa1f fix(iOS): migrate from RCTSharedApplication() for RCTDeviceInfo's RCTIsIPhoneNotched method (#47220)
Summary:
Far as i can see it, this is the last direct reference to how we used to get windows before the introduction of scenes. Everything now uses the new Scenes system (potentially we could start adding a `RCTSceneDelegate` if we ever want to move in that direction)

I also threw in a nullability check. Theoretically, that shouldn't happen, but honestly, who knows what platform will come in the future, better safe than sorry. Let me know if you think i should remove it

## Changelog:

[INTERNAL] [FIXED] - Potentially Migrate the last `KeyWindow` usage to `RCTKeyWindow` instead of tapping to the `UIWindow` directly via RCTSharedApplication

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

Test Plan:
yarn test:
<img width="1784" alt="Screenshot 2024-10-26 at 23 48 22" src="https://github.com/user-attachments/assets/3c0c6b2b-6aa1-4e7a-b663-327a363e4de6">
iOS test: Sadly it seems like it is still broken on Xcode 16 on my machine. Will leave it up to the CI to test it. I can see that there are more that are potentially broken. Might try to take a look and see if i can fix it in another PR.
<img width="1840" alt="Screenshot 2024-10-26 at 23 53 47" src="https://github.com/user-attachments/assets/2e302aee-bc57-41fe-baf3-0292dc65485e">

Reviewed By: philIip

Differential Revision: D65057289

Pulled By: cipolleschi

fbshipit-source-id: a5b2e875e681120a54e57ede90d67e66e9376a56
2024-10-29 04:37:24 -07:00
Nick Gerleman
52cdedb40e Fix missing emitter attributes on iOS TextInput when controlled component value specified using value instead of children (#47269)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47269

There were [reports](https://github.com/reactwg/react-native-releases/issues/595) that patching in the fixes for iOS controlled input did not work as expected.

I think tracked this down to a difference in how I tested, where the controlled component I used passed value as a child of the `TextInput`, instead of via `value`. Passing via `value` triggers a secondary bug, where we don't correctly pass a reference to correct ShadowView when creating attributedstring, specifically in the iOS TextInputShadowNode impl.

We previously passed nothing for the ShadowView (only the first two struct fields). This was exposed in D52589303 which enabled `-Wextra`, but there, I went with same behavior of passing empty ShadowView, instead of the correct behavior (like Android impl) of passing a ShadowView of the current ShadowNode.

After fixing this, we now correctly create event emitters in the passed attributedstring, which matches expectations for pargraph-level eventemitter now in typing attributes. We don't seem actually use this on iOS for TextInput right now (just Text), but this is likely the right foundation for events regardless.

Changelog:
[iOS][Fixed] - Fix missing emitter attributes on iOS TextInput when controlled component value specified using `value` instead of `children`

Reviewed By: cipolleschi

Differential Revision: D65108163

fbshipit-source-id: 499fe28439fabd2579eca6ded7fd13fd8ea2e43e
2024-10-29 03:43:10 -07:00
David Vacca
4076dbfc86 Convert ReactFeatureFlags to Kotlin (#47260)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47260

Convert ReactFeatureFlags to Kotlin

changeLog: [Android][Changed] Migrate ReactFeatureFlags to Kotlin

Reviewed By: shwanton, javache

Differential Revision: D65070217

fbshipit-source-id: 8939326c1e1e7cd634347a58123ad8c0795c309e
2024-10-28 18:49:19 -07:00
David Vacca
03797dda03 Convert LongStreamingStats to Kotlin (#47261)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47261

Convert LongStreamingStats to Kotlin

changeLog: [internal] internal

Reviewed By: javache

Differential Revision: D65070215

fbshipit-source-id: b4e3ca9152ea382e516d1b598401df6bf38135eb
2024-10-28 18:49:19 -07:00
David Vacca
b5696e6172 Migrate PreAllocateViewMountItem to Kotlin (#47258)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47258

Migrate PreAllocateViewMountItem to Kotlin

changeLog: [internal] internal

Reviewed By: shwanton

Differential Revision: D65070220

fbshipit-source-id: 3785f36747ea54304e45234daf377d20381f3c6c
2024-10-28 18:49:19 -07:00
David Vacca
0705eb8b91 Assert FeatureFlags in Bridgeless initialization only on Debug mode (#47263)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47263

Assert FeatureFlags in Bridgeless initialization only on Debug mode

changelog: [internal] internal

Reviewed By: shwanton

Differential Revision: D65078365

fbshipit-source-id: 79a40ba84e140b9784660ac9d1c14fd0f7426653
2024-10-28 14:23:51 -07:00
Samuel Susla
92d743a9ab surface setup issues in EventBeat and Scheduler (#47253)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47253

changelog: [internal]

Add assert statements to make sure EventBeat and Scheduler classes are correctly setup.

Scheduler must receive RuntimeScheduler through ContextContainer.
Callers of EventBeat must set beatCallback before calling request.

Reviewed By: javache

Differential Revision: D65001802

fbshipit-source-id: 5e044e1e6b0249bc89c11cccd51801add2e85b88
2024-10-28 13:17:43 -07:00
Eli White
3111473d57 Add test for native module returning enum (#47229)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47229

Adding a test case for an enum value in a fromNative position

Changelog: [Internal]

Reviewed By: makovkastar

Differential Revision: D65038107

fbshipit-source-id: ed323d9a8b226be3ff571c86fda617cabc17cdb9
2024-10-28 12:03:33 -07:00
Zeya Peng
b5b65275c6 move multiline and submitBehavior down to BaseTextInputProps (#47205)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47205

move `multiline` and `submitBehavior` from ios and android respectively to BaseTextInputProps

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D64494449

fbshipit-source-id: ac737af27ba21ee886c92667f6c51945738bfc02
2024-10-28 10:17:02 -07:00
Zeya Peng
db835e28d8 Make textInputProps.submitBehavior on android an enum type (#47206)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47206

Share definition of `SubmitBehavior` enum on ios, and use it on android

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D64718150

fbshipit-source-id: a078c9be44c625cc5e9001e4ae25d32eaaf5d8e4
2024-10-28 10:17:02 -07:00
Samuel Susla
8b9535f101 add missing breaks in PointerEvent (#47233)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47233

changelog: [internal]

This looks like a missing break statement when it was refactored in https://github.com/facebook/react-native/pull/41519

Reviewed By: rubennorte

Differential Revision: D65040504

fbshipit-source-id: c4d52792099a5764d00c16708e400fa8a0046c93
2024-10-28 10:14:34 -07:00
Samuel Susla
9a5d3efb12 remove EventEmitter::toggleEventTargetOwnership_ (#47224)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47224

changelog: [internal]

not used, let's remove it.

Reviewed By: rshest

Differential Revision: D65004362

fbshipit-source-id: 7cedf18bf1d685510da3512cf40628897b357bcf
2024-10-28 09:20:04 -07:00
Pieter De Baets
bd133b5dd5 Add featureflag to not re-order mount items in FabricMountingManager (#46702)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46702

In https://github.com/facebook/react-native/pull/44188, we've started combining multiple transactions in a single transaction, to meet React's atomicity requirements, while also dealing with the constraints of Android's Fabric implementation.

This revealed a bug where in some scenarios (especially when using transitions), a node may be deleted and created during the same transaction. The current implementation of FabricMountingManager assumes it can safely reorder some operations, which it does to optimize the size of IntBufferBatch mount items. This is however incorrect and unsafe when multiple transactions are merged.

**Example:**

Differentiator output:

```
# Transaction 1
Remove #100 from #11
Delete #100

# Transaction 2
Create #100
Insert #100 into #11
```
FabricMountingManager output
```
Remove #100 from #11
Insert #100 into #11
Delete #100
```

Note that the create action is also skipped, because we only update `allocatedViewTags` after processing all mutations, leading FabricMountingManager to assume creation is not required.

This leads to an invalid state in SurfaceMountingManager, which will be surfaced as a crash in `getViewState` on the next mutation that interacts with these views.

Changelog: [Android][Fixed] Fix crash in getViewState when using suspense fallbacks.

Reviewed By: sammy-SC

Differential Revision: D63148523

fbshipit-source-id: 07ae26b2f7b7eba1b9784041dd3059b0956c035e
2024-10-28 06:18:43 -07:00
Samuel Susla
dd432790b8 Use RuntimeScheduler in EventBeat 2nd try (#47196)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47196

changelog: [internal]

EventBeat can use RuntimeScheduler directly, no need to go through RuntimeExecutor.

Reviewed By: christophpurrer

Differential Revision: D64927936

fbshipit-source-id: 9fb317d7c98da588d3438424ab9923dc0c0259c1
2024-10-28 05:50:15 -07:00
zhongwuzw
e271b23fad Fixes regression of RCTWindowFrameDidChangeNotification not fired (#47236)
Summary:
Fixes https://github.com/facebook/react-native/issues/47234. regression from 391680fe84 (diff-b7fda5d350ac535115fa683faa7317b43aa11f3448f95266ef9ff051c3753a6fL63)

bypass-github-export-checks

## Changelog:

[IOS] [FIXED] - Fixes regression of RCTWindowFrameDidChangeNotification not fired

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

Test Plan: Demo in https://github.com/facebook/react-native/issues/47234.

Reviewed By: blakef

Differential Revision: D65058105

Pulled By: cipolleschi

fbshipit-source-id: 0e286182ed93f289cb853710e2e00801ef2d4f73
2024-10-28 05:23:52 -07:00
Riccardo Cipolleschi
4192678bd7 Pin Xcodeproj to < 1.26.0 (#47237)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47237

The Xcodeproj gem has been released yesterday to version 1.26.0 and it broke the CI pipeline of react native.

This should fix the issue

## Changelog
[Internal] - Pin Xcodeproj gem to 1.26.0

Reviewed By: blakef

Differential Revision: D65057797

fbshipit-source-id: f4035a1d3c75dd4140eb1646ab2aa0ccb08fb16b
2024-10-28 04:20:31 -07:00
Pieter De Baets
dc2000c875 Improve correctness of textTransform: capitalize (#47219)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47219

We received reports that textTransform does not correctly match the web behaviour for capitalize, eg. capitalized characters should not be lowercased when using `capitalize`.

Example input: 'hello WORLD', should become 'Hello WORLD'.

Changelog: [General][Fixed] TextTransform: capitalize better reflects the web behaviour

Reviewed By: NickGerleman

Differential Revision: D65023821

fbshipit-source-id: 8ba5fdbd7afb1460193bf82a2f4021c3aff2110a
2024-10-26 17:57:26 -07:00
Jakub Piasecki
33e1ae13f8 Add tests for LayoutableChildren iterator
Summary:
Adds unit tests that directly cover the order in which `LayoutableChildren` iterator goes over the descendant nodes. The covered cases are as follows (nodes with `display: contents` are marked green):

### Single `display: contents` node

```mermaid
flowchart TD
R((R)) --> A((A))
R --> B((B))
R --> C((C))

B --> D((D))
B --> E((E))

style B fill:https://github.com/facebook/yoga/issues/090
```

Correct order: `A, D, E, C`

### Multiple `display: contents` nodes

```mermaid
flowchart TD
R((R)) --> A((A))
R --> B((B))
R --> C((C))

A --> D((D))
A --> E((E))

B --> F((F))
B --> G((G))

C --> H((H))
C --> I((I))

style A fill:https://github.com/facebook/yoga/issues/090
style B fill:https://github.com/facebook/yoga/issues/090
style C fill:https://github.com/facebook/yoga/issues/090
```

Correct order: `D, E, F, G, H, I`

### Nested `display: contents` nodes

```mermaid
flowchart TD
R((R)) --> A((A))
R --> B((B))
R --> C((C))

B --> D((D))
B --> E((E))

E --> F((F))
E --> G((G))

style B fill:https://github.com/facebook/yoga/issues/090
style E fill:https://github.com/facebook/yoga/issues/090
```

Correct order: `A, D, F, G, C`

### Leaf `display: contents` node

```mermaid
flowchart TD
R((R)) --> A((A))
R --> B((B))
R --> C((C))

style B fill:https://github.com/facebook/yoga/issues/090
```

Correct order: `A, C`

### Root `display: contents` node

```mermaid
flowchart TD
R((R)) --> A((A))
R --> B((B))
R --> C((C))

style R fill:https://github.com/facebook/yoga/issues/090
```

Correct order: `A, B, C` - `LayoutableChildren` goes over the children with `display: contents` property, setting it on the root node should have no effect.

Changelog: [Internal]

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

Reviewed By: joevilches

Differential Revision: D64981779

Pulled By: NickGerleman

fbshipit-source-id: ee39759c663a40f96ad313f1b775d53ab68fb442
2024-10-25 18:01:20 -07:00
Samuel Susla
db09e7c2e5 delete shouldYield from commit options (#47191)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47191

changelog: [internal]

not used, let's delete it.

Reviewed By: javache, rubennorte

Differential Revision: D64916432

fbshipit-source-id: 182848c85ca58d4e8fae3c6ab67c781807803dff
2024-10-25 17:41:06 -07:00
Jakub Piasecki
a88ddcecc9 Fix for nodes with display: contents not being cleaned in some cases (#47194)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47194

Fixes a case where a node with `display: contents` would not be cleaned up in some cases. This was caused by it being called after some early returns handling different quick paths. This PR moves the call to `cleanupContentsNodesRecursively` earlier so that it's always called.

The problem here wasn't mutating before cloning, but leaving a node marked as dirty after the layout has finished.

The exact case in which I found this was a node with a single `display: contents` child which needs to be a leaf. Then in the parent node [this](b0b842d5e7/yoga/algorithm/CalculateLayout.cpp (L1339)) condition is true, so `cleanupContentsNodesRecursively` doesn't get called and the child node is never visited and cleaned. I assume the same will happen in the other paths with an early return here.

Changelog:
[General][Fixed] - Fix for nodes with `display: contents` not being cleaned in some cases

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

Reviewed By: rozele

Differential Revision: D64910099

Pulled By: NickGerleman

fbshipit-source-id: 6d56f8fbf687b7ee5af889c0b868406213c9cee8
2024-10-25 17:34:36 -07:00
Ramanpreet Nara
4f47439a02 cleanup: ExceptionsManager: Delete updateExceptionMessage (#47167)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47167

I couldn't find any usages of this method in javascript.

Removing, so that the native code is easier to read.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D64606928

fbshipit-source-id: 1d52d58437370ae3d99e9c44500080687f137191
2024-10-25 15:12:40 -07:00
Ramanpreet Nara
f8788963b9 cleanup: ExceptionsManager: Delete reportUnhandledException (#47166)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47166

This method wasn't used from javascript.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D64607415

fbshipit-source-id: 2fb7eeee9479de85284d05629ed8e1bfb9fa5917
2024-10-25 15:12:40 -07:00
Ramanpreet Nara
0941b51e9d earlyjs: Make ExceptionsManager the js interface for c++ pipeline (#47165)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47165

The c++ pipeline needs a javascript interface.

We could just re-use exceptions manager (for now).

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D64779068

fbshipit-source-id: 4e300668a01fa22e194ea9f149ef1d936d5e0834
2024-10-25 15:12:40 -07:00
Ramanpreet Nara
2247e0b983 earlyjs: Make JsErrorHandler work for all js throwables
Summary:
Now, handleError can be called with a JSError that wraps a non-error object!

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D64706198

fbshipit-source-id: 562ed7d4e2a13eaef48acfdf3499296462e54166
2024-10-25 15:12:40 -07:00
Samuel Susla
3fff4cf966 delete MountingCoordinator::Shared typealias (#47207)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47207

changelog: [internal]

delete typealias `MountingCoordinator::Shared` and use `std::shared_ptr<const MountingCoordinator>` directly.

Reviewed By: christophpurrer

Differential Revision: D64917023

fbshipit-source-id: 586ffcd5d22ea48b22d8a6cf86aa5fdf87fdefd0
2024-10-25 12:51:57 -07:00
David Vacca
eddc0a1d49 Delete CoreFeatures class (#45626)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45626

I'm deleting CoreFeatures class and all its imports because it was fully replaced by ReactNativeFeatureFlags

Changelog: [Internal][Removed] Delete CoreFeatures class in favor of ReactNativeFeatureFlags

Reviewed By: rubennorte

Differential Revision: D60137380

fbshipit-source-id: 8bf918cdd1ce66e315aa95e1c5a28879445ff9f9
2024-10-25 08:32:20 -07:00
David Vacca
a01e2e4165 Delete CoreFeatures::excludeYogaFromRawProps (#45627)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45627

I'm deleting CoreFeatures::excludeYogaFromRawProps in favor of ReactNativeFeatureFlags::excludeYogaFromRawProps();

changelog: [internal] internal

Reviewed By: rubennorte

Differential Revision: D60124448

fbshipit-source-id: 1dfec40d638c4051ebfebe712abe0bee6764e584
2024-10-25 08:32:20 -07:00
David Vacca
26278b10b1 Migrate enableCppPropsIteratorSetter to ReactNativeFeatureFlags (#45602)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45602

Migrate enableCppPropsIteratorSetter to ReactNativeFeatureFlags

Changelog: [Internal] internal

Reviewed By: rubennorte

Differential Revision: D60022936

fbshipit-source-id: 88fe6f41af3dea0ac5de4a097901a7e8df39efb2
2024-10-25 08:32:20 -07:00
David Vacca
143b9d172c Expose JSBundleLoader as parameter of DefaultReactHost (#47179)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47179

In this diff I'm exposing the new parameter (JSBundleLoader) as parameter of DefaultReactHost.

changelog: [Android][Breaking] Added JSBundleLoader as parameter of DefaultReactHost

Reviewed By: cortinico

Differential Revision: D64381501

fbshipit-source-id: dd0d56441802f7db53c67c659bbcae63c4b1b613
2024-10-25 02:08:32 -07:00
David Vacca
80f846948a Remove unused dependencies from facebook/react/interfaces (#47115)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47115

Remove unused dependencies from facebook/react/interfaces

changelog: [internal] internal

Reviewed By: cortinico

Differential Revision: D64585748

fbshipit-source-id: fd42b63dd25cb4b6d4d7bb4f05912cff3f167db8
2024-10-25 02:08:32 -07:00
David Vacca
2cb5198f1b Delete CompositeReactPackage from RN (#47128)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47128

Delete CompositeReactPackage from RN, these classes were deprecated for a long time and they can be deleted now, there are no internal usages

changelog: [Android][Breaking] Deleting deprecated CompositeReactPackage

Reviewed By: cortinico

Differential Revision: D64382211

fbshipit-source-id: d4fdfd51177612a64dde918cd68d6e852ef1b0e2
2024-10-25 02:08:32 -07:00
Parsa Nasirimehr
795a21a471 fix(iOS): migrate from depracated websocket method in RCTCxxInspectorWebSocketAdapter (#47197)
Summary:
Saw this while going through the remaining warnings of the project. I double checked, and i can't find any other usages left behind, so this is probably the last one

## Changelog:

[INTERNAL] [FIXED] - Switch to using the new sendString method for Websocket

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

Test Plan:
yarn test:
<img width="933" alt="Screenshot 2024-10-25 at 00 55 58" src="https://github.com/user-attachments/assets/dbfebb90-4957-4fc9-8a90-153c03055ac9">
Running the tests in Xcode with `CMD+U` or the objc-test: I could not get it to pass in either the old code or the modified code. I know the test documentation said it needs a WebSocket, but it was a bit too vague , and even turning metro on did not help, so i have no idea how to test it. If anyone can guide me on that one, please let me know

Reviewed By: blakef

Differential Revision: D64934981

Pulled By: cipolleschi

fbshipit-source-id: c6f13d3da5aafe3eed8b99b98f04904fcdcc4115
2024-10-24 23:49:13 -07:00
Blake Friedman
94fdc38822 fix: mitigate DangerJS transpilation bug (#47192)
Summary:
Danger seems to have a bug where it's not transpiling the import of
rnx-kit/rn-changelog-generator. This mitigates the issue to get our
project back on track.

This can be replicated locally by:

```bash
DEBUG="*" DANGER_GITHUB_API_TOKEN=$GITHUB_TOKEN yarn danger pr https://github.com/facebook/react-native/pull/47182
```
You can see it running correctly here when switching to the branch with the fix.  **I'm a little concerned that this is still failing on the PR**.  Thoughts?

 {F1946190275}

Changelog: [internal]

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

Reviewed By: cortinico

Differential Revision: D64924466

Pulled By: blakef

fbshipit-source-id: 68df0521620809effe3a78ce842e043382ad64a6
2024-10-24 20:07:20 -07:00
Riccardo Cipolleschi
e851e73c18 Add yoga to app search paths (#47195)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47195

When a user wants to create a Fabric Component i their app (not in a separate library) the app fails to build because:
- The custom component has to inherit from `RCTViewComponentView`
- `RCTViewComponentView` imports `ViewProps.h`
- `ViewProps.h` imports `HostPlatformViewProps.h`
- `HostPlatformViewProps.h` imports `BaseViewProps.h`
- `BaseViewProps.h` imports `YogaStylableProps.h`

which is a Yoga private header and the App has not visibility over it.

It is also not possible to fix this issue with forward declaring the `YogaStylableProps`, because `BaseViewProps` inherit from the yoga's props, so the compiler needs the full declaration of `YogaStylableProps` to work

This needs to be picked in 0.76

## Changelog
[iOS][Fixed] - Give apps access to Yoga headers

Reviewed By: blakef

Differential Revision: D64925222

fbshipit-source-id: e724076bbfb0a678948340dfab2ce609e6509533
2024-10-24 17:16:50 -07:00
Sunny Luo
d293fdd27a Add jsBundleFile to DefaultReactNativeHost.kt (#47188)
Summary:
The JsBundleFilePath has been ignored when converting DefaultReactNativeHost to ReactHost

Changelog:
[Internal] [Changed] - Add jsBundleFile to DefaultReactNativeHost.kt

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

Reviewed By: javache

Differential Revision: D64914149

Pulled By: cortinico

fbshipit-source-id: d437ca81df5a170e0c5f01a22ccda83f43a09dd2
2024-10-24 14:59:21 -07:00
David Vacca
70c7616535 Make ReactHost.createSurface() method non nullable (#47189)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47189

ReactHost.createSurface() should not return a nullable surface, I'm changing that here.

changelog: [Android][Breaking] Make ReactHost.createSurface() method non nullable

Reviewed By: tdn120

Differential Revision: D64910107

fbshipit-source-id: ce8c5efd2c1e36eba0a85ae89cd1cd2a6305e885
2024-10-24 13:04:23 -07:00
Thomas Nardone
d825a4d712 Add OnLayoutChange API for scroll views (#47177)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47177

Changelog: [Android][Added] Add OnLayoutChange API for scroll views

Reviewed By: lyahdav, mdvacca

Differential Revision: D64843826

fbshipit-source-id: 3161730ccd0b3816d1704d07a02714a2ff04ae3a
2024-10-24 11:05:38 -07:00
Alan Lee
ba061a5d18 Bump NDK to 27.1 (#46357)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46357

Bumping NDK to 27.1.12297006 as we need it to build native libraries with 16KB page size support.

See:
- Changelog r27: https://github.com/android/ndk/wiki/Changelog-r27
- 16KB page sizes: https://developer.android.com/guide/practices/page-sizes

Changelog:
[Android] [Changed] - Android NDK to 27.1

Reviewed By: cortinico

Differential Revision: D62278654

fbshipit-source-id: 9968a45d9f41031571dfa1bb1671d6ad71d0644d
2024-10-24 10:58:09 -07:00
Alan Lee
37375d8aba bump Folly to 2024.10.14.00 (#47033)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47033

Lastest Folly has updates to fix build errors with LLVM 19 which is also llikely needed for NDK 27

- bf46c8a21f

- also add folly's new dependency fast_float
- update fmt version

Changelog:
[General][Changed] - Bump Folly to 2024.10.14.00

Reviewed By: NickGerleman

Differential Revision: D64372125

fbshipit-source-id: 1a88f1bc2af7bedce96437f2dba5b6e0fe9ea772
2024-10-24 10:10:19 -07:00
Riccardo Cipolleschi
dc7e9e2d83 Exclude generation of app-defined components from RCTThirdPartyFabricComponentsProvider (#47176)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47176

While writing the guide for the New Architecture, we realized that we need to exclude the generation of the Cls function in the RCTThirdPartyFabricComponentsProvider for components defined in the app.

This is needed because a component that is defined in the app will have those function defined in the app project. However, the RCTThirdPartyFabricComponentsProvider is generated in Fabric, inside the Pods project.

The pod project needs to build in isolation from the app and cocoapods then link the app to the pods project. But the compilation of the pods project fails if one of the symbol needed by the pods lives in the app.

By disabling the generation of that function in th RCTThirdPartyFabricComponentsProvider, we can successfully build the app.

The downside is that the user needs to register the component manually, but this is not an issue because if they are writing a component in the app space, they have all the information tomanually register it in the AppDelegate

## Changelog
[iOS][Fixed] - Do not generate the ComponentCls function in the RCTThirdPartyFabricComponentsProvider for components deined in the app.

Reviewed By: cortinico, blakef

Differential Revision: D64739896

fbshipit-source-id: 0eca818ea0198532a611377d14a3ff4c95cb5fe3
2024-10-24 09:36:07 -07:00
Sam Zhou
ad341e3969 Add as const cast and make types readonly to prepare for natural inference (#47184)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47184

Changelog: [Internal]

Reviewed By: panagosg7

Differential Revision: D64859497

fbshipit-source-id: 2cff5e2671e210a4e8cefb5a2d8c0fb56d5a0d1b
2024-10-23 23:32:37 -07:00
David Vacca
5e21232717 Assert enableBridgelessArchitecture is true when starting Bridgeless (#47145)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47145

Staring Bridgeless without previously setting ReactNativeFeatureFlags.enableBridgelessArchitecture() is UB, we should assert enableBridgelessArchitecture is true when starting Bridgeless

changelog: [internal] internal

Reviewed By: NickGerleman

Differential Revision: D64641081

fbshipit-source-id: d7964f8a9d5a2e6dad9d44b8fd5cd5a52d1b2cf4
2024-10-23 22:53:44 -07:00