Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47930
This diff adds a list of props that will be used by the Android `ImagePrefetcher` to create an `ImageRequest`. This list is derived from all the props that `ReactImageView` uses to create its `ImageOptions` and `ImageRequest` objects.
Changelog: [Internal]
Reviewed By: javache
Differential Revision: D66453306
fbshipit-source-id: ca4f59784c81f2b94ed4b052f6fbe5e8c6b97a2a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48052
LLVM-15 has a warning `-Wunused-variable` which we treat as an error because it's so often diagnostic of a code issue. Unused variables can compromise readability or, worse, performance.
This diff either (a) removes an unused variable and, possibly, it's associated code or (b) qualifies the variable with `[[maybe_unused]]`.
#buildsonlynotests - Builds are sufficient
- If you approve of this diff, please use the "Accept & Ship" button :-)
Reviewed By: javache, wuyuoss
Differential Revision: D66143498
fbshipit-source-id: a461f115610258777bd1173f91cf4d4472e2fc5e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48057
FabricViewStateManager has been deprecated for a long time and it's unused, let's delete it
changelog: [Android][Breaking] Delete deprecated class FabricViewStateManager
Reviewed By: javache, cortinico
Differential Revision: D66403219
fbshipit-source-id: e8f893b6a240ca09c0e86821c0a15fa345ffd221
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48056
ComponentNameResolver is meant to be used only internaly, we reduce its visbility to internal
changelog: [Android][Breaking] Removed ComponentNameResolver from public API
Reviewed By: javache
Differential Revision: D66403218
fbshipit-source-id: bf08284400a6dc6446b771c894488ed3fb371e25
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47349
This is needed to be able to recurse into the literals and compare them.
I'm primarily unsure if there is a problem representing doubles/floats as numbers instead of strings though.
Changelog: [Internal]
Reviewed By: makovkastar
Differential Revision: D65284058
fbshipit-source-id: b2de9ed5fb7f079a432c94aaea69027863879909
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47987
Store a tag value for whether the view is added or removed, to better track the state instead of checking view.getParent().
Changelog: [Internal]
Reviewed By: javache
Differential Revision: D66383241
fbshipit-source-id: 16521eb4052e9473be058a00cfe29d7f198b7861
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47915
## Purpose of this noop-ing
If an fatal js error happens during js runtime init, the js thread continues executing and raises **yet another** fatal error.
This noop-ing was an **attempt** to prevent that second inactionable fatal from happening: That fatal is usually inactionable.
## Problems with this noop-ing
I don't think this is the right approach: There could be legitimate reasons to continue executing native -> js calls post first js fatal.
I don't think it does *much*: it doesn't noop native -> js calls executed on the runtime scheduler, which should be most of them.
## Changes
Instead of trying to prevent that fatal, just let it happen. Then, don't report the second fatal: D66193194 and D66392706.
## Safetly
The production impact is negligible: This codepath is executed only after early js errors. There shouldn't be any in production right now.
We've spent a lot of time making our javascript error handling pipeline's coverage compresive. So, after an early js fatal error happens, subsequent js fatals should get handled properly.
Changelog: [Internal]
Reviewed By: javache
Differential Revision: D66394278
fbshipit-source-id: ef342fc2eba9ae9f27b15a0f412fb69bd92aed43
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48020
Progress towards Performance panel display parity for User Timing events in Chrome DevTools.
- Support nullable `track` name in `ReactPerfLogger`, passing track name directly to `FuseboxTracer`.
- Update `FuseboxTracer` to register "Main" process and send V8-aligned `blink.user_timing`-categorised tracing events.
The previous track naming strategy continues to be used under Perfetto.
Changelog: [Internal]
**Better, but not perfect yet**
For now, this is probably the upper limit of how aligned we can be with Chrome on web, since our forked DevTools frontend is 6mo+ behind `main`. Notably, it does not include equivalent custom track handling today: https://github.com/ChromeDevTools/devtools-frontend/commit/4b4435feef14c5c0ac71d932940c6ea7613f8afe
{F1969750671}
> Importing an exact trace from Chrome into RNDT is unable to sub-group the "Timings" track.
Reviewed By: rubennorte
Differential Revision: D66579308
fbshipit-source-id: fa57151d2be477eaa15f62e5c19ee09b1a0ef43a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48004
Follows https://github.com/facebook/react-native/pull/47962 and depends on https://github.com/facebookexperimental/rn-chrome-devtools-frontend/pull/139.
Updates the modern debugger server to no longer respond to `FuseboxClient` messages — namely `FuseboxClient.setClientMetadata`. This method is replaced by `ReactNativeApplication.enable` for identifying the React Native DevTools frontend.
Changelog:
[General][Breaking] - The `FuseboxClient.setClientMetadata` CDP method is removed. Instead, use `ReactNativeApplication.enable`.
Reviewed By: rubennorte
Differential Revision: D66575324
fbshipit-source-id: f2b4cbacd857931832d89305510f5aaf51df483a
Summary:
Updates Fresco from 3.4.0 to 3.5.0. Picks up a few new features, including experimental support for XML-based drawable resource types
Changelog:
[Android][Changed] - Update Fresco to 3.5.0
Reviewed By: cortinico
Differential Revision: D66553841
fbshipit-source-id: d0e630c73ba73ea9bbf96f7d630471c5383145f0
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48039
This class was removed in D66127067 but was marked as DeprecatedInNewArchitecture and not Deprecated, which limited the signal we gave to developers to move away from this.
Restore for now to e
Changelog: [Android][Fixed] Reverted removal of TurboReactPackage
Reviewed By: rshest
Differential Revision: D66648209
fbshipit-source-id: 165f9390b4874e69353612b929d87b0c495588af
Summary:
building RN tester with 0.77 rc-0 doesn't work now because of `java.io.IOException: No such file or directory` on line 48.
`buildDirectory` is a Gradle property representing a file
https://github.com/facebook/react-native/pull/47552 removes this file altogether so feel free to close if that one is the "right one"
## Changelog:
[ANDROID] [FIXED] - fix IOException in `BuildCodegenCLITask`
Pull Request resolved: https://github.com/facebook/react-native/pull/48008
Test Plan: After this change, building RN tester works.
Reviewed By: cortinico
Differential Revision: D66650038
Pulled By: robhogan
fbshipit-source-id: 11cd83493fa118c6b79d11c9113228dd3971a803
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48041
Changelog: [internal]
This adds a Fantom test for the LongTask API, testing it using public APIs :D
Reviewed By: javache
Differential Revision: D66601861
fbshipit-source-id: f3531e8b58ffa044dcb5cec2f462ae6a31c27790
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48025
Changelog: [internal]
This migrates the existing tests we have for the current public API for host component refs to Fantom.
After this, the only remaining test to migrate before we can clean up the legacy mocks for Fabric, etc. is the one for IntersectionObserer.
Reviewed By: sammy-SC
Differential Revision: D66599070
fbshipit-source-id: 67da1cd3b360ac79aed6fe6ad2a8bd5273754174
Summary:
There are currently 2 warnings firing for every PR (e.g. look here https://github.com/facebook/react-native/pull/48013/files).
Those are annoying so I'm fixing them here.
## Changelog:
[INTERNAL] - Fix eslint warnings in react-native
Pull Request resolved: https://github.com/facebook/react-native/pull/48016
Test Plan: CI
Reviewed By: NickGerleman
Differential Revision: D66595842
Pulled By: cortinico
fbshipit-source-id: 0fd39629a97dbbe5d75a78c8eaa50241faf6bf1e
Summary:
A NPE can occur when a user touches the screen before the `SurfaceMountingManager` is initialized. Below is an example of the error log from our production service. This issue can also be reproduced using RNTester. To prevent invalid touch events during init time of rn app from causing an NPE, add a null check for SurfaceMountingManager before calling mark/sweepActiveTouchForTag.
```
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.facebook.react.fabric.mounting.SurfaceMountingManager.markActiveTouchForTag(int)' on a null object reference
at com.facebook.react.fabric.FabricUIManager.markActiveTouchForTag(FabricUIManager.java)
at com.facebook.react.uimanager.JSTouchDispatcher.markActiveTouchForTag(JSTouchDispatcher.java)
at com.facebook.react.uimanager.JSTouchDispatcher.handleTouchEvent(JSTouchDispatcher.java)
at com.facebook.react.runtime.ReactSurfaceView.dispatchJSTouchEvent(ReactSurfaceView.java)
at com.facebook.react.ReactRootView.onInterceptTouchEvent(ReactRootView.java)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2870)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3352)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2963)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3352)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2963)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3352)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2963)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3352)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2963)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3352)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2963)
at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:794)
at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1967)
at android.app.Activity.dispatchTouchEvent(Activity.java:4571)
at com.rainist.banksalad2.feature.common.BaseActivity.dispatchTouchEvent(BaseActivity.java)
at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:70)
at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:752)
at android.view.View.dispatchPointerEvent(View.java:16498)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:8676)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:8423)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:7752)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:7809)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:7775)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:7978)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:7783)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:8035)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:7756)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:7809)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:7775)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:7783)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:7756)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:11343)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:11212)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:11168)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:11477)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:337)
at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
at android.os.MessageQueue.next(MessageQueue.java:335)
at android.os.Looper.loopOnce(Looper.java:187)
at android.os.Looper.loop(Looper.java:319)
at android.app.ActivityThread.main(ActivityThread.java:9063)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:588)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
```
https://github.com/user-attachments/assets/e9c6ff84-c94d-4392-9042-8e635197202e
## Changelog:
[Android] [Fixed] - Avoid NPE when touch event is triggered before SurfaceManager is initiated
Pull Request resolved: https://github.com/facebook/react-native/pull/48007
Test Plan:
I checked the crashed being fixed on RNTester.
https://github.com/user-attachments/assets/71f7e359-707a-494c-ae34-fef8d432e612
Reviewed By: cortinico
Differential Revision: D66594576
Pulled By: javache
fbshipit-source-id: b1559d94866bdb021e0374f1953684849603033c
Summary:
fix typo in `inherithed`
## Changelog:
<!-- Help reviewers and the release process by writing your own changelog entry.
Pick one each for the category and type tags:
[IOS] [CHANGED] - fix typo in utils.rb
For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[IOS] [CHANGED] - fix typo in utils.rb
Pull Request resolved: https://github.com/facebook/react-native/pull/48013
Test Plan: I did not spot any changes when switching it but in some specific build settings it could destroy some behaviors probably.
Reviewed By: cipolleschi
Differential Revision: D66595786
Pulled By: cortinico
fbshipit-source-id: d1607fd1127352533fb2977bdfcafec1edd1aef7
Summary:
https://github.com/facebook/react-native/pull/46385 introduced use of `Object.hasOwn` as an incidental detail of some `Animated` performance improvements.
Unfortunately, `Object.hasOwn` is not present in the version of JSC shipped with Android, nor the built in iOS JSC until iOS 15.4, which is greater than React Native's minimum version (13.4).
Instead:
- Use `obj.hasOwnProperty(prop)` for known objects that have the `Object` prototype.
- Otherwise, use `Object.hasOwn` where it is defined.
- Lastly, fall back to `Object.prototype.hasOwnProperty.call(obj, prop)`, which is compatible with passed `null`-prototype objects.
Fixes https://github.com/facebook/react-native/issues/47963
Intend to pick for RN 0.77.
## Changelog:
[GENERAL][FIXED] Replace Object.hasOwn usages to fix Animated on JSC
Pull Request resolved: https://github.com/facebook/react-native/pull/48035
Test Plan:
- Run `rn-tester` on Android with Hermes disabled.
- Verify the FlatList->Basic example redboxes before this change, and works after it.
Reviewed By: yungsters
Differential Revision: D66638379
Pulled By: robhogan
fbshipit-source-id: 51ac525851b41adea3bf3cc41349225138e1f2fe
Summary:
This Pull Request fixes a regression introduced in https://github.com/facebook/react-native/commit/7c7e9e6571c1f702213e9ffbb40921cd5a1a786b, which adds a `filename*` attribute to the `content-disposition` of a FormData part. However, as the [MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition#directives) states, there is no `filename*` attribute for the `content-disposition` header in case of a form data.
The `filename*` attribute would break the parsing of form data in the request, such as in frameworks like `Next.js` which uses the web implementation of [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request).
Fixes https://github.com/facebook/react-native/issues/44737
## 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] [Fixed] - Remove non compliant `filename*` attribute in a FormData `content-disposition` header
Pull Request resolved: https://github.com/facebook/react-native/pull/46543
Test Plan:
- Clone the `react-native` repo
- Create a simple JS file that will act as a node server and execute it
```javascript
const http = require('http');
const server = http.createServer(async function (r, res) {
const req = new Request(new URL(r.url, 'http://localhost:3000'), {
headers: r.headers,
method: r.method,
body: r,
duplex: 'half',
});
const fileData = await req.formData();
console.log(fileData);
res.writeHead(200);
res.end();
});
server.listen(3000);
```
- Go to `packages/rn-tester`
- Add a `useEffect` in `js/RNTesterAppShared.js`
```javascript
React.useEffect(() => {
const formData = new FormData();
formData.append('file', {
uri: 'https://www.gravatar.com/avatar',
name: '测试photo/1.jpg',
type: 'image/jpeg',
});
fetch('http://localhost:3000', {
method: 'POST',
body: formData,
}).then(res => console.log(res.ok));
});
```
- Run the app on iOS or Android
- The node server should output the file added to the FormData with an encoded name
Reviewed By: robhogan
Differential Revision: D66643317
Pulled By: yungsters
fbshipit-source-id: 0d531528005025bff303505363671e854c0a2b63
Summary:
This PR migrates `ReactSwitchManager` to Kotlin
Also it moves it's shadow node to a separate file (`ReactSwitchShadowNode.kt`)
## Changelog:
[ANDROID] [CHANGED] - Migrate `ReactSwitchManager` to Kotlin
Pull Request resolved: https://github.com/facebook/react-native/pull/48003
Test Plan: Make sure that `Switch` example in `RNTester` works correctly
Reviewed By: cortinico
Differential Revision: D66594606
Pulled By: javache
fbshipit-source-id: 774641c4cf57d6d5f770df1fed4fcafef2af7ceb
Summary:
solve the exception on android when `Appearance.setColorScheme` and activity recreate()
Fixes https://github.com/facebook/react-native/issues/47954
## Changelog:
[Android][Fixed] setColorScheme should be called on the UI thread
Pull Request resolved: https://github.com/facebook/react-native/pull/47955
Reviewed By: cortinico
Differential Revision: D66573373
Pulled By: javache
fbshipit-source-id: 97808e163e1c53bb94f4be7269d9cb9e212f2e95
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47962
Updates `HostAgent` to respond equivalently if either `FuseboxClient.setClientMetadata` (outgoing) or `ReactNativeApplication.enable` (incoming) are sent by the CDP frontend.
This is a partial migration, to be followed by removing the `FuseboxClient.setClientMetadata` method later.
Changelog: [Internal]
Reviewed By: robhogan
Differential Revision: D66501027
fbshipit-source-id: 1ff669c24667f51d240311e75f95747efe577e2d
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48002
Demonstrates the issue identified in https://github.com/facebook/react-native/issues/47960 and a crash we've been seeing internally around `getViewState` referencing a view that does not exist.
When reparenting unflattened nodes, Differentiator may emit an `update` with a `parentShadowView` that does not exist on the native side yet, thereby crashing Android.
Landing the test-case first (with some test cleanup), so the diff for the actual fix is clearer.
Changelog: [Internal]
Reviewed By: lenaic
Differential Revision: D66557919
fbshipit-source-id: 5428c32e5f0200a8e98568cabeedb0c61aafbe23
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47968
Updates the Inspector Proxy to report + log when a profiling build target (experimental) is registered. This notifies the developer that debugging is available for these app(s), which will not otherwise fetch development bundles from Metro.
Changelog: [Internal]
Reviewed By: rubennorte
Differential Revision: D66501771
fbshipit-source-id: e06dee279158094ad5c70bf8e6a90e7c983de48a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47983
Changelog: [internal]
This mitigates some performance regressions caused by the migration from `ReactFabricHostComponent` to `ReactNativeElement` (enabling the DOM APIs).
Those regressions were caused by 2 main things:
1. By the use of a class hierarchy and having to call `super()`, which we transpile to a very complex code to ensure it's spec compliant.
2. By the use of private fields (`#viewConfig`) which are significantly slower than a regular field with the `_` naming convention (`_viewConfig`) processed by our custom transform.
This mitigates those problems by using the `_` convention and refactoring the class hierarchy to avoid the use of `super()` while preserving the Flow typing and most of the existing implementation.
Reviewed By: javache, andrewdacenko
Differential Revision: D66540756
fbshipit-source-id: db6aa18c12194b18e3a69e9979621d0feae6186a
Summary:
Removed `node-fetch` in favour of node builtin fetch to get rid of the deprecated `punycode` warning when using Node 22.
`react-native/community-cli-plugin` already requires Node >= 18 where it was made available by default (without `--experimental-fetch` flag).
This change is similar to the one made in https://github.com/facebook/react-native/pull/45227
## Changelog:
[GENERAL] [CHANGED] - Drop node-fetch in favor of Node's built-in fetch from undici in `react-native/community-cli-plugin`
Pull Request resolved: https://github.com/facebook/react-native/pull/47397
Test Plan: tests pass
Reviewed By: blakef
Differential Revision: D66512595
Pulled By: NickGerleman
fbshipit-source-id: c4e01baf388f9fae8cea7b4bfe25034bff28b461
Summary:
X-link: https://github.com/facebook/yoga/pull/1755
Pull Request resolved: https://github.com/facebook/react-native/pull/47975
I've been working with callsites here and its annoying if you switch these that you need to move these params around too. Let's just make them the same order
Changelog: [Internal]
Reviewed By: NickGerleman
Differential Revision: D66519836
fbshipit-source-id: 2e98e671270a053c6e62372e2003f1ca67774ec9