Commit Graph
147 Commits
Author SHA1 Message Date
Samuel SuslaandFacebook GitHub Bot afb543683c introduce a way to inspect shadow node revision in Fantom (#51566)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51566

changelog: [internal]

Expose [revision](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactCommon/react/renderer/core/ShadowNode.h#L229) of shadow node in Fantom tests. This makes it possible to write tests verifying that shadow nodes are only cloned when they should.

Even though excessive cloning does not usually lead to bugs, it may lead to performance problems.

Also introduce a test showing a performance problem where changing height of "Sibling" view from 1 to 2 will lead to component `D` being cloned by Yoga. Component D is not affected by the size change of Sibling and the clone is unnecessary.

```jsx
<ScrollView>
  <View id="Sibling" style={{ height: 1 }} />
  <View id="A">
    <View id="B">
      <View id="C">
        <View id="D" ref={ref} />
      </View>
    </View>
  </View>
</ScrollView>
```

Reviewed By: rshest

Differential Revision: D75287261

fbshipit-source-id: ea5acb2f5d7ba6e1e5bf895d8f82a16471122ec5
2025-05-24 15:44:11 -07:00
Rubén NorteandFacebook GitHub Bot a573049c0a Improve support for multi-config benchmarks (#51559)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51559

Changelog: [internal]

Improves the support for multi-config benchmarks in Fantom by printing the Fantom configuration summary in the header of the table with the benchmark results for each variant.

Reviewed By: rshest

Differential Revision: D75281972

fbshipit-source-id: 80caf2e668a30ea1454cb932e91dac91192323bf
2025-05-23 04:24:44 -07:00
Rubén NorteandFacebook GitHub Bot cc9be3048a Add support multi-config test runs (#51542)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51542

Changelog: [internal]

This adds support for Fantom to run specific test suites with different combinations of options/flags, using wildcards as values.

See the new documentation for this feature in this diff for more details.

Reviewed By: rshest

Differential Revision: D75231299

fbshipit-source-id: 0e953e6de68f004944ee29206af49770c8b7dd9b
2025-05-23 04:24:44 -07:00
Rubén NorteandFacebook GitHub Bot 9d58eb5719 Display Fantom test configuration in test output (#51528)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51528

Changelog: [internal]

This adds some logic to the Fantom runner to display the test configuration with the test results.

Reviewed By: lenaic

Differential Revision: D75063176

fbshipit-source-id: 8371e90247c1a0c24f29a13ead25fa5dbf98ec10
2025-05-23 04:24:44 -07:00
Tim YungandFacebook GitHub Bot 1977dd6596 RN: Sort Pragmas in Headers (#51554)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51554

Sorts pragma directives file headers in React Native.

Changelog:
[Internal]

Reviewed By: SamChou19815

Differential Revision: D75264593

fbshipit-source-id: 9e4b253dd0fc94dc2fc469d7114b93a8aae305f4
2025-05-22 21:18:53 -07:00
Nick LefeverandFacebook GitHub Bot 7674cd25a7 Add tests for @fantom_hermes_variant (#51457)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51457

See title

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D74999954

fbshipit-source-id: bd140b2df71477e2966406ed612a00ff3ea6de8b
2025-05-22 08:52:09 -07:00
Luna WeiandFacebook GitHub Bot b8a4fb2a4d Add docs about react flags and debugging (#51521)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51521

Changelog: [Internal] - Add docs about react flags and debugging

Reviewed By: lenaic

Differential Revision: D75152355

fbshipit-source-id: 4ef69d036e8b70a3903ba2d2dbda6530b1893d2b
2025-05-21 23:11:25 -07:00
Panos VekrisandFacebook GitHub Bot 50ca7e5730 manual annotations in preparation of natural inference rollout in react-native, tools, etc.
Summary:
The Flow team is improving the way Flow infers type for primitive literals. This diff prepares the codebase for the new behavior by adding type annotations, or annotations of the form `'abc' as const`.

Changelog: [internal]

Reviewed By: marcoww6

Differential Revision: D75188179

fbshipit-source-id: be50990f23f79cf2d8dae7576af5190218adcafe
2025-05-21 20:06:46 -07:00
Panos VekrisandFacebook GitHub Bot 1eebb5aa11 Back out "add 'as const' annotations in preparation of natural inference rollout in xplat/js [4/n]"
Summary:
Original commit changeset: 67ee5673816d

Original Phabricator Diff: D75114154

Reviewed By: SamChou19815

Differential Revision: D75161840

fbshipit-source-id: 144fc0e488154b957f4f2a549c077a2784124849
2025-05-21 12:03:51 -07:00
Panos VekrisandFacebook GitHub Bot 2a068c6559 add 'as const' annotations in preparation of natural inference rollout in xplat/js [4/n] (#51488)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51488

The Flow team is improving the way Flow infers type for primitive literals.
Announcement: https://fb.workplace.com/groups/flowlang/permalink/1725180268087629/

This diff prepares the codebase for the new behavior by codemoding `as const` annotations.

## Repro steps

1/ Used steps in D73610163 to produce the code changes.

2/ Reverted files where `flow` errored:
```
flow status --show-all-errors > errors.log
node ~/fbsource/fbcode/flow/facebook/error-analyzer.js errors.log |
  awk -F':' '{ print $1 }' | sort -u | grep -v 'Total Error Count' |
  xargs hg revert --rev .
```

3/ Reverted files that did not improve error count in new Flow mode
```
# Run Flow before change
~/fbsource/fbcode/flow/facebook/flowd status --show-all-errors > errors-0.log
# Run Flow after change
~/fbsource/fbcode/flow/facebook/flowd status --show-all-errors > errors-1.log

# Compute error counts before and after
node ~/fbsource/fbcode/flow/facebook/error-analyzer.js errors-0.log | sort > errors-counts-0.log
node ~/fbsource/fbcode/flow/facebook/error-analyzer.js errors-1.log | sort > errors-counts-1.log

# Revert files with no change in error count
comm -12 errors-counts-0.log errors-counts-1.log | awk -F':' '{ print $1 }' | xargs hg revert --rev .~1
```

## Note to code owners

Due to the large number of errors involved in this rollout, adding `as const` was the most feasible large-scale automated solution. Ideally, a lot of these errors would be fixed by adding other appropriate type annotations. For example instead of annotating
```
type Shape = {type: 'circle', radius: number} | {type: 'square', side: number} | ...;
type ShapeKind = 'circle' | 'square' | 'triangle';
const circle = {
  type: "circle" as const,  // <-- annotation added here
  radius: 42,
};
shape.type as ShapeKind;
takesShape(circle);
```
a more appropriate annotation would be
```
const circle: Circle = { type: "circle"; radius: 42 };
...
```

Changelog: [Internal]

drop-conflicts

Reviewed By: SamChou19815

Differential Revision: D75114154

fbshipit-source-id: 67ee5673816da9625431e2a2466a1e0038386151
2025-05-21 08:42:30 -07:00
Panos VekrisandFacebook GitHub Bot 5250b59ee2 manual annotations in preparation of natural inference rollout in xplat/js (#51487)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51487

The Flow team is improving the way Flow infers type for primitive literals. This diff prepares the codebase for the new behavior by adding type annotations, or annotations of the form `'abc' as const`.

Changelog: [internal]

Reviewed By: SamChou19815

Differential Revision: D75114156

fbshipit-source-id: e3175af85cdd2388c3b45af4beb314f334e3f9b5
2025-05-21 07:07:18 -07:00
Rubén NorteandFacebook GitHub Bot b1e8729f4d Fix incorrect view flattening when using a specific not fully transparent color (#51379)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51379

Changelog: [General][Fixed] Fix incorrect flattening / non-rendering of views with backgroundColor set to `rgba(255, 255, 255, 127/256)`

Fixes #51378.

## Context

When testing some unrelated things with Fantom is realized that the color for some text that I wasn't explicitly defining was being set to `rgba(255, 255, 255, 127)`, like here:

https://github.com/facebook/react-native/blob/249a24ac756275eadbe3b4df1ff9c974af1671d2/packages/react-native-fantom/src/__tests__/Fantom-itest.js#L540-L542

When digging a bit more about why, I realized that was actually the value for `UndefinedColor`. When looking a bit deeper, I saw that the value for that constant was being set like this:

```
using Color = int32_t;

namespace HostPlatformColor {
static const facebook::react::Color UndefinedColor =
    std::numeric_limits<facebook::react::Color>::max();
}
```

I'm not sure what the logic could've been here:
- Defining it as a value out of bounds for all valid colors? In this case, it's a 32 bit value so all the range of values are actually valid RGBA colors.
- Defining it as a fully opaque white? Seems dangerous for a default because you wouldn't be able to distinguish a explicitly set white color from a non-set color, relevant if you're seeing a white background color in a view on top of another view with any other background color.

The result of this existing logic was actually setting `UndefinedColor` to `rgba(255, 255, 255, 127)` because the alpha channel is defined in the first bits of the value, and `Color` being a signed int with 32 bits, the largest value is `01111....1`, so extracting the first 8 bits, you get 127.

## Changes

This changes the value set for the `UndefinedColor` constant (which is used, among other things, to determine if a view sets a background color, or otherwise could potentially be flattened).

The new value, instead of white with a 127/256 opacity, is black with 0% opacity (or simply the number 0 in `int32_t`).

Reviewed By: javache

Differential Revision: D74869311

fbshipit-source-id: 5582b4803b0b5c72cb3c1b33720c4542c5e3f1de
2025-05-20 10:38:05 -07:00
Nick LefeverandFacebook GitHub Bot 3306c3b962 Improve naming of the hermes variants (#51456)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51456

Going from:
* static_hermes_stable -> static_hermes
* static_hermes_trunk -> static_hermes_experimental

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D74999979

fbshipit-source-id: f20b07af4c7fddc6d162937b4c96f0bf60902dbd
2025-05-19 10:08:10 -07:00
Nick LefeverandFacebook GitHub Bot 01db5aa230 Support running tests with different hermes variants (#51451)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51451

This diff adds the `fantom_hermes_variant` pragma which can be set to:
- `hermes` for the default Hermes runtime used by RN
- `static_hermes` for the stable version of Static Hermes
- `static_hermes_trunk` for the "trunk" version of Static Hermes

Each variant will set up the correct build options for the runner and the correct compiler to use for the bundle.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D74959718

fbshipit-source-id: 5d30c8e15ab052eb5686f26632f08ab42b5e68c7
2025-05-19 03:06:53 -07:00
Nick LefeverandFacebook GitHub Bot b1772de409 Make default mode used for benchmarks more obvious (#51446)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51446

See title

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D74958927

fbshipit-source-id: 245397c6e9a89a40e5c1260fcd624e5f6b9f7c8d
2025-05-19 03:06:53 -07:00
Tim YungandFacebook GitHub Bot 84de8a075e RN: Delete @oncall Annotations (#51416)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51416

Deletes `oncall` annotations from the `facebook/react-native` repository.

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D74902524

fbshipit-source-id: 32a6a5b2ff27281792d572f151e2b094d9a79029
2025-05-17 16:18:05 -07:00
Tim YungandFacebook GitHub Bot 255c197baf RN: Prefer Destructured Import for createRef (#51399)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51399

Prefers using this as a destructured import instead of as a member expression of `React`.

Changelog:
[Internal]

Reviewed By: rubennorte

Differential Revision: D74888097

fbshipit-source-id: a22ca4b791153ff0c2f4ab34ff8e3ce5e9280e0d
2025-05-16 16:33:18 -07:00
Andrew DatsenkoandFacebook GitHub Bot 3e1b9a9182 Fix order of ancestor titles (#51397)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51397

Changelog: [Internal]

Fix order of ancestor titles.

Due to reverse being applied to the title order it flipped order on even contexts.

Reviewed By: rubennorte

Differential Revision: D74886550

fbshipit-source-id: c556af977f1abee633527151a5896c7d69bd0b48
2025-05-16 10:05:01 -07:00
Nicola CortiandFacebook GitHub Bot 036e47ef9f Add a gradle task to download native 3p dependencies. (#51357)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51357

This adds a `prepareNative3pDependencies` Gradle task that downloads and prepares all the 3p dependecies.
This will be needed before we download native deps for Fantom.

Changelog:
[Internal] [Changed] -

Reviewed By: cipolleschi

Differential Revision: D74812436

fbshipit-source-id: 85796d0bcffaeef05d3a21d50f39954ef39ae92c
2025-05-15 09:31:42 -07:00
Rubén NorteandFacebook GitHub Bot 6e9a816940 Migrate test to use React.createRef insted of ref functions (#51345)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51345

Changelog: [internal]

I just realized there were some tests where we didn't migrate to the new recommended pattern.

Reviewed By: rshest

Differential Revision: D74803018

fbshipit-source-id: b74468f1be35fba8d20d3b96ea2b55452a8175ee
2025-05-15 08:46:32 -07:00
Rubén NorteandFacebook GitHub Bot ca764bb511 Fix Fantom tests to avoid logging errors to test output (#51346)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51346

Changelog: [internal]

I saw that this test was logging errors to the console, which is considered a bad practice in Jest tests.

This prevents the logs from being printed in the test output and also adds assertions to verify what should be logged.

Reviewed By: rshest

Differential Revision: D74803463

fbshipit-source-id: 9c840a51e0e616a6bb15b7a40b3a6937fcb88b64
2025-05-15 05:27:02 -07:00
Rubén NorteandFacebook GitHub Bot 7776122e2e Move playground tests to their own directory (#51310)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51310

Changelog: [internal]

Just a bit of separation between these and Fantom own tests.

Reviewed By: lenaic

Differential Revision: D74717487

fbshipit-source-id: f9d8667c823fcda7b1f3222803367c6b15d9309d
2025-05-14 04:01:31 -07:00
Samuel SuslaandFacebook GitHub Bot 3e3f8eade5 enable enableEagerAlternateStateNodeCleanup in tests (#51291)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51291

changelog: [internal]

enable enableEagerAlternateStateNodeCleanup in tests and remove workarounds.

Reviewed By: rubennorte

Differential Revision: D74643973

fbshipit-source-id: 00f9a6b36546fdea246b587e0e716c7aa76c6bbc
2025-05-13 07:00:26 -07:00
Rubén NorteandFacebook GitHub Bot 0766587b5d Add playground benchmark (#51259)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51259

Changelog: [internal]

We recently added `Playground-itest` as a quick way to test things with Fantom without committing them.

This does the same for benchmarks, so we can quickly answer questions like:

> is `key in obj` faster than `obj[key]`?

Without having to create a new benchmark manually.

Reviewed By: yungsters

Differential Revision: D74578297

fbshipit-source-id: d86604d459f15652d0c2e1ad16a99d011a1324ca
2025-05-12 07:59:59 -07:00
Rubén NorteandFacebook GitHub Bot 996be87071 Add Playground test (#51220)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51220

Changelog: [internal]

Just a playground file to do quick tests in the Fantom environment.

For example, I just used it to know if Hermes supports `AggregateError`, which does:

```
  it('...', () => {
    console.log('AggregateError', global.AggregateError);
  });
```

{F1977824992}

Reviewed By: lenaic

Differential Revision: D74474870

fbshipit-source-id: cbe8a287738b09afe336ae479cc3105d1474e58b
2025-05-10 01:53:28 -07:00
Jan KassensandFacebook GitHub Bot 32fafdf980 cleanup shipped flag enableFabricCompleteRootInCommitPhase
Summary:
Flag was removed in {D74196673}, this cleans up the dynamic flag.

bypass-github-export-checks

Changelog: [internal]

Reviewed By: jackpope

Differential Revision: D74493584

fbshipit-source-id: 6ade542b7e1bd9c4367b7dbef4d2f1ec2d79d0df
2025-05-09 23:01:51 -07:00
Rubén NorteandFacebook GitHub Bot 54499d8007 Ensure LogBox is disabled in Fantom tests (#51210)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51210

Changelog: [internal]

This adds a safety mechanism to Fantom tests to prevent LogBox from swallowing errors.

Now we validate that LogBox isn't installed when running tasks, so we can properly fix error reporting in tests.

Reviewed By: rshest

Differential Revision: D74464749

fbshipit-source-id: ef5e814b14aedbc681a4c7f9f8f60f454b239b6d
2025-05-09 07:11:24 -07:00
Rubén NorteandFacebook GitHub Bot 30363070a3 Define Fantom specific initialization module (#51211)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51211

Changelog: [internal]

This modifies the setup for Fantom so:
1. We don't inject "InitializeCore" by default.
2. We define a default environment setup module for Fantom with good defaults (LogBox, etc. disabled).

We also migrate all existing tests to use the new module.

The goal of this is to prevent LogBox from being used in tests so we can properly fix error propagation in the work loop (so they're not intercepted by it).

Reviewed By: rshest

Differential Revision: D69003812

fbshipit-source-id: 00353b5055e3700943a08ea67f698d49e068555b
2025-05-09 07:11:24 -07:00
Rubén NorteandFacebook GitHub Bot 7e640b5dd3 Add additional test cases for error handling in Fantom event loop (#51208)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51208

Changelog: [internal]

Adding a few more test cases to make sure error handling is fixed considering these use cases.

Reviewed By: rshest

Differential Revision: D74459974

fbshipit-source-id: 9a5865a9a09dd64535b4d38307db6c30f213b45f
2025-05-09 07:11:24 -07:00
Pieter De BaetsandFacebook GitHub Bot ef6f2fb32d Create granite.target_platform for RN overrides (#51076)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51076

Changelog: [Internal]

Reviewed By: MichaelTay, rshest

Differential Revision: D73451500

fbshipit-source-id: b31962fed5004204e15f4adbaf8a8ce2432b94a2
2025-05-06 03:38:22 -07:00
Tim YungandFacebook GitHub Bot e69e35e370 Fantom: Create Shadow Node Reference Counter (#51088)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51088

Creates `ShadowNodeReferenceCounter`, a module with utilities for writing Fantom tests that make assertions about the reference count for a `ShadowNode` object.

Changelog:
[Internal]

Reviewed By: lunaleaps

Differential Revision: D74131710

fbshipit-source-id: a949a402ee52f40445ce99c712540e80c8a05065
2025-05-05 23:43:41 -07:00
Rubén NorteandFacebook GitHub Bot 030ca3c543 Fix bug when dispatching unique and non-unique events of the same type on the same target (#50988)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50988

Changelog: [internal]

This fixes a potential bug where we coalesce unique events with non-unique ones of the same type and target.

Not marked as a bug fix in the changelog because this wouldn't happen in practice, as we always dispatch events of a given type the same way (all unique or all non-unique).

Reviewed By: sammy-SC, javache

Differential Revision: D73849222

fbshipit-source-id: 6f387d63b3a68dccc81c110287d42e15e31c181e
2025-04-29 10:13:09 -07:00
Rubén NorteandFacebook GitHub Bot 524afb4c2a Expose event priorities in Fantom and JS (#50986)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50986

Changelog: [internal]

This just exposes some enum values and methods that we forgot to expose in a few interfaces.

Reviewed By: javache

Differential Revision: D73849221

fbshipit-source-id: 19014d53216e67c77b0c31e5ade8f86de071b001
2025-04-29 10:13:09 -07:00
Rubén NorteandFacebook GitHub Bot 9ae7f7fcc1 Refactor InterruptibleRendering Fantom test to use dispatchNativeEvent (#50957)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50957

Changelog: [internal]

Now we can use the higher level API for event dispatching in this test.

Reviewed By: javache

Differential Revision: D73663626

fbshipit-source-id: 961af26f62128f093c71ad14f457ac8544348415
2025-04-28 06:55:25 -07:00
Rubén NorteandFacebook GitHub Bot 2489308871 Improve pattern to access host instances in tests (#50938)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50938

Changelog: [internal]

No more `maybeNode`s. Using ref objects makes the tests cleaner and the JSX easier to read than injecting lambdas.

This speaks for itself:
* 617 lines added
* 1393 lines removed

{F1977434870}

Reviewed By: lenaic

Differential Revision: D73659018

fbshipit-source-id: d1c23e6457bb1d351ce02b9f6fa8778b06ee0e55
2025-04-25 09:22:02 -07:00
Samuel SuslaandFacebook GitHub Bot 0c8f3aca0e incorporate feedback to Fantom's user guide (#50899)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50899

changelog: [internal]

making things clearer in the docs for Fantom.

Reviewed By: rubennorte

Differential Revision: D73580305

fbshipit-source-id: 0e5edaa3baf57fc54f7a0c454fe4d2fa81627f66
2025-04-25 04:54:58 -07:00
Rubén NorteandFacebook GitHub Bot 7325531eae Fix all Excalidraw SVG diagrams in the docs (#50760)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50760

Changelog: [internal]

This updates all Excalidraw SVG diagrams in the repository to use the latest format exported by Excalidraw after the fix in https://github.com/excalidraw/excalidraw/pull/9386.

I basically opened every image in Excalidraw and re-exported it.

Reviewed By: lenaic

Differential Revision: D73107703

fbshipit-source-id: 4432e952f9e6ee29f59ef8a9ff05479552744a31
2025-04-16 07:24:33 -07:00
Rubén NorteandFacebook GitHub Bot db4b3df910 Use emojis in technical docs titles (#50699)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50699

Changelog: [internal]

Just changing the template to include emojis in the top level titles to make it easier to scan the doc

Reviewed By: lenaic

Differential Revision: D72961870

fbshipit-source-id: 64c45e7ac769c38af06ea318cdb581a04e230f90
2025-04-14 05:41:02 -07:00
Rubén NorteandFacebook GitHub Bot 143beaaa99 Improve format of navigation to home (#50665)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50665

Changelog: [internal]

Just a stylistic change of the link back to the documentation home.

It also changes the link in the template to make sure it's incorrect so people are forced to edit it when creating new docs.

Reviewed By: lenaic

Differential Revision: D72866823

fbshipit-source-id: fa7be286f996049b3f06e2defa5a8c486d63091b
2025-04-11 10:28:04 -07:00
Rubén NorteandFacebook GitHub Bot 9fde76a02d Improve documentation for Fantom (expanding on pragmas) (#50663)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50663

Changelog: [internal]

Adds additional documentation about pragmas and feature flags for Fantom.

Changes the diagram to mention that feature flags are passed to the Fantom CLI.

Reviewed By: andrewdacenko

Differential Revision: D72865960

fbshipit-source-id: abfd167279195495064f3c4dbdcaff92dd865bcf
2025-04-11 10:28:04 -07:00
Rubén NorteandFacebook GitHub Bot d18abc8ec7 Use scrollTop for scrolling tests (#50660)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50660

Changelog: [internal]

This is just a simpler way to test for changes in scroll position.

Reviewed By: andrewdacenko

Differential Revision: D72860138

fbshipit-source-id: a92d430399255a278f5c3c72005a5288d28310ab
2025-04-11 08:05:48 -07:00
Rubén NorteandFacebook GitHub Bot 277d39a216 Add technical documentation for Fantom
Summary:
Changelog: [internal]

This adds some technical documentation for the Fantom testing system.

Reviewed By: andrewdacenko

Differential Revision: D72861981

fbshipit-source-id: edcf71c98bea0b95dfdbb6289aaf7eda4b0b24b1
2025-04-11 07:52:26 -07:00
d06b32d215 Add usage documentation for Fantom (#50659)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50659

Changelog: [internal]

This adds the user guide documentation for Fantom.

Reviewed By: sammy-SC

Differential Revision: D72860137

fbshipit-source-id: 672224b38d045e29af2468ab05fed98991218bf7

Co-authored-by: Samuel Susla <samuelsusla@meta.com>
2025-04-11 07:52:26 -07:00
Tim YungandFacebook GitHub Bot 45a9279c2e Fantom: Make Object Arguments $ReadOnly
Summary:
Changing these object arguments to `$ReadOnly` permits passing in values that are `$ReadOnly` (e.g. `payload` argument to `enqueueNativeEvent`).

Changelog:
[Internal]

Reviewed By: lyahdav

Differential Revision: D72474879

fbshipit-source-id: 27341131724f4f572b78563975774a5b20dee8f8
2025-04-04 16:15:42 -07:00
Rubén NorteandFacebook GitHub Bot 7d8ac6639f Move ensureInstance and isUnreachable to tests utilities directory (#50260)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50260

Changelog: [internal]

Created new directory `react-native/src/private/__tests__/utilities` and moved `ensureInstance` and `isUnreachable` to it.

Reviewed By: yungsters

Differential Revision: D71826787

fbshipit-source-id: 50a50a54ab928c9060282a9f2256ad97dd856ba4
2025-03-25 17:09:18 -07:00
Rubén NorteandFacebook GitHub Bot 3331218b84 Fix several tests and grouping in Fantom-itest (#50258)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50258

Changelog: [internal]

Minor reordering of tests in `Fantom-itest`, fix of describe block for  `enqueueScrollEvent` and fix incorrect usage of `enqueueScrollEvent` instead of `scrollTo` in `scrollTo` tests.

Reviewed By: yungsters

Differential Revision: D71820977

fbshipit-source-id: 07637e2d18cde96c78c83285ba28201260e42f3c
2025-03-25 17:09:18 -07:00
Rubén NorteandFacebook GitHub Bot b12ab7a3d4 Enforce that WeakRef.deref() is always called within the event loop (#50257)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50257

Changelog: [internal]

## Context

We have some tests that make sure certain objects are deallocated/released at the right times, but those are generally hard to get right. The main reason is that WeakRefs semantics are tied to the tasks and microtasks in JS, but we handle them both inside and outside the Event Loop in Fantom tests.

This leads to some surprising behavior where things we expect to have been deallocated weren't because of some innocent looking code.

## Changes

This introduces a safety mechanism in Fantom to enforce that WeakRefs are always dereferenced inside the Event Loop, by patching the method in `WeakRef` and checking if we're in the Event Loop using Fantom APIs.

It also updates the existing test using WeakRefs to fix the new errors thrown by this patch, and to serve as a "good example" on how to use WeakRefs to do memory testing.

Reviewed By: yungsters

Differential Revision: D71815397

fbshipit-source-id: 8faab1898d9112ec365b41867179abb8b251e337
2025-03-25 17:09:18 -07:00
Samuel SuslaandFacebook GitHub Bot 9d19992088 add documentation for Fantom public APIs (#50034)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50034

changelog: [internal]

add documentation for Fantom public APIs.

Reviewed By: rubennorte

Differential Revision: D71197744

fbshipit-source-id: dc7f97732eb6437bc0a33dec9fe2430e38c49e66
2025-03-14 11:12:15 -07:00
Samuel SuslaandFacebook GitHub Bot 0f45d332d4 move Fantom's API to regular functions (#50035)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50035

changelog: [internal]

to make it easier to write JSDocs, let's export functions directly from index.js instead of using proxy object.

Reviewed By: rubennorte

Differential Revision: D71200977

fbshipit-source-id: 0b53c0d3f73577c19253537b9e884459a4920643
2025-03-14 11:12:15 -07:00
Samuel SuslaandFacebook GitHub Bot 6e6e2ea0ca add tests for Fantom.scheduleTask (#50033)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50033

changelog: [internal]

All public APIs should be covered with tests, this diff adds tests for Fantom.scheduleTask.

Reviewed By: rubennorte

Differential Revision: D71195921

fbshipit-source-id: dc7f0f889b9633b1e641dc8887fd506bc4753fe5
2025-03-14 09:03:12 -07:00