Commit Graph

38536 Commits

Author SHA1 Message Date
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
Christoph Purrer 26f4c78aa2 Use ShadowNode::Traits instead of directly enable Yoga measurement (#48223)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48223

[Changelog] [Internal] - Use ShadowNode::Traits instead of directly enable Yoga measurement

The goal of this change is to simple use ShadowNodeTraits to enable measurement of ShadowNode props

Reviewed By: NickGerleman

Differential Revision: D67114097

fbshipit-source-id: dccb0f9b83f339c07ca41678533d97191277b520
2024-12-12 10:15:39 -08:00
Nick Gerleman a28867f952 Remove home-rolled yarn caching (#48237)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48237

Noticed this when trying to diagnose what seemed like a stale caching issue. It effectively reverts D59917944.

D59917944 added logic to only do yarn caching on main, but it has some correctness issues:
1. We cache `node_modules` instead of the yarn cache, which may contain e.g. build artifacts, or other scratch/cache files written (such as anything that writes to `node_modules/.cache`). We really want to be caching the yarn cache, which has pristine packages before install, which I think it will also need to perform the real install anyways.
2. We key the cache on root `package.json`, which is missing a lot of information (both provided by the other `package.json` in the repo, but mostly, the lockfile resolution).

We only save cache when we're on `refs/heads/main` (so continuous builds against main), and supposedly, builds against base branch should be able to restore against those, but recent PR jobs I have seen, where `package.json` has not changed, all have `Cache not found for input keys: node-modules-068350889e87919c1c6c2c220c8d2d92db13f38820bf2efb315d1274b97bc367`

Because of the potential correctness issues, and that the strategy for limiting to main seemingly is not allowing cache to be used in PR, this diff goes back to previous solution, which may store more artifacts (but working cache should also reduce cost by making jobs run faster).

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D67140004

fbshipit-source-id: f74074a498af56b1837fa23cf80795f76935b762
2024-12-12 09:13:52 -08:00
Riccardo Cipolleschi 9f4b4aba93 Test Old Arch with Maestro (#48244)
Summary:
This pr tests the Old Arch on the Template app using Maestro

## Changelog:
[Internal] - Test old arch in CI with Maestro for template app

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

Test Plan: GHA

Reviewed By: cortinico

Differential Revision: D67141524

Pulled By: cipolleschi

fbshipit-source-id: bef3a9b6fec9d7c91d858d534a2d00e91f1842b5
2024-12-12 09:01:31 -08:00
Pieter De Baets 8fc4e8b35b Use registerCallableModule consistently (#48238)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48238

Use the helper module we have, which has better type-safety and less code duplication.

Changelog: [Internal]

Reviewed By: fabriziocucci

Differential Revision: D67139572

fbshipit-source-id: 39ae9119d97f937b30ad6e7451468cbb3cc37a84
2024-12-12 08:30:58 -08:00
Pieter De Baets c06f13e7fb Error when using runTask in a re-entrant way (#48235)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48235

Recursively calling runTask is not supported, as the inner call will no-op since we're already executing the eventloop.

Currently errors are not correctly propagated, but this at least makes it so that we don't attempt to schedule the task either, which could lead to incorrect assumptions being made.

Changelog: [internal]

Reviewed By: rubennorte

Differential Revision: D67107664

fbshipit-source-id: e665a96671f4812308d87aec3b880ce2009328e2
2024-12-12 08:09:02 -08:00
Hanno J. Gödecke 9dce26215b feat: add RawPropsParser as optional parameter to Concrete-/ComponentDescriptor (#48232)
Summary:
In this PR we introduced a new mechanism for `RawPropsParser` to construct its RawValues directly from `jsi::Value` instead of converting it to `folly::dynamic` first:

- https://github.com/facebook/react-native/pull/48047/

In this PR we added a parameter to `RawPropsParser` to opt-into using the above described mechanism:

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

Whats missing is that `RawPropsParser` was default constructed in `ComponentProvider` and there is no way to pass a custom instance (where you'd for example set the above described parameter). This PR adds support for that.

## 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] - Add `RawPropsParser` as optional parameter to Concrete-/ComponentDescriptor

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

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

Reviewed By: cipolleschi

Differential Revision: D67135357

Pulled By: javache

fbshipit-source-id: 45f384d42314976c16cae10d5ea0419d13fd0889
2024-12-12 07:26:21 -08:00
Nick Gerleman f4a17fbb93 Add missing glog dep to React-idlecallbacksnativemodule.podspec (#48241)
Summary:
`react_native_assert` on iOS uses glog under the hood, and https://github.com/facebook/react-native/pull/47911 added usage to a new podspec, which means new entire binary under some build modes. Need to add missing dependency I think?

Changelog: [Internal]

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

Test Plan: tes_ios_helloworld passes with DynamicLibraries

Reviewed By: cipolleschi

Differential Revision: D67141052

Pulled By: NickGerleman

fbshipit-source-id: 299a499f40e9b54c4aca5d6e1c95c43ce933fb2b
2024-12-12 06:57:43 -08:00
Rubén Norte 6059660c60 Ship feature flag shouldSkipStateUpdatesForLoopingAnimations by default (#48224)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48224

Changelog: [General][Fixed] Removed unnecessary state updates in React to reflect the current state of looping animations.

This enables that feature flag by default and prepares for an incoming cleanup.

Reviewed By: yungsters, dmytrorykun

Differential Revision: D67109980

fbshipit-source-id: 3c98731221b0fb01a8d49d537df859fe23c0ae45
2024-12-12 05:41:01 -08:00
Rubén Norte 11c49d60cc Make feature flags module and overrides read-only (#48229)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48229

Changelog: [internal]

The type definitions for these objects (the exported value by the `ReactNativeFeatureFlags` module, and the input value for `ReactNativeFeatureFlags.override()` method) were writable objects, which is incorrect and causes other problems down the line.

This just makes them read-only.

Reviewed By: yungsters

Differential Revision: D67109719

fbshipit-source-id: 8d56e05042587a53cdd05e51b4207ef27ace2d91
2024-12-12 05:41:01 -08:00
Eric Rozell e04738b7ec Disable weak event emitter in AttributedString for Mac Catalyst (#48225)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48225

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

The weak event emitter in AttributedString attributes is causing a serialization error when typing into a TextInput in a Mac Catalyst build. We can resolve this by not putting the event emitters in the attributed string, but this is likely to cause other issues with event handling for nested <Text> components.

## Changelog

[iOS][Fixed] - Workaround for Mac Catalyst TextInput crash due to serialization attempt of WeakEventEmitter

Reviewed By: NickGerleman

Differential Revision: D66664583

fbshipit-source-id: efdfbcb0db4d5e6b9bf7c14f9bbb221faae2d724
2024-12-12 05:39:51 -08:00
Alex Hunt 9888b499f5 Add support for Performance.mark events in PerformanceTracer (#48200)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48200

Wires up `Performance.mark()` events, completing support for User Timings in Fusebox.

Other changes:

- Refactors `reportMeasure` to receive a `duration`.
- Fixes conversion for time values (ms -> µs) in emitted trace events.

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D66704283

fbshipit-source-id: 352abbade26eb976e793481dde04463431bf2eb7
2024-12-12 04:40:43 -08:00
Alex Hunt fd9cdf3214 Add new Fusebox Tracing API, integrate into PerformanceEntryReporter (2/2) (#48043)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48043

Adds a new `PerformanceTracing` API to replace `ReactPerfLogger` and `FuseboxTracer`.

- Mostly a clone of `FuseboxTracer`, with small refactorings.
- Exposes a new `CdpTracing.h` header, intended for shared CDP/Chrome types (that will later propagate through to the runtime impl of `performance.mark,measure()`).
- These live in a new `jsinspector_tracing` library, to avoid a dependency cycle.

**Key change**: With both diffs, `PerformanceTracer` is added to `PerformanceEntryReporter` to initially wire up the `performance.measure` event — replacing the previous routing.

- `FuseboxTracer` remains load-bearing for the out-of-tree call to `stopTracingAndWriteToFile()`.

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D66650181

fbshipit-source-id: 9092257f23cdb8746e69f5ff3eb7dbf4c8142938
2024-12-12 04:40:43 -08:00
Alex Hunt 59969b6135 Remove Fusebox calls from ReactPerfLogger, rename (1/2) (#48044)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48044

Updates `ReactPerfLogger` (now renamed `ReactPerfettoLogger`) to log to Perfetto only.

This precedes integrating `FuseboxTracer` calls into `PerformanceEntryReporter` for User Timing events and Interaction events.

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D66600278

fbshipit-source-id: f250f6b018d091d740bb13d5fcce9b716c4a6f72
2024-12-12 04:40:43 -08:00
Mateo Guzmán 79ed11f8f4 fix(rn-tester): text input and xml http request dark mode adjustments (#48207)
Summary:
Was troubleshooting in these modules recently and noticed a few texts off in dark mode. Replacing a few instances of the Text component in all I could see in the two screens.

## Changelog:

[INTERNAL] - RN Tester `TextInput` & `XMLHttpRequest` dark mode adjustments

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

Test Plan:
<details>
<summary>View Screenshots (before fixes)</summary>

| Screenshot 1 | Screenshot 2 | Screenshot 3 | Screenshot 4 | Screenshot 5 | Screenshot 6 |
|--------------|--------------|--------------|--------------|--------------|--------------|
| ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 11 36](https://github.com/user-attachments/assets/c396bc5d-4b3c-4f63-8ac0-68bc808aa9d4) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 11 21](https://github.com/user-attachments/assets/cd8e5a2f-9066-4bc7-b56b-65dbd6df7dc4) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 10 30](https://github.com/user-attachments/assets/da451c18-40cd-4421-b8f5-a2462f82fee9) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 10 23](https://github.com/user-attachments/assets/32925fdb-f983-439f-b898-6986b739895a) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 10 19](https://github.com/user-attachments/assets/f0db7b49-dfef-4abc-aef0-2d55b016c0f8) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 10 16](https://github.com/user-attachments/assets/bad6dc45-3679-4bb6-aadd-6743053cd90f) |
| ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 10 10](https://github.com/user-attachments/assets/43028f51-c6e2-4b26-b20d-a3639606d6d5) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 10 07](https://github.com/user-attachments/assets/f8e2196e-bc64-4507-b330-d1d85730ddff) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 09 59](https://github.com/user-attachments/assets/a7100770-4b38-421f-9b73-09e4fff9e012) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 09 53](https://github.com/user-attachments/assets/27759c8c-0e56-4b92-8173-ba031b994e5c) | | | |

</details>

<details>
<summary>View Screenshots (after fixes)</summary>

| Screenshot 1 | Screenshot 2 | Screenshot 3 | Screenshot 4 | Screenshot 5 | Screenshot 6 |
|--------------|--------------|--------------|--------------|--------------|--------------|
| ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 05 30](https://github.com/user-attachments/assets/71c0287d-d98a-4bfe-85dc-1e08da12ce43) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 05 26](https://github.com/user-attachments/assets/45eac165-f42a-4193-98cc-3ee85d963382) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 05 23](https://github.com/user-attachments/assets/c0e4432d-2d1d-487f-8965-3829c3257364) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 05 19](https://github.com/user-attachments/assets/ab81500c-66c1-4b90-b2b1-f7c490e0029b) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 05 16](https://github.com/user-attachments/assets/aafcad74-e851-49a8-9db0-df06f81f0b30) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 05 11](https://github.com/user-attachments/assets/29a2a6c8-e448-4c90-844d-29a248f9ab69) |
| ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 05 07](https://github.com/user-attachments/assets/54e505c4-c554-4000-aac1-61b97e034f55) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 04 39](https://github.com/user-attachments/assets/0e91dc29-199d-424e-b36a-6b0f7a317cd2) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 04 22](https://github.com/user-attachments/assets/e965b01d-0b03-4d01-a971-57c3bd550146) | ![Simulator Screenshot - iPhone SE (3rd generation) - 2024-12-11 at 00 04 15](https://github.com/user-attachments/assets/50ef03a6-bf1a-4db3-845b-e98373369574) |  |  |

</details>

Reviewed By: cipolleschi

Differential Revision: D67087492

Pulled By: javache

fbshipit-source-id: c9c64377d8c10d965bc5db7783aa80f099ce858a
2024-12-12 04:07:10 -08:00
Mateo Guzmán dffa57fa25 Exclude packages/react-native/ReactAndroid/build from lint checks (#48217)
Summary:
When running the linter locally, noise is generated from the `packages/react-native/ReactAndroid/build` folder. This folder does not need to be checked, as it is already excluded in the [.gitignore](https://github.com/facebook/react-native/blob/main/.gitignore#L33).

## Changelog:

[INTERNAL] - Exclude `packages/react-native/ReactAndroid/build` from lint checks

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

Test Plan:
```bash
yarn lint
```

Reviewed By: huntie

Differential Revision: D67134035

Pulled By: cortinico

fbshipit-source-id: f314c8601d6a3bf8ac6ebed67bdc392c6a6aeba8
2024-12-12 03:12:32 -08:00
Panos Vekris e5a526ff44 remove as_const option (on by default) in fbsource (#48227)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48227

This option is on by default in Flow v0.256

Reviewed By: gkz

Differential Revision: D67117062

fbshipit-source-id: 1595afe48178529ad43b33a215d84ff225cf9fa9
2024-12-12 02:01:35 -08:00
Andrew Coates 849407ae6f Fix no return static analysis error in SchedulerPriorityUtils.h (#47911)
Summary:
In react-native-windows our static analysis tools report an error for `timeoutForSchedulerPriority` due to cases where it may not always return a value.  This is an upstreaming of the patch we have to fix that error.

## Changelog:

[INTERNAL] [FIXED] - Fix no return static analysis error in SchedulerPriorityUtils.h

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

Test Plan: Building should be sufficient.

Reviewed By: christophpurrer

Differential Revision: D66992063

Pulled By: NickGerleman

fbshipit-source-id: 999fea328d0c66ad92314f537e41beff5856c285
2024-12-12 01:31:18 -08:00
Chi Tsai e34c1e9bd2 Add default implementation for Object.create(prototype) (#47946)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47946

Object creation with custom prototype can currently be done, but it is
unnecessarily convoluted. Users have to call into the global object to
get the `Object.create` function, then call it with the custom
prototype.

This diff adds a JSI API for Object.create(prototype) to make it easy
for users.

Changelog: [Internal]

Reviewed By: avp

Differential Revision: D66485209

fbshipit-source-id: 32018f847190ac16f695f011a78be0c45c4c4659
2024-12-12 01:14:00 -08:00
Chi Tsai 04f33ecd58 Add default implementation for Object.getPrototypeOf and Object.setPrototypeOf (#47996)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47996

Getting and setting an Object's prototype is convoluted. Users have to
call into the global object to get the method, then call it.

This diff adds a JSI API for Object.getPrototype and Object.setPrototype
to make it easy for users.

Changelog: [Internal]

Reviewed By: fbmal7

Differential Revision: D66562549

fbshipit-source-id: 85a2e49deb9d00500544de4cc5ab123c4717398e
2024-12-12 01:14:00 -08:00
Christoph Purrer 07d723cb72 Remove unused (Android) TextLayoutManager getter (#48208)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48208

[Changelog] [Internal] - Remove unused (Android) TextLayoutManager getter

This getter
```
void* getNativeTextLayoutManager() const;
```
is not used on Android and different in signature to the iOS one:
```
std::shared_ptr<void> getNativeTextLayoutManager() const;
```
Deleting it for now to make future code sharing between various platforms easier.

This change removes further the by now discouraged pattern of:
```
using SharedTextLayoutManager = std::shared_ptr<const TextLayoutManager>;
```
and changes callers to use
```
std::shared_ptr<const TextLayoutManager>;
```
directly.

Reviewed By: javache

Differential Revision: D67059514

fbshipit-source-id: b94dc7f664083c5c62c4ba7defca480549ca9dc1
2024-12-11 23:45:21 -08:00
hoxyq (Meta Employee) a80baac58e Remove comment syntax from ReactNativeTypes (#31457)
Summary:
# Summary

I'm working to get the main `react-native` package parsable by modern
Flow tooling (both `flow-bundler`, `flow-api-translator`).

This diff trivially removes some redundant Flow comment syntax in
`ReactNativeTypes.js`, which fixes parsing under these newer tools.

## How did you test this change?

Files were pasted into `react-native-github` under fbsource, where Flow
validates .

DiffTrain build for [92b62f500c3fca44a9dc9ead936ef3bf19481f02](https://github.com/facebook/react/commit/92b62f500c3fca44a9dc9ead936ef3bf19481f02)

Reviewed By: huntie

Differential Revision: D67100354

Pulled By: hoxyq

fbshipit-source-id: 575e4bd8ceefad15576273920a263ae89d027cad
2024-12-11 22:47:38 -08:00
Sam Zhou 7000b9b76c Add annotations and casts to fix future flow error (#48219)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48219

Changelog: [internal]

Reviewed By: panagosg7

Differential Revision: D67099060

fbshipit-source-id: fbb975d6194b071aa8f30dcd2b8f7f40130d31fb
2024-12-11 14:16:58 -08:00
Riccardo Cipolleschi 3ff9212ce4 Fix React-graphics podspec source_files (#48216)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48216

The `React-graphics` podspec is manually excluding some paths from the source_files but this approach is error prone. For esample changes that added new paths that must be excluded can create failures.

This change the podspec file to explicitly add only the files that iOS requires.

## Changelog:
[iOS][Changed] - Explicitly define the source files for React-graphics

## Facebook:
This change is necessary because we added the macos platform that was not included before and now we can't build RNTester from fbsource using the internal pipeline.

Reviewed By: hoxyq

Differential Revision: D67095677

fbshipit-source-id: 701d5938f6e141a313be62c8f930a089e1d6ee96
2024-12-11 08:48:31 -08:00
Hanno J. Gödecke 03d2186ace Construct RawValue directly from jsi::Value (#48047)
Summary:
### Motivation:

We are looking for a way to access the "raw" jsi value in our fabric view components, so that we can pass complex types like `HostObjects` or `jsi::Object` with `NativeState` attached to our components directly.
Currently the props are converted from `jsi::Object` to `folly::dynamic`, which prevents us from accessing these values directly.

### Changes

This PR is a implementation of the proposal discussed here:

- https://github.com/facebook/react-native/pull/44966#issuecomment-2503915245

These changes extend `RawValue` so that it can be directly constructed from `RawValue(Runtime*, jsi::Value&)` (not just from `folly::dynamic`).

`RawValue`s are created by the `RawPropParser.cpp`. By default it will use the `RawValue(folly::dynamic)` constructor, but we added a feature flag called `useRawPropsJsiValue`, which will sue the JSI constructor.
This enables to test this feature at runtime incrementally.

This change might also be tested on a component basis, by setting a flag in the component descriptor to enable JSI prop parsing for the RawPropParser, as outlined in this PR:

- https://github.com/hannojg/react-native/pull/2

## 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] [Added] - Add `useRawPropsJsiValue` feature flag to represent props internally as `jsi::Value`s instead of converting them to `folly::dynamic`

[General] [Added] - Added `RawValue(Runtime*, jsi::Value&)` constructor to make a `RawValue` from a `jsi::Value`.

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

Test Plan: Enable the `useRawPropsJsiValue` feature flag and test the rn-tester app on android and iOS. Make sure you get no new errors / warnings in the native console.

Reviewed By: NickGerleman

Differential Revision: D66877093

Pulled By: javache

fbshipit-source-id: 7342e5f86d2492ad63a9ccf5508f04e7eb252def
2024-12-11 08:38:12 -08:00
Juliusz Wajgelt 7d0338cb0b fix incorrect mmap file offset in JSBigFileString (#48198)
Summary:
`JSBigFileString` incorrectly passes the file offset to `mmap`, causing errors when `offset` is non-zero.

## Changelog:
[GENERAL] [FIXED] - `JSBigFileString` fails for non-zero offset arguments

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

Test Plan: - verify the new unit test passes

Reviewed By: cipolleschi

Differential Revision: D67086826

Pulled By: javache

fbshipit-source-id: 0991bb34a710b85ff0263dc553efb85ba62b4cd8
2024-12-11 08:24:50 -08:00
Mitya Kononchuk 477489ce84 Fix running fantom tests via buck-test (#48215)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48215

Changelog: [internal]

Reviewed By: rubennorte

Differential Revision: D66976980

fbshipit-source-id: d553c2f702d6928fb0ad88fcc2c6f04160a65d02
2024-12-11 07:07:10 -08:00