Commit Graph

12270 Commits

Author SHA1 Message Date
shubhamguptadream11 45b177f50d fix: height and width added back in props (#47044)
Summary:
Fixes this: https://github.com/facebook/react-native/issues/41151

## Changelog:

[GENERAL] [FIXED] - Passed height and width as native props to support cases where source is an array.

**Issue**: Unable to use height and width as props in Image components when passing source as an array.

This functionality worked before this [commit](https://github.com/facebook/react-native/pull/34481). In Image.android.js and Image.ios.js, height and width props are extracted before passing them to the native side. This extraction makes these props ineffective when passed directly. Although setting height and width in style is a workaround, these props should still be respected since they exist for this purpose.

The issue occurs only when the source prop is an array. When source is an object, width and height are manually passed to the style object, so the issue doesn't arise.

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

Test Plan: Tested this on `rn-tester` app

Reviewed By: necolas, javache

Differential Revision: D64458292

Pulled By: cipolleschi

fbshipit-source-id: 5cacad79b8d4468a4a1fd0977221e42ce4b2e5d1
2024-10-18 05:04:11 -07:00
Samuel Susla b0f0f0631c delete typealias RunLoopObserver::Unique (#47117)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47117

changelog: [internal]

use unique_ptr directly instead of typealias obscuring the type.

Reviewed By: christophpurrer

Differential Revision: D64302758

fbshipit-source-id: 5a7ee2408a04de6cf1e60036463227cd2b455fcf
2024-10-18 04:52:45 -07:00
Tim Yung c9ea05552f RN: Fix lint/sort-imports Errors (#47109)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47109

Fixes the `lint/sort-imports` errors that are now surfaced after fixing the lint configuration.

For a couple files, I added lint suppressions instead because the unsorted import ordering is important due to interleaved calls with side effects.

Changelog:
[Internal]

Reviewed By: GijsWeterings

Differential Revision: D64569485

fbshipit-source-id: 26415d792e2b9efe08c05d1436f723faae549882
2024-10-18 04:07:02 -07:00
Frank Calise e14a2f3862 test(rn-tester): skip loading indicators when list is empty (#47094)
Summary:
During testing for 0.76-RC6, I came across the following behavior in RNTester.

Components > FlatList > Basic > Toggle `Empty` switch

You'll notice there are activity indicators in the header/footer (see video) for some time and things appear to be somewhat janky. I think the expectations would be to see only the `ListEmptyComponent` that is defined for this to look more correct. This will help not give any false indication that something has gone wrong with the latest picks when testing newer versions.

## Changelog:

[INTERNAL] [FIXED] - Fixed FlatList Empty behavior in RNTester

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

Test Plan: https://github.com/user-attachments/assets/6e116641-5b24-473c-a654-7d32a081b83f

Reviewed By: yungsters

Differential Revision: D64541905

Pulled By: cipolleschi

fbshipit-source-id: 0447d99588d85f9e1a46c6da169a0838e94994bc
2024-10-18 03:33:22 -07:00
Pieter De Baets 95a5d1c628 Explicity reset typeface in updateTextPaint (#47097)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47097

Calling Paint.reset() doesn't reset the active type face (https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/libs/hwui/hwui/PaintImpl.cpp;l=86), which causes measurements bugs for Text which don't specify a font to be incorrect.

Changelog: [Android][Fixed] Text without explicit font styles was potentially cut-off.

Reviewed By: NickGerleman

Differential Revision: D64535719

fbshipit-source-id: d300c26bf828a0e2e4b170254f9be5f409aff2dc
2024-10-18 03:29:34 -07:00
Nick Gerleman 0a2dec175e Remove legacy absolute positioning path (#46984)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46984

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

The legacy (wrong) absolute positioning path positions in two places, including work that is definitely always overwritten in the new absolute layout path.

This came up before for position: static, but we didn't clean this up at the time. This code is also now leading display: contents impl being more annoying.

This diff tries to converge to the more spec correct implementation of positioning here, that also only happens in one place.

Previous path would potentially also incorrectly justify when `justify-content` was non-default, but not handled in the previous few cases? We don't have access to the flexLine at this point later, and apart from the existing tests now passing I reused the new correct logic for justification (spec says we should position child as if its the only child in the container https://www.w3.org/TR/css-flexbox-1/#abspos-items).

I added a new, more scoped errata `AbsolutePositionWithoutInsetsExcludesPadding` to preserve some of the legacy behavior that showed as very breaking.

I also did not try removing `AbsolutePercentAgainstInnerSize` which I suspect would be more breaking than this change.

Changelog:
[General][Breaking] - More spec compliant absolute positioning

Reviewed By: joevilches

Differential Revision: D64244949

fbshipit-source-id: ca97570e0de82e8f0424a0912adfd0b05254559e
2024-10-17 22:40:16 -07:00
Phillip Pan 2ffd31bbd7 set modal rendered state to false on unmount (#47078)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47078

Changelog: [Internal]

in fabric, we've found a scenario where this modal state update is required to cleanup all artifacts from the modal presentation views. it is safe to add this back, as it was originally removed for a scenario that no longer exists.

Reviewed By: shwanton

Differential Revision: D64388550

fbshipit-source-id: f13571260379554b0126c379ace9f9e1b81866be
2024-10-17 22:09:43 -07:00
Nick Gerleman 0ba00fc998 Merge Android ViewNativeComponent ViewConfig into BaseViewConfig (#47105)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47105

`codegenNativeComponent` expects we declare props as extending `ViewProps`, but the generated ViewConfig extends from BaseViewConfig.

This doesn't matter on iOS, where ViewProps are implemented more uniformly across components, but on Android, means we miss about 40 view props, since `ReactViewManager` backing `<View>` supports quite a bit more than `BaseViewManager`. This means that any components which extend `ReactViewManager` have some ViewProps omitted.

In this diff, I went with the solution of moving the props specific to View's ViewConfig to BaseViewConfig. This means the SVC may treat more props as valid than the underlying native component, but this should be safe compared to undercounting, and this will make future moves from ReactViewManager to BaseViewManager safer.

BaseViewConfig was already exposing props not supported by BaseViewManager, like those related to border widths (which effect LayoutShadowNode, but cannot be drawn out of the box?), so this shouldn't be too out there.

The alternative to this was to publicly expose the View ViewConfig and extend from that in codegen instead, but this seemed more complicated without much benefit.

Changelog:
[Android][Fixed] - Merge Android ViewNativeComponent ViewConfig into BaseViewConfig

Reviewed By: elicwhite

Differential Revision: D64570806

fbshipit-source-id: de5c590e935c879e33d59c36ddce1f2481023c19
2024-10-17 20:51:11 -07:00
Shawn Dempsey d78cb78b15 React Activity exposes ReactHost (#46980)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46980

Changelog: [Android][Added]  React Activity exposes ReactHost

**Context:**

*These changes will not impact `DefaultReactHost` which is the way most OSS apps interface with `ReactHost`*

* We are simplifying `ReactHost` and `ReactHostDelegate` for Brownfield uses.
* We fetch the `ReactHost` to create the `ReactDelegate`
https://www.internalfb.com/code/fbsource/[00ee07afc695]/xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactActivityDelegate.java?lines=110-112

* With Bridgeless, you must use or extend `ReactHostDelegate` to get the `ReactHost` since we don't expose a getter on `ReactActivity`.
* If there is a custom Application, then getting the `ReactHost` will need a custom implementation.
* For the base case, we shouldn't need to subclass the delegate.

**Change:**

* Expose `ReactHost` on `ReactActivity` for Bridgeless access.
* Expose `ReactActivity` on `ReactActivityDelegate`. This will help us avoid keeping a reference to Activity in each subclass.
* Update the RN Android API's

Reviewed By: arushikesarwani94

Differential Revision: D64150994

fbshipit-source-id: a9d790a4b4ce4eca29dee4bdc8d9fc56cf742f1f
2024-10-17 19:33:40 -07:00
Jorge Cabiedes Acosta 398512a4ed Fix getOpacity() for drawables (#47103)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47103

`getOpacity()` is supposed to return a PixelFormat enum instead of a value between 0..255.
https://developer.android.com/reference/android/graphics/drawable/Drawable#getOpacity()

Also, I'm taking the value from the paint instead of the color's alpha since the paint might've been modified by setAlpha by this point and otherwise the paint will hold the alpha set by the color anyway since setAlpha() on Paints is just a helper for setColor() (https://developer.android.com/reference/android/graphics/Paint#setAlpha(int))

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D64273014

fbshipit-source-id: e2c524f1d816ee3705c5118232be759898e666ea
2024-10-17 17:37:25 -07:00
Jorge Cabiedes Acosta 02e4f3e16a Nullable borderRadius optimization on shadows and outline (#46819)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46819

Just some preparation to implement the new `BackgroundDrawable` and `BorderDrawable`.

This makes shadows and outline rely on `CompositeBackgroundDrawable` to set the state of `BorderRadiusStyle` and also makes them have a nullable borderRadius variable and initialize it only if we have it set saving a bit of overhead and performance

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D63798853

fbshipit-source-id: 994327415ba160cf8e5ccb3135c4917809499f81
2024-10-17 17:37:25 -07:00
Rubén Norte 14bbb87516 Fix incorrect type being passed to NativePerformance.mark (#47102)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47102

Changelog: [internal]

In D64466057 / https://github.com/facebook/react-native/commit/32f7b3b4e0b8be1d1138f43c46b3c86d9a64c29a we accidentally modified the API of `NativePerformance.mark` (which we wanted to preserve and move the changes to `NativePerformance.markWithResult` after some iteration) to make `startTime` optional, which isn't compatible with the previous native API.

This fixes the issue by reverting the type back to being required and always passing it from the JS API.

Differential Revision: D64557467

fbshipit-source-id: 3ade4271622ac6213fd4c2d4948c7d40e4abe715
2024-10-17 13:05:01 -07:00
Edmond Chui d11954e800 add appId to Telemetry (#47099)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47099

Changelog: [Internal]

As discussed in D64547367, recent changes caused `description` to stop reporting `appId`.

This impacted Telemetry's "top apps" dashboards.
{F1936011487}

Reviewed By: hoxyq

Differential Revision: D64548348

fbshipit-source-id: 46af650a89e2bef7be000482e7b774f56f84cac3
2024-10-17 12:47:05 -07:00
Edmond Chui 0d591d9dc3 add appId as a standalone field (#47098)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47098

Changelog: [Internal]

D63329456 updated the `description` field to be human-readable.
Unfortunately, InspectorProxy relies on this field to compare the incoming `/open-debugger` calls.

hoxyq discovered the symptom of Fusebox failing to launch with `No compatible apps connected. React Native DevTools can only be used with the Hermes engine.` in Metro

Reviewed By: hoxyq

Differential Revision: D64547367

fbshipit-source-id: deed6851f3ede2c74be2b492def1eba6e58c43e6
2024-10-17 12:47:05 -07:00
Joe Vilches 1d6ac09530 Fix animating background colors in View (#47101)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47101

See https://github.com/facebook/react-native/issues/47011

borders do not have this problem because they call `removeAllAnimations` on the layer after changing it, which is what I am doing here

Changelog: [iOS] [fixed] - Fixed bug where background colors would sometimes animate when changing on Views

Reviewed By: cipolleschi

Differential Revision: D64493968

fbshipit-source-id: cf81549f21b124b67c6e7647c6ae827bfe80a9cf
2024-10-17 11:58:12 -07:00
Samuel Susla d3fa580508 unify overlapping logic among platform specific EventBeats (#47085)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47085

changelog: [internal]

Move induce method from  AppleEventBeat and AndroidEventBeat to its subclass EventBeat.

# Goal of this stack:
Centralise event beat logic into EventBeat class inside react-native-github. Subclasses should only override EventBeat::request and EventBeat::induce.

Reviewed By: christophpurrer

Differential Revision: D64302639

fbshipit-source-id: cdea5ee64dc25633ae59fdce5b1ce6aff8a97d68
2024-10-17 11:51:22 -07:00
Samuel Susla 9fe253d677 delete AsynchronousEventBeat in favour of platform specific EventBeats (#47058)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47058

changelog: [internal]

# Goal of this stack:
Centralise event beat logic into EventBeat class inside react-native-github. Subclasses should only override EventBeat::request and EventBeat::induce.

Reviewed By: christophpurrer

Differential Revision: D64291889

fbshipit-source-id: fa46e2c5246e1a9a1b5f3bd02e5c0efa562188e9
2024-10-17 11:51:22 -07:00
Nicola Corti 7168a9d1a2 Stable API - Make AccessibilityInfoModule internal (#47092)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47092

This class should not be public. I'm updating the BUCK rule to make it `internal` and remove it from the public API surface.

Technically breaking however I haven't found meaningful usages of this API in OSS so this should be safe to ship.

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

Reviewed By: mdvacca

Differential Revision: D64539866

fbshipit-source-id: 21c9965dc95b697bef93bbad23872921a73566aa
2024-10-17 11:46:41 -07:00
Peter Abbondanzo c54b23ff9e Ensure alert dialog title wraps to two lines, uses default style (#47095)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47095

The [internal `DialogTitle` implementation from Android](https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/core/java/com/android/internal/widget/DialogTitle.java;l=63?q=DialogTitle) makes additional checks to see if the title should wrap to two lines before applying ellipsis, so this change recreates those same checks. This change also removes the text appearance and size changes made to the layout.

Reverts some of the changes made to https://github.com/facebook/react-native/pull/45395.

**Changelog:**
[Android][Fixed] - Fixed styling on alert dialog titles to wrap two lines and retain bold appearance

Reviewed By: cortinico

Differential Revision: D64543105

fbshipit-source-id: 30d1f9091aa7216eb5d00e4f8f14cbc719c803ea
2024-10-17 11:34:00 -07:00
yungsters (Meta Employee) dc737a7356 Delete __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED from React Native Renderer (#31276)
Summary:
## Summary

The React Native Renderer exports a
`__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED` property with a
single method that has no remaining call sites:
`computeComponentStackForErrorReporting`

This PR cleans up this unused export.

## How did you test this change?

```
$ yarn
$ yarn flow fabric
$ yarn test
```

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

Reviewed By: rickhanlonii, kassens

Differential Revision: D64484457

Pulled By: yungsters

fbshipit-source-id: 9a7629210739d23175480191d30fc02ba3ee2fee
2024-10-17 10:56:28 -07:00
Cristian Matteu 4ae999b90b Add announceForAccessibilityWithOptions method mock. (#47063)
Summary:
Currently, tests on components that use the `AccessibilityInfo.announceForAccessibilityWithOptions` method fail because a mock for this method is not present in the `jest` setup file. This PR adds the mock for the before mentioned method in the appropriate `setup.js` file
## Changelog:
[General][Added] - Added the missing `announceForAccessibilityWithOptions` function mock in the `packages/react-native/jest/setup.js` file.

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

Test Plan:
Here are the commands I executed after making the modification:
- `yarn prettier`
- `yarn lint`
- `yarn test`
### Test output
![rn-tests-output](https://github.com/user-attachments/assets/81e9772e-37ce-43ad-9869-5f7f64c292f0)

Reviewed By: tdn120

Differential Revision: D64495941

Pulled By: lunaleaps

fbshipit-source-id: 6ab835e2934b87ec3ac64cf0aebd8dcb58cd0da1
2024-10-17 09:20:32 -07:00
Robert Pasiński 32f7b3b4e0 fix: performance.measure with mark names (#46786)
Summary:
This PR improves PerformanceObserver Native Public API and fixes issue with `performance.measure` not working with mark names.

## Changelog:

 - Made `PerformanceEntryReporter::report[Mark|Measure]` return the created entry with computed data.
 - Updated JS-Native interface to return computed data from Native side to JS.
 - Updated JS tests

[GENERAL] [FIXED] - Fixed `performance.measure` with mark names
[GENERAL] [INTERNAL] - `PerformanceEntryReporter::reportMark` and `PerformanceEntryReporter::reportMeasaure` now return created performance entries.

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

Test Plan:
- [ ] Update JS tests
 - [ ] Update Native tests

Reviewed By: rshest

Differential Revision: D64466057

Pulled By: rubennorte

fbshipit-source-id: d280d66c268a9830fbc9e6f3304e108ecf870a59
2024-10-17 07:25:50 -07:00
Edmond Chui ff113545cf Update debugger-frontend from a897db8...117c96a (#47072)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47072

Changelog: [Internal] - Update `react-native/debugger-frontend` from a897db8...117c96a

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

Reviewed By: hoxyq

Differential Revision: D64487276

fbshipit-source-id: ae7efce5dadf72f62c824d0acbc6aa6d44149905
2024-10-17 07:25:20 -07:00
Nicola Corti 7bbac8ee27 Migrate MainReactPackage to Kotlin (#47070)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47070

For the sake of Stable API, I'd like to get this class converted to Kotlin

The class is becoming `final` so could be breaking for some users if they subclass `MainReactPackage` which I believe this should not be a valid usage of this API.

Changelog:
[Android] [Changed] - Migrate MainReactPackage to Kotlin (and make it final)

Reviewed By: tdn120

Differential Revision: D64479418

fbshipit-source-id: 24a07de4e5796a7b82ba34c9b36511b8fc526f1a
2024-10-17 05:29:04 -07:00
Nicola Corti 2d2bb9c588 Undo breaking change on ViewManagerDelegate.kt String params (#47086)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47086

When we migrated `ViewManagerDelegate` to Kotlin, we convered his string params to be `String` (rather than `String?`).

Existing implementation of this interface in OSS written in Kotlin were using `String?` due to this interface being in Java (and not being Nullsafe annotated).
Therefore now changing this interface from `String?` to `String` is a breaking change for them.

Affected libraries are:
https://github.com/search?q=%22fun+receiveCommand%28%22+%22commandId%3A+String%3F%22+%22args%3A+ReadableArray%22+language%3Akotlin+-org%3Afacebook+-is%3Afork&type=code&p=4

This prevents the breaking change and should be included in 0.76.

Changelog:
[Android] [Fixed] - Undo breaking change on ViewManagerDelegate.kt String params

Reviewed By: cipolleschi

Differential Revision: D64532446

fbshipit-source-id: aac286554ad0e35f557160f900bcbad1acc5930d
2024-10-17 04:45:05 -07:00
Samuel Susla c90ab6e878 use unique_ptr instead of shared_ptr in RCTScheduler (#47055)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47055

changelog: [internal]

no need to use shared_ptr here.

Reviewed By: christophpurrer

Differential Revision: D64464645

fbshipit-source-id: 8947ac8d13322ace3204697047a7582940f98687
2024-10-17 04:42:46 -07:00
Rubén Norte 2d9fe11578 Unify feature flags for event loop (2nd attempt) (#47084)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47084

Changelog: [internal]

This unifies all the feature flags that control the new event loop on RN. Before, we'd have granular flags for different aspects of it. With this diff, we enable the event loop by default with bridgeless, and we introduce a new flag to explicitly disable it in that case if necessary.

When we're ready to clean up this opt-out, we just need to remove the `&& !ReactNativeFeatureFlags::disableEventLoopOnBridgeless()` conditions.

Reviewed By: fkgozali

Differential Revision: D64464902

fbshipit-source-id: d1a0ba38dd4c189c2da905b49de23a821223ac3a
2024-10-17 04:42:37 -07:00
Rubén Norte f92863e815 Add support for feature flags without native implementation (#47059)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47059

Changelog: [internal]

This adds a new configuration for feature flags to preserve their definition only in JavaScript and skip their native API and implementations. This is useful to preserve the API in JavaScript when JavaScript changes progress faster than native changes.

Reviewed By: sammy-SC

Differential Revision: D64464779

fbshipit-source-id: 0af9624daad7bd655172905f8f616d53655cb407
2024-10-17 04:42:37 -07:00
Samuel Susla a72510d586 delete EventBeat's copy ctor and remove default implementation for induce (#47057)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47057

changelog: [internal]

EventBeat should never be copied. Make that explicit.
EventBeat::induce must never be empty, remove the default implementation.

# Goal of this stack:
Centralise event beat logic into EventBeat class inside react-native-github. Subclasses should only override EventBeat::request and EventBeat::induce.

Reviewed By: christophpurrer

Differential Revision: D64291845

fbshipit-source-id: 9265491c33b23d6ec2ccad4e2ea55e2b11211e6a
2024-10-17 04:36:28 -07:00
Samuel Susla e6ba1db5e9 rename AsyncEventBeat to AndroidEventBeat (#47053)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47053

changelog: [internal]

AsyncEventBeat is Android specific, let's rename it to reflect that.

Goal of this stack:
Centralise event beat logic into EventBeat class inside react-native-github. Subclasses should only override EventBeat::request and EventBeat::induce.

Reviewed By: christophpurrer

Differential Revision: D64301829

fbshipit-source-id: cc550ce3836764519c2f4ef849d699ed66226359
2024-10-17 04:36:28 -07:00
Samuel Susla c36806f9e8 pass eventBeat directly into EventDispatcher (#47052)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47052

changelog: [internal]

EventBeat can be constructed in Scheduler and passed to EventDispatcher. This is cleaner than passing down all dependencies and constructing it in place.

# Goal of this stack:
Centralise event beat logic into EventBeat class inside react-native-github. Subclasses should only override EventBeat::request and EventBeat::induce.

Reviewed By: christophpurrer

Differential Revision: D64291401

fbshipit-source-id: ef6d2bdb630767de1dab6052d9d9226c9e1a5f3c
2024-10-17 04:36:28 -07:00
Samuel Susla b1ec76e2ad copy by value in RunLoopObserver ctor (#47051)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47051

changelog: [internal]

copy weak owner instead of using const&. const& is wrong here and hides important information because weak owner is always copied into ivat.

Goal of this stack:
Centralise event beat logic into EventBeat class inside react-native-github. Subclasses should only override EventBeat::request and EventBeat::induce.

Reviewed By: christophpurrer

Differential Revision: D64291515

fbshipit-source-id: 3e74270f03fac121e9f45b0a8ad287ccdb0a059a
2024-10-17 04:36:28 -07:00
Samuel Susla e00002131c refactor EventBeat owner (#47050)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47050

changelog: [internal]

- Rename SchedulerToolbox::asynchronousEventBeatFactory to SchedulerToolbox::eventBeatFactory. There is only one eventBeat, no need to distinguish between sync and async.
- Remove typealias EventBeat::SharedOwnerBox and pass by value instead of const&.

# Goal of this stack:
Centralise event beat logic into EventBeat class inside react-native-github. Subclasses should only override `EventBeat::request` and `EventBeat::induce`.

Reviewed By: christophpurrer

Differential Revision: D64291288

fbshipit-source-id: 96afc56a51677ed9e61b2a662bb968678fa770f7
2024-10-17 04:36:28 -07:00
Nicola Corti 125d01286f Add -Xshare:off for Unit tests (#47066)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47066

This suppresses the warning:
```
Sharing is only supported for boot loader classes because bootstrap classpath has been appended
```

which is not relevant for us.

Changelog:
[Internal] [Changed] - Add -Xshare:off for Unit tests

Reviewed By: cipolleschi

Differential Revision: D64474372

fbshipit-source-id: 67d0a2da47ecd1d4ab906b03515b9a59f2e4f245
2024-10-17 04:33:01 -07:00
Tim Yung 01e210fd28 RN: Support Ref Cleanup in useMergeRefs (#47040)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47040

Updates `useMergeRefs` to support cleanup functions.

Changelog:
[General][Changed] - `useMergeRefs` and components using it (e.g. `Pressable`) now support ref cleanup functions.

Reviewed By: lunaleaps

Differential Revision: D64437947

fbshipit-source-id: b715abfa5b4236c1a7685ac023ff1d0384b6a3a4
2024-10-17 01:28:07 -07:00
Alan Lee 1c002c7b4e bump fbjni to 0.7.0 (#47031)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47031

fbjni 0.7.0 has updates to support 16KB page size

- https://github.com/facebookincubator/fbjni/releases/tag/v0.7.0

Changelog:
[Android][Changed] - Bump fbjni to 0.7.0

Reviewed By: cortinico

Differential Revision: D64372127

fbshipit-source-id: eb2be6aec30ea5051d55d38554c0a912ff579109
2024-10-17 00:43:21 -07:00
Nick Gerleman 6dc64d44f8 Add some unit tests for RCTIsAttributedStringEffectivelySame (#47038)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47038

tsia

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D64433780

fbshipit-source-id: d29f23c3d01cbb6157ba33c682cb1d9e20f12a7a
2024-10-16 23:34:08 -07:00
Tim Yung fa0358a058 RN: Fix useMergeRefs-test.js (#47076)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47076

The Jest unit tests for `useMergeRefs` were incorrectly implemented, leading to missing expected values. The root cause is that the test helpers were rendering to new roots instead of reusing the same root.

This refactors the test helpers to be simpler and easier to debug, and then fixes the bug described above.

Changelog:
[Internal]

Reviewed By: lunaleaps

Differential Revision: D64498741

fbshipit-source-id: f0dd65f89e0c13721e83a8e38a699bc688812a0e
2024-10-16 16:01:10 -07:00
Thomas Nardone 9406a09f87 Add PixelUtil extensions for Int, Long (#46992)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46992

Changelog: [Android][Added] Added PixelUtil extensions for Int and Long

Reviewed By: Abbondanzo

Differential Revision: D64262473

fbshipit-source-id: 49a666662ca260b878bdfa9a81a79dd6a381c879
2024-10-16 13:55:01 -07:00
Edmond Chui c35035ed3c Update debugger-frontend from 0ecc39f...a897db8 (#47067)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47067

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

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

Reviewed By: hoxyq

Differential Revision: D64475173

fbshipit-source-id: 216c88e13c292c4f857e03e135d761e7042a14c0
2024-10-16 12:21:31 -07:00
Sam Zhou 75dc0f7c73 Eliminate last React$AbstractComponent in react-native (#47069)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47069

Use of this internal type will trigger a `internal-type` error in the next version of Flow. This diff eliminates the last use in react native.

Changelog: [Internal]

Reviewed By: panagosg7

Differential Revision: D64479166

fbshipit-source-id: d440a2fbfe88223462ce61252082a2e7381fb4c9
2024-10-16 11:55:49 -07:00
Nicola Corti c867aba2f3 Move BridgelessDevSupportManager to .devsupport package (#46914)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46914

The `BridgelessDevSupportManager` should have lived inside the `.devsupport` package alongside all the other
devsupport related tooling.

It was instead created inside `.runtime` causing a tight coupling with `ReactHostImpl`.
This made it impossible for Frameworks to customize it (i.e. in Expo GO) also because there was a circular
dependency between ReactHostImpl and BridgelessDevSupportManager

In this diff I'm:
1. Breaking the circular dependency by using `ReactHostDevHelper`
2. Updating all the parameters to reference `ReactHost` rather than `ReactHostImpl`
3. Moving BridgelessDevSupportManager to the `.devsupport` package.

This is breaking for users that are manually composing a `BridgelessDevSupportManager` or
that are extending the `ReactInstanceDevHelper`.

- `ReactInstanceDevHelper` has 3 new method which will have to be implemented.
- `BridgelessDevSupportManager` is now living in a different package.

Changelog:
[Android] [Breaking] - Add 3 methods to ReactInstanceDevHelper

Reviewed By: rshest

Differential Revision: D64105790

fbshipit-source-id: 13478fe1a035adb5b0dc83ebb1daad6cfb243881
2024-10-16 11:25:26 -07:00
Edmond Chui ad6a2fa612 Fusebox reload-to-profile refactor (#47060)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47060

Changelog: [internal]

Follow up on feedback from D64077813

 oliver_clean

Reviewed By: hoxyq

Differential Revision: D64469842

fbshipit-source-id: e4639defb01683090823eb6774b0c65e9157ef27
2024-10-16 10:31:15 -07:00
Ruslan Lesiutin f53cd7238c Encapsulate TracingAgent (#46986)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46986

# Changelog: [Internal]

Encapsulate integration with `FuseboxTracer.cpp` into `TracingAgent.cpp`, which will be responsible for handling `Tracing` domain CDP events.

Closer to the top of the stack, more changes will be added to it.

Reviewed By: huntie

Differential Revision: D64249695

fbshipit-source-id: 4adf5973299275e210e7cdf9c816efab881c9daf
2024-10-16 10:14:52 -07:00
Samuel Susla 4e12b86bfc delete fetchImagesInViewPreallocation feature flag (#47056)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47056

changelog: [internal]

Reviewed By: Abbondanzo

Differential Revision: D64464758

fbshipit-source-id: 88b8deacac273b693c4bcdd195cbf46441330b0b
2024-10-16 09:08:28 -07:00
poonamjain96 848471b69f Add test case for set opacity in new arch examples (#47043)
Summary:
Part of this: https://github.com/facebook/react-native/issues/46757
Solves:
- ME2E0004

## 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 ] - Add setOpacity test in new-arch-example

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

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

Reviewed By: cortinico

Differential Revision: D64457441

Pulled By: cipolleschi

fbshipit-source-id: 310270293f5c7ec8a94c0d38fdd0897e4591ec14
2024-10-16 08:33:37 -07:00
antFrancon 6aeca53b3e fix(android): Prevent ArrayIndexOutOfBoundsException in permission check (#47047)
Summary:
This PR addresses a potential `ArrayIndexOutOfBoundsException` in the Android module's permission checking logic.

```diff
- results.length > 0 && results[j] == PackageManager.PERMISSION_GRANTED
+ results.length > j && results[j] == PackageManager.PERMISSION_GRANTED
```

It ensures that we only access the results array when the index `j` is within bounds, preventing crashes due to invalid array access that have been occurring in the production environment.

Here is the Crashlytics dashboard concerning this type of crash on my app last week (react-native 0.75.4 - old arch):
![image](https://github.com/user-attachments/assets/0b7c1a10-39f6-4a17-9eee-4b17986f5b85)

## Changelog:

[ANDROID] [FIXED] - Prevent ArrayIndexOutOfBoundsException in permission check

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

Test Plan:
1. Verify normal permission request scenarios still work on Android:
   - Request a permission (e.g., camera, location)
   - Grant the permission
   - Verify the app functions correctly with the granted permission

2. Monitor production crash reports:
   - Deploy the fix to production
   - Observe a decrease in ArrayIndexOutOfBoundsException occurrences in the permission check logic

Note: As this crash was only observed in production, we'll rely on production monitoring to verify the fix's effectiveness over time.

Reviewed By: rshest

Differential Revision: D64464171

Pulled By: cortinico

fbshipit-source-id: 87beacf7ee749a51665577d05a56cc8d6889d70f
2024-10-16 07:30:30 -07:00
David Vacca 6b67772204 Enable 'useFabricInterop' by default in new architecture (#47017)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47017

Enable 'useFabricInterop' by default in RNOSS

changelog: [Android][Changed] Enable fabric interop by default in new architecture for Android

Reviewed By: cortinico, rshest

Differential Revision: D64340659

fbshipit-source-id: b94421aaf482675dbe8838a97d9968494e4fa75f
2024-10-16 04:37:14 -07:00
Douglas Lowder f673759c83 feat: Add tvOS support to Hermes artifacts (#46865)
Summary:
Adds tvOS to the list of Apple platforms supported by the Hermes artifacts. After this, the React Native TV builds will be able to use the same Hermes artifacts as those used by RN core.

~Added some code in `hermes-utils.rb` so that the Hermes podspec can use a local Maven repo (`/tmp/maven-local`).~

> *Note:* ~This PR should not be merged until the corresponding Hermes PR https://github.com/facebook/hermes/pull/1529 is merged.~ (https://github.com/facebook/hermes/pull/1529 has been merged)

## Changelog:

[iOS][Added] tvOS support for Hermes artifacts

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

Test Plan: - tvOS is also added to the build and test GitHub workflows.

Reviewed By: rshest

Differential Revision: D64461324

Pulled By: cipolleschi

fbshipit-source-id: d63889c60c72519818e7076cd0ab5851791715a1
2024-10-16 03:39:58 -07:00
Edmond Chui 4df224ca6d Fusebox reload-to-profile (Part 2 of 2: JS) (#46905)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46905

Changelog: [General][Added] - Add support for reload-to-profile in Fusebox (Part 2 of 2: JS)

Reviewed By: hoxyq

Differential Revision: D64077813

fbshipit-source-id: a6d3326d8514f49e47074d21d37e00044ad62fd8
2024-10-16 01:27:28 -07:00