Commit Graph

12270 Commits

Author SHA1 Message Date
Dmitry Rykun 0ceb0b3942 Calculate Android mounting instructions based on updates accumulated in rawProps (#48303)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48303

## Context

If a component is re-rendered/committed multiple times before mount, Android mounting layer creates and executes mounting instructions for every commit. Component's native representation is updated multiple times, potentially triggering expensive computations (e.g. recreating boxShadows) for a single draw.

A more efficient way would be to create mounting instructions to update the component from the initial state (before the first render) to the final state (after the last render) in one go.

iOS does that.

This diff is an attempt to experiment on achieving such behaviour for Android.

## Implementation Details

1. When cloning a ShadowNode, accumulate all the updates in `Props.rawProps`.
2. For calculating prop update payloads to be sent to the Android mounting layer, diff old and new `rawProps` by calling `newProps->getDiffProps(oldProps)`.
3. Most importantly, move computing of the mounting instructions from `schedulerDidFinishTransaction`, which is called after every commit, to `schedulerShouldRenderTransactions` which happens only once, after the final commit.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D63457028

fbshipit-source-id: 991727838a4e11628cb696d66d41e1d441a5ef4f
2024-12-17 09:03:08 -08:00
zhongwuzw 5c789c3d3a Fabric: Fixes TextInput crash when textShadowOffset is set and textShadowRadius is nan (#48296)
Summary:
Fixes https://github.com/facebook/react-native/issues/48288

## Changelog:

[IOS] [FIXED] - Fabric: Fixes TextInput crash when textShadowOffset is set and textShadowRadius is nan

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

Test Plan: Repro demo in https://github.com/facebook/react-native/issues/48288

Reviewed By: cipolleschi

Differential Revision: D67334179

Pulled By: NickGerleman

fbshipit-source-id: a9456a152d31bef1666669cbded28d99ec8a2028
2024-12-17 06:53:47 -08:00
Mateo Guzmán 5370347f54 Upgrading typescript-config module version to esnext (#48230)
Summary:
Fixes https://github.com/facebook/react-native/issues/45810

Upgrading `typescript-config` module version from `es2015` to `esnext`, in order to support dynamic imports.

## Changelog:

[GENERAL] [CHANGED] - Upgrading `typescript-config` module version to `esnext`

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

Test Plan:
Create a new React Native project:

```bash
npx react-native-community/cli@latest init AwesomeProject
```

Copy the changes in the reproducer from the linked issue and add a lazy import:

```tsx
const LazyAssetExample = React.lazy(() => import('./components/AssetExample'));
```

See the error when running `yarn tsc`:

<img width="739" alt="image" src="https://github.com/user-attachments/assets/99989cd1-e11a-4b23-b178-f221d8cdd8ca" />

 ---

To fix the error, apply the following patch:

```patch
 diff --git a/node_modules/react-native/typescript-config/tsconfig.json b/node_modules/react-native/typescript-config/tsconfig.json
index d5e1bce..51f54c1 100644
 --- a/node_modules/react-native/typescript-config/tsconfig.json
+++ b/node_modules/react-native/typescript-config/tsconfig.json
@@ -3,7 +3,7 @@
     "display": "React Native",
     "compilerOptions": {
       "target": "esnext",
-      "module": "es2015",
+      "module": "esnext",
       "types": ["react-native", "jest"],
       "lib": [
         "es2019",

```

Verify it is fix by running `yarn tsc` again

Reviewed By: cipolleschi

Differential Revision: D67334277

Pulled By: NickGerleman

fbshipit-source-id: d26525023ff6fcfff651d1e4cee48ab2854b8d83
2024-12-17 06:08:43 -08:00
Riccardo Cipolleschi 03b9f041db Improve E2E Stability for Android (#48286)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48286

This change bumps the specs for the Android E2E tests. This has been reported to improve the stability of the tests.

We need to keep part of the `flatlist.yml` commented as it creates an issue with Maestro as it takes too much memory.

I'll reach out to the people working on Maestro to try and understand what's going on there.

## Changelog:
[Internal] - Improve android Stability and reenable E2E tests on main

Reviewed By: fabriziocucci

Differential Revision: D67276601

fbshipit-source-id: 7cca253547063a0ec39da7de58806286c6632b07
2024-12-17 03:45:18 -08:00
Riccardo Cipolleschi b511a95652 Fix Text tests (#48279)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48279

The text tests has 2 issues:
* on iOS, the Text cell was sometimes rendered below the tabbar, with a small percentage visible. When this happens, the test was actually moving to a different tab rather then navigating to the Text screen
* on Android, sometimes navigation took too long and a scroll command was issued. This moved the screen away from the right screen we wanted to test.

This change fixes both issues by ensuring that the Text cell is 100% visible (not behind the tabbar) and by ensuring that the title "Text" is visible in Android, so the navigatin has actually happened

## Changelog:
[Internal] - Fix Text tests

Reviewed By: fabriziocucci

Differential Revision: D67274009

fbshipit-source-id: ed12f096788e7e6e74ee8d336dba350b35b85e81
2024-12-17 03:45:18 -08:00
Thomas Nardone c832f94cf7 Extract SoftException categories (#48289)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48289

Provide a mechanism to register specific category constants, which can be used by individual  `ReactSoftExceptionListener`s to differentiate behavior, if desired.

Changelog: [Android][Added] SoftException categories

Reviewed By: makovkastar

Differential Revision: D66785403

fbshipit-source-id: cb2c8861bb1dce29a6787d328b814cee09f36464
2024-12-16 20:33:18 -08:00
David Vacca 2516414f02 Migrate UIBlock to Kotlin (#48294)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48294

Migrate UIBlock to Kotlin

changelog: [internal] internal

Reviewed By: tdn120

Differential Revision: D67187378

fbshipit-source-id: ae38998d5adebbaddd1976397e229435229a7471
2024-12-16 20:24:22 -08:00
David Vacca b88346f9ea Update deprecation message (#48293)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48293

Update deprecation message

changelog: [internal] internal

Reviewed By: arushikesarwani94

Differential Revision: D67292511

fbshipit-source-id: 4d3315ce05f5c5ae1060659e98832305fee93377
2024-12-16 19:21:26 -08:00
David Vacca 45e4a3afce Migrate ReactPointerEventsView to kotlin (#47749)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47749

Migrate ReactPointerEventsView to kotlin

changelog: [Android][Breaking] Mikgrating pointerEvents API breaks compatibility for kotlin usages of this api as a val

Reviewed By: cortinico

Differential Revision: D66217250

fbshipit-source-id: ff192c9f92d1df93c082b563937eb3f37176f144
2024-12-16 18:39:54 -08:00
David Vacca 25ee3e805d Migrate ReactOverflowView to kotlin (#47750)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47750

Migrate ReactOverflowView to kotlin

changelog: [internal] internal

Reviewed By: NickGerleman

Differential Revision: D66217252

fbshipit-source-id: 8cd642dee2077006eab10d718a1887a77fd029a7
2024-12-16 18:39:12 -08:00
Ruslan Lesiutin 03a1246c35 Refactor TraceEvent format (#48269)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48269

# Changelog: [Internal]

I've noticed that our definition of Trace Event is different from the one that is defined in Google's doc / V8 / Chrome. This has some flaws:
* It creates fragmentation, like with custom track ids or with mocked process ids.
* Current implementation is strict the relationship between `performance.mark()`, `performance.measure` APIs and Instant, Complete Trace Events. Basically only something recorded with `performance.mark` can be an instant trace event.

This should unblock recording custom trace events inside `PerformanceTracer`, such as when tracing started and others. Same could be said about events related to CPU profiling from Hermes, which will be based on these APIs.

This is the pre-requisite for next diff that will add emitting `TracingStartedInPage` event. With this event, the trace should look similar to the one recorded in the browser, and Timings / Main tracks no longer should be registered manually.

Reviewed By: huntie

Differential Revision: D67207107

fbshipit-source-id: fd7f55dd82167c14a63c2d93aaa649072c5a2a2c
2024-12-16 15:19:16 -08:00
Riccardo Cipolleschi 4368368ef5 Fix some peer dependencies on React types (#48292)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48292

These dependencies are making the CI on main to fail.

## Changelog:
[General][Fixed] - Fix peer dependencies on React types

Reviewed By: javache, hoxyq

Differential Revision: D67283609

fbshipit-source-id: b325246f5de654a9ccbf7f96eec24434047a38ee
2024-12-16 14:08:19 -08:00
Thomas Nardone b662b1f4e4 Update ReactOkHttpNetworkFetcherTest (#48205)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48205

Flip mockito usages to mockito-kotlin

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D66985841

fbshipit-source-id: 23c501c96567e6f4f884bc4db8930f1d68b0351c
2024-12-16 13:00:50 -08:00
Thomas Nardone 3960a2dd8c Fix up network module tests (#48160)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48160

Shift to mockito-kotlin and fix ReactCookieJarContainerTest so it's not just testing a mock.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D66898956

fbshipit-source-id: 5ccc652b86e5a80b81d257d3ec645d7bc813301b
2024-12-16 13:00:50 -08:00
Thomas Nardone 1cbda5f64e Fix NetworkingModuleTest (#48159)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48159

Fix the setup for ignored tests and re-enable them.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D66897564

fbshipit-source-id: bac777c981976e08140bc0832f5402995ffceb8e
2024-12-16 13:00:50 -08:00
Thomas Nardone e393711ef8 Add mockito-kotlin (#48158)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48158

Changelog: [Android][Added] Add mockito-kotlin for Kotlin unit testing

Reviewed By: cortinico

Differential Revision: D66897263

fbshipit-source-id: c608622e2431578f4eaa3fecff4f6c82a56b5090
2024-12-16 13:00:50 -08:00
Stefano Formicola d31ac832c5 Add CCACHE_BINARY path to Xcode build settings and use it in ccache scripts (#48257)
Summary:
When building a react native app from Xcode and ccache has been set to be used, the `ccache-clang.sh` and `ccache-clang++.sh` scripts cannot find `ccache`, because Xcode PATH does not include ccache binary.
What I've done is setting a `CCACHE_BINARY` user-defined Xcode setting containing the result of executing `command -v ccache` during pod install execution and directly calling it in ccache scripts, set by ReactNativePodsUtils when ccache is enabled.

Fixes https://github.com/facebook/react-native/issues/46126

## Changelog:

[IOS] [FIXED] - fix ccache not found error exporting ccache binary path as Xcode user-defined setting to be used by ccache scripts

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

Test Plan: Correctly builds helloworld and RNTester apps using ccache by enabling it at pod install time: `USE_CCACHE=1 pod install`.

Reviewed By: christophpurrer

Differential Revision: D67280700

Pulled By: cipolleschi

fbshipit-source-id: 5478a191f9bd77606a56ccd340fea225ab62d4bc
2024-12-16 10:58:28 -08:00
Rubén Norte 06584241ba Fix ESLint warnings and remove from ignore list (#48291)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48291

Changelog: [internal]

`react-native-fantom` was added to `.eslintignore` when we upgraded to React 19 because we wanted to reduce the amount of warnings to ease the migration.

This re-enables ESLint for that directory and removes the warnings.

Reviewed By: cipolleschi

Differential Revision: D67283104

fbshipit-source-id: 4ec2363ceaff3cd7bd6e5d70e9588c3dd22d7d85
2024-12-16 09:19:55 -08:00
Mateo Guzmán 92bffe6571 Fix PR warnings generated by unsorted imports from RCTNetworking.js.flow (#48272)
Summary:
There are a some warnings in the PRs generated by the unsorted imports in the `RCTNetworking.js.flow` file.

This PR addresses that. As an example: https://github.com/facebook/react-native/pull/48271/files

<img width="721" alt="image" src="https://github.com/user-attachments/assets/7e5347a5-c802-4c21-870d-f4983b515a7b" />

## Changelog:

[INTERNAL] [FIXED] - Sorting `RCTNetworking.js.flow` imports that generate a warning in the PRs

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

Test Plan: Verify that this PR doesn't show these warnings anymore

Reviewed By: NickGerleman

Differential Revision: D67274752

Pulled By: javache

fbshipit-source-id: 84ac36e0aaaeaf0156e40de9f6c61bd70fa1db85
2024-12-16 08:44:03 -08:00
Riccardo Cipolleschi 5a81ceed2a React Native sync for revisions de68d2f...372ec00 (#48196)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48196

X-link: https://github.com/facebook/metro/pull/1400

- **[372ec00c03](https://github.com/facebook/react/commit/372ec00c03 )**: Update ReactDebugInfo types to declare timing info separately ([#31714](https://github.com/facebook/react/pull/31714)) //<Sebastian Markbåge>//
- **[3d2ab01a55](https://github.com/facebook/react/commit/3d2ab01a55 )**: [Flight] Extract special cases for Server Component return value position ([#31713](https://github.com/facebook/react/pull/31713)) //<Sebastian Markbåge>//
- **[1c9b138714](https://github.com/facebook/react/commit/1c9b138714 )**: Don't serialize chunk ids for Hint and Console rows ([#31671](https://github.com/facebook/react/pull/31671)) //<Sebastian Markbåge>//
- **[de68d2f4a2](https://github.com/facebook/react/commit/de68d2f4a2 )**: Register Suspense retry handlers in commit phase ([#31667](https://github.com/facebook/react/pull/31667)) //<Josh Story>//
- **[16d2bbbd1f](https://github.com/facebook/react/commit/16d2bbbd1f )**: Client render dehydrated Suspense boundaries on document load ([#31620](https://github.com/facebook/react/pull/31620)) //<Josh Story>//
- **[5b0ef217ef](https://github.com/facebook/react/commit/5b0ef217ef )**: s/server action/server function ([#31005](https://github.com/facebook/react/pull/31005)) //<Ricky>//
- **[e3b7ef32be](https://github.com/facebook/react/commit/e3b7ef32be )**: [crud] Only export uRC when flag is enabled ([#31617](https://github.com/facebook/react/pull/31617)) //<lauren>//
- **[aba370f1e4](https://github.com/facebook/react/commit/aba370f1e4 )**: Add moveBefore Experiment ([#31596](https://github.com/facebook/react/pull/31596)) //<Sebastian Markbåge>//
- **[1345c37941](https://github.com/facebook/react/commit/1345c37941 )**: Mark all lanes in order on every new render ([#31615](https://github.com/facebook/react/pull/31615)) //<Sebastian Markbåge>//
- **[91061073d5](https://github.com/facebook/react/commit/91061073d5 )**: Mark ping time as update ([#31611](https://github.com/facebook/react/pull/31611)) //<Sebastian Markbåge>//
- **[a9f14cb44e](https://github.com/facebook/react/commit/a9f14cb44e )**: Fix Logging of Immediately Resolved Promises ([#31610](https://github.com/facebook/react/pull/31610)) //<Sebastian Markbåge>//
- **[c11c9510fa](https://github.com/facebook/react/commit/c11c9510fa )**: [crud] Fix deps comparison bug ([#31599](https://github.com/facebook/react/pull/31599)) //<lauren>//
- **[64f89510af](https://github.com/facebook/react/commit/64f89510af )**: [crud] Enable on RTR FB builds ([#31590](https://github.com/facebook/react/pull/31590)) //<lauren>//
- **[7558ffe84d](https://github.com/facebook/react/commit/7558ffe84d )**: [crud] Fix copy paste typo ([#31588](https://github.com/facebook/react/pull/31588)) //<lauren>//
- **[7c254b6576](https://github.com/facebook/react/commit/7c254b6576 )**: Log yielded time in the Component Track ([#31563](https://github.com/facebook/react/pull/31563)) //<Sebastian Markbåge>//
- **[6177b18c66](https://github.com/facebook/react/commit/6177b18c66 )**: Track suspended time when the render doesn't commit because it suspended ([#31552](https://github.com/facebook/react/pull/31552)) //<Sebastian Markbåge>//
- **[eaf2d5c670](https://github.com/facebook/react/commit/eaf2d5c670 )**: fix[eslint-plugin-react-hooks]: Fix error when callback argument is an identifier with an `as` expression ([#31119](https://github.com/facebook/react/pull/31119)) //<Mark Skelton>//
- **[047d95e85f](https://github.com/facebook/react/commit/047d95e85f )**: [crud] Basic implementation ([#31523](https://github.com/facebook/react/pull/31523)) //<lauren>//
- **[92c0f5f85f](https://github.com/facebook/react/commit/92c0f5f85f )**: Track separate SuspendedOnAction flag by rethrowing a separate SuspenseActionException sentinel ([#31554](https://github.com/facebook/react/pull/31554)) //<Sebastian Markbåge>//
- **[053b3cb050](https://github.com/facebook/react/commit/053b3cb050 )**: [crud] Rename Effect type ([#31557](https://github.com/facebook/react/pull/31557)) //<lauren>//
- **[7dd6b9e68a](https://github.com/facebook/react/commit/7dd6b9e68a )**: [crud] Add enableUseResourceEffectHook flag ([#31556](https://github.com/facebook/react/pull/31556)) //<lauren>//
- **[d8afd1c82e](https://github.com/facebook/react/commit/d8afd1c82e )**: [crud] Scaffold initial types ([#31555](https://github.com/facebook/react/pull/31555)) //<lauren>//
- **[3720870a97](https://github.com/facebook/react/commit/3720870a97 )**: Log Render Phases that Never Committed ([#31548](https://github.com/facebook/react/pull/31548)) //<Sebastian Markbåge>//
- **[8a41d6ceab](https://github.com/facebook/react/commit/8a41d6ceab )**: Unify RootDidNotComplete and RootSuspendedWithDelay exit path  ([#31547](https://github.com/facebook/react/pull/31547)) //<Sebastian Markbåge>//
- **[63cde684f5](https://github.com/facebook/react/commit/63cde684f5 )**: (chore): copy fix in <style> precedence error ([#31524](https://github.com/facebook/react/pull/31524)) //<Zack Tanner>//
- **[b01722d585](https://github.com/facebook/react/commit/b01722d585 )**: Format event with "warning" yellow and prefix with "Event: " ([#31536](https://github.com/facebook/react/pull/31536)) //<Sebastian Markbåge>//
- **[c13986da78](https://github.com/facebook/react/commit/c13986da78 )**: Fix Overlapping "message" Bug in Performance Track ([#31528](https://github.com/facebook/react/pull/31528)) //<Sebastian Markbåge>//
- **[4686872159](https://github.com/facebook/react/commit/4686872159 )**: Log passive commit phase when it wasn't delayed ([#31526](https://github.com/facebook/react/pull/31526)) //<Sebastian Markbåge>//
- **[5d89471ca6](https://github.com/facebook/react/commit/5d89471ca6 )**: Export __COMPILER_RUNTIME in stable ([#31540](https://github.com/facebook/react/pull/31540)) //<lauren>//
- **[3644f0bd21](https://github.com/facebook/react/commit/3644f0bd21 )**: Use completedRenderEndTime as the start of the commit phase if it's an immediate commit ([#31527](https://github.com/facebook/react/pull/31527)) //<Sebastian Markbåge>//
- **[8657869999](https://github.com/facebook/react/commit/8657869999 )**: Separate Tracks for Components and Phases ([#31525](https://github.com/facebook/react/pull/31525)) //<Sebastian Markbåge>//
- **[b15135b9f5](https://github.com/facebook/react/commit/b15135b9f5 )**: [ez] Update useMemoCache return type ([#31539](https://github.com/facebook/react/pull/31539)) //<lauren>//

Changelog:
[General][Changed] - Bump React from 18.3.1 to 19.0.0

bypass-github-export-checks
jest_e2e[run_all_tests]

Reviewed By: cortinico

Differential Revision: D67018480

fbshipit-source-id: 39bca3261ffaa8bb7d74187510724d77cc36b196
2024-12-16 06:58:21 -08:00
Rubén Norte 18243d07e4 Customize log level in Fantom output (#48263)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48263

Changelog: [internal]

Customize log level in Fantom based on flag in runner.js.

Reviewed By: javache

Differential Revision: D67199970

fbshipit-source-id: 31cdd2eaeee8e7ab4c8985661b35822d78d0457b
2024-12-16 06:03:03 -08:00
Rubén Norte d1293f6d44 Allow creating empty surfaces without using AppRegistry initialization paths (#48262)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48262

Changelog: [internal]

At the moment, we can't start surfaces in Fabric without calling `AppRegistry.runApplication`.

This is completely unnecessary in cases like Fantom, where the creation of the surface is done manually from JS and we render to it immediately after (so we don't need to call into JS again to run AppRegistry).

Reviewed By: javache

Differential Revision: D67199971

fbshipit-source-id: e6402686b6f544a4a7651f6a21a57891ca6be3d1
2024-12-16 06:03:03 -08:00
Pieter De Baets 173b65803d Store backfaceVisibility as boolean (#48268)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48268

No need to store and compare strings here when a simple boolean will do.

Changelog: [Internal]

Reviewed By: NickGerleman, mdvacca

Differential Revision: D67204387

fbshipit-source-id: c78cc758797980c2bce11875e0f6ea1961058f05
2024-12-16 05:54:38 -08:00
Dmitry Rykun eac4b32573 Rename the last remaining usage of parentShadowView.tag to parentTag (#48267)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48267

`parentShadowView.tag` was renamed to `parentTag` in D66656411. This one callsite is hidden behind an `#ifdef`, so it didn't produce a compile error.

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D67203413

fbshipit-source-id: 8c1b1af616165b9a80bd38ab4d7376cb2f27cce5
2024-12-16 05:37:13 -08:00
Rubén Norte 358fd38825 Add scheduleTask and runWorkLoop to public API (#48284)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48284

Changelog: [internal]

We recently prevented tasks that run via `runTask` to synchronously call `runTask` because the execution is synchronous and we can't nest tasks in the event loop (D67107664 / https://github.com/facebook/react-native/pull/48235).

This adds `scheduleTask` to schedule tasks (also within tasks) with the right expectations (the task will not run synchronously on that call but at the right time).

It also adds `runWorkLoop` so we can run scheduled tasks if they're not scheduled from an already running task.

Reviewed By: javache

Differential Revision: D67275518

fbshipit-source-id: acde0093802fbcb7083334f2c0247b37b759a6b1
2024-12-16 04:50:15 -08:00
zhongwuzw 5d67490574 Fabric: Fixes Numeric TextInput not triggering onSubmitEditing (#48276)
Summary:
Fixes https://github.com/facebook/react-native/issues/48259 . The paper code like :
https://github.com/facebook/react-native/blob/2fee13094b3d384c071978776fd8b7cff0b6530f/packages/react-native/Libraries/Text/TextInput/RCTBaseTextInputView.mm#L777-L784

## Changelog:

[IOS] [FIXED] - Fabric: Fixes Numeric TextInput not triggering onSubmitEditing

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

Test Plan: Repro in https://github.com/facebook/react-native/issues/48259

Reviewed By: cipolleschi

Differential Revision: D67274739

Pulled By: javache

fbshipit-source-id: 57396c6e1a8ef96a1b29cae4a9aa9b5f48f6080b
2024-12-16 04:46:03 -08:00
Mateo Guzmán 87b1bad45e ActivityIndicator: setting resource-id from the testID prop (#48271)
Summary:
Fixes https://github.com/facebook/react-native/issues/39092

Right now, the `testID` prop that is passed to the ActivityIndicator component is not being applied as a `resource-id`. In this PR, we overwrite the `onInitializeAccessibilityNodeInfo` in the `ProgressBarContainerView` to set this `resource-id`.

## Changelog:

[ANDROID][ADDED] - ActivityIndicator: setting `resource-id` from the `testID` prop

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

Test Plan:
Render a simple activity indicator and pass a `testID` as follows:

```tsx
import {ActivityIndicator} from 'react-native';

function Playground() {
  return (
    <ActivityIndicator
      color="white"
      testID="default_activity_indicator"
      accessibilityLabel="Wait for content to load!"
    />
  );
}
```

<details>
<summary>Inspect the element using an e2e tool such as Maestro or Appium, the `resource-id` is not present: (see screenshot)</summary>

<img width="736" alt="image" src="https://github.com/user-attachments/assets/3aecce5f-3850-4c62-b1ab-aed4133e12bc" />

</details>

 ---

Apply the changes and then:

<details>
<summary>Inspect again, the `resource-id` is present now: (see screenshot)</summary>

<img width="731" alt="image" src="https://github.com/user-attachments/assets/5a0e3bfa-924a-4a50-8eef-2f7fff7e1290" />

</details>

Reviewed By: rshest

Differential Revision: D67274852

Pulled By: javache

fbshipit-source-id: 2ac8d2bbebed5d1723eb33e735bbf3b477a42572
2024-12-16 04:42:38 -08:00
zhongwuzw 6076a41560 Fabric: Fixes LayoutConformanceView not work (#48253)
Summary:
Fixes iOS LayoutConformanceView not work, seems caused by https://github.com/facebook/react-native/issues/48188. NickGerleman can you help to review please?

## Changelog:

[IOS] [FIXED] - Fabric: Fixes LayoutConformanceView not work

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

Test Plan:
Before:
![image](https://github.com/user-attachments/assets/ca1f12c1-825b-4167-849d-b88f8ec54e21)

After:
![image](https://github.com/user-attachments/assets/c81b3192-8552-4147-b3af-3a8920a91d6c)

Reviewed By: NickGerleman, cipolleschi

Differential Revision: D67195461

Pulled By: javache

fbshipit-source-id: 2f45d9a9aa2389ba7cb89e601e7225dbef4f7abf
2024-12-16 04:18:28 -08:00
Pieter De Baets 5edd32bf3f Fix MacOS build (#48285)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48285

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D67275514

fbshipit-source-id: 6512cbb090e90f827f643353a0a73c4f9516f651
2024-12-16 04:06:27 -08:00
Pieter De Baets ba8136e41d Create TurboModule for test helpers (#48283)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48283

Migrate from custom JSI integration to use TurboModule base-class.

This doesn't use codegen right now for ease of migration, and to avoid needing to setup a js_library buck definition for react-native-fantom. We should also figure out what the right abstraction/division of responsibilities is going forward for TesterAppDelegate and FantomModule.

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D67111850

fbshipit-source-id: e1623d80f1f25ec123315b3620930dd17dd8a8a7
2024-12-16 04:06:27 -08:00
Kræn Hansen 2fee13094b App fails to build when Node binary path contains a space (#48275)
Summary:
Building RNTester fails locally because my node path contains a space " ".
(I'm using [fnm](https://github.com/Schniz/fnm) which installs into `/Users/{username}/Library/Application Support/fnm`).

I haven't verified this, but I suspect this is broken for other apps as well, as the script is called when bundling for any app.

<details>

<summary>Expand to see output from the failed build</summary>

```
Node found at: /Users/kraen.hansen/Library/Application Support/fnm/node-versions/v22.11.0/installation/bin/node
+ DEST=/tmp/RNTesterBuild/Build/Products/Release-iphonesimulator/RNTester.app
+ [[ ! -n '' ]]
+ [[ Release = *Debug* ]]
+ [[ -n '' ]]
+ case "$CONFIGURATION" in
+ DEV=false
+++ dirname ../react-native/scripts/react-native-xcode.sh
++ cd ../react-native/scripts/..
++ pwd
+ REACT_NATIVE_DIR=/Users/kraen.hansen/Repositories/react-native/packages/react-native
+ PROJECT_ROOT=/Users/kraen.hansen/Repositories/react-native/packages/rn-tester
+ cd /Users/kraen.hansen/Repositories/react-native/packages/rn-tester
+ [[ -n /Users/kraen.hansen/Repositories/react-native/packages/rn-tester/js/RNTesterApp.ios.js ]]
+ :
+ source /Users/kraen.hansen/Repositories/react-native/packages/react-native/scripts/node-binary.sh
++ '[' -z '/Users/kraen.hansen/Library/Application Support/fnm/node-versions/v22.11.0/installation/bin/node' ']'
++ type '/Users/kraen.hansen/Library/Application Support/fnm/node-versions/v22.11.0/installation/bin/node'
+ HERMES_ENGINE_PATH=/Users/kraen.hansen/Repositories/react-native/packages/rn-tester/Pods/hermes-engine
+ '[' -z /Users/kraen.hansen/Repositories/react-native/packages/rn-tester/Pods/hermes-engine/build_host_hermesc/bin/hermesc ']'
+ [[ true != false ]]
+ [[ -f /Users/kraen.hansen/Repositories/react-native/packages/rn-tester/Pods/hermes-engine ]]
+ '[' -z '' ']'
+ export NODE_ARGS=
+ NODE_ARGS=
+ '[' -z '' ']'
+ CLI_PATH=/Users/kraen.hansen/Repositories/react-native/packages/react-native/scripts/bundle.js
+ '[' -z '' ']'
+ BUNDLE_COMMAND=bundle
+ '[' -z '' ']'
+ COMPOSE_SOURCEMAP_PATH=/Users/kraen.hansen/Repositories/react-native/packages/react-native/scripts/compose-source-maps.js
+ [[ -z '' ]]
+ CONFIG_ARG=
+ [[ -z '' ]]
+ BUNDLE_NAME=main
+ BUNDLE_FILE=/tmp/RNTesterBuild/Build/Products/Release-iphonesimulator/main.jsbundle
+ EXTRA_ARGS=()
+ case "$PLATFORM_NAME" in
+ BUNDLE_PLATFORM=ios
+ '[' '' = YES ']'
+ EMIT_SOURCEMAP=
+ [[ ! -z ../sourcemap.ios.map ]]
+ EMIT_SOURCEMAP=true
+ PACKAGER_SOURCEMAP_FILE=
+ [[ true == true ]]
+ [[ true != false ]]
++ basename ../sourcemap.ios.map
+ PACKAGER_SOURCEMAP_FILE=/tmp/RNTesterBuild/Build/Products/Release-iphonesimulator/sourcemap.ios.map
+ EXTRA_ARGS+=("--sourcemap-output" "$PACKAGER_SOURCEMAP_FILE")
+ [[ true != false ]]
+ [[ false == false ]]
+ EXTRA_ARGS+=("--minify" "false")
+ [[ -n '' ]]
+ [[ -n '' ]]
+ EXTRA_ARGS+=("--config-cmd" "$NODE_BINARY $NODE_ARGS $REACT_NATIVE_DIR/cli.js config")
+ '/Users/kraen.hansen/Library/Application Support/fnm/node-versions/v22.11.0/installation/bin/node' /Users/kraen.hansen/Repositories/react-native/packages/react-native/scripts/bundle.js bundle --entry-file /Users/kraen.hansen/Repositories/react-native/packages/rn-tester/js/RNTesterApp.ios.js --platform ios --dev false --reset-cache --bundle-output /tmp/RNTesterBuild/Build/Products/Release-iphonesimulator/main.jsbundle --assets-dest /tmp/RNTesterBuild/Build/Products/Release-iphonesimulator/RNTester.app --sourcemap-output /tmp/RNTesterBuild/Build/Products/Release-iphonesimulator/sourcemap.ios.map --minify false --config-cmd '/Users/kraen.hansen/Library/Application Support/fnm/node-versions/v22.11.0/installation/bin/node  /Users/kraen.hansen/Repositories/react-native/packages/react-native/cli.js config'
/bin/sh: /Users/kraen.hansen/Library/Application: No such file or directory
node:internal/errors:983
  const err = new Error(message);
              ^

Error: Command failed: /Users/kraen.hansen/Library/Application Support/fnm/node-versions/v22.11.0/installation/bin/node  /Users/kraen.hansen/Repositories/react-native/packages/react-native/cli.js config
/bin/sh: /Users/kraen.hansen/Library/Application: No such file or directory

    at genericNodeError (node:internal/errors:983:15)
    at wrappedFn (node:internal/errors:537:14)
    at checkExecSyncError (node:child_process:888:11)
    at execSync (node:child_process:960:15)
    at Command.handleAction (/Users/kraen.hansen/Repositories/react-native/packages/react-native/scripts/bundle.js:48:9)
    at Command.listener [as _actionHandler] (/Users/kraen.hansen/Repositories/react-native/node_modules/commander/lib/command.js:542:17)
    at /Users/kraen.hansen/Repositories/react-native/node_modules/commander/lib/command.js:1502:14
    at Command._chainOrCall (/Users/kraen.hansen/Repositories/react-native/node_modules/commander/lib/command.js:1386:12)
    at Command._parseCommand (/Users/kraen.hansen/Repositories/react-native/node_modules/commander/lib/command.js:1501:27)
    at Command.parse (/Users/kraen.hansen/Repositories/react-native/node_modules/commander/lib/command.js:1064:10)
    at Object.<anonymous> (/Users/kraen.hansen/Repositories/react-native/packages/react-native/scripts/bundle.js:71:11)
    at Module._compile (node:internal/modules/cjs/loader:1546:14)
    at Object.<anonymous> (node:internal/modules/cjs/loader:1689:10)
    at Module.load (node:internal/modules/cjs/loader:1318:32)
    at Function._load (node:internal/modules/cjs/loader:1128:12)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:218:24)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:170:5)
    at node:internal/main/run_main_module:36:49 {
  status: 127,
  signal: null,
  output: [
    null,
    '',
    '/bin/sh: /Users/kraen.hansen/Library/Application: No such file or directory\n'
  ],
  pid: 64660,
  stdout: '',
  stderr: '/bin/sh: /Users/kraen.hansen/Library/Application: No such file or directory\n'
}

Node.js v22.11.0
Command PhaseScriptExecution failed with a nonzero exit code

warning: Run script build phase '[CP-User] [RN]Check FBReactNativeSpec' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'React-RCTFBReactNativeSpec' from project 'Pods')
warning: Run script build phase 'Build JS Bundle' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'RNTester' from project 'RNTesterPods')
warning: Run script build phase '[RN] Copy Hermes Framework' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'RNTester' from project 'RNTesterPods')
** BUILD FAILED **
```
</details>

This PR add single quotes around the `$NODE_BINARY` and `$REACT_NATIVE_DIR` to avoid `--config-cmd` escaping similarly to the way they're escaped when invoked just below: https://github.com/facebook/react-native/blob/00c7174c24fd15db7723633e3e67aa59a7e73a6c/packages/react-native/scripts/react-native-xcode.sh#L155

## Changelog:

[IOS] [FIXED] - Properly escape paths in Xcode build script used when bundling an app.

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

Test Plan:
- Change your node path to contain a space (possibly through a symlink and manually updating the `.xcode.env.local` file in `packages/rn-tester`.
- Build the RNTester app for e2e tests: `yarn e2e-build-ios`
- See the failure mentioned above 💥
- Apply this patch and re-run the build command to success 

Reviewed By: NickGerleman

Differential Revision: D67256815

Pulled By: robhogan

fbshipit-source-id: e27a8cd079347fdf982c28b5af347be621c8feba
2024-12-15 18:15:49 -08:00
Eric Rozell 00c7174c24 Add override to RCTHermesInstance destructor (#48265)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48265

For some clang warnings configurations, you may hit `-Winconsistent-missing-destructor-override` without this override modifier.

## Changelog

[Internal]

Reviewed By: cipolleschi

Differential Revision: D67203040

fbshipit-source-id: 51f8f9bc4e45ebdb008dc440b779302b1103668a
2024-12-13 16:44:01 -08:00
Eric Rozell 9a2b807dcb Remove unnecessary semi-colon before method body (#48266)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48266

For some clang build configurations the semi-colon triggers `-Wsemicolon-before-method-body`. This fixes that warning in iOS sources.

## Changelog

[Internal]

Reviewed By: cipolleschi

Differential Revision: D67203041

fbshipit-source-id: f2f2f3799691c3fc59e102a852ca2cf61154e55e
2024-12-13 16:44:01 -08:00
Christoph Purrer ae90dd3aaa Share TextLayoutManager.h across all platforms (#48210)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48210

[Changelog] [Internal] - Share TextLayoutManager.h across all platforms

The goal of this change is to enable to share `TextLayoutManager.h` across all platforms, the same we do for:

https://github.com/facebook/react-native/blob/main/packages/react-native/ReactCommon/react/renderer/imagemanager/ImageManager.h

Reviewed By: philIip

Differential Revision: D67064488

fbshipit-source-id: 15ee02f3c2351ad65590b5f0dee2f3dbbde4df32
2024-12-13 16:12:40 -08:00
Maddie Lord c2fd35a442 Add logging in ReactInstanceManager.onHostPause when activity is incorrectly null (#48226)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48226

Adding logging to onHostPause to help diagnose cases when the activity is incorrectly null.

Reviewed By: fkgozali

Differential Revision: D67123351

fbshipit-source-id: f694a3a89e4584776050f6bca2f33f2805528d4b
2024-12-13 13:35:08 -08:00
Mateo Guzmán 81c74cd35f ScrollView: handling testID correctly for horizontal scroll view (#48254)
Summary:
Fixes https://github.com/facebook/react-native/issues/46180

This PR fixes the `testID` not being set as a `resource-id` in the `HorizontalScrollView`.

Currently the `resource-id` is being set correctly when we use a vertical scroll view (this is done [here](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java#L156) for reference) but we still miss setting this when we use a horizontal one as the managers for both components are different.

## Changelog:

[ANDROID][FIXED] - Handling `testID` correctly for horizontal scroll view

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

Test Plan:
Render a simple `ScrollView` component with `horizontal` set as `true` and pass a `testID` property as shown:

```tsx
function Playground() {
  return (
    <ScrollView testID="customScrollViewTestId" horizontal>
      <View
        style={{
          marginVertical: 400,
          backgroundColor: 'white',
          padding: 14,
          margin: 50,
          width: 200,
          height: 200,
        }}
      />
    </ScrollView>
  );
}
```

Open Maestro Studio and search for **customScrollViewTestId** in the search bar.

<details>
<summary>Before the fix: The `testID` is not found. (See screenshot)</summary>

![image](https://github.com/user-attachments/assets/9f1c6438-e105-468e-8bf4-4e2238824f9f)
</details>

<details>
<summary>See the same in Appium. (See screenshot)</summary>

<img width="900" alt="image" src="https://github.com/user-attachments/assets/4f1a7858-4549-45b2-bb5f-d0b3485e5d69" />

</details>

 ---

Apply this fix, and search again in Maestro Studio.

<details>
<summary>After the fix: The `testID` is now recognised and can be found in the search bar. (See screenshot)</summary>

![image](https://github.com/user-attachments/assets/371f6d1f-5a41-461b-b276-7c0e702ee1e2)
</details>

<details>
<summary>See the same in Appium. (See screenshot)</summary>

<img width="891" alt="image" src="https://github.com/user-attachments/assets/ef03310c-c1ab-4ef7-b2c5-60c3b8d84c10" />

</details>

Reviewed By: tdn120, mdvacca

Differential Revision: D67201619

Pulled By: javache

fbshipit-source-id: 016faf724a482e0eca6dedfbf94dd9ea56255757
2024-12-13 12:39:31 -08:00
Hanno J. Gödecke ed36e896ac feat: add getState for StateWrapperImpl (#48255)
Summary:
We're trying to pass `jsi::Value`s directly to our view components (and convert them to java/swift types manually). That way we can pass "complex" objects to our views (such as `jsi::Object`s with `NativeState` attached, without the need to convert them to e.g. `folly::dynamic`).

On android we store our complex prop values on the `StateWrapperImpl` to pass the complex types between c++ and java/kotlin. See an example here:

https://github.com/hannojg/nitro/blob/2378fe7754294c496b2cbcd62f7109529e276427/packages/react-native-nitro-image/nitrogen/generated/android/c%2B%2B/JValueFromStateWrapper.cpp#L21-L23

```
  const auto& customStateData = dynamic_cast<const ConcreteState<CustomStateData>&>(state);
  CustomStateData data = customStateData.getData();
  std::shared_ptr<HybridTestObjectSwiftKotlinSpec> nativeProp = data.nativeProp;
```

> (And then it might be used in java like this:)
https://github.com/hannojg/nitro/blob/2378fe7754294c496b2cbcd62f7109529e276427/packages/react-native-nitro-image/android/src/main/java/com/margelo/nitro/image/NitroExampleViewManager.java#L31-L38

```kotlin
public Object updateState(NonNull View view, ReactStylesDiffMap props, StateWrapper stateWrapper) {
   StateWrapperImpl stateWrapperImpl = (StateWrapperImpl) stateWrapper;

    HybridTestObjectSwiftKotlinSpec nativeProp = ValueFromStateWrapper.valueFromStateWrapper(stateWrapperImpl);
    long value = nativeProp.getBigintValue();
    Log.d("NitroExampleViewManager", "Value from state: " + value);
```

For that we need to be able to access the underlying state, which is what we added in this PR.

## 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] [ADDED] - Added `getState` method for `StateWrapperImpl`

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

Test Plan: Internal change, just make sure all tests are passing

Reviewed By: cipolleschi

Differential Revision: D67196130

Pulled By: javache

fbshipit-source-id: 7da74bcddef79abd3122baaad1bfce30330ecc80
2024-12-13 10:02:32 -08:00
Hanno J. Gödecke ecf17666ad fix(android): fix mapbuffer jni headers not found consuming react-native from prefab (#48243)
Summary:
I was getting build errors when I tried to include `StateWrapperImpl.h` in my library's code on android. The error was:
![CleanShot 2024-12-12 at 15 02 44@2x](https://github.com/user-attachments/assets/bffb69f4-f80c-4610-9ad7-bd8098ac5340)

```
node_modules/react-native/ReactAndroid/build/prefab-headers/reactnative/react/fabric/StateWrapperImpl.h:11:10: fatal error: 'react/common/mapbuffer/JReadableMapBuffer.h' file not found
#include <react/common/mapbuffer/JReadableMapBuffer.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 warnings and 1 error generated.
```

The problem is that the map buffer files inside the mapbuffer folder are nested, so the prefab outcome looks like this:

![CleanShot 2024-12-12 at 14 53 26@2x](https://github.com/user-attachments/assets/ccd8c738-e887-40ba-a83b-38a7d2103d36)

Hence it can't resolve the header path.

This change removes the header prefix part as its not needed, since the nested folder structure in mapbuffer already matches what we need, see:

https://github.com/facebook/react-native/tree/main/packages/react-native/ReactAndroid/src/main/jni/react/mapbuffer

## 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] - Fixed build issue when including mapbuffer jni headers in library code

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

Test Plan:
make sure the header path looks correct in the prefab build dir:

![CleanShot 2024-12-12 at 14 41 43@2x](https://github.com/user-attachments/assets/72598263-8775-4551-ab4a-91e9c9496b61)

Reviewed By: cipolleschi

Differential Revision: D67200010

Pulled By: cortinico

fbshipit-source-id: 127a17392fcca0a3a07643497729979849f0a17a
2024-12-13 09:32:15 -08:00
Rubén Norte edb3850adb Log status code when commands fail (#48222)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48222

Changelog: [internal]

Tiny improvement over the current setup so it might help detect some current issues.

Reviewed By: yungsters

Differential Revision: D67021976

fbshipit-source-id: 7829f2ea0d839178f1a50d176b42dc0906c2e585
2024-12-13 08:10:59 -08:00
Nick Gerleman 06751aa0d1 "experimental_layoutConformance" ViewProp -> "experimental_LayoutConformance" component (#48188)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48188

Yoga is full of bugs! Some of these bugs cannot be fixed without breaking large swaths of product code. To get around this, we introduced "errata" to Yoga as a mechanism to preserve bug compatibility, and an `experimental_layoutConformance` prop in React Native to create layout conformance contexts. This has allowed us to create more compliant layout behavior for XPR.

This prop was originally designed as a context-like component, so you could set a conformance level at the root of your app, and individual components could change it for compatibility. This was difficult to achieve at the time, without introducing a primitive like `LayoutConformanceView`, which itself participated in the view tree. This prop has not been the desired end-goal, since it does not make clear that it is setting a whole new context, effecting children as well!

Now that we've landed support for `display: contents`, we can achieve this desired API pretty easily.

**Before**

```
import {View} from 'react-native';

// Root of the app
<View {...props} experimental_layoutConformance="strict">
  {content}
</View>

```

**After**

```
import {View, experimental_LayoutConformance as LayoutConformance} from 'react-native';

// Root of the app
<LayoutConformance mode="strict">
  <View {...props}>
    {content}
  </View>
</LayoutConformance>

```

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D66910054

fbshipit-source-id: e6a304b5c30ad3c5845a7ce2d1021996a74c2f34
2024-12-12 14:57:04 -08:00
zhongwuzw 4adaacb4f7 Exclude Android HorizontalScrollContentView cxx component code (#48138)
Summary:
Exclude Android HorizontalScrollContentView cxx component code, iOS don't need it. cc NickGerleman can you help to review? :)

## Changelog:

[IOS] [FIXED] - Exclude Android HorizontalScrollContentView cxx component code

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

Test Plan: iOS don't include any Android HorizontalScrollContentView code.

Reviewed By: christophpurrer

Differential Revision: D67127853

Pulled By: NickGerleman

fbshipit-source-id: 7901aa7bf62eada58d973e07e8a95e4d595c1ea5
2024-12-12 14:50:59 -08:00
Pieter De Baets 49a594a513 Remove references to legacy JSC SamplingProfiler
Summary:
This module is no longer functional, the global method `pokeSamplingProfiler` does not exist. There are no implementations in the core of `JSCSamplingProfiler` (removed back in 2019! - https://www.internalfb.com/diff/D10473627)

Changelog: [Internal]

Reviewed By: fabriziocucci

Differential Revision: D67140119

fbshipit-source-id: 9dfe80d63e935004ef4a1956e8a7a544a2f9a8c1
2024-12-12 14:43:18 -08:00
Pieter De Baets e06fa5d102 Remove legacy JSC HeapCapture (#48239)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48239

The native method this module references (`nativeCaptureHeap`) no longer exists, and Metro no longer emits this command.

Changelog: [Android][Removed] Removed JSCHeapCapture module, deprecated PackagerCommandListener#onCaptureHeapCommand

Reviewed By: fabriziocucci

Differential Revision: D67140120

fbshipit-source-id: 7c318366c38868c8a0c589473b6abadd0a09bdde
2024-12-12 14:43:18 -08:00
Jorge Cabiedes Acosta a2db0ba9c4 Add expectedReleaseValue to RN Feature Flags (#48073)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48073

Small change so we can know what the final value of the feature flag will be

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D64077789

fbshipit-source-id: 2a9e2c7ceeb18813b4556f92db547697bba966a5
2024-12-12 13:55:35 -08:00
Hanno J. Gödecke d6919526a6 feat: RawPropsParser add useRawPropsJsiValue parameter (#48231)
Summary:
In this PR we added a change that allows the RawPropsParser to construct its RawValues directly from the `jsi::Value` instead of converting it to `folly::dynamic` first.
We added a global feature flag to turn this on, however, for migrations it might be better to use this functionality as an opt-in on a component basis. With this change `ComponentDescriptors` can now create their RawPropsParser instance with the `useRawPropsJsiValue` flag to opt into it.

(Note: a few more changes are needed to make this accessible to the `ComponentDescriptor`, for which I opened [this follow up PR here](https://github.com/facebook/react-native/pull/48232))

## 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
-->

[INTERNAL] [ADDED] - Added `useRawPropsJsiValue` parameter to `RawPropsParser` to opt into skipping folly::dynamic conversions during prop parsing.

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

Test Plan: Internal change / just make sure all tests are passing.

Reviewed By: NickGerleman

Differential Revision: D67139641

Pulled By: javache

fbshipit-source-id: 5b243edb8149870aad0a5a1b3998ee67997783d7
2024-12-12 12:52:16 -08:00
Pieter De Baets fd5bd3e5de Pass JSI Dynamic filter callback by ref (#48242)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48242

This std::function is immediately invoked, no need to copy it around.

Changelog: [Internal]

Reviewed By: fabriziocucci

Differential Revision: D67093042

fbshipit-source-id: 2b863fb1857da73568afaf6f3d3c8c7bbef0d61b
2024-12-12 11:38:36 -08:00
Hanno J. Gödecke feff4a7556 feat(android): allow passing filter function for prop folly::dynamic conversion (#48202)
Summary:
### Motivation

- We need to exclude certain prop keys from conversion to `folly::dynamic` on android for our custom use case where we pass down `jsi::object`s with NativeState attached down the props

Otherwise we run into crashes such as:

![CleanShot 2024-12-11 at 09 18 26@2x](https://github.com/user-attachments/assets/b460187e-5442-4547-ae36-ffd188f444f2)

### Changes

- `dynamicFromValue` was marked as `noexcept` although it can throw, I removed the `noexcept` for correctness
- Made it so you can pass down a filter function to exclude certain props from conversion (using the existing mechanism for that)
	- I think there is no way to pass a filter function and retain it in `RawProps` as that is constructed very early on in `UIManagerBinding`

## 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
-->

[INTERNAL] [ADDED] - Allow passing a filter function to `BaseViewProps` to exclude certain props on android from being dynamically casted

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

Test Plan:
You can try modifying for example `ScrollViewProps.cpp` and pass a fourth argument to `ViewProps` to confirm that the filtering is working:

```cpp
ScrollViewProps::ScrollViewProps(
    const PropsParserContext& context,
    const ScrollViewProps& sourceProps,
    const RawProps& rawProps)
    : ViewProps(context, sourceProps, rawProps, [&](const std::string& keyName){
        return true;
    }),
```

Reviewed By: NickGerleman

Differential Revision: D67088540

Pulled By: javache

fbshipit-source-id: ed8cf5d773d357dfc54553f5ccf7adf27c781d56
2024-12-12 11:38:36 -08:00
CHEN Xian-an 1763321c89 Support system font families on iOS (#47544)
Summary:
Apple introduced system font families

```
font-family: system-ui;
font-family: ui-sans-serif;
font-family: ui-serif;
font-family: ui-monospace;
font-family: ui-rounded;
```

for Safari at 2020 (see https://developer.apple.com/videos/play/wwdc2020/10663/?time=872).

This PR implementation supports above font families on iOS.

bypass-github-export-checks

## Changelog:

[IOS] [ADDED] - Support system font families (system-ui, ui-sans-serif, ui-serif, ui-monospace, and ui-rounded) on iOS

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

Test Plan: Run `RNTester` and view the `Text` component where shows the usage for those font families.

Reviewed By: NickGerleman

Differential Revision: D65761307

Pulled By: cipolleschi

fbshipit-source-id: 18628160b7753b314389e887cddfe9d0ec96ee1d
2024-12-12 10:50:34 -08:00
Riccardo Cipolleschi 61e876ef89 Convert HelloWorld to Swift (#48246)
Summary:
This PR converts the HelloWorld app to Swift. The HelloWorld app is our internal copy of the Template and the template is now using Swift. It's important that this macroscopic changes are synched between the template and HelloWorld, otherwise we risk to ship changes that works in the helloworld app but that break the template, and therefore the next release. That already happened once this month.

## Changelog:
[Internal] - Migrate HelloWorld app to swift

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

Test Plan: GHA

Reviewed By: cortinico

Differential Revision: D67143408

Pulled By: cipolleschi

fbshipit-source-id: f74412116570e44c2a394173f7d4d3b6dd85e2e5
2024-12-12 10:44:27 -08:00
Christoph Purrer 59c72e9d29 (Almost) align Android TextLayoutManager interface with iOS one (#48209)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48209

[Changelog] [Internal] - (Almost) align Android TextLayoutManager interface with iOS one

This change aligns the public API surface of `TextLayoutManager` from RN Android closer to the RN iOS one.

Reviewed By: javache

Differential Revision: D67061225

fbshipit-source-id: b06f47c7e322bdac429cefb85bf2f2a80210a64f
2024-12-12 10:22:25 -08:00