Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54349
Added comprehensive KDoc documentation to the ComponentNameResolverBinding object and its JNI method for installing component name resolvers into the JavaScript runtime.
changelog: [internal] internal
Reviewed By: lenaic
Differential Revision: D85926888
fbshipit-source-id: 253577d4c5d48bee22acb5666680becd4e632879
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54345
Added comprehensive KDoc documentation to the `FloatUtil` class and its public methods to improve code readability and developer experience.
The documentation explains:
- The purpose of epsilon-based floating-point comparison and why it's necessary
- The role of the EPSILON constant in determining equality
- Special case handling for NaN values (both considered equal when both are NaN)
- Null value handling in the nullable overload
- Method parameters and return values
This documentation will help developers understand the rationale behind using this utility instead of direct float equality comparisons, which can be unreliable due to floating-point precision issues.
changelog: [internal] internal
Reviewed By: lenaic
Differential Revision: D85923748
fbshipit-source-id: d054099de3d9903801aadca4cfcd3127bb6d5297
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54360
## Changelog:
[General] [Fixed] - Fixing an issue with the error LogBox formatting on windows causing text to wrap
Reviewed By: rickhanlonii, yannickl
Differential Revision: D76845667
fbshipit-source-id: 4b1ce705396f9818cbe9be80d521478b5eba632b
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54357
Changelog: [Internal] - Ignore whether ScrollView enables subview clipping and just use the drawing rect for forwarding a clippingRect for VirtualView
Reviewed By: yungsters
Differential Revision: D85817030
fbshipit-source-id: e89298d106ec993ce1ca63131da002e0685c34dd
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54353
Changelog: [internal]
We have support for the network track in performance traces so we no longer need this custom integration.
Reviewed By: huntie
Differential Revision: D85946500
fbshipit-source-id: 4efa132a6524af6595ddf9f8c2b5651959fa1f94
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54354
Changelog: [internal]
This just renames the tracks for network, etc. to go under a "⚛ Native" track group.
Reviewed By: huntie
Differential Revision: D85946501
fbshipit-source-id: f7ea65bfd84ed4965749f7e22091bcaff38a5bc3
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54355
Changelog: [internal]
Small refactor to make sure profiling timespans don't break if there's an exception in one of the listeners.
Reviewed By: huntie
Differential Revision: D85951560
fbshipit-source-id: 162672a7e644893f46a3b0100284bc4125a83757
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54266
Introduces the concept of **Performance Issues**, an experimental performance signals concept for React Native.
**Design**
Performance Issues are an **experimental** user space API via the User Timings `detail` object.
```
performance.measure({
start,
end,
detail: {
devtools: {
...
},
rnPerfIssue: {
name: 'React: Cascading Update',
severity: 'warning', // 'info' | 'warning' | 'error',
description:
'A cascading update is a update that is triggered by a previous update. This can lead to performance issues and should be avoided.',
learnMoreUrl:
'https://react.dev/reference/dev-tools/react-performance-tracks#cascading-updates',
}
}
});
```
When `rnPerfIssue` is present, we eagerly report an the event over CDP, regardless of an active performance trace, via the `"__react_native_perf_issues_reporter"` runtime binding.
**This diff**
- Updates the V2 Perf Monitor UI (Android) to display Performance Issues as a count.
- (UI parts of this diff, including `HostTarget::installPerfIssuesBinding` are reinstated from the previous INP design, removed in D82208400).
Changelog: [Internal]
Reviewed By: hoxyq
Differential Revision: D85448199
fbshipit-source-id: 0cee0eff275219fa46ccf788a6208889d3a0506e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54265
Introduces the concept of **Performance Issues**, an experimental performance signals concept for React Native.
**Design**
Performance Issues are an **experimental** user space API via the User Timings `detail` object.
```
performance.measure({
start,
end,
detail: {
devtools: {
...
},
rnPerfIssue: {
name: 'React: Cascading Update',
severity: 'warning', // 'info' | 'warning' | 'error',
description:
'A cascading update is a update that is triggered by a previous update. This can lead to performance issues and should be avoided.',
learnMoreUrl:
'https://react.dev/reference/dev-tools/react-performance-tracks#cascading-updates',
}
}
});
```
When `rnPerfIssue` is present, we eagerly report an the event over CDP, regardless of an active performance trace, via the `"__react_native_perf_issues_reporter"` runtime binding.
**This diff**
- Adds a `perfIssuesEnabled` feature flag.
- Initial implementation of the above API.
- Initially reports a "Cascading Render" issue, aligning 1:1 with the corresponding React performance track event (note: to be added in the React codebase, see https://github.com/facebook/react/pull/34961).
This feature is gated by the `perfMonitorV2Enabled` feature flag.
Changelog: [Internal]
Reviewed By: hoxyq
Differential Revision: D85448200
fbshipit-source-id: e5aed5138682331e1cd3a713a5f09fb6745138bc
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54343
Fixed NotWrittenPrivateField lint warnings in ReactHorizontalScrollView.java by marking three private static fields as final:
- DEBUG_MODE: Changed from `private static boolean` to `private static final boolean`
- TAG: Changed from `private static String` to `private static final String`
- NO_SCROLL_POSITION: Changed from `private static int` to `private static final int`
These fields are initialized once and never modified, making them compile-time constants. Marking them as final follows Java best practices and prevents potential issues with Redex code optimization.
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D85904890
fbshipit-source-id: f83a19392a2418d8415936421f1e021316643056
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54342
`-Wswitch-enum` was introduced in 2024 and is beneficial because it will err when switch statement is missing a case for an enum, even with `default:` present. This helps alert developers when they add an enum value of all the switch statements that need updating.
These diffs are to help progress the codebase so that we can enable `-Wswitch-enum` by default in `fbobjc`
## Changelog:
[General] [Fixed] - Add missing value to switch for `-Wswitch-enum` builds
Differential Revision: D85835952
fbshipit-source-id: e56c45895a63325e565315a39ea59df769c4a3ad
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54325
Apps that override ScrollView may need to customize the auto scroll behavior on focus. This adds a protected method for apps that override ReactScrollView to customize focus behaviors.
## Changelog
[Internal]
Reviewed By: joevilches
Differential Revision: D85779339
fbshipit-source-id: 1ba978ed14ceb224ddc1d0da97727ff9702972e7
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54262
Similar to `performance.measure()`, Chrome is adding an optional `detail` arg to `console.timeStamp`. Here we implement this for React Native, by direct passing to the `"TimeStamp"` trace event args.
[`console.timeStamp()`](https://developer.mozilla.org/en-US/docs/Web/API/console/timeStamp_static) remains an experimental, non-standard API.
Changelog: [Internal]
Reviewed By: hoxyq
Differential Revision: D85437162
fbshipit-source-id: 36f5f6207cf205df5a216bde95013ea9540fc082
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54323
Changelog: [internal]
We no longer need to lazily load these modules, because they're always used now.
Reviewed By: lunaleaps
Differential Revision: D85782126
fbshipit-source-id: 263eb234558b90d9cf5c6d55bccb39eb8d1c6a48
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54321
Changelog: [internal]
Just moving some tests from `ReactFabricPublicInstance` to `ReactNativeElement` now that they're only used for that class.
Reviewed By: lunaleaps
Differential Revision: D85782130
fbshipit-source-id: 1445f61df2cbd691e09187b3b122032ad941cd67
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54320
Changelog: [internal]
This class is no longer used after we shipped DOM APIs.
Reviewed By: lunaleaps
Differential Revision: D85782129
fbshipit-source-id: 7ffa33aa1bade777d2b3fb7ae8b7c136376983a7
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54322
Changelog: [internal]
This just cleans up the feature flag, which is set to `true` by default and it's been enabled in `stable` already.
Reviewed By: lunaleaps, yungsters
Differential Revision: D85782127
fbshipit-source-id: 0a6174708066cfe597b4c6dbc8bb33829c6155e9
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54324
Changelog: [General][Added] - Enable Web Performance APIs
This promotes the Web Performance APIs from canary to stable.
Reviewed By: cipolleschi
Differential Revision: D85783108
fbshipit-source-id: 8d8b4565f28dc20d63e677c01366f4f37d5c46e4
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54328
changelog: [internal]
makes debugging easier if there is name of command.
Reviewed By: christophpurrer, javache
Differential Revision: D85784113
fbshipit-source-id: 14f89ea8b8401dce2dc84d14caaecc6cacda04b2
Summary:
We saw this error while integrating changes in react native windows
https://github.com/microsoft/react-native-windows/issues/15292
Fixed type consistency in cloneMultipleRecursive by using size_t for loop iterator to properly match vector size type, improving type safety when iterating over children nodes.
## Changelog:
[GENERAL][FIXED] - Use size_t instead of int for vector iteration in cloneMultipleRecursive
<!-- Help reviewers and the release process by writing your own changelog entry.
Pick one each for the category and type tags:
|GENERAL|FIXED|- Message
For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
Pull Request resolved: https://github.com/facebook/react-native/pull/54318
Reviewed By: christophpurrer
Differential Revision: D85800905
Pulled By: javache
fbshipit-source-id: 2fdb539e1c9af56eebdd5c7a900fa0e697bcab3a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54237
Before we were adding a single pixel for the stretchable area. in RCTViewComponentView we calculate what percentage is 1 pixel from the entire image to create the unit rectangle:
```
CGRect contentsCenter = CGRect{
CGPoint{imageCapInsets.left / imageSize.width, imageCapInsets.top / imageSize.height},
CGSize{(CGFloat)1.0 / imageSize.width, (CGFloat)1.0 / imageSize.height}};
```
However sometimes when dividing `1.0 / imageSize.width` we would get a big enough float that causes a rounding error essentially having part of the border bleed into the stretchable region.
The easiest way to fix this is give the stretchable region a little more space so to prevent the bleeding.
We can do this by rounding the edgeInsets that give the border area its size
The alternative is some shockingly complex math to appropriately calculate the most convenient stretchable area size
Changelog: [Internal]
Reviewed By: cipolleschi
Differential Revision: D85260693
fbshipit-source-id: 50eaba2189f3ff524be730211f8d19023522c68a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54228
## Issue
When prefetching images with the `resizeMethod` prop set, there's a brief period of time where the image has not laid out and the dimensions are 0x0. Since `ImageSource.h` only considers the `type` and `uri` properties for equality, two different `ImageSource` objects would be considered equal despite having different `size`. We would continue on to prefetch the image in its fullest quality and retain that image in `ImageState`, and upon subsequent requests once we have non-zero layouts, we would bail out early in the `ImageShadowNode::updateStateIfNeeded` method since both the old image source and image request params are equal in this case.
## Fix
Rather than adding `size` to the equality check, this change adds identical logic directly from `ReactImageView` to determine if we should postpone the image request: if the image is resizable and we don't have a width or a height, postpone!
## Additional Context
I noodled with a few spots of where this should ultimately live, but this seemed like the least invasive without making some larger refactors. The other approach I considered was to instead return an optional `ImageRequest` object from `ImageManager->requestImage call` to signal that no request was ever made, and using the `ImageRequest` response as part of the equality check.
Changelog: [Internal]
Reviewed By: christophpurrer
Differential Revision: D85200818
fbshipit-source-id: 82090feb500dafa47af14220a17262d715d20a7a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54326
This variable was not needed, isAttachedToWindow was working as expected.
## Changelog
[Internal]
Reviewed By: Abbondanzo
Differential Revision: D85798355
fbshipit-source-id: 1716b323b4ac0d1d6f3e29370223db66540020d2
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54316
Changelog: [internal]
This defines an internal class in Kotlin to access `PerformanceTracer` methods, necessary for platform-specific integrations on Android.
Reviewed By: sbuggay
Differential Revision: D85689126
fbshipit-source-id: 84cb675984b90c677c3a322b191e24cc6b58c74f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54315
Changelog: [internal]
This adds methods to `PerformanceTracer` so consumers can be notified when tracing starts/stop. This is necessary to activate features necessary for tracing that would be costly to enable all the time.
Reviewed By: sbuggay
Differential Revision: D85689124
fbshipit-source-id: 9f9f79162dcb988ac4be02a8911401ce448461a9
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54309
We can encounter cases where something is rendered by React but not yet attached to Android at the point focus is called.
If we defer focus until the View is attached to the window, we can avoid apps needing to add annoying timeouts or other creative mechanisms to wait for native mount before calling imperative focus.
The only caveat here is that if you call imperative focus on something offscreen initially that is attached later (e.g., due to clipping), apps could encounter undesirable bugs where focus jumps at the point the previously detached view is now attached. One might also argue it's bug prone to call focus on something that is far offscreen / you don't plan to mount onscreen immediately.
## Changelog
[Android][Fixed] Defers focus until View is attached
Reviewed By: sbuggay
Differential Revision: D85727424
fbshipit-source-id: 677834aa2d9ba2d3247d1e71b3fe0cdd9a6ec4aa
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54295
Sets up a feature flag for keydown/keyup events. Split out from actual work implementing the feature to avoid having to run codegen each commit
Changelog: [Internal]
Reviewed By: alanleedev
Differential Revision: D84938062
fbshipit-source-id: b556f347720b4a651cd321996f2914a9c670c7a1
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54307
First of the remaining steps to fully rollout `sweepActiveTouchOnChildNativeGesturesAndroid`. It's already enabled by default everywhere an override is set, letting this bake for a week then going to remove
Changelog: [Internal]
Reviewed By: javache
Differential Revision: D85700377
fbshipit-source-id: 81f5b8679e5562ba6c5dfae331052b181b5258ec
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54292
Sets up a feature flag to experiment with using `useInsertionEffect` in `Pressability`, instead of `useEffect.
Using `useInsertionEffect` enables `Pressability` to behave more predictability in component trees with `<Activity mode="hidden">` because the events are scheduled more similarly to platform controls (e.g. focus and blur events will still fire even when "hidden").
Changelog:
[Internal]
Reviewed By: javache
Differential Revision: D85612742
fbshipit-source-id: c2faab25bfcf7f964521e680eb3c4132c1087ef4
Summary:
An earlier change (0.79 and onwards, I believe?) runs the iOS artifacts code generator script in Xcode as well as from Cocoapods. This duplication runs it twice, but the second step isn't able to load the new `autolinking.json` correctly; See: https://github.com/facebook/react-native/pull/53503
This PR "double" fixes this by:
- simply passing the "real" output directory to the artifacts generator in (`script_phases.sh`) where it's called by Xcode, rather than a temporary directory
- preferring `$RCT_SCRIPT_OUTPUT_DIR` if it's set as an environment variable in the artifacts generator (which it is by `script_phases.sh`)
While this is technically redundant, future changes here make this feel like a safer option, since both conventions overlap in these two places, and the double fix may prevent a regression here in the shortterm and convey what this path is supposed to be in both places.
## Changelog:
[IOS] [FIXED] - Fix autolinking-generated react-native-config output not being used in ReactCodegen script phase due to temp output directory
Pull Request resolved: https://github.com/facebook/react-native/pull/54066
Test Plan:
- Prefer `$RCT_SCRIPT_OUTPUT_DIR` env var for finding `build/generated/autolinking/autolinking.json`
- Always use real `$RCT_SCRIPT_OUTPUT_DIR` as output in `withCodegenDiscovery` in `react_native_pods_utils/script_phases.sh` (which is called by Xcode rather than Cocoapods to invoke the artifacts generator) since the temporary output directory isn't necessary
Reviewed By: javache
Differential Revision: D85673625
Pulled By: cipolleschi
fbshipit-source-id: 9d297fb0ee24f52a0bb7c5a8f41bf770bf63b18f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54303
React 19.2.0 introduces the `useEffectEvent`, which are functions that can be used inside `useEffect` but that should not be listed in the `useEffect` dependencies.
Without this bump, eslint will still tell the user to add the function declared with `useEffectEvent` into the dependency array of a useEffect.
## Changelog:
[General][Changed] - Bump eslint-plugin-react-hooks to 7.0.1
Reviewed By: huntie
Differential Revision: D85658780
fbshipit-source-id: 75860f06a2875b53de61f4f99572277d9d04839f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54290
A few places where we fall through intentionally are implicit. We can make those explicit with `NS_FALLTHROUGH`. Many places, however, are bugs from failing to add a `break` :eek: -- fix those places too.
These are all found via `-Wimplicit-fallthrough`... we will seek to make this an error by default (vs only in `CompilerWarningLevel.MEDIUM` or higher).
## Changelog:
[iOS] [Fixed] - Add missing `break;` to `-[RCTViewManager pointerEvents]`
Reviewed By: philIip
Differential Revision: D85583441
fbshipit-source-id: e8959b27a2e23ccfc6581286257d5d41b18c5630
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54291
We are computing a weighted distance by squaring the major and minor axis distance. For particularly long lists, this means that items that are quite far away have a tendency to overflow the int value when squared, producing a negative number that becomes the smallest weighted distance.
Switching the computed value to double should mitigate the issue, since MAX_DOUBLE >>> MAX_INT ^ 2.
## Changelog
[Android][Fixed] - Resolves an int overflow in findNextFocusableElement
Reviewed By: martinbooth
Differential Revision: D85598005
fbshipit-source-id: 2a5de4e10c21f3d42ae5872d311e714b3f92efad
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54235
Changelog: [Internal]
Reverting `experimental_prefetchResources` back to `experimental_prefetchResource` for simplicity of use
Reviewed By: lenaic, mdvacca
Differential Revision: D85261208
fbshipit-source-id: 1c7705187346a2422dddb5c106fd372a8ee49283