Summary:
Updates all `metro*` dependencies to the latest `^0.82.0`.
The breaking changes in this release apply only to frameworks and integrators.
This update brings `package.json#exports` resolution enabled by default, and lazy hashing for much faster Metro startup.
Release notes:
https://github.com/facebook/metro/releases/tag/v0.82.0
Changelog:
[General][Changed] Update Metro to ^0.82.0
Reviewed By: vzaidman
Differential Revision: D70778791
Summary:
acquireWakeLockNow was static before but wasn't marked as static in https://github.com/facebook/react-native/commit/9afad527b831ec0c5d50e88daacbaacbc476d478 when changing code to Kotlin.
This breaks react-native-firebase but I've submitted the bug report there as I guess it might be fixed there too.
## Changelog:
[ANDROID] [FIXED] - Marked acquireWakeLockNow as static
Pull Request resolved: https://github.com/facebook/react-native/pull/49875
Test Plan: No tests as it reverts the broken change
Reviewed By: rshest
Differential Revision: D70773675
Pulled By: javache
fbshipit-source-id: d7363702dfec078b7e6d2693d05b8ab87e818522
Summary:
This pull request includes a minor change to the `React-cxxreact.podspec` file in the `ReactCommon/cxxreact` package. The change corrects a typo in the `HEADER_SEARCH_PATHS` configuration.
## Changelog:
[IOS] [FIXED] - Corrected the path from `"$(PODS_ROOT)/fas_float/include"` to `"$(PODS_ROOT)/fast_float/include"` in the `HEADER_SEARCH_PATHS` configuration.
Pull Request resolved: https://github.com/facebook/react-native/pull/49879
Reviewed By: rshest
Differential Revision: D70773742
Pulled By: javache
fbshipit-source-id: 0823732bf45c8c17ee7d4c0c3542be5c286445ba
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49873
In the old architecture, when we were passing a `null` value as a parameter in a function that accepted nullable parameter, the null value was mapped to `nil` on iOS.
After my changes in [d4236791e2](https://github.com/facebook/react-native/commit/d4236791e238a614d2fadf5c5659874d983ab029), in the New Architecture, through the interop layer, legacy modules were receiving an `NSNull` object instead of nil.
This was breaking those modules which started crashing or observing undesired behavior.
This change fixes the issue by making sure that, in those cases, a `nil` value is passed.
Note that nested objects in the old architecture were correctly receiving NSNull, so nested objects were behaving correctly already.
## Changelog:
[iOS][Fixed] - Properly pass `nil` for nullable parameters instead of `NSNull` for legacy modules
Reviewed By: javache
Differential Revision: D70723460
fbshipit-source-id: 384f48b6dbb3f54c369b31b6d2ee06069fa3591c
Summary:
Fixes https://github.com/facebook/react-native/issues/49819 . Details about how the issue was introduced in the issue description.
bypass-github-export-checks
## Changelog:
[IOS] [FIXED] - Fixed: extraModulesForBridge callback not called when New Architecture enabled
<!-- 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/49849
Test Plan:
Without the change:
1. Open `packages/rn-tester` project
2. In `AppDelegate.mm`, implement `extraModulesForBridge` and add a breakpoint / output something
3. Run the app in iOS <-- Verify that the method is not executed
With the change:
1-3. Same as above <-- verify that the method is called correctly
> [!NOTE]
> As far as I could tell, there is no test suite for this specific codepath, so I didn't write a test for this change. Happy to write one if someone can guide me a little bit.
Reviewed By: rshest
Differential Revision: D70724196
Pulled By: cipolleschi
fbshipit-source-id: cc08798d08cdbd6883347810c7d2697c358770fb
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49850
`RCTUIImageViewAnimated` has some bugs around reuse.
1. Recycling will set `image` to null, which will no-op on comparison to `self.image`, but `self.image` is always null when the image is animated, because `RCTUIImageViewAnimated` handles rendering the frames itself. This means we don't properly do things like invalidating the DisplayLink when the image is first recycled.
2. If we ever set superclass image to nil, we make some change to the underlying CALayer, which causes the content to remain black, even though we customize our own `displayLayer`. Diffing layer descriptions, we seem to afterward have a `contentsMultiplyColor` and `contentsSwizzle` on the layer that aren't public.
The solution I have in this diff is to, instead of drawing layers ourselves, update backing UIImage image to the frame. I think this would fix some other bugs as well, like tintColor not applying to animated images. My guess is that this shouldn't add too much extra work, since `UIImageView` should just be propagating the `UIImage` to the layer in a same way that we were before. This same bug may have also been possible before when switching between animated and non-animated image sources I think.
Changelog:
[iOS][Fixed] - Fix Recycling of Animated Images
Reviewed By: cipolleschi, joevilches
Differential Revision: D70668516
fbshipit-source-id: f1127da3e03ebab2b6f7584ba492b3e13448c13b
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49858
`prepareToRecycleView` returns nullable, since we may decide a view is not recyclable. We should respect that and return the view returned by super.
Changelog: [Internal]
bypass-github-export-checks
Reviewed By: fabriziocucci
Differential Revision: D70696246
fbshipit-source-id: a8e12320611a3b6a3d05353e4b7556c4da416aea
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49851
Android doesn't allow to mount a view that already has a parent. View recycling removes all children from a view. But if some views don't support recycling, they'll keep a reference to their children. Children being recycled will cause an exception when being mounted.
This diff removes the view from its parent when it is being recycled. This guarantees that whatever the parent, the view can be mounted after being recycled.
bypass-github-export-checks
Changelog: [Internal]
Reviewed By: sammy-SC
Differential Revision: D70672120
fbshipit-source-id: 023d8fb48982d6d9ae7f9c537f7f2bb21cf15066
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49837
Bootstraps the `NetworkReporter` API and `jsinspector_network` library. This will form the common C++ logic for Network Inspection in React Native DevTools.
Changelog: [Internal]
Reviewed By: hoxyq
Differential Revision: D70554862
fbshipit-source-id: 862e255f61e21871c35b1a848caec3f34e843823
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49816
Previously, we had different versions of "debug" installed in different packages, mostly because of messed up `yarn.lock` entries.
Also, updated the package, receiving some performance improvements (no relevant breaking changes).
Changelog:
[General][Internal] update and dedupe the npm package "debug"
Reviewed By: huntie
Differential Revision: D70402368
fbshipit-source-id: 5e21bc6d92e0cb45ac1d862f100ef6dc0f21dbc1
Summary:
`jscodeshift` is only used in one module (`src/generators/components/GenerateViewConfigJs.js`, but depends on a rather complex dependency chain and has a rather large maintenance burden relative to what it's used for and the value it adds in the codebase.
Since the `GenerateViewConfigJs` module creates simple templates, using `babel/core` (and implicitly `babel/template` and `babel/types`) is a lot simpler and changes little code. The only change this introduces to the output are formatting changes (`singleQuote` and `trailingCommas` options are discarded). The code is otherwise functionally identical.
## Changelog:
[INTERNAL] [CHANGED] - Drop jscodeshift dependency from react-native/codegen
Pull Request resolved: https://github.com/facebook/react-native/pull/49641
Test Plan:
This was tested against a React Native build with the `react-native/babel-plugin-codegen` plugina active and using the snapshots in the repo itself. While the snapshots have changed in formatting, none of the outputs change the code's AST.
<details>
<summary>
Example output from <code>react-native/babel-plugin-codegen</code> to supplement the snapshot tests
</summary>
This is the example bundling output of `AndroidSwipeRefreshLayout`. This demonstrates that both the view config output and the `Commands` export continue to be generated correctly.
```js
var _interopRequireDefault = require(_dependencyMap[0]);
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.__INTERNAL_VIEW_CONFIG = exports.Commands = undefined;
var _codegenNativeCommands = _interopRequireDefault(require(_dependencyMap[1]));
var _codegenNativeComponent = _interopRequireDefault(require(_dependencyMap[2]));
var React = _interopRequireWildcard(require(_dependencyMap[3]));
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
var NativeComponentRegistry = require(_dependencyMap[4]);
var _require = require(_dependencyMap[5]),
ConditionallyIgnoredEventHandlers = _require.ConditionallyIgnoredEventHandlers;
var _require2 = require(_dependencyMap[6]),
dispatchCommand = _require2.dispatchCommand;
var nativeComponentName = 'AndroidSwipeRefreshLayout';
var __INTERNAL_VIEW_CONFIG = exports.__INTERNAL_VIEW_CONFIG = {
uiViewClassName: "AndroidSwipeRefreshLayout",
directEventTypes: {
topRefresh: {
registrationName: "onRefresh"
}
},
validAttributes: {
enabled: true,
colors: {
process: (req => 'default' in req ? req.default : req)(require(_dependencyMap[7]))
},
progressBackgroundColor: {
process: require(_dependencyMap[8]).default
},
size: true,
progressViewOffset: true,
refreshing: true,
...ConditionallyIgnoredEventHandlers({
onRefresh: true
})
}
};
var _default = exports.default = NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG);
var Commands = exports.Commands = {
setNativeRefreshing(ref, value) {
dispatchCommand(ref, "setNativeRefreshing", [value]);
}
};
```
</details>
Reviewed By: yungsters
Differential Revision: D70580474
Pulled By: elicwhite
fbshipit-source-id: 85bc6578b685f19a1565ded8d7e56dc2a1ff1999
Summary:
It seems that if we update the scroll state when the state wrapper is null we can get into an out of sync state.
I've replicated the issue in HelpCenter and confirmed with a video this seems to be the case (i.e. when gazing on some cards, their corresponding frame is incorrect)
https://www.internalfb.com/intern/px/p/6xWgl
NOTE: I have accidentally stumbled upon this fix but I could really use a review from someone who has more context around the `ReactScrollViewHelper` because this change might have bigger implications I'm not aware of!
Changelog:
[Android][Fixed] - Fix occasional syncronization issue in ScrollView when rendering dynamic content with content offset
Commits affecting the React Native open source repository must have a changelog
entry in the commit summary. Every React Native release has almost 1000 commits,
and manually categorizing these commits is very time consuming.
In your diff summary, please add a `Changelog:` entry using the format:
The "Category" field may be one of:
- **Android**, for changes that affect Android.
- **iOS**, for changes that affect iOS.
- **General**, for changes that do not fit any of the other categories.
- **Internal**, for changes that would not be relevant to developers consuming
the release notes.
The "Type" field may be one of:
- **Breaking**, for breaking changes.
- **Added**, for new features.
- **Changed**, for changes in existing functionality.
- **Deprecated**, for soon-to-be removed features.
- **Removed**, for now removed features.
- **Fixed**, for any bug fixes.
- **Security**, in case of vulnerabilities.
If your change does not modify React Native's public interface, you can use:
Changelog: [Internal]
For more details, please read the wiki: https://fburl.com/react-native/changelog
Reviewed By: javache
Differential Revision: D70484547
fbshipit-source-id: c314b958eeed4dd96755539f5bbfb8f03e17a525
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49841
Changelog: [internal]
This effectively reverts D62962341 / https://github.com/facebook/react-native/pull/46563 as the experiments didn't provide the expected wins and we don't have bandwidth to iterate on this.
Reviewed By: rshest
Differential Revision: D70622429
fbshipit-source-id: c53c9437448c0a7be8f5b4f04d6369efbd99105a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49810
Changelog:
[Internal]
Migrated StyleSheet namespace content to StyleSheetExport.js to recreate it by importing * as StyleSheet, which aligns with TS namespace definition. Added .flow files that specify base type declarations and will be digested by the flow tooling.
Reviewed By: huntie
Differential Revision: D70391322
fbshipit-source-id: dd974ef282cb984a1e57d5732e3b5bdab6db4564
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49836
We were passing the path to the `RegularFile` instead of the `PublishingArtifacts` to the gradle script.
cortinico why this is not checked at build time? This should be a typing issue that should be caught at build time, also during the test-all jobs, not just when the nightly run...
## Changelog:
[Internal]
Reviewed By: cortinico
Differential Revision: D70617638
fbshipit-source-id: 67ff1aea2bd827fb110db7a0d2f3651b88a1e8cc
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49835
The implementation of moduleProviderForName is slightly off.
This method was supposed to replace the previous ternary expression and to enhance with the module provider call.
The ternary expression used to be
```
!RCTTurboModuleInteropEnabled() || [self _isTurboModule:moduleName] ? [self _provideObjCModule:moduleName] : nil
```
However, as you can see from the current implementation, instead of calling `RCTTurboModuleInteropEnabled()` we are calling `RCTTurboModuleEnabled()` which is clearly a mistake.
On top of that, I'm also updating the guard around the `getModuleProvider` selector as it was bypassing the other checks, and that's wrong.
## Changelog:
[Internal] - Fix moduleProviderForName method
Reviewed By: RSNara
Differential Revision: D70569552
fbshipit-source-id: ed4055da9ea385ed10323ed8d7a8772010b3a105
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49823
Introduce LegacyArchitectureLogger class, which provides logging functionality to help track and debug usage of legacy architecture components when an app is running on the new architecture. The data provided by this class will help identify classes and methods that are still being used in the new architecture when they shouldn't.
changelog: [Internal] Internal
Reviewed By: rshest
Differential Revision: D70543605
fbshipit-source-id: 56262170c03bb0fd375b8dc3cb34a7c15a69a810
Summary:
Benchmark to test changes from https://github.com/facebook/react-native/issues/49449
Might be nice to have some version of this in the repo.
## Changelog:
[INTERNAL] [ADDED] - Setup a Macrobenchmark for RNTester
Pull Request resolved: https://github.com/facebook/react-native/pull/49486
Test Plan:
### Methodology
Picked various JS file from websites (facebook, instagram) to artificially grow RN tester bundle somewhat realistically. The files are required lazily from a button press callback to simulate the code being included, but not executed, as it would be in a large app that uses lazy requires for the different screens.
I've also made the RN tester screens lazy so all their code is not loaded initially. This is more representative of real apps. Note this is implemented in a hacky way just for the purpose of this test. It would actually be nice to implement this properly.
The tests were made using low end device Samsung Galaxy A03s.
### Compression ON with 10.5 mb bundle
#### Peak allocated memory
60.9 mb
#### ReactInstance.loadJSBundler
148.64 ms
#### Benchmark
timeToFullDisplayMs min 1,825.0, median 1,911.1, max 1,994.8
timeToInitialDisplayMs min 834.9, median 860.9, max 903.9
#### APK
Size: 22.9 mb
Download size: 14.5 mb
### Compression OFF with 10.5 mb bundle
#### Peak allocated memory
51.5 mb
#### ReactInstance.loadJSBundler
946 us
#### Benchmark
timeToFullDisplayMs min 1,752.8, median 1,827.2, max 1,977.5
timeToInitialDisplayMs min 837.7, median 881.3, max 937.2
#### APK
Size: 28 mb
Download size: 14.5 mb
Reviewed By: rshest
Differential Revision: D70002286
Pulled By: cortinico
fbshipit-source-id: 436597f439ba244649373870c1facefdb12297d9
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49813
Making use of the recently standardised `REACT_NATIVE_DEBUGGER_ENABLED` preprocessor flag, conditionally swap out `HostAgent` for a stub in production (non dev, non profiling) builds. This uses the same private implementation idiom as `HermesRuntimeTargetDelegate`.
This results in a **42.2kiB** size reduction (uncompressed) in production builds, due to excluding the CDP agent components of `jsinspector-modern`.
- Intentionally, we're gating just this logic, rather than several outer integration points/native bindings for `jsinspector-modern`. This is for predictability and maintenance — the Fusebox subsystem is always loaded/bound, but can fork to an empty implementation.
{F1975625351}
Changelog: [Internal]
Reviewed By: hoxyq
Differential Revision: D70495853
fbshipit-source-id: 00253ac71444819a917a3781efe38365acb91e85
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49786
Most of these call-sites are only used for exceptional scenarios, so we can just rely on std::to_string and do string concatenation. For a few others that may be more perf-sensitive, I switched over to `snprintf`.
Changelog: [Internal]
Reviewed By: sammy-SC
Differential Revision: D70402439
fbshipit-source-id: 3b90ebb13a7bf1c6cf30722ef636e5e8498a5b26
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49815
The pull to refresh component props's casting is imprecise.
This change uses the more precise type for the props.
## Changelog:
[Internal] - cast props to `PullToRefreshViewProps`
Reviewed By: sammy-SC
Differential Revision: D70559080
fbshipit-source-id: c42d3d41a22683a3392813c2af25828781a68401
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49795
# Changelog: [Internal]
I've been able to reliably and consistently record samples with an interval between 2 consecutive ones to be ~0.1-0.2ms, lets bump the sampling frequency to have more frames.
On Windows, Hermes Sampler peaks at ~500Hz, so this won't have much effect.
Reviewed By: huntie
Differential Revision: D70395983
fbshipit-source-id: 9a9e619d75096a3ee75e0e1a2f8b8fff33130268
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49794
# Changelog: [Internal]
Before, we would store all User Timings and Timeline Events in the PerformanceTracer's buffer, and then add Profile event to it as well.
On larger apps, the amount of events buffered could reach ~100k, which inevitably would cause OOM.
With this approach, we will flush out buffered events from PerformanceTracer first, then do JavaScript Profile serialization, then send it over CDP straight away.
Reviewed By: huntie
Differential Revision: D70395982
fbshipit-source-id: 2c17abba421fa9c4afc4d4ca36afd98b1db50905
Summary:
Added a new template `ReactNativeVersion.kt-template.js` to be used to generate the Kotlin template for Android. Updating also the set-rn-artifacts-version script to use this template instead of the Java one.
## Changelog:
[INTERNAL] - Migrate ReactNativeVersion Android template to Kotlin
Pull Request resolved: https://github.com/facebook/react-native/pull/49758
Test Plan:
```bash
yarn test-android
yarn android
node ./scripts/releases/set-version.js 1000.0.0
```
Reviewed By: huntie, rshest
Differential Revision: D70486775
Pulled By: cortinico
fbshipit-source-id: 5dd1e0e2ecf4d848dc24e6c47df243a1259ab559
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49751
fast_float promises significant improvements in float parsing performance and is already what's being used in folly internally. Unifying all percentage parsing on the new css parser logic, which can use fast_float internally.
Changelog: [Internal]
Reviewed By: rshest
Differential Revision: D70392268
fbshipit-source-id: 56147e5478d008bc2c34579df035ec7acf8744bb