Commit Graph

12270 Commits

Author SHA1 Message Date
Eli White 02c6790842 Make CompleteType contain module and component reserved names (#48477)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48477

Over the years of copying and moving and renaming types through CodegenSchema, this type ended up in the Command params, although the Command parser doesn't allow it.

I made this change to a fixture:

{F1974104959}

and got this error

```
 FAIL  xplat/js/react-native-github/packages/react-native-codegen/src/parsers/flow/components/__tests__/component-parser-test.js
  ● RN Codegen Flow Parser › can generate fixture COMMANDS_DEFINED_WITH_ALL_TYPES

    Unsupported param type for method "scrollTo", param "speed". Found UnionTypeAnnotation

      127 |       default:
      128 |         (type: empty);
    > 129 |         throw new Error(
          |               ^
      130 |           `Unsupported param type for method "${name}", param "${paramName}". Found ${type}`,
      131 |         );
      132 |     }
```

Also, a default value for enum an argument of a Command doesn't make sense anyways.

Commands should probably have support for enums and string literal unions, but that's out of scope here.

Still need to add to this vec\concat on www: https://www.internalfb.com/code/www/[ebfa58f888a6064e17879934d447f59bcc2b6951]/flib/intern/sandcastle/react_native/ota_steps/SandcastleOTACompatibilityCheckReportingStep.php?lines=62

Changelog: [internal]

Reviewed By: cipolleschi

Differential Revision: D67806808

fbshipit-source-id: f0f31cca30abbf61f569933ea7c49cf6bfd18a3f
2025-01-06 18:42:37 -08:00
Christoph Purrer c8552519b3 Make SurfaceManager const correct (#48485)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48485

[Changelog] [Internal] - Make SurfaceManager const correct

This marks methods which don't modify member props as `const` and others as non `const`.

The current API signature is misleading as `const` methods do alter `mutable` members

Reviewed By: rshest

Differential Revision: D67820439

fbshipit-source-id: 6a991bd7ccbd464c2390e33e0c29b136892d65e0
2025-01-06 14:41:39 -08:00
Luna Wei 8681fc2ab2 Remove optionality of intersectionRect
Summary:
Changelog:
[General][Changed] - Mark `intersectionRect` required in `NativeIntersectionObserverEntry` to reflect native logic.

Reviewed By: rubennorte

Differential Revision: D67868219

fbshipit-source-id: cdc15908c0cf687b13d1424a59ee1e2383811ab3
2025-01-06 13:30:10 -08:00
Christoph Purrer 3744349ed7 Add RuntimeSchedulerKey constant for RuntimeScheduler lookup (#48486)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48486

[Changelog] [Internal] - Add RuntimeSchedulerKey constant for RuntimeScheduler lookup

Similar to https://github.com/facebook/react-native/pull/48127 this adds a contant to avoid typos when inserting or retrieving the RuntimeScheduler

Reviewed By: rshest

Differential Revision: D67822346

fbshipit-source-id: af982c6d4b875ffde06aae8e953c4892754a074b
2025-01-06 11:23:04 -08:00
Christoph Purrer c4edfe7323 Remove startEmptySurface from SurfaceManager (#48479)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48479

[Changelog] [Internal] - Remove startEmptySurface from SurfaceManager

Most of the logic deleted here does not seem to be needed as the core functionality is in:

https://github.com/facebook/react-native/blob/main/packages/react-native/ReactCommon/react/renderer/scheduler/SurfaceHandler.cpp#L88-L96

And this code path can be reached both via
- `startSurface` (by passing in an empty `moduleModule` OR
- `startEmptySurface`

Reviewed By: shwanton, rubennorte

Differential Revision: D67805569

fbshipit-source-id: e3d06dcaa637996498a6cb52b5c1b98f740326ce
2025-01-06 10:32:16 -08:00
Mykhailo Kravchenko 0154372b93 feat: Manage keyboard shortcuts visibility of TextInput (#47671)
Summary:
**iOS** does offer a native property for **UITextField** called `inputAssistantItem`. According to the [documentation](https://developer.apple.com/documentation/uikit/uitextinputassistantitem), we can hide the **"shortcuts"** by setting the `leadingBarButtonGroups` and `trailingBarButtonGroups` properties to empty arrays.

I propose adding a new property for **TextInput** in **React Native**, which would set these native properties to empty arrays. This new property could be called `disableInputAssistant` or `disableKeyboardShortcuts` and would be a `boolean`.

Developers can manage this behavior (the redo & undo buttons and suggestions pop-up hiding) after applying these native props.

https://github.com/react-native-community/discussions-and-proposals/discussions/830

## Changelog:

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

Pick one each for the category and type tags:

[IOS] [ADDED] - [TextInput] Integrate a new property - `disableKeyboardShortcuts`. It can disable the keyboard shortcuts on iPads.

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[IOS] [ADDED] - [TextInput] Integrate a new property - `disableKeyboardShortcuts`. It can disable the keyboard shortcuts on iPads.

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

Test Plan:
Manual
1. Open TextInput examples.
2. Scroll down and reach the "Keyboard shortcuts" section.
3. Test each case.

Note: **TextInput** behaves the same as now when the new prop is not passed or is `false`.

https://github.com/user-attachments/assets/5e814516-9e6c-4495-9d46-8175425c4456

Reviewed By: javache

Differential Revision: D67451609

Pulled By: cipolleschi

fbshipit-source-id: 59ba3a5cc1644ed176420f82dc98232d88341c6e
2025-01-06 09:54:29 -08:00
zhongwuzw a3dfc4984d Fabric: Added ScrollEndDragEvent for scrollEndDrag event (#48319)
Summary:
Fixes https://github.com/facebook/react-native/issues/42533 .

## Changelog:

[IOS] [FIXED] -  Fabric: Added ScrollEndDragEvent for scrollEndDrag event

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

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

Reviewed By: javache

Differential Revision: D67517912

Pulled By: cipolleschi

fbshipit-source-id: aa1caebfb690d09a207b3ebce382eceb520009e5
2025-01-06 08:44:23 -08:00
Rubén Norte cb308bdc5e Add benchmark for host component class variants (#48450)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48450

Changelog: [internal]

This implements a basic benchmark to compare `ReactFabricHostComponent` and `ReactNativeElement` (legacy and DOM implementations for native component instances).

Reviewed By: rshest

Differential Revision: D66698546

fbshipit-source-id: dd4bde833e5c9eb32c79a52d06f3c360fb012e23
2025-01-06 07:10:28 -08:00
Rubén Norte ff7c550a86 Run benchmarks in test mode when not specifying verification functions in CI (#48451)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48451

Changelog: [internal]

Modifies the execution of benchmarks in CI to run benchmarks in test mode when they don't define a `verify` method.

If a benchmark uses `verify`, the test is meant to make sure that the benchmark doesn't regress in CI. If it doesn't, then running the benchmark on CI doesn't provide much value. In that case, we run a single iteration of each test case just to make sure things don't break over time.

Reviewed By: rshest

Differential Revision: D67637754

fbshipit-source-id: 33b78a9c809386cf2e040314b0427de6a53da3e3
2025-01-06 07:10:28 -08:00
Rubén Norte 3795f0fb66 Add API to run benchmarks in Fantom (#48452)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48452

Changelog: [internal]

Implements a basic API to run benchmarks with Fantom (using `tinybench` under the hood):

```
import {benchmark} from 'react-native/fantom';

benchmark
  .suite('Suite name', {
    // options
  })
  .add(
    'Test name',
    () => {
      // code to benchmark
    },
    {
      beforeAll: () => {},
      beforeEach: () => {},
      afterEach: () => {},
      afterAll: () => {},
    },
  )
  .verify(results => {
    // check results and throw an error if the expectations fail
  });
```

Features:
* Print benchmark results in the console as a table.
* It opts into optimized builds automatically
* Verifies that optimized build is used (unless manually opting out of the check via `disableOptimizedBuildCheck`).
* Supports verification of results (making expectations and making the test fail if the benchmark doesn't meet some expectations).

Reviewed By: rshest

Differential Revision: D66926183

fbshipit-source-id: 61cfa7689ea7684eb870fbbc815b8d236a1871e6
2025-01-06 07:10:28 -08:00
Rubén Norte bc3072eafc Implement native module to measure CPU time (#48454)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48454

Changelog: [internal]

This implements a native module for Fantom to provide information about the CPU time used by the current process. This will be used by Fantom as the clock to run benchmarks more accurately.

It provides 2 implementations:
1. One based on `clock_gettime` with `CLOCK_THREAD_CPUTIME_ID` that's available on Linux. This provides the CPU time for the current process with decent precision (tens of nanoseconds).
2. A fallback implementation that uses a monotonic clock (not actually CPU time).

We can add a MacOS equivalent in a following diff.

Reviewed By: rshest

Differential Revision: D67596312

fbshipit-source-id: dd712c0171aa998ddbb6fed9187b3c467cd5417d
2025-01-06 07:10:28 -08:00
Alex Hunt eee2866508 Fix InspectorFlags debug default, clean up legacy Buck opt in (#48504)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48504

Following D67857739, fixes accidental change where the removed `ReactNativeFeatureFlags` flag read was not replaced with `true`. This temporarily disabled Fusebox on `main`, where not configured via other build flags.

{F1974195736}

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D67857739

fbshipit-source-id: 2a6fb2e6733035245e7ad959c7d3c650a9fde994
2025-01-06 07:02:22 -08:00
Mateo Guzmán b477cfa0ba Add AppStateModule Android unit tests (#48492)
Summary:
Currently the `AppStateModule` doesn't have any unit tests in the Android implementation. This should make it safer for future changes or refactors.

## Changelog:

[INTERNAL] - Add `AppStateModule` Android unit tests

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

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

Reviewed By: cipolleschi

Differential Revision: D67857498

Pulled By: cortinico

fbshipit-source-id: f90ced1cf02ac12a3438495b425ce7931decf19a
2025-01-06 06:49:27 -08:00
Kræn Hansen 7a85b91125 Fix ruby unit tests (#48498)
Summary:
As a prerequisite of enabling running unit tests on CI again, this PR suggests changes needed to the Ruby unit tests.

I've added comments on the code below, justifying changes where I deem a justification might be needed.

For use internally, I suggest accessing the folly_config and boost_config directly via the `Helpers` class instead of the `get_folly_config` and `get_boost_config` because these global functions are defined in `react_native_pods` which would be result in circular requires. An alternative would be to move these global functions to a separate file.

## Changelog:

[INTERNAL] [FIXED] - Fix Ruby unit tests.

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

Test Plan:
- `cd packages/react-native`
- `./scripts/run_ruby_tests.sh`

Reviewed By: rshest

Differential Revision: D67852809

Pulled By: cipolleschi

fbshipit-source-id: 54d8bd708a9e3fd9aef3569ac89ec6ddcd244437
2025-01-06 02:31:42 -08:00
Ruslan Shestopalyuk 5ce07386e1 Convert FabricEventDispatcher (#48491)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48491

# Changelog:
[Internal] -

As in the title.

Reviewed By: christophpurrer

Differential Revision: D67825655

fbshipit-source-id: e94431ae6978332c0566ab0a500e1a85f1ad9a7d
2025-01-06 01:46:46 -08:00
Ruslan Shestopalyuk a9d86be3a4 Migrate EventDispatcher interface to Kotlin (#48445)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48445

# Changelog:
[Internal] -

As in the title.

Reviewed By: christophpurrer

Differential Revision: D67760373

fbshipit-source-id: 6360ed5b488ec47bdd2e4d0357d0d06e8e42f614
2025-01-06 01:46:46 -08:00
Ruslan Shestopalyuk d470f39d8a Migrate RCTEventEmitter to Kotlin (#48467)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48467

# Changelog:
[Internal] -

As in the title.

Reviewed By: christophpurrer

Differential Revision: D67793304

fbshipit-source-id: 39bbdebf8434ad57bab3e1d309915a8132033f5b
2025-01-06 01:46:46 -08:00
Alan Lee d5f33c19cb com.facebook.react.views.text.frescosupport.FrescoBasedReactTextInlineImageViewManager.java (#47561)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47561

Convert Java to Kotlin

Changelog:

[Android][Breaking] changed visibility of FrescoBasedReactTextInlineImageViewManager to internal

Reviewed By: javache

Differential Revision: D65606954

fbshipit-source-id: bfdb5624a104029c8d667ddb9262c862ab846a61
2025-01-06 01:26:14 -08:00
woxtu 088fcb1e5d Resolve run script build phase warnings (#48495)
Summary:
This PR updates podspecs and resolve the following Xcode warnings:

```
Run script build phase '[CP-User] [RN]Check rncore' will be run during every build because it does not specify any outputs. To address this issue, 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.
```

```
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 issue, 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.
```

Enabling the `always_out_of_date` flag will uncheck "Based on dependency analysis" in a script phase.

## Changelog:

[INTERNAL] [FIXED] - Resolve run script build phase warnings

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

Test Plan:
1. Run `bundle exec pod install` in the RNTester folder
2. Open the Xcode workspace
3. Check "Based on dependency analysis" is unchecked in the '[CP-User] [RN]Check rncore' script phase and the '[CP-User] [RN]Check FBReactNativeSpec' script phase

Reviewed By: cipolleschi

Differential Revision: D67835376

Pulled By: rshest

fbshipit-source-id: 11eec80d8172bc0129bfdcf7c79b5edf40427fab
2025-01-06 00:46:51 -08:00
Ruslan Shestopalyuk e99b47ce48 Use proper mockito/kotlin for RootViewTest and JSPointerDispatcherTest (#48490)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48490

## Changelog:
[Internal] -
This makes the `RootViewTest` and `JSPointerDispatcher` tests to use mockito-kotlin instead of the Java Mockito, which is the legacy of the conversion of the corresponding tests from Java.

Which:
* is the right thing to do, as we have more Kotlin-idiomatic tests
* helps with some Kotlin conversion with classes under test down the line, as Kotlin Mockito handles things like nullability etc properly

Reviewed By: javache

Differential Revision: D67824679

fbshipit-source-id: 055e9c7c4a33164ce6f4b9a5c47f16051d2a132f
2025-01-05 08:38:43 -08:00
Ruslan Shestopalyuk b867c01fa6 Convert RCTModernEventEmitter (#48466)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48466

# Changelog:
[Internal] -

As in the title.

Reviewed By: christophpurrer

Differential Revision: D67793108

fbshipit-source-id: 1730f4519f740372bde392236feae23ad4a18f0a
2025-01-04 12:44:48 -08:00
Ruslan Shestopalyuk 4ad6a94c60 Kotlinify EventEmitterWrapper (#48489)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48489

# Changelog:
[Internal] -

As in the title.

Reviewed By: christophpurrer

Differential Revision: D67823110

fbshipit-source-id: 840d15d891066b3fc8e6fa8cd2e856ee51e72ce3
2025-01-04 12:24:50 -08:00
Christoph Purrer 6abcca8374 Stop all surfaces on SurfaceManager destruction (#48481)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48481

[Changelog] [Internal] - Stop all surfaces on SurfaceManager destruction

Reviewed By: zeyap

Differential Revision: D67809574

fbshipit-source-id: 150ddd091e6822c3a40f8ea413aa65da50445ede
2025-01-03 19:58:06 -08:00
Ruslan Shestopalyuk a6e6f5e869 ReactEventEmitter -> Kotlin (#48464)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48464

# Changelog:
[Internal] -

As in the title.

Reviewed By: christophpurrer

Differential Revision: D67791375

fbshipit-source-id: eca1f999b43c405ce48aa5fa3518ec08363f5836
2025-01-03 16:24:09 -08:00
Ruslan Shestopalyuk 076920647e Migrate PointerEventHelper (#48459)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48459

# Changelog:
[Internal] -

As in the title.

Reviewed By: tdn120

Differential Revision: D67762029

fbshipit-source-id: c29010d20aa7a4cbe2d92aeacc1851eec3c7701e
2025-01-03 16:24:09 -08:00
Mateo Guzmán 33aebc34bf Fix RNTester dark mode Android Text examples (#48380)
Summary:
The Android `Text` examples in dark mode are not readable. This PR addresses that by replacing the `Text` usages with `RNTesterText`.

## Changelog:

[INTERNAL] [FIXED] - Fixing dark mode Android `Text` examples

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

Test Plan:
Some screenshots after the fixes.

| Image 1 | Image 2 | Image 3 | Image 4 | Image 5 |
|---------|---------|---------|---------|---------|
| ![Screenshot_1734981250](https://github.com/user-attachments/assets/d9c27ac7-5024-478b-a47c-3c057801eea1) | ![Screenshot_1734981168](https://github.com/user-attachments/assets/92c6e11a-ac30-46f5-8878-3659d9e40f9a) | ![Screenshot_1734981146](https://github.com/user-attachments/assets/8bfba649-e036-473a-a622-2289daf67951) | ![Screenshot_1734981127](https://github.com/user-attachments/assets/9b1e2a68-8b34-463b-8637-f2b5682733d2) | ![Screenshot_1734981115](https://github.com/user-attachments/assets/af0c85c5-6216-4af1-ae92-b818213f3719) |
| Image 6 | Image 7 | Image 8 | Image 9 | Image 10 |
|---------|---------|---------|---------|---------|
| ![Screenshot_1734981101](https://github.com/user-attachments/assets/91a07f43-8b9e-4462-8906-5ee1f68741a5) | ![Screenshot_1734981080](https://github.com/user-attachments/assets/3b8ffe9a-53b9-4863-b332-d3055740aa18) | ![Screenshot_1734980904](https://github.com/user-attachments/assets/c5aa8bb6-f1f6-4693-bc31-74557946f009) | ![Screenshot_1734981057](https://github.com/user-attachments/assets/10c8c785-58b8-401a-ad18-7bdcd91cd28d) | ![Screenshot_1734980876](https://github.com/user-attachments/assets/d9ed3b35-01fe-4311-adf3-7a6e4e13aeab) |

Reviewed By: javache

Differential Revision: D67657571

Pulled By: philIip

fbshipit-source-id: da93d072f4bb32017961ee70c76f6add8a874ae1
2025-01-03 15:44:16 -08:00
Sam Zhou b030418649 Deploy 0.258.0 to xplat (#48482)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48482

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D67810693

fbshipit-source-id: 82e858d4d5ef3c9896ea3bd58a4f4364dce5bdd0
2025-01-03 15:37:43 -08:00
Rubén Norte 1120f88401 Update test for DOM APIs to show current vs. desired behavior for getRootNode (#48439)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48439

Changelog: [internal]

This is in preparation for implementing `getRootNode` and `ownerDocument` properly in the DOM APIs.

Reviewed By: rshest

Differential Revision: D67137215

fbshipit-source-id: bda6b1f843f219e03df533797fa9e4adbaa54c60
2025-01-03 12:57:16 -08:00
Rubén Norte 4d2649bac8 Extend tests for ReadOnlyNode.compareDocumentPosition (#48438)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48438

Changelog: [internal]

Just adding tests to make sure we cover the cases where the root is unmounted.

Reviewed By: rshest

Differential Revision: D67752010

fbshipit-source-id: 3cc17cd25878013a26dc407640be00e8dc251eea
2025-01-03 12:57:16 -08:00
Rubén Norte a1b13f6a55 Extract ensureInstance utility from tests (#48434)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48434

Changelog: [internal]

We were starting to repeat this logic too much in tests, so extracting so we can reuse it.

Reviewed By: rshest

Differential Revision: D67520443

fbshipit-source-id: 64e4e5b35f83dc45e41bb0efae9685aeaf0cf2e2
2025-01-03 12:57:16 -08:00
Rubén Norte 35d0d7c97b Small refactor to lazy load RendererProxy (#48437)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48437

Changelog: [internal]

Just a small refactor to slightly improve readability (and potentially performance).

Reviewed By: christophpurrer

Differential Revision: D67520444

fbshipit-source-id: 9f53a432c4f4363b42083fb52c3beedb8016ccd4
2025-01-03 12:57:16 -08:00
Rubén Norte 6c383ea7b8 Set more sensible defaults for viewport width and height (#48436)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48436

Changelog: [internal]

Changing the defaults to use something that resembles a real device (in this case the iPhone 14 which is a very common device).

Reviewed By: christophpurrer

Differential Revision: D67759914

fbshipit-source-id: 87fe3be19196ece62c412e5076c601be746a4f22
2025-01-03 12:57:16 -08:00
Rubén Norte bac56bf828 Allow configuring viewport width, height and device pixel ratio (#48433)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48433

Changelog: [internal]

Allows customizing the root dimensions.

Reviewed By: christophpurrer

Differential Revision: D67693031

fbshipit-source-id: ddbe426a6492512dc2eb7554f26b63d14d5ce75d
2025-01-03 12:57:16 -08:00
Ruslan Shestopalyuk 13bad5268b Migrate EventDispatcherListener/Provider interfaces to Kotlin (#48463)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48463

# Changelog:
[Internal] -

As in the title.

Reviewed By: cortinico

Differential Revision: D67791241

fbshipit-source-id: 99d937e08a1e4ee1a5bd3f8eda71bc814ddbfffe
2025-01-03 12:38:17 -08:00
Alex Hunt 546d21c796 Remove fuseboxEnabledDebug flag (#48435)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48435

Cleans up the runtime `fuseboxEnabledDebug` feature flag. The modern CDP backend has been enabled by default in open source since 0.76.

- Updates `ReactInstanceIntegrationTest` to preserve testing under both backend modes (legacy Hermes debugger vs Fusebox).
- Preserves ability to override `ReactNativeFeatureFlags` in tests via `InspectorFlagOverridesGuard` — we anticipate that future CDP features will continue to read from the `ReactNativeFeatureFlags` system (`fuseboxEnabled` was/is a special case).

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D67759600

fbshipit-source-id: 5878dd879bae435e59c48823a9b9faf85561b028
2025-01-03 05:56:04 -08:00
Rubén Norte 39757da650 Add environment variable to enable C++ debugging (#48441)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48441

Changelog: [internal]

Adds a new environment variable (`FANTOM_ENABLE_CPP_DEBUGGING`) to enable C++ debugging via `fdb`.

Reviewed By: RSNara

Differential Revision: D67683048

fbshipit-source-id: d074a1a063c5da6b048d5456036e83cc14245eaf
2025-01-03 04:57:43 -08:00
Rubén Norte d28300ad9d Add environment variables to print Fantom output and buck commands (#48440)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48440

Changelog: [internal]

Modifies the Fantom runner to read 2 new environment variables to help with debugging:
- `FANTOM_PRINT_OUTPUT`: prints the output of the CLI to the output of the test.
- `FANTOM_LOG_COMMANDS`: logs the buck commands executed by the runner, so they can be re-run outside the runner for debugging, etc.

Reviewed By: rshest

Differential Revision: D67682750

fbshipit-source-id: aff48c4f47078db1be53e0ee105089fbc921768f
2025-01-03 04:57:43 -08:00
Rubén Norte 42b911b5cb Implement streaming mode for console logs in tests (#48372)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48372

Changelog: [internal]

Implements log streaming in Fantom tests. This allows us to see the logs emitted from tests as they're logged, so we don't need to wait until the test completes to flush all of them at the same time.

Reviewed By: rshest

Differential Revision: D67600609

fbshipit-source-id: efb3125e13fd9aec1800a5f1ddaf0d93dcb29218
2025-01-03 04:57:43 -08:00
Rubén Norte f1ba4ef131 Add async flavors for runCommand and runBuck2 utilities (#48371)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48371

Changelog: [internal]

Adds a new favor for `runCommand` and `runBuck2` that works asynchronously and support parsing their output in real time.

Reviewed By: javache

Differential Revision: D67600614

fbshipit-source-id: 99dd2ce9bff11036829f214bf19208b10c9c1b25
2025-01-03 04:57:43 -08:00
Rubén Norte 8f096ab4f8 Refactor utility to run buck2 commands as a method to run arbitrary commands (#48370)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48370

Changelog: [internal]

Small refactor in preparation for async commands with streaming.

Reviewed By: javache

Differential Revision: D67600611

fbshipit-source-id: 11fe6b6ccd8849f904338ccc9454361ad5923863
2025-01-03 04:57:43 -08:00
Rubén Norte 726a72328e Use structured output for Fantom logs and test results (#48369)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48369

Changelog: [internal]

This improves logs in Fantom by preserving the original log levels. It's also in preparation for adding support for log streaming in tests.

Reviewed By: javache

Differential Revision: D67600616

fbshipit-source-id: 1c4997d5e836a78327f33092527543fe025c90c6
2025-01-03 04:57:43 -08:00
Rubén Norte 5f09c36942 Remove unnecessary filter for AppRegistry logs (#48367)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48367

Changelog: [internal]

We removed the calls to `AppRegistry` in Fantom, so this filter isn't necessary anymore (just a no-op).

Reviewed By: rshest

Differential Revision: D67600610

fbshipit-source-id: d985cc5f0ee1728ac72c567bc091a6c2877f2659
2025-01-03 04:57:43 -08:00
Rubén Norte fb3b87c2b5 Remove existing logs and warnings from tests (#48391)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48391

Changelog: [internal]

When we enabled log streaming in Fantom, we saw a lot of logs that we were previously not forwarding (console.error, console.warn) in existing tests.

This removes all the warnings and errors from those tests.

Reviewed By: rshest

Differential Revision: D67602299

fbshipit-source-id: 111f373eafd8707f2746ff727894f1fa4283b83f
2025-01-03 04:57:43 -08:00
Rubén Norte d7d9e1c090 Use codegen for Fantom native module (#48432)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48432

Changelog: [internal]

This moves the native module definition for Fantom to the `react-native` package so we can migrate the module to use the codegen.

Also implements the migration.

Reviewed By: christophpurrer

Differential Revision: D67759729

fbshipit-source-id: d79d078908b05fc4b6f5f26f0144ab7e3485cb83
2025-01-03 04:57:43 -08:00
Rubén Norte c0f3e64070 Follow naming convention for NativeFantom module (#48368)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48368

Changelog: [internal]

Just a minor rename to align with the existing convention.

Reviewed By: javache

Differential Revision: D67549203

fbshipit-source-id: faa9e34cdce7c59e2c6b3f7e697c90df103699d0
2025-01-03 04:57:43 -08:00
Alex Hunt 3e0fc8899b Remove hermes-inspector-msggen (#48465)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48465

Removes the `packages/hermes-inspector-msggen` workspace. Since https://github.com/facebook/react-native/pull/39300, this is no longer referenced in React Native, and is now part of the Hermes repo.

Changelog: [Internal]

Reviewed By: cortinico, hoxyq

Differential Revision: D67791612

fbshipit-source-id: 73da135b264d8df632fefe87cc4e3101075ae98c
2025-01-03 04:29:09 -08:00
Rubén Norte f20486cc77 Improve error messages in expect().toThrow(message) (#48430)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48430

Changelog: [internal]

This expectation currently prints a very generic message that is hard to parse, so this change improves it a bit to account for more cases. E.g.:
* Before: "Expected <function> to throw"
* After: "Expected <function> to throw with message 'foo', but threw with message 'bar'"

Reviewed By: rshest

Differential Revision: D67738146

fbshipit-source-id: 690f15971cec0e8a7b038eeacc9302c9f3edc323
2025-01-03 02:16:38 -08:00
Mateo Guzmán 7e029b0dcf Modal: FLAG_SECURE not respected in modal dialog (#48317)
Summary:
Fixes https://github.com/facebook/react-native/issues/38537

Setting `WindowManager.LayoutParams.FLAG_SECURE` in the window flags is not respected in the Android Modal component, causing security issues with screenshots or screen recordings as the content in the modal is visible. The flag works correctly in the rest of the components, see the videos in the linked issue.

This PR addresses that by checking whether this flag is set in the current activity and then setting it in the dialog when creating a new one in the `ReactModalHostView`.

## Changelog:

[ANDROID][FIXED] - `FLAG_SECURE` not respected in Modal dialog

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

Test Plan:
To test this, you need a physical device as with the emulator the flags don't seem to be respected either.

The easiest way to test this in code is by setting the flags in the main activity. You can do so by adding this code snippet:

<details>
<summary>onCreate in RNTesterApplication.kt</summary>

```kt
override fun onCreate() {
    ReactFontManager.getInstance().addCustomFont(this, "Rubik", R.font.rubik)
    super.onCreate()

    ...

    registerActivityLifecycleCallbacks(
            object : ActivityLifecycleCallbacks {
              override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {
                activity.window.setFlags(
                        WindowManager.LayoutParams.FLAG_SECURE,
                        WindowManager.LayoutParams.FLAG_SECURE
                )
              }

              override fun onActivityStarted(activity: Activity) {}
              override fun onActivityResumed(activity: Activity) {}
              override fun onActivityPaused(activity: Activity) {}
              override fun onActivityStopped(activity: Activity) {}
              override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {}
              override fun onActivityDestroyed(activity: Activity) {}
            }
    )
  }
```
</details>

Then, you can render a simple modal component:

<details>
<summary>RNTesterPlayground.js</summary>

```tsx
function Playground() {
  const [modalVisible, setModalVisible] = React.useState(false);

  return (
    <>
      <Modal
        visible={modalVisible}
        testID="playground-modal">
        <Text testID="inner-text-test-id">Hello World!</Text>
        <Button title="Close Modal" onPress={() => setModalVisible(false)} />
      </Modal>

      <Button
        title="Open Modal"
        onPress={() => {
          setModalVisible(true);
        }}
      />
    </>
  );
}
```
</details>

You can then try to record the screen or take screenshots. You will notice that before opening the modal, you won't be able to see anything in the recording, but when opening the modal, the content is visible.

I've tried my best to record the before and after the fix, but as the screen recordings will mostly show a black screen, you have to forward a bit in both videos to see the difference.

<details>
<summary>Before the fix (notice the blank screen and then content visible)</summary>

https://github.com/user-attachments/assets/fc5bbe26-d238-425b-90d3-0e43c89ccaac

</details>

<details>
<summary>After the fix (notice all the screen recording is a black screen)</summary>

https://github.com/user-attachments/assets/0d6991a0-974b-45c5-8f4a-bf4718c284e6

</details>

Reviewed By: cipolleschi

Differential Revision: D67368741

Pulled By: alanleedev

fbshipit-source-id: 9f31063a9208a6df257da424bf3096bf15a5ddcb
2025-01-02 20:40:09 -08:00
Joe Vilches 1b88c5b429 Fix case when dashed/dotted borders do not work with overflow: hidden (#48414)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48414

Was looking into https://github.com/facebook/react-native/issues/48078 which was brought to my attention due to my recent refactorings of iOS Views, especially around how overflow: hidden works. This bug was not brought on by my changes but seems to be a lingering Fabric bug (iirc this bool was not changed when I refactored things)

Anyway, dotted/dashed borders did not work with overflow: hidden. The reason why is we use core animation borders in this case which is incorrect as CA cannot do these types of borders. So I added a check to make sure that the borders are solid as well if we want to use CA to draw them.

Changelog: [iOS] [Fixed] - Dashed & dotted borders now work with overflow: hidden

Reviewed By: mdvacca

Differential Revision: D67720492

fbshipit-source-id: 5aecc15f2d7cbd71952d78d6972f6fc6b7a93ea8
2025-01-02 14:03:26 -08:00
Ruslan Shestopalyuk febf6f4a9c Convert TouchesHelper.java (#48447)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48447

# Changelog:
[Internal] -

As in the title.

Reviewed By: tdn120

Differential Revision: D67760245

fbshipit-source-id: 5054408438de7cbdfaa7c98d9f5935f03ee93760
2025-01-02 13:59:54 -08:00