Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51858
Creates a new private package for the ESLint rules that are defined in the `facebook/react-native` repository for linting the monorepo itself: `react-native/eslint-plugin-monorepo`
It resides in a new `private/` directory that will be used for all private packages. I plan to move private packages over from `packages/` and `tools/`.
This also eliminates the need for the `eslint-plugin-lint` dependency in open source.
Changelog:
[Internal]
Reviewed By: cortinico
Differential Revision: D76088698
fbshipit-source-id: 697d5d91421cda4ef3f96d0497a96954cd047296
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51880
Updates the `sort-imports` lint rule.
The main change is that it enforces newlines after the last import statement.
Changelog:
[Internal]
Reviewed By: SamChou19815
Differential Revision: D76149902
fbshipit-source-id: 928871655c5de0613b18334d6fc0d71b3a971a18
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51907
changelog: [internal]
fixes a crash that is described by the two tests. The two tests cover both changes made to Differentiator.cpp. If you revert either of the change, a test will crash.
Reviewed By: christophpurrer
Differential Revision: D76231984
fbshipit-source-id: c32ab1851844121095f1dec953befb2e77c83fd4
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51875
This diff raises the logLevel of assertion LegacyArchitecture classes when minimizing of legacy architecture is enabled
Reviewed By: rshest
Differential Revision: D76080325
fbshipit-source-id: 75c92ba7fc54cfbc76bbc2fa3c3dc6a72a376c8f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51876
This diff raises the logLevel of LegacyArchitecture classes when minimizing of legacy architecture is enabled
Reviewed By: cortinico
Differential Revision: D76080324
fbshipit-source-id: 3764c0657b912db81e0dc46b6eb57cbb02b335ba
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51872
This converts to Kotlin and internaline MountingManager.
The only usage in OSS is react-natve-live-markdown:
https://github.com/Expensify/react-native-live-markdown/issues/693
They're using reflection to access Mounting Manager, which they shouldn't.
Other than them, I wasn't able to find meaningful usages of `MountingManager`
Changelog:
[Android] [Breaking] - Convert to Kotlin and internalize MountingManager
Reviewed By: rshest
Differential Revision: D76126338
fbshipit-source-id: 5ab491f86d697a82b8e5b02b031877020dfa3e9e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51836
Currently, `community-cli-plugin` loads the user config and then overrides parts of it - specifically `resolver.resolveRequest` and `serializer.getModulesRunBeforeMainModule`, making it impossible for a user to modify this config.
Instead, treat the CLI's resolver and serializer customisations as "Framework defaults", layered on top of `react-native/metro-config` defaults but beneath a user's `metro.config.js`.
This allows the user to obtain (via `react-native/metro-config`'s `getDefaultConfig`) and extend or override them, if they need to.
This is technically breaking because users who currently have a custom `resolveRequest` or `getModulesRunBeforeMainModule` in their `metro.config.js` will have that config respected from this change, whereas currently they won't have any effect.
Changelog:
[General][Breaking] Community CLI users: user-defined `resolver.resolveRequest` and `serializer.getModulesRunBeforeMainModule` Metro config now takes precedence over CLI defaults
Reviewed By: huntie
Differential Revision: D74811395
fbshipit-source-id: c250caf798fdaedb0822bea3d6e65c0c3ae4d691
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51844
These just redefine the existing `receiveCommand` from the ViewManagerDelegate which already has this codegen'ed
Changelog: [Internal]
Reviewed By: cortinico, rshest
Differential Revision: D75869325
fbshipit-source-id: c8ba482075c2586caf33f46a871b5b5e16fda213
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51890
changelog: [internal]
Fixing possible build failures when targets are built in different context:
- Adding includes to used std functions.
- Using explicit jsi namespace.
- Declaring dependency.
Reviewed By: javache
Differential Revision: D74878821
fbshipit-source-id: 9dfd7ba94651280331be6c9fe6948fce50955589
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51806
Correct the type of args, which is always non-null. This is backwards-compatible as subclasses can override this method with a more permissive nullable type and still be substitutable.
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D75869317
fbshipit-source-id: 8f6c9119140794447eca55be24483a35450d7bb6
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51850
This change refactors the last compose-xcframework step to intgrate with the cli.js script to coordinate the build process.
## Changelog:
[Internal] -
Reviewed By: cortinico
Differential Revision: D76046443
fbshipit-source-id: 4740bb0869c688611a03d5085771aa6222132e7e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51845
This change refactors the build step of SwiftPM to use the cli.js script to coordinate it.
## Changelog:
[Internal] -
Reviewed By: cortinico
Differential Revision: D76046444
fbshipit-source-id: 7aa4ba55e46c2e4502687f035ba1e7bf772b3079
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51848
This change refactors the script by moving the step to setup the repo properly in a separate `setup.js` file.
This allows to simplify the main script by using the cli task.
## Changelog:
[Internal] -
Reviewed By: cortinico
Differential Revision: D76046441
fbshipit-source-id: 1da6f8dabf75640e455fcb2f543164c6a242abe0
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51849
This simple change refactors the code of reactNativeDependencies to have more accurate logging when the step fails in CI
## Changelog:
[Internal] -
Reviewed By: cortinico
Differential Revision: D76046440
fbshipit-source-id: 2a1105285b0b1d5208a99c30d6ec2859bb8a0187
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51846
This change introduces a cli script to simplify handling of tasks when building React Native with Swift PM
## Changelog:
[Internal] -
Reviewed By: cortinico
Differential Revision: D76045574
fbshipit-source-id: 334d0502e781710f3744d9a3585ccfe7f2fa0038
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51847
This change introduces a types.js to add some useful flow types to build React Native with Swift PM.
## Changelog:
[Internal] -
Reviewed By: cortinico
Differential Revision: D76045454
fbshipit-source-id: 352e9f1a2845106c49461c3ac66188f49b520eb3
Summary:
This commit adds support for building XCFrameworks from the prebuild-script
- Added build script to help build xcframeworks
- Added full header file structure
- Added calling the build script from the main prebuild script
TODO: We need to add resources / privacy bundles
## Changelog:
[IOS] [ADDED] - Added building XCFframework from the prebuild script
Pull Request resolved: https://github.com/facebook/react-native/pull/51596
Test Plan: Run prebuild script and verify that XCFrameworks are successfully built.
Reviewed By: cortinico
Differential Revision: D75869879
Pulled By: cipolleschi
fbshipit-source-id: 7da1dfe2bea34966b88bdb0c31bf7c6ada420c57
Summary:
This commit adds building the swift package from the prebuild script:
- Added swiftpackage.js for building the swift package
- Added calling building from the main script
- Added configurable build type from the main script.
- Removed params in jsdoc from the link method
## Changelog:
[IOS] [ADDED] - Added building swift package from the prebuild script
Pull Request resolved: https://github.com/facebook/react-native/pull/51595
Test Plan:
Run prebuild script and verify that the Swift package is successfully built.
Rollback Plan:
Reviewed By: cortinico
Differential Revision: D75865275
Pulled By: cipolleschi
fbshipit-source-id: d4d9f26c817eb15c16f6be52ffa4b9f060e789da
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51840
Bumps the minimum version of Node.js in React Native to the current active LTS release (22.x, upgraded from 18.x which is now out of support).
- CI configurations are reduced from `[22, 20, 18]` to `[24, 22]`.
{F1978909878}
See https://nodejs.org/en/about/previous-releases.
Changelog:
[General][Breaking] - Our new minimum Node version is Node.js 22
Reviewed By: yungsters, cortinico
Differential Revision: D76037015
fbshipit-source-id: b6e4b3ee279a9a93d716a13297420bba73f45250
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51866
We're not really running those tests in OSS. They would require an emulator in OSS CI which
is costly and flaky. I'd rather remove the build logic for them and rely on Fantom for those kind
of tests in the future.
Changelog:
[Internal] [Changed] -
Reviewed By: cipolleschi
Differential Revision: D76050039
fbshipit-source-id: 29789a9c7db5c7108c4536db620d83640819874f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51865
As in 0.81 we're stopping 1st party support for JSC, we can now cleanup the RNTester
flavor for JSC and simplify the setup here.
Changelog:
[Internal] [Changed] -
Reviewed By: rshest
Differential Revision: D76051319
fbshipit-source-id: 79b01cc64af2466a0be47ceaa0cd211cb6b02f53
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51854
AGP 8.10.x comes with a source breaking change:
https://issuetracker.google.com/issues/416890061
This shoudl fix it and unblock us for the 0.81 release.
Changelog:
[Android] [Changed] - Bump AGP to 8.10.x
Reviewed By: huntie
Differential Revision: D76053989
fbshipit-source-id: b0fe19544c79d65002127176f2722cdfd85f0a3c
Summary:
PR https://github.com/facebook/react-native/issues/51078 Implemented finding disabled libraries but the code (below) didn't actually filter any libraries out because destructured name is `undefined`. This pr adds the name to codegenEnabledLibraries so filtering would work.
```js
const libraries = codegenEnabledLibraries.filter(
({name}) => !disabledLibraries.includes(name),
);
```
## Changelog:
[IOS] [FIXED] - Skip codegen for selectively disabled libraries in react-native.config.js
Pull Request resolved: https://github.com/facebook/react-native/pull/51838
Test Plan:
1. Install a library that has the componentProvider field set in the codegen config (for example: react-native-safe-area-context and react-native-screens or see [reproducer](https://github.com/aattola/rn-codegen-exclude))
2. Exclude library with react-native.config.js
3. install pods / run codegen
4. Check that codegen actually excluded the specified dependencies from: `ios/build/generated/ios/RCTThirdPartyComponentsProvider.mm`
Rollback Plan:
Reviewed By: cortinico
Differential Revision: D76044622
Pulled By: cipolleschi
fbshipit-source-id: 9e70c2a263c750edb1ea95305c9e5e178e2ce8d8
Summary:
When building Android in cloud environments, it turns out that in some of the environments, `sdkmanager` is not in any of the paths checked in `packages/react-native/ReactAndroid/hermes-engine/build.gradle.kts`, so the build fails.
I have added the path for the Linux cloud build environments I have been using (EAS).
I have also added the ability to insert a custom value for the path, in case this problem occurs again in future.
## Changelog:
[Internal][Fixed] - Allow more sdkmanager paths in hermes-engine Android build.
Pull Request resolved: https://github.com/facebook/react-native/pull/51829
Test Plan: Tested the changes in CI builds in EAS.
Reviewed By: rshest
Differential Revision: D76117000
Pulled By: cortinico
fbshipit-source-id: 2c8aff1ba4f03dbe77935992a774ed71f85264a3
Summary:
Part of https://github.com/facebook/metro/issues/1480
This PR adds a check in `HMRClient.js` that prevents processing `registerBundle` calls coming from different origin than the one declared in HMR `setup()`.
This is useful in a Module Federation setup, where we have multiple HMRClients present in runtime - when Host loads external remote, the requestURL will have different origin, but it will be processed by the HMRClient from the Host which in turn causes a runtime error.
## 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
-->
[GENERAL] [ADDED] - Process HMR registerBundle calls from the same origin only
Pull Request resolved: https://github.com/facebook/react-native/pull/51821
Test Plan: TBD
Reviewed By: christophpurrer
Differential Revision: D76044353
Pulled By: huntie
fbshipit-source-id: 3928347b1e9a90355d02b87b07fde812479bcb67
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51856
Enables the `enableEagerAlternateStateNodeCleanup` feature flag in the open source React Native renderers that are currently targeting React 19.1, by manually patching them in the React Native repository.
This feature flag has been found to significantly improve memory management of parent alternate fibers in persistent modes (i.e. Fabric), and we want this to be available to open source users of React Native before the next scheduled public version release of React.
For more details about the fix, see: https://github.com/facebook/react/pull/33161
Changelog:
[General][Changed] - Reduces memory usage, by improving memory management of parent alternate fibers. (Previously, a parent fiber might retain memory associated with shadow nodes from a previous commit.)
Reviewed By: rickhanlonii
Differential Revision: D76073900
fbshipit-source-id: 6779ea0862d4a1e25354b12ef3d1363dc12d26cc
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48783
## Overview
This is the final boss of the new owner stacks feature. With owner stacks, we don't need to parse message strings to find the component stack for logbox. Instead, we can access the component stack directly with `captureOwnerStack`.
This means we don't need to install the LogBox console.error patch and can greatly simplify the process of handling errors and make it more reliable.
To do this, we rely only on adding LogBox to the ExceptionManager:
- `reactConsoleErrorHandler` -> `LogBox.addConsoleLog`
- `reportException` -> `LogBox.addException`
Changelog:
[General][Fixed] - Remove LogBox patch, de-duplicating errors
## Benefits
As a side effect, this removes a lot of duplicate errors. For example, currently if a component throws, you get 2 errors:
{F1974436906}
After this, there's just the one you expect:
{F1974436908}
## Followups
After this lands and doesn't need reverted for some reason, we can delete a ton of code from logbox for finding and detecting stacks from errors.
Reviewed By: javache
Differential Revision: D68380668
fbshipit-source-id: 68112f1e3992fada4d6aaffdf9bd618ce1834f7b
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51843
Changelog: [Internal]
To avoid corrupting the React fiber tree when committing from multiple threads this diff only updates shadow node references within the fiber tree for commits originating from React.
This guarantees that during the update of the references no React render will start or is running, making the update of the shadow node reference safe to execute.
S527994
Reviewed By: sammy-SC
Differential Revision: D76043845
fbshipit-source-id: bfcbeaae7fc8b976a1c2db6682330cef9ca25ab8
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51725
This change builds upon the focus/blur portion showcased in ViewExample but showcases several more components all in one spot. This can be shared with additional platforms or expanded to include more component examples like Image, but the goal is to target Android and not distract from the primary use cases.
Changelog: [Internal]
Reviewed By: NickGerleman
Differential Revision: D75747410
fbshipit-source-id: 7d53366d9f32192ca6b3da45dd127836fb6efdf6
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51724
Moves focus change listener logic from `ReactViewManager` to `BaseViewManager` so all view managers that extend the class can get focus/blur event dispatching for free. This does so by applying event listeners where `addEventEmitters` is called, so any extending classes must try to call `super.addEventEmitters` or implement it themselves. In the case of TextInput, this logic is re-implemented because the component emits an additional event when the text input is blurred and I wanted to avoid duplicate calls to get the event emitter for the view instance.
In addition, I've added logic and a test case to ensure that any preexisting focus change listeners set on the view instance are called. There can only ever be one focus change listener tied to a view instance, so this ensures that ones created during view instantiation are retained. However, this does not guarantee that events are emitted for downstream users who overwrite the focus change listener later in the view's lifecycle (i.e. in response to a prop change or an extending view manager that doesn't call `super.addEventEmitters`). There is no clean way to enforce that the `BaseViewManager` focus change listener is always set without changing the generics and introducing a significant breaking change.
Changelog: [Android][Added] - Adds support for onFocus/onBlur event dispatching logic to all native views that implement `BaseViewManager`
Reviewed By: NickGerleman
Differential Revision: D75579321
fbshipit-source-id: 02e1e6d0e78e9d05e4ec5bb59789f3097b73b3f8
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51791
On iOS the <Image> shadow node was expecting a layout call for every clone. With `passChildrenWhenCloningPersistedNodes` <Image> components may have the image source updated without layout being called on it due to the re-use of the previous layout data thanks to the improved handling of layout invalidation.
This diff triggers the image request as soon as possible if the cloned shadow node has a clean layout. The request will be made as soon as the image manager is set on the shadow node.
Changelog: [iOS][Fixed] - Fix RCTImageComponentView image loading after source props change with no layout invalidation
Reviewed By: NickGerleman, sammy-SC
Differential Revision: D75919671
fbshipit-source-id: 8b92a9c63b6ff4a62c7eb7b0dbe18dd2be989b81
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51827
TextLayoutManager has an optimization today, where it reuses a scratch TextPaint throughout layouts.
This is not safe in Facsimile, since the paint is included as part of `Layout`, and the `Layout` escapes the TextLayoutManager, to later be drawn. I.e. every `PreparedLayoutTextView` right now is sharing this same scratch Paint.
This change makes it so that we only ever use a scratch paint for the purpose of measurements, where the layout is short-lived.
A simpler approach could be to just abandon the scratch TextPaint, since they do not seem wildly expensive at a glance (though not trivial).
Changelog: [Internal]
Reviewed By: rshest
Differential Revision: D75987605
fbshipit-source-id: 3fe3519c6164828a25cb4e2b0ee6eded73695a95