Commit Graph

12270 Commits

Author SHA1 Message Date
Mateo Guzmán 50d0157f0c test(network): [android] ResponseUtil unit tests (#48075)
Summary:
Currently the class `ResponseUtil` is still in Java, I'm adding some unit tests so it is safer to migrate it to Kotlin.

## Changelog:

[INTERNAL] - `ResponseUtil` unit tests

Pull Request resolved: https://github.com/facebook/react-native/pull/48075

Test Plan:
```bash
yarn test-android
```

Reviewed By: cortinico

Differential Revision: D66727736

Pulled By: lunaleaps

fbshipit-source-id: 9c89c75905b4e0c9c4820a556245a07e135e0f17
2024-12-04 10:26:04 -08:00
Andrew Datsenko 2e444d2b40 Add ReactNativetester#getRenderedOutput() API (#47970)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47970

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D65617491

fbshipit-source-id: 49369b694a81b7dfb541c75d9e24b62fc141d980
2024-12-04 09:55:56 -08:00
Soe Lynn 469978f170 Fix Interop code for having unsync ViewManager between ModuleRegistry and BridgeProxy (#48069)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48069

Changelog [Internal]:
Fix Interop code for having unsync ViewManager between ModuleRegistry and BridgeProxy

Reviewed By: RSNara

Differential Revision: D66137400

fbshipit-source-id: ace3f60b6b972f17c7124ec33f0d3e8d035e966c
2024-12-04 09:40:16 -08:00
zhongwuzw efcfe5dcd6 Fabric: Fixes insets not adjust when keyboard disappear (#47924)
Summary:
Fixes https://github.com/facebook/react-native/issues/47731 .

## Changelog:

[IOS] [FIXED] - Fabric: Fixes insets not adjust when keyboard disappear

Pull Request resolved: https://github.com/facebook/react-native/pull/47924

Test Plan: Demo in https://github.com/facebook/react-native/issues/47731

Reviewed By: blakef

Differential Revision: D66651865

Pulled By: cipolleschi

fbshipit-source-id: a75afbd1a7651f0c77022d913f910821c482fcf7
2024-12-04 07:49:12 -08:00
Rob Hogan b5b9e032c2 Fix Android JSC compatibility - replaceAll -> replace (#48076)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48076

JSC for Android does not implement `String.prototype.replaceAll`:

 {F1971791988}

https://github.com/facebook/react-native/pull/47466 introduced a use of it into runtime code, breaking JSC compatibility.

This.. replaces it.. with `replace`. Since the argument is already a regex with a `g` modifier, `replaceAll` wasn't necessary anyway.

Changelog:
[ANDROID][FIXED] Fix JSC by avoiding use of unavailable `str.replaceAll()`

Reviewed By: javache

Differential Revision: D66712312

fbshipit-source-id: 534b6db6834a2fda46ae8457437de3caa24f4eb0
2024-12-04 06:07:21 -08:00
Rubén Norte 4c62d46525 Remove legacy versions of the native methods for performance.mark and performance.measure (#48067)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48067

Changelog: [internal]

We don't need to keep these versions for backwards compatibility anymore.

Reviewed By: rshest

Differential Revision: D65423761

fbshipit-source-id: 59046a577c1de4aedb2593a12a45d9deb3bb4260
2024-12-04 04:38:54 -08:00
Phillip Pan 0217d7e19c have RCTInstance decorate non-app provided turbomodules with bridgeless APIs (#48053)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48053

Changelog: [Internal]

`getModuleInstanceFromClass:` is a delegate method intended to be implemented by the product layer to provide modules. if it is not implemented to return a module for a given key, `RCTTurboModuleManager` will simply call `new` on the TM class.

however, these two paths differentiate - for `getModuleInstanceFromClass:`, we will call `_attachBridgelessAPIsToModule:` which provides objects like surfacePresenter to the native module.

if we fallback to calling `new`, then this attachment does not happen, even if the app has already been migrated to bridgeless modules.

thus, the fix in the case is to lift the fallback into RCTInstance as well, and decorate the APIs onto the new fallback.

Reviewed By: cipolleschi

Differential Revision: D66675034

fbshipit-source-id: 1ab89a4006d05f744f5d42b5de786ccea4d4a55d
2024-12-03 22:23:04 -08:00
Joe Vilches 74f3ab7d40 Properly camelcase mainAxisownerSize in FlexLine (#48077)
Summary:
X-link: https://github.com/facebook/yoga/pull/1762

Pull Request resolved: https://github.com/facebook/react-native/pull/48077

OCD strikes again. Grepped this time to make sure we didn't miss any cases for this specific param name

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D66715777

fbshipit-source-id: 3e881a15b3b2836a4a55b11d7ec621541b92a05d
2024-12-03 19:16:56 -08:00
Eli White 949d229b5f Apply enum changes to new codegen version (#48000)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48000

Adding this type to CompleteTypes

Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D65305755

fbshipit-source-id: 962297ba21b3b88f0117631fb4192c111e903fc6
2024-12-03 16:41:36 -08:00
Richard Barnes 5e7eb9f3a6 Revert D66143498
Summary:
This diff reverts D66143498
T209377282 Breaking tests on Twilight

Differential Revision: D66717950

fbshipit-source-id: 640592761fec29ed6e11a8b6faf441dd44685c42
2024-12-03 14:31:53 -08:00
Dmitry Rykun 725527885a Android: Initiate image prefetching on ImageShadowNode layout (#47932)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47932

This diff introduces a code path to trigger image prefetching from `ImageShadowNode::layout`.
Changelog: [Internal]

Reviewed By: javache

Differential Revision: D66454087

fbshipit-source-id: 17f5fed7d29c7d69cf76c28562898a81fac24044
2024-12-03 13:31:24 -08:00
Luna Wei d19f5f97b8 Fix naming convention for new rootThreshold related APIs and add Fantom tests (#48071)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48071

Changelog: [Internal]

- Write fantom test for rn_rootThreshold given current implementation of IntersectionObserver
- Rename `rn_rootThreshold` to `rnRootThreshold`
- Rename `rn_intersectionRootRatio` to `rnRootIntersectionRatio`
- Rename `rootThresholds` on observer to `rnRootThresholds`

Reviewed By: rubennorte

Differential Revision: D66464509

fbshipit-source-id: 8ed66afa54bab99a28625ebe6f227d59d0bd7389
2024-12-03 13:29:51 -08:00
Luna Wei 9aa21b5e87 Return intersection rect (#48070)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48070

Changelog: [General][Changed]

Return the clipped `intersectionRect` in IntersectionObserverEntry regardless of whether the observer `isIntersecting` or not. This addresses a deviance from the [web spec](https://www.w3.org/TR/intersection-observer/?fbclid=IwZXh0bgNhZW0CMTEAAR1XaWZim1ij0N1p07aCM__SYerXhu88UTDZRFCZEvRhQW2crRMwEvfwAdQ_aem_zH8WjTh0VFjEeORG76rcew#intersection-observer-entry)

Reviewed By: rubennorte

Differential Revision: D66516179

fbshipit-source-id: fdc766f0e6fc0a899b1b11547a2aa06010b8d010
2024-12-03 13:29:51 -08:00
Pieter De Baets 9800c8e47e Improve differentiator logging (#48061)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48061

Improve consistency of debug logs in differentiator.

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D66654292

fbshipit-source-id: f4accdea184b932f94359c893e6de59f8139ca22
2024-12-03 10:17:02 -08:00
Pieter De Baets 34901d4861 Fix differentiator emitting updates with incorrect parentTag (#48055)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48055

Address the test-case identified in D66557919, where Differentiator could emit updates for views referencing an incorrect parentTag.

The longer-term fix here is to avoid emitting any updates for nodes which are being reparented, but that requires bigger changes, including to the LayoutAnimation system. As a short-term patch, we're passing through an explicit `parentShadowViewForUpdate` which will be used as the current parent for update purposes.

 {F1971278019}

Changelog: [Android][Fixed] Fix Fabric mutations sometimes triggering a `getViewState` crash when referencing an invalid parentTag.

Reviewed By: rubennorte

Differential Revision: D66654293

fbshipit-source-id: cd5b3e577ad1eede1b6dea834582ac6d750cbb81
2024-12-03 10:17:02 -08:00
Fabrizio Cucci 21c9491926 Migrate package com.facebook.react.uimanager.RootView to Kotlin (#47701)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47701

As per title.

Changelog:
[Android][Breaking] Convert RootView to Kotlin

Reviewed By: cortinico

Differential Revision: D66159881

fbshipit-source-id: 082881a03946088293dde3c085e1d1882bac96be
2024-12-03 09:59:48 -08:00
Alex Hunt d6f286a4a0 Add description to React-jsinspector.podspec, refactoring (#48066)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48066

Minor edits to this build spec to align with other packages in `ReactCommon/`.

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D66700351

fbshipit-source-id: 47942c27d6154b78c165508447a3056f1354f5c3
2024-12-03 08:44:48 -08:00
Dmitry Rykun 318db8eedf Add Android-specific ImageRequestParams (#47930)
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
2024-12-03 04:09:42 -08:00
Richard Barnes 071d223ee0 Remove unused-variable in ../xplat/compphoto/gpuEngine/tools/ToolHelpers.cpp +3 (#48052)
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
2024-12-03 04:07:49 -08:00
David Vacca 67bff8734f Delete GuardedResultAsyncTask (#48058)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48058

Delete unused abstract class GuardedResultAsyncTask

I'm deleting without depreacting becuase I didn't find usages internally or externally

changelog: [Android][Breaking] Delete unused abstract class GuardedResultAsyncTask

Reviewed By: javache

Differential Revision: D66416570

fbshipit-source-id: 8b369dfcd3e99b24f97c62cec9229f82ba5eed77
2024-12-02 18:45:27 -08:00
David Vacca b25b65ba19 Delete deprecated class FabricViewStateManager (#48057)
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
2024-12-02 18:45:27 -08:00
David Vacca a4849cb3d6 Reduce visibility of ComponentNameResolver to internal (#48056)
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
2024-12-02 18:45:27 -08:00
David Vacca 385b9f4265 Migrate ComponentNameResolver to kotlin (#47919)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47919

Migrate ComponentNameResolver to kotlin

changelog: [Android][Changed] Migrate ComponentNameResolver to kotlin

Reviewed By: javache

Differential Revision: D66403041

fbshipit-source-id: 7af1a89988373014c5aeb1f6145324cf889a1a36
2024-12-02 18:45:27 -08:00
Mateo Guzmán bfc8b3391e Migrate BatchEventDispatchedListener to kotlin (#48038)
Summary:
Migrating `BatchEventDispatchedListener` from Java to Kotlin

## Changelog:

[INTERNAL] - Migrating `BatchEventDispatchedListener` from Java to Kotlin

Pull Request resolved: https://github.com/facebook/react-native/pull/48038

Test Plan:
```bash
yarn test-android
```

Reviewed By: tdn120, cortinico

Differential Revision: D66653052

Pulled By: javache

fbshipit-source-id: 494866c54d349587e313c18717c6c587a2228aa8
2024-12-02 17:53:59 -08:00
Joe Vilches 2df7552fa2 Back out "Back out "[yoga][intrinsic sizing] Update public API for intrinsic sizing setters""
Summary:
Original commit changeset: 793f77dad021

Original Phabricator Diff: D66332309

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D66662661

fbshipit-source-id: 22ed3ac9492f0a563c041ce4cb5fba4b65b53211
2024-12-02 17:29:49 -08:00
Joe Vilches e1623b7525 Back out "Back out "[yoga][intrinsic sizing] Modify private apis to set, store, and get intrinsic sizing keywords"" (#48049)
Summary:
X-link: https://github.com/facebook/yoga/pull/1756

Pull Request resolved: https://github.com/facebook/react-native/pull/48049

Changelog: [Internal]

Original commit changeset: 1d596964e0c8

Original Phabricator Diff: D66332307

Reviewed By: NickGerleman

Differential Revision: D66662662

fbshipit-source-id: 4f9ac2b1557b848f519dcd728d7097b52f1190b3
2024-12-02 17:29:49 -08:00
Eli White fa8a25eb6b Make enum types annotation objects instead of literal strings and numbers (#47349)
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
2024-12-02 14:32:35 -08:00
Eli White 96c2be8567 Don't store pretty printed json in schema
Summary: Changelog: [Internal]

Reviewed By: javache

Differential Revision: D66603960

fbshipit-source-id: 2d7844df76f168b99eb76bb19359ee71e953d0b2
2024-12-02 14:32:35 -08:00
Thomas Nardone 53bc661138 ReactViewGroup - track clipped views (#47987)
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
2024-12-02 14:28:35 -08:00
Ramanpreet Nara 69ecaef068 Remove native -> js call noop-ing after early js error (#47915)
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
2024-12-02 14:18:55 -08:00
Alex Hunt 215b0a50cf Update debugger-frontend from 6b80704...486803f (#48051)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48051

Changelog: [Internal] - Update `react-native/debugger-frontend` from 6b80704...486803f

Resyncs `react-native/debugger-frontend` from GitHub - see `rn-chrome-devtools-frontend` [changelog](https://github.com/facebookexperimental/rn-chrome-devtools-frontend/compare/6b80704fd50ea0bf10f5f5da5a4343de29aff8b2...486803f6bf272e0629297265dee8048a2f1269dd).

Reviewed By: hoxyq

Differential Revision: D66664563

fbshipit-source-id: 8c04c0f99e203f594d4e86a52aca99803c4b005f
2024-12-02 12:02:07 -08:00
Alex Hunt 11c214d0c9 Update FuseboxTracer to closer align with Chrome trace events (#48020)
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
2024-12-02 11:24:34 -08:00
Alex Hunt 1a9780f0e3 Remove FuseboxClient CDP domain (#48004)
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
2024-12-02 08:27:52 -08:00
Peter Abbondanzo 72bb2f4089 Bump Fresco to 3.5.0
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
2024-12-02 07:33:37 -08:00
Pieter De Baets 70a957452c Restore deprecated TurboReactPackage (#48039)
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
2024-12-02 07:30:52 -08:00
Alex Hunt a4310ede9c Update debugger-frontend from b61aae3...6b80704 (#48042)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48042

Changelog: [Internal] - Update `react-native/debugger-frontend` from b61aae3...6b80704

Resyncs `react-native/debugger-frontend` from GitHub - see `rn-chrome-devtools-frontend` [changelog](https://github.com/facebookexperimental/rn-chrome-devtools-frontend/compare/b61aae3ccc6e2684dfbf1e2a06b0f985b459f11f...6b80704fd50ea0bf10f5f5da5a4343de29aff8b2).

Reviewed By: blakef

Differential Revision: D66651149

fbshipit-source-id: 6848eebb4b7c04c7c04ae1f784fc39785945bf7b
2024-12-02 06:25:54 -08:00
Vojtech Novak 9147b0753a fix IOException in BuildCodegenCLITask (#48008)
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
2024-12-02 05:09:54 -08:00
Rubén Norte 2480de6ffb Add Fantom test for LongTask API (#48041)
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
2024-12-02 04:47:17 -08:00
Rubén Norte 60a4d22307 Migrate ReactFabricPublicInstance tests to Fantom (#48025)
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
2024-12-02 04:47:17 -08:00
Rubén Norte 09f6d165ec Export ReactNativeTester (#48024)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48024

Changelog: [internal]

Reviewed By: rshest

Differential Revision: D66599071

fbshipit-source-id: 52585e030642e5b6bd8921d2c9f9d14ee5d6ce71
2024-12-02 04:47:17 -08:00
Nicola Corti 88c9a42fca Fix eslint warnings in react-native (#48016)
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
2024-12-02 04:11:22 -08:00
zhongwuzw 28ced2e558 Fabric: Fixes Modal onRequestClose not called (#48037)
Summary:
Fixes https://github.com/facebook/react-native/issues/48030 .

## Changelog:

[IOS] [FIXED] - Fabric: Fixes Modal onRequestClose not called

Pull Request resolved: https://github.com/facebook/react-native/pull/48037

Test Plan: Repro please see  https://github.com/facebook/react-native/issues/48030.

Reviewed By: cortinico

Differential Revision: D66647232

Pulled By: cipolleschi

fbshipit-source-id: 773517dfe45f6f2e6348cda225e972fbac05edc2
2024-12-02 04:06:40 -08:00
CHOIMINSEOK b8095f4692 Avoid NPE when touch event is triggered before SurfaceManager is initiated (#48007)
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
2024-12-02 03:54:34 -08:00
Wojciech Lewicki 44b04b6d42 fix: add mising subpsec to React-Fabric podspec (#48023)
Summary:
Running app with static linking fails to compile. Probably during https://github.com/facebook/react-native/pull/43581 adding that code was overlooked since the analogous thing seems to be added: https://github.com/facebook/react-native/pull/43581/files#diff-6680f6849631e3dcc5897ee3961a9d6d2bc57aff3eccb79a9d9c634183276202R566.

cc rubennorte since you made the linked PR.

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[IOS] [FIXED] - Add missing subpsec to React-Fabric podspec.

Pull Request resolved: https://github.com/facebook/react-native/pull/48023

Test Plan: Run https://github.com/WoLewicki/reproducer-react-native/tree/%40wolewicki/static-linking-with-live-markdown and see that it won't compile without this change.

Reviewed By: cipolleschi

Differential Revision: D66600486

Pulled By: cortinico

fbshipit-source-id: 9de64541e49d27cdf00f37942adab6620476f15a
2024-12-02 03:23:45 -08:00
Wojciech Lewicki fa03840e68 fix: typo in inherited (#48013)
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
2024-12-02 03:23:01 -08:00
Nicola Corti 490db92562 Gradle to 8.11.1 (#48026)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48026

This should mitigate this particular issue we're seeing on Windows:
- https://github.com/facebook/react-native/issues/46210

Changelog:
[Android] [Changed] - Gradle to 8.11.1

Reviewed By: javache

Differential Revision: D66600321

fbshipit-source-id: d58437485222e189d90bcf4d6b41ca956449ed22
2024-12-02 03:22:32 -08:00
Rob Hogan e996b3f346 Fix Animated on JSC: Object.hasOwn -> obj.hasOwnProperty (#48035)
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
2024-12-02 03:16:28 -08:00
Hugo FOYART f791fb9e66 fix: FormData filename in content-disposition (#46543)
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
2024-12-02 03:14:28 -08:00
Kacper Rozniata b886bc4db9 feat(android): migrate ReactSwitchManager to Kotlin (#48003)
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
2024-12-02 02:41:31 -08:00
zhongwuzw 91e217ff54 Add completion block when call js module function (#47998)
Summary:
Fabric bridgeless don't call completion block when call js module method, so let's support it :).

## Changelog:

[IOS] [FIXED] - [Fabric] Add completion block when call js module function

Pull Request resolved: https://github.com/facebook/react-native/pull/47998

Test Plan: Module call js module method when passed `onComplete` block can be called successfully in bridgeless mode.

Reviewed By: fabriziocucci

Differential Revision: D66594514

Pulled By: javache

fbshipit-source-id: 74644b1f359a24cfa93389451e172fbc6a8ee1a1
2024-11-29 04:08:52 -08:00