Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47088
Whe migrating this interface to Kotlin we've subtly introduced a breaking change which is causing a lot of breakages in the ecosystem.
This is forcing users to do:
```
// Before
reactContext.getNativeModule(UIManagerModule::class.java)!!.eventDispatcher
// After
reactContext.getNativeModule(UIManagerModule::class.java)!!.getEventDispatcher()
```
This reverts this breaking change.
Plus the method had a generic parameters which was completely unnecessary so I'm removing it.
Changelog:
[Android] [Fixed] - Undo breaking change on UIManager eventDispatcher accessor
Reviewed By: cipolleschi
Differential Revision: D64533594
fbshipit-source-id: c4f9a36993a22839fae90fb239f883305422ecec
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
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
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
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
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
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
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
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
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47104
In https://github.com/facebook/react-native/pull/46082, the lint configuration for `lint/sort-imports` was accidentally removed.
This has happened on more than one occasion in the past. In order to prevent this from happening again in the future, I'm also adding a Jest integration test to verify that this lint rule is enabled in the `eslintrc.js` configuration.
Changelog:
[Internal]
Reviewed By: robhogan
Differential Revision: D64547410
fbshipit-source-id: ec4f14aff140691b644189dfa3116a3d39285f80
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
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
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
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
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
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
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

Reviewed By: tdn120
Differential Revision: D64495941
Pulled By: lunaleaps
fbshipit-source-id: 6ab835e2934b87ec3ac64cf0aebd8dcb58cd0da1
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47087
In the repo, we don't have a `build-apple-framewroks.sh` file, but we do have a `build-apple-framewrok.sh` file, with no ending `s`
## Changelog:
[Internal] - Fix CI cache key
Reviewed By: cortinico
Differential Revision: D64531456
fbshipit-source-id: 05c104390b875eeef2cf15f8a30c8672cfc9b61d
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
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
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
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
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
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
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
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
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
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
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
Summary:
After examining Hermes artifacts built after merging of https://github.com/facebook/react-native/issues/46865 , it was apparent that tvOS frameworks were missing from the Hermes universal framework generated by CI.
I went back and discovered additional steps that need to be added to the `build-hermes-macos` action to make CI work correctly.
## Changelog:
[Internal][Fixed] add required steps to build tvOS in build-hermes-macos action
Pull Request resolved: https://github.com/facebook/react-native/pull/47073
Test Plan: After merging, Hermes artifacts generated by CI should contain the missing tvOS bits.
Reviewed By: rshest
Differential Revision: D64528911
Pulled By: cipolleschi
fbshipit-source-id: 61db3e154767830a4726d7ceeec229a4af30d247
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
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