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/54313
This change updates the draft release workflow to add dSYMS for Hermes V1 and also updating the url from where the dSYMs can be downloaded.
## Changelog:
[Internal] -
Reviewed By: j-piasecki
Differential Revision: D85758123
fbshipit-source-id: 7d771266de5b3829e9a39c649b610aaf79aa6206
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
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54244
# Changelog: [Internal]
Refactors the logic a bit.
We will use `Runtime` domain as a signal for installation of `console.createTask()` implementation.
Reviewed By: huntie
Differential Revision: D85274860
fbshipit-source-id: 80c91a8a83ba2b95b70aa38a72529bbd20275c0d
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54261
# Changelog: [Internal]
These are actually unused and we've changed the approach - CDP agents do not control tracing status.
Reviewed By: huntie
Differential Revision: D85436029
fbshipit-source-id: faa79bbda92c0e0c55f26389bfe0c6efcf9e76c8
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54252
## Changelog:
[Internal] [Added] - pass down isAsync arg to start/stopOnRenderCallback to indicate thread
make it more explicit where start/stopOnRenderCallback is invoked so we can handle it on each platform in a more thread safe way
Reviewed By: lenaic
Differential Revision: D85365058
fbshipit-source-id: 5f0ee1343547fe3466fcd23282e0f27e129a2e7d
Summary:
Fixes https://github.com/facebook/react-native/issues/54168
In React Native 0.82.0, text on Android does not scale down when the system font scale is set to less than 1.0 (e.g., 85%). This regression was introduced when `PixelUtil.toPixelFromSP()` was changed to use `DisplayMetricsHolder.getScreenDisplayMetrics()` instead of `getWindowDisplayMetrics()` in commit [1ad2ec09](https://github.com/facebook/react-native/commit/1ad2ec099ac0ccc7402c37783004fbad3dbe0484).
The issue occurs because:
1. **windowDisplayMetrics** is obtained from `context.resources.displayMetrics` and includes the system font scale from `Configuration`
2. **screenDisplayMetrics** is populated by `Display.getRealMetrics()`, which returns physical display metrics **without** the system font scale setting ([Reference](https://developer.android.com/reference/android/view/Display#getRealMetrics(android.util.DisplayMetrics)))
When `getRealMetrics()` is called, it overwrites the `scaledDensity` value (which is `density * fontScale`), effectively resetting it to just `density` and losing the user's font scale preference.
## 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
-->
[ANDROID] [FIXED] - Fix text not scaling down when system fontScale < 1.0
Pull Request resolved: https://github.com/facebook/react-native/pull/54238
Test Plan:
https://github.com/kdwkr/rn-0.82.0-android-layout-scale
Tested with this reproducer
---
Reviewed By: javache
Differential Revision: D85350263
Pulled By: alanleedev
fbshipit-source-id: ff646cf0405f689ff2a9166a1474fdb8b1b85fd6
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54264
Implementing a fantom test covering the correct update of runtime shadow node references when using passChildrenWhenCloningPersistedNodes combined with syncOnCommit.
Changelog: [Internal]
Reviewed By: sbuggay
Differential Revision: D85437783
fbshipit-source-id: adad786e293c1acfe13e3a07ffb210dec0c17292
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54263
When enabling `passChildrenWhenCloningPersistedNodes` and `updateRuntimeShadowNodeReferencesOnCommit`, updates inserting shadow nodes between existing child shadow nodes would result in shadow node reference updates being skipped.
Since `passChildrenWhenCloningPersistedNodes` requires that the react fiber references the mounted shadow node instance at all times, this would result in invalid react renders, bringing back old revisions holding invalid layout metrics.
This diff updates the reference update applied on commit, submitting the updated shadow node references for added shadow nodes. Inserted shadow nodes between existing child shadow nodes will move the previously mounted shadow nodes to the end of the child array. This leads to the `updateMountedFlag` pass to consider these as "added" shadow nodes.
Changelog: [Internal]
Reviewed By: sbuggay
Differential Revision: D85406405
fbshipit-source-id: 7bd9a492fc67549970183c0932cfd7c8b7e61312
Summary:
This PR adds support for background size, position and repeat styles. It follows the [CSS](https://www.w3.org/TR/css-backgrounds-3/#backgrounds) spec. Currently we default to `background-origin: padding-box` and `background-clip : border-box` to match the web's behavior. We can introduce these styles later. I have split the PR intro three parts for review. This PR includes JS parsing and style propagation to native changes. I wanted to introduce one style at a time, but CSS spec is such that size, position and repeat are intertwined.
## Changelog:
[GENERAL][ADDED] - Background size, position and repeat styles.
<!-- 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/52284
Test Plan:
Merge the [iOS](https://github.com/facebook/react-native/pull/52283) and [android](https://github.com/facebook/react-native/pull/52282) PR into this, this PR includes `BackgroundImageExample`. I have also added testcases for parsing syntax in JS.
https://github.com/user-attachments/assets/b7192fdf-52ba-4eb0-a1be-d47c72d87e92
Reviewed By: joevilches
Differential Revision: D82973282
Pulled By: jorge-cab
fbshipit-source-id: a94e33962c6708be963e1cac049da50d4764da64
Summary:
This PR adds support for background size, position and repeat styles. It follows the [CSS](https://www.w3.org/TR/css-backgrounds-3/#backgrounds) spec. Currently we default to `background-origin: padding-box` and `background-clip : border-box` to match the web's behavior. We can introduce these styles later. I have split the PR intro three parts for review. This PR includes android only changes. I wanted to introduce one style at a time, but CSS spec is such that size, position and repeat are intertwined.
## Changelog:
[ANDROID][ADDED] - Background size, position and repeat styles.
<!-- 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/52282
Test Plan:
Merge the [JS](https://github.com/facebook/react-native/pull/52284) PR, rebuild android app and test RNTester app, it includes `BackgroundImageExample`. I have also added testcases for parsing syntax in JS.
https://github.com/user-attachments/assets/b7192fdf-52ba-4eb0-a1be-d47c72d87e92
Reviewed By: joevilches
Differential Revision: D82993837
Pulled By: jorge-cab
fbshipit-source-id: 52859e51d2c4bab27823d3eb913993fdfbb4c04d