Compare commits

..
Author SHA1 Message Date
Nicola CortiandFacebook GitHub Bot 185443e299 Migrate RNTester to use {usesCleartextTraffic} Manifest Placeholder (#52620)
Summary:
This creates a `debugOptimized` build type for React Native Android, meaning that we can run C++ optimization on the debug build, while still having the debugger enabled. This is aimed at improving the developer experience for folks developing on low-end devices or emulators.

Users that intend to debug can still use the `debug` variant where the full debug symbols are shipped.

## Changelog:

[ANDROID] [ADDED] - Create a debugOptimized buildType for Android


Test Plan:
Tested locally with RNTester by doing:

```
./gradlew installDebugOptimized
```

This is the output of the 3 generated .aar. The size difference is a proof that we're correctly stripping out the C++ debug symbols:

<img width="193" height="54" alt="Screenshot 2025-07-15 at 17 49 50" src="https://github.com/user-attachments/assets/584a0e8d-2d17-40d4-ac29-da09049d6554" />
<img width="235" height="51" alt="Screenshot 2025-07-15 at 17 49 39" src="https://github.com/user-attachments/assets/eda8f9e7-3509-4334-8c16-990e55caa04d" />
<img width="184" height="52" alt="Screenshot 2025-07-15 at 17 49 32" src="https://github.com/user-attachments/assets/a5c94385-bc00-4484-b43e-088ee039827f" />

Rollback Plan:

Reviewed By: cipolleschi

Differential Revision: D78351347

Pulled By: cortinico
2025-07-18 07:43:44 -07:00
Jakub PiaseckiandFacebook GitHub Bot 5cda3065ce Update font scale on Android when recreating RootView (#52595)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52595

Changelog: [ANDROID][FIXED] Update font scale when recreating `RootView`

At the moment `enableFontScaleChangesUpdatingLayout` flag only works when the activity is configured to handle font scale changes by itself (`configChanges="fontScale"` in the manifest).

When that configuration is missing, the OS handles the font scale changes by recreating the activity, but in this case the path responsible for updating internally kept font size isn't executed.

This diff updates the RootView, so that the display metrics are also updated when it's created. Alternative approach would be to do that on the Activity, but that assumes usage of `ReactActivity`.

Reviewed By: NickGerleman

Differential Revision: D78323174

fbshipit-source-id: e48583091767497b5dfd4f2d938329530de4068d
2025-07-18 06:50:29 -07:00
Rubén NorteandFacebook GitHub Bot 532b415960 Throw an error when using an unrecognized @fantom_ prefixed pragma (#52701)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52701

Changelog: [internal]

This adds validation for Fantom test file pragmas to avoid ignoring configurations accidentally when introducing typos.

Reviewed By: rshest

Differential Revision: D78550866

fbshipit-source-id: 7123bfb39573adbb1adf417c232cf7d4cae4cd25
2025-07-18 04:19:28 -07:00
Rubén NorteandFacebook GitHub Bot adef486333 Assume NativePerformance will be available if the Performance module is loaded (#52671)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52671

Changelog: [internal]

When setting up the global `performance` value, we check if the native module exists to decide what version to setup: the legacy "barebones" version or the modern version that's mostly spec compliant.

As we do that check and we shouldn't be requiring the module from anywhere else, it should be safe to always assume the module will be defined if we load the `Performance` class, so we can avoid checks in all methods.

NOTE: I've kept some checks for a few methods that are still not fully propagated (new methods like `reportMark`, `reportMeasure` and `getMarkTime`).

This improves performance slightly for `performance` methods:

* Before

| (index) | Task name                                                 | Latency average (ns) | Latency median (ns) | Throughput average (ops/s) | Throughput median (ops/s) | Samples |
| ------- | --------------------------------------------------------- | -------------------- | ------------------- | -------------------------- | ------------------------- | ------- |
| 0       | 'mark (default)'                                          | '1803.32 ± 0.71%'    | '1763.00'           | '563849 ± 0.01%'           | '567215'                  | 554908  |
| 1       | 'mark (with custom startTime)'                            | '1762.39 ± 1.67%'    | '1692.00'           | '587832 ± 0.01%'           | '591017'                  | 567414  |
| 2       | 'measure (default)'                                       | '1879.47 ± 1.44%'    | '1813.00'           | '548962 ± 0.01%'           | '551572'                  | 532064  |
| 3       | 'measure (with start and end timestamps)'                 | '1916.65 ± 0.84%'    | '1873.00'           | '531258 ± 0.01%'           | '533903'                  | 521743  |
| 4       | 'measure (with mark names)'                               | '2049.84 ± 0.44%'    | '2013.00'           | '492799 ± 0.01%'           | '496771'                  | 487844  |
| 5       | 'clearMarks'                                              | '719.87 ± 0.04%'     | '711.00'            | '1403602 ± 0.01%'          | '1406470'                 | 1389136 |
| 6       | 'clearMeasures'                                           | '710.04 ± 0.04%'     | '701.00'            | '1421610 ± 0.01%'          | '1426534'                 | 1408373 |
| 7       | 'mark + clearMarks'                                       | '2256.56 ± 1.10%'    | '2143.00'           | '460721 ± 0.02%'           | '466636'                  | 443152  |
| 8       | 'measure + clearMeasures (with start and end timestamps)' | '2345.44 ± 1.11%'    | '2244.00'           | '442395 ± 0.02%'           | '445633'                  | 426360  |
| 9       | 'measure + clearMeasures (with mark names)'               | '2349.55 ± 0.61%'    | '2283.00'           | '434370 ± 0.02%'           | '438020'                  | 425613  |

* After

| (index) | Task name                                                 | Latency average (ns) | Latency median (ns) | Throughput average (ops/s) | Throughput median (ops/s) | Samples |
| ------- | --------------------------------------------------------- | -------------------- | ------------------- | -------------------------- | ------------------------- | ------- |
| 0       | 'mark (default)'                                          | '1791.47 ± 1.08%'    | '1732.00'           | '573787 ± 0.01%'           | '577367'                  | 558202  |
| 1       | 'mark (with custom startTime)'                            | '1699.41 ± 1.27%'    | '1642.00'           | '605188 ± 0.01%'           | '609013'                  | 588441  |
| 2       | 'measure (default)'                                       | '1820.92 ± 1.39%'    | '1763.00'           | '563437 ± 0.01%'           | '567215'                  | 549173  |
| 3       | 'measure (with start and end timestamps)'                 | '1923.57 ± 1.65%'    | '1852.00'           | '537112 ± 0.01%'           | '539957'                  | 519867  |
| 4       | 'measure (with mark names)'                               | '2036.09 ± 1.05%'    | '1983.00'           | '500406 ± 0.01%'           | '504286'                  | 491139  |
| 5       | 'clearMarks'                                              | '657.49 ± 0.07%'     | '641.00'            | '1543793 ± 0.01%'          | '1560062'                 | 1520939 |
| 6       | 'clearMeasures'                                           | '669.02 ± 0.09%'     | '651.00'            | '1520386 ± 0.01%'          | '1536098'                 | 1494730 |
| 7       | 'mark + clearMarks'                                       | '2213.09 ± 1.53%'    | '2103.00'           | '470008 ± 0.02%'           | '475511'                  | 451858  |
| 8       | 'measure + clearMeasures (with start and end timestamps)' | '2353.15 ± 1.27%'    | '2214.00'           | '448563 ± 0.02%'           | '451671'                  | 424962  |
| 9       | 'measure + clearMeasures (with mark names)'               | '2298.28 ± 0.62%'    | '2243.00'           | '441703 ± 0.02%'           | '445831'                  | 435108  |

Reviewed By: hoxyq

Differential Revision: D78412931

fbshipit-source-id: 07390722bb00a51847cb5625b2adb4e26f89e5d2
2025-07-18 03:44:21 -07:00
Rubén NorteandFacebook GitHub Bot c9367a8d86 Remove optionality for stable methods of the NativePerformance module (#52668)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52668

Changelog: [internal]

These methods have been available for months so no need to consider backwards compatibility with older binaries.

Reviewed By: huntie

Differential Revision: D78412932

fbshipit-source-id: 0f1d541c36c98a4cc8c847d1ee7a08a9d0f4b849
2025-07-18 03:44:21 -07:00
Alex HuntandFacebook GitHub Bot e247be793c Lower minimum Node.js version to 20.19.4 (#52678)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52678

From partner feedback, there's still appetite to support Node 20.x for the next <1y of life. Lower min version to `20.19.4` (Jul 2025) and widen test matrix in CI.

Changelog:
[General][Breaking] - Our new minimum Node version is Node.js 20 (Overrides #51840)

Reviewed By: cortinico

Differential Revision: D78494491

fbshipit-source-id: c8d9dc6250cb11f8a12ca7e761b65f4a8dae9265
2025-07-18 03:32:13 -07:00
Nick GerlemanandFacebook GitHub Bot 3f9b19eb89 Fix build_android GHA Job (#52694)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52694

build_android job is always failing, with this assertion. Seems like find/replace in D78484060 gone wrong?

Changelog: [Internal]

Reviewed By: sbuggay

Differential Revision: D78534334

fbshipit-source-id: 291bdd01b41fa6efea00ed63a0dee8bdb14cbc3a
2025-07-17 20:42:02 -07:00
Ramanpreet NaraandFacebook GitHub Bot 862e8c7049 IntersectionObserver: Clean up legacy observe/unobserve methods
Summary:
In this diff, we migrated IntersectionObserver to tokens: D74262804.

So that we wouldn't have to store shadow nodes on the javascript side.

Storing shadow nodes lead to a memory leak in the past.

Changelog: [internal]

Reviewed By: rubennorte

Differential Revision: D78494075

fbshipit-source-id: 38923ca4b265de6ff81ea20e5649e0bd2e39afc9
2025-07-17 17:35:22 -07:00
Sam ZhouandFacebook GitHub Bot 23c8787fe2 Add annotations to fix future errors after fix for unsound array types (#52691)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52691

Unannotated array literals are unsound in Flow right now. This diff adds in annotations and makes a few things readonly, to reduce future errors.

Changelog: [Internal]

Reviewed By: marcoww6

Differential Revision: D78519638

fbshipit-source-id: d98a7668ecf97bcc87dcb3fad25ade736d885d9a
2025-07-17 17:30:43 -07:00
Tim YungandFacebook GitHub Bot d78c242e4d RN: Enable enableVirtualViewRenderState by Default (#52686)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52686

Enables the `enableVirtualViewRenderState` feature flag by default.

Also, fixed classification for this and the `enableVirtualViewWindowFocusDetection` feature flags. (They were incorrect.)

Changelog:
[Internal]

Reviewed By: lunaleaps

Differential Revision: D78500846

fbshipit-source-id: 099adaa4ed0026c8bb7438df869564d76a999007
2025-07-17 12:59:13 -07:00
Tim YungandFacebook GitHub Bot 5d4d1ce84b RN: Cleanup scheduleAnimatedCleanupInMicrotask Flag (#52685)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52685

Cleans up the `scheduleAnimatedCleanupInMicrotask ` feature flag and deletes code paths that are now unreachable.

Changelog:
[Internal]

Reviewed By: mdvacca

Differential Revision: D78498600

fbshipit-source-id: 307562030373742e64968ae4c92d6bfbb48ddc71
2025-07-17 12:59:13 -07:00
Tim YungandFacebook GitHub Bot 5c7fdb252e RN: Cleanup disableInteractionManager Flag (#52684)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52684

Cleans up the `disableInteractionManager` feature flag and deletes code paths that are now unreachable.

Changelog:
[Internal]

Reviewed By: mdvacca

Differential Revision: D78498348

fbshipit-source-id: a3128c1e5ca9c5879080df54b7683a3c916cec13
2025-07-17 12:59:13 -07:00
Tim YungandFacebook GitHub Bot 1814418f12 RN: Cleanup avoidStateUpdateInAnimatedPropsMemo Flag (#52683)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52683

Cleans up the `avoidStateUpdateInAnimatedPropsMemo` feature flag and deletes code paths that are now unreachable.

Changelog:
[Internal]

Reviewed By: mdvacca

Differential Revision: D78497862

fbshipit-source-id: 26406e713ca5b7b194159638a20dcfca877ba380
2025-07-17 12:59:13 -07:00
Tim YungandFacebook GitHub Bot 0a3808d07c RN: Cleanup alwaysFlattenAnimatedStyles Flag (#52682)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52682

Cleans up the `alwaysFlattenAnimatedStyles` feature flag.

This was already unused starting with {D77314904}.

Changelog:
[Internal]

Reviewed By: mdvacca

Differential Revision: D78497554

fbshipit-source-id: 8bfbe6485812a675cdf3e78612347457f45ada90
2025-07-17 12:59:13 -07:00
Tim YungandFacebook GitHub Bot 0508eddfe6 RN: Default Hermes Parser to reactRuntimeTarget: "19" (#52625)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52625

Changes `react-native/babel-preset` so that by default, `hermes-parser` is configured with `reactRuntimeTarget: "19"`. This changes the compiled output of Component Syntax to not use `forwardRef` when a `ref` prop is present.

Additionally, this adds a new preset option property, `hermesParserOptions`. This object allows users of `react-native/babel-preset` to supply overrides for any `hermes-parser` options.

Changelog:
[General][Changed] - Configures `react-native/babel-preset` to target React 19 by default, meaning Component Syntax will not compile to `forwardRef` calls when a `ref` prop is present.
[General][Added] - Added support to `react-native/babel-preset` for a `hermesParserOptions` option, that expects an object that enables overriding `hermes-parser` options.

Reviewed By: SamChou19815

Differential Revision: D78383269

fbshipit-source-id: 1e6b66b9bfbeaf8a06fdc39031cb6de7e921765f
2025-07-17 12:53:36 -07:00
Rubén NorteandFacebook GitHub Bot 25c61123fb Fix incorrect locking and attempts check in ShadowTree experiment (#52681)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52681

Changelog: [internal]

In the original change I made in D78418504 / https://github.com/facebook/react-native/pull/52645 I made 2 mistakes:
1. Used a lock that would try to re-lock on itself without it being recursive (which would cause a deadlock). I didn't see that because when testing I didn't hit the case where we'd exhaust the options.
2. The `attemps` variable wasn't incremented, so we never left the loop in case of exhaustion.

This propagates a flag to `tryCommit` to indicate we've already locked on the commitMutex_ so we don't need to lock again in that case and increases the counter, fixing the issue.

Reviewed By: cortinico

Differential Revision: D78497509

fbshipit-source-id: 546ccd0c84aed5416ce1aef47d79419b4fe06f66
2025-07-17 12:18:52 -07:00
Rubén NorteandFacebook GitHub Bot 9b30fe0c45 Back out "Add missing attempts++ in ShadowNode with MAX_COMMIT_ATTEMPTS_BEFORE_LOCKING" (#52680)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52680

Changelog: [internal]

Reverting to make the fix easier to pick. Will land again on top.

Original commit changeset: 91d7f5d88a90

Original Phabricator Diff: D78487202

Reviewed By: cortinico

Differential Revision: D78497511

fbshipit-source-id: 58379787786cadcbcbe354feb97bc400a24f9d58
2025-07-17 12:18:52 -07:00
Rubén NorteandFacebook GitHub Bot fef6e0f584 Back out "Fix incorrect locking in ShadowTree experiment" (#52679)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52679

Changelog: [internal]

Reverting to make the fix easier to pick. Will land again on top.

Original commit changeset: c18e967488de

Original Phabricator Diff: D78480136

Reviewed By: cortinico

Differential Revision: D78497510

fbshipit-source-id: 8037276cb70d27ff695c76cd9575b525568c4489
2025-07-17 12:18:52 -07:00
Luna WeiandFacebook GitHub Bot 4c9591c0ea Use experimental VirtualView (#52592)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52592

Changelog: [Internal] - Expose VirtualViewExperimental in JS, use in a test surface

Reviewed By: yungsters

Differential Revision: D78027899

fbshipit-source-id: d3d9808b8ba8e36c5fdb0c831c0855ed318d0a30
2025-07-17 12:15:57 -07:00
Luna WeiandFacebook GitHub Bot 937eac64e8 Move off of ReactScrollViewHelper.ScrollListener (#52591)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52591

Changelog: [Internal] Stop using ReactScrollViewHelper.ScrollListener for layout, scroll events from ScrollView

Reviewed By: yungsters

Differential Revision: D78287689

fbshipit-source-id: 3fe944d90e0165d10953a603e5694ac7bbaeb9b8
2025-07-17 12:15:57 -07:00
Luna WeiandFacebook GitHub Bot 510bfd4101 Fix VirtualViewExperimental (#52590)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52590

Changelog: [Internal] - Fix a couple of bugs with VirtualViewExperimental

1. `also` side-effect bug where we were accessing `scrollView` before it was assigned
2. Handling empty `rect`. Now, we don't add the virtualView until it has a non-empty rect layout

Reviewed By: yungsters

Differential Revision: D78287690

fbshipit-source-id: 1806b748a0117e51c7a201191396d79db3a8d205
2025-07-17 12:15:57 -07:00
Nicola CortiandFacebook GitHub Bot 847721dc9b Add missing attempts++ in ShadowNode with MAX_COMMIT_ATTEMPTS_BEFORE_LOCKING (#52673)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52673

We should be incrementing the `attempts` variable as otherwise this loop with never stop.

Created from CodeHub with https://fburl.com/edit-in-codehub

Changelog:
[Internal] -

Reviewed By: rubennorte

Differential Revision: D78487202

fbshipit-source-id: 91d7f5d88a90bdfa806195fd35897f2f51c1deb9
2025-07-17 09:02:19 -07:00
Rubén NorteandFacebook GitHub Bot 2a01eadcb8 Remove unnecessary $FlowFixMe after correct typing for console.timeStamp (#52633)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52633

Changelog: [internal]

Now that we have the correct type definition for `console.timeStamp` we can remove the unnecessary `$FlowFixMe` annotations we had to add to use the new arguments.

Reviewed By: hoxyq

Differential Revision: D78405312

fbshipit-source-id: 29378ee6fa5986e22d0dfdfb85b7e25375361dc9
2025-07-17 08:35:36 -07:00
Rubén NorteandFacebook GitHub Bot c247554342 Add correct typing for console (including console.timeStamp) (#52632)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52632

Changelog: [internal]

This improves the type definitions for methods in the global `console` object, most importantly:
- Removes use of `any`.
- Defines correct typing for `console.timeStamp`, including new parameters for the Chrome Extensibility API.

Reviewed By: hoxyq

Differential Revision: D78405314

fbshipit-source-id: 6f31cc3005ff708ef6aa155bcd150d53a845e66c
2025-07-17 08:35:36 -07:00
Rubén NorteandFacebook GitHub Bot 10ddec7aeb Add stubs for missing console methods (#52643)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52643

Changelog: [internal]

Defines stubs for the following `console` methods:
* `time`
* `timeEnd`
* `count`
* `countReset`

Reviewed By: huntie

Differential Revision: D78418212

fbshipit-source-id: 8063f240f1e3fcfb3e36a2b43e61ca0e8cdf94db
2025-07-17 08:35:36 -07:00
Rubén NorteandFacebook GitHub Bot b9e1e37c87 Define typing for performance extensibility API (#52631)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52631

Changelog: [internal]

Just a small improvement in the type definitions to serve as documentation for the expected arguments for custom tracks in RNDT.

Reviewed By: hoxyq

Differential Revision: D78405313

fbshipit-source-id: 75d250ea27f2e55e172aaf6e72399b85cecd43f4
2025-07-17 08:35:36 -07:00
Krystof WoldrichandFacebook GitHub Bot c4082c9ce2 surface uncaught promise rejections with ExceptionsManager.handleException instead of swallowing them (#51594)
Summary:
This PR fixes logging of rejections, which stopped working with the transition from using `LogBox` for warnings to directing users to use React Native Debugger, where warnings can be viewed in the `Console` tab.

Rejected promises before this PR used `LogBox.addLog` with the `level: warn` directly without `console.warn`, which notified users to open debugger to view a warning (after rejected promise) without actually printing any warnings to the console.

This PR uses `ExceptionsManager.handleException(error, false /* isFatal */);` for promise rejections that correctly raising an error to the console if needed.

### Rejected Promise in Chrome
Displaying the error as long as it's uncaught in the form:
`Uncaught (in promise) Error`
and if there's a message in that error:
`Uncaught (in promise) Error: ${message}`
once the error is handled, this error disappears:
{F1978806409}
This is done with `Runtime.exceptionThrown`, and  `Runtime.exceptionRevoked`:
{F1979815326}

## Changelog:
[General][Breaking] unhandled promises are now handled by ExceptionsManager.handleException, instead of being swallowed as Logbox Warnings.
----
This is a breaking change because we changed the wording for these errors and because some systems (like Sentry) might start monitoring a new set of errors when this code is adopted.

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

Test Plan:
Use `Promise.reject` and observe that the rejection is now shown symbolicated in LogBox and also printed in React Native Debugger Console.

```
<Button
  title="Uncaught Promise Rejection"
  onPress={() => {
    const err = new Error('test error');
    err.cause = new Error('cause');
    const promise = Promise.resolve().then(() => {
      throw err;
      // also test with throwing a string / object:
      // throw 'aa';
      // throw {test: 'object'};
      // return Promise.reject();
    });

    setTimeout(() => {
      promise.catch(e => {
        console.log('promise error caught', e);
      });
    }, 4000);
  }}
/>
```

### Before
There's no indication whatsoever there's an uncaught promise.

### After
An error is logged:
Error-
{F1979749366}
Text-
{F1979749350}
Object-
{F1979749351}
Promise.reject() or undefined-
 {F1979749826}

Reviewed By: hoxyq

Differential Revision: D75442651

Pulled By: vzaidman

fbshipit-source-id: bf6c56e643f03997f5a604b85c543aad62648a29
2025-07-17 07:55:50 -07:00
Christian FalchandFacebook GitHub Bot 4ee2b60a1e resolve xcframework paths from conf switch script (#52664)
Summary:
When switching between debug/release we run a small script to make sure to copy the correct version of the RNDeps xcframework.

This script was missing a resolve function that fixed up some path issues that we do when installing in the podspec.

## Changelog:

[IOS] [FIXED] - Fixed issue with RNDeps release/debug switch failing

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

Test Plan:
- Create new RN App
- Install pod with prebuilt deps
- Build (success)
- Switch to release
- Build (success)

Reviewed By: cortinico

Differential Revision: D78481590

Pulled By: cipolleschi

fbshipit-source-id: 2d02b0bc55e8aef6f3fafb4f7aa193c4cf00414e
2025-07-17 06:46:00 -07:00
Rubén NorteandFacebook GitHub Bot 2d4c43c267 Fix incorrect locking in ShadowTree experiment (#52662)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52662

Changelog: [internal]

In the original change I made in D78418504 / https://github.com/facebook/react-native/pull/52645 I made a mistake and used a lock that would try to re-lock on itself without it being recursive (which would cause a deadlock). I didn't see that because when testing I didn't hit the case where we'd exhaust the options.

This propagates a flag to `tryCommit` to indicate we've already locked on the `commitMutex_` so we don't need to lock again in that case, fixing the issue.

Reviewed By: sammy-SC

Differential Revision: D78480136

fbshipit-source-id: c18e967488de14e73e6abf6f6e82c16bc42a12c6
2025-07-17 05:37:07 -07:00
Christian FalchandFacebook GitHub Bot 2e55241a90 added missing script in package.json (#52663)
Summary:
When switching between release/debug we're running a script to copy the correct xcframework. This script for the React-Core prebuilts was not part of the package.json file.

This caused the build to fail after trying to switch from debug -> release.

## Changelog:
[IOS] [FIXED] - Fixed missing script for resolving prebuilt xcframework when switching between release/debug

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

Test Plan:
- Create new RN App
- Install pod with prebuilt deps and core
- Build (success)
- Switch to release
- Build (success)

Reviewed By: cortinico

Differential Revision: D78481302

Pulled By: cipolleschi

fbshipit-source-id: 1c7181e63219098ae140d77ff1cb2c0c9b9642e5
2025-07-17 05:26:07 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 2c752af535 Fix Windows CI (#52666)
Summary:
As per [this issue](https://github.com/actions/runner-images/issues/12416), Windows machine doesn't have access to D: drive anymore

## Changelog:
[Internal] -

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

Test Plan: GHA

Reviewed By: huntie

Differential Revision: D78484060

Pulled By: cipolleschi

fbshipit-source-id: 36d844f9d7d69f1d74a154b019307cc1e269ad66
2025-07-17 05:15:04 -07:00
Pieter De BaetsandFacebook GitHub Bot b6f4142bb2 Reduce legacy arch warning for OnLayoutEvent (#52665)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52665

This API is being used by react-native-svg (https://github.com/software-mansion/react-native-svg/blob/main/android/src/main/java/com/horcrux/svg/VirtualView.java#L606) which is causing issues when enabling legacy arch minification.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D78478751

fbshipit-source-id: 7f48368c11ec855bbeb5e904628b082a5bc741ff
2025-07-17 04:39:41 -07:00
Nicola CortiandFacebook GitHub Bot 2f553ec7f6 Unbreak build_android due to missing dependency on rrc_view (#52661)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52661

The CI is currently red on main due to a missing dependency on `rrc_view`
from the recent TransformHelper.cpp addition.
This fixes it.

Changelog:
[Internal] [Changed] -

Reviewed By: cipolleschi

Differential Revision: D78479785

fbshipit-source-id: 3d2b698d9ce46cf22c15ad43005f621526590145
2025-07-17 04:09:25 -07:00
Nicola CortiandFacebook GitHub Bot 7ef57163cb Make accessors inside HeadlessJsTaskService open again (#52660)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52660

The documentation for those methods mention that users should override them to
provide their own implementation.

However those vals are not `open` so users cannot really override them.
This fixes it.

See more context on https://github.com/facebook/react-native/pull/48800#issuecomment-3082665024

So this was practically a breaking change, that I'm attempting to mitigate.

Changelog:
[Android] [Fixed] - Make accessors inside HeadlessJsTaskService open again

Reviewed By: cipolleschi

Differential Revision: D78479162

fbshipit-source-id: eefc7332e2004198cd6bd64b60a66215f137ad4a
2025-07-17 04:05:47 -07:00
Moti ZilbermanandFacebook GitHub Bot bbda71f2c8 Fix argv handling for packaged mode (#52641)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52641

Changelog: [Internal]

TSIA, missed this in D77591742

bypass-github-export-checks

Reviewed By: huntie

Differential Revision: D78413090

fbshipit-source-id: a02d604def172b531a89021496208171373ddd8c
2025-07-17 03:13:26 -07:00
Moti ZilbermanandFacebook GitHub Bot 60efc757d9 Implement --version flag
Summary:
Changelog: [Internal]

Adds a basic `--version` command line flag to the RNDT shell. This will be used in code paths (including tests) that need to verify that the shell is executable, but do not need to actually display a window or hand over control to the main shell instance.

bypass-github-export-checks

Reviewed By: huntie

Differential Revision: D78351936

fbshipit-source-id: e8982cfea6435da0ac9ea5f50d57c7642a8e2edb
2025-07-17 03:13:26 -07:00
Moti ZilbermanandFacebook GitHub Bot 4a1884e5e5 Exclude unimportant files from Electron build
Summary:
TSIA

Changelog: [Internal]

bypass-github-export-checks

Reviewed By: huntie

Differential Revision: D78351935

fbshipit-source-id: 7f71f3df3ecf8ce92891109b8d9f8e0a74361f21
2025-07-17 03:13:26 -07:00
David VaccaandFacebook GitHub Bot 20baf2a992 Delete ReactNativeNewArchitectureFeatureFlags.isNewArchitectureStrictModeEnabled() (#52650)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52650

ReactNativeNewArchitectureFeatureFlags.isNewArchitectureStrictModeEnabled() is unused, let's delete it

changelog: [internal] internal

Reviewed By: arushikesarwani94

Differential Revision: D78438409

fbshipit-source-id: 8208ae0d3f59e6a3197643e4a7610db3116eb1c6
2025-07-16 18:06:29 -07:00
Rubén NorteandFacebook GitHub Bot 21cd09d4c0 Implement mechanism to prevent ShadowTree commit exhaustion (#52645)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52645

Changelog: [internal]

This add a new feature flag to test a fix for https://github.com/facebook/react-native/issues/51870

Reviewed By: cortinico, sammy-SC

Differential Revision: D78418504

fbshipit-source-id: 2792026b6936393d196fd1e3162f8b2c61a38ed6
2025-07-16 12:02:07 -07:00
Joe VilchesandFacebook GitHub Bot d00de31aef Use setter for accessibilityElements (#52644)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52644

There have been some hard to find crashes with iOS outlined in https://fb.workplace.com/groups/3615245781855602/permalink/23898365966450285/. Talking with lenaic this may be due to us not using the setter to set this property. Let's try that

Changelog: [Internal]

Reviewed By: lenaic

Differential Revision: D78413954

fbshipit-source-id: a68b90a2276805283082ceaf1020e13bd8ef8eb6
2025-07-16 10:56:28 -07:00
generatedunixname89002005287564andFacebook GitHub Bot de67d6ec67 Fix CQS signal modernize-use-using in xplat/js/react-native-github/packages (#52629)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/52629

Reviewed By: javache

Differential Revision: D78404030

fbshipit-source-id: 553a9f26327c4b3439b773981c25b5e1d469d8f1
2025-07-16 10:23:13 -07:00
Nicola CortiandFacebook GitHub Bot 88bafeddab Add TransformHelper.cpp to reactnativejni_common (#52640)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52640

Not having `TransformHelper.cpp` included in CMake is causing the C++ code to fail compiling.
This diff fixes it.

Changelog:
[Internal] [Changed] -

Reviewed By: cipolleschi, javache

Differential Revision: D78414015

fbshipit-source-id: 4900427a86eb38bfec10e5e385296d89c73e9051
2025-07-16 09:52:04 -07:00
Mathieu ActhernoeneandFacebook GitHub Bot 86994a6e22 Fix Dimensions window values on Android < 15 (#52481)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52481

This PR (initially created for edge-to-edge opt-in support, rebased multiple times) fixes the `Dimensions` API `window` values on Android < 15, when edge-to-edge is enabled.

Currently the window height doesn't include the status and navigation bar heights (but it does on Android >= 15):

<img width="300" alt="Screenshot 2025-06-27 at 16 23 02" src="https://github.com/user-attachments/assets/c7d11334-9298-4f7f-a75c-590df8cc2d8a" />

Using `WindowMetricsCalculator` from AndroidX:

<img width="300" alt="Screenshot 2025-06-27 at 16 34 01" src="https://github.com/user-attachments/assets/7a4e3dc7-a83b-421b-8f6d-fd1344f5fe81" />

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

## Changelog:

[Android] [Fixed] Fix `Dimensions` `window` values on Android < 15 when edge-to-edge is enabled

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

Test Plan:
Run the example app on an Android < 15 device.

Rollback Plan:

Reviewed By: cortinico

Differential Revision: D77906644

Pulled By: alanleedev

fbshipit-source-id: 121cd6bc4133973f06b28eb9e79c9387ac7070a1
2025-07-16 09:15:43 -07:00
Fabrizio CucciandFacebook GitHub Bot b795d61592 Add skipActivityIdentityAssertionOnHostPause feature flag (#52639)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52639

Add feature flag in the attempt to address the pile of tasks reporting the following error in panelapps:

> Error: android_crash:java.lang.AssertionError:com.facebook.react.runtime.ReactHostImpl.onHostPause

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D78339196

fbshipit-source-id: 9ef748e7ea85f179d8f8c418a978bd5c99f70601
2025-07-16 08:42:41 -07:00
Samuel SuslaandFacebook GitHub Bot 0fd060f558 disable view culling when accessibility API is detected (#52612)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52612

changelog: [internal]

View Culling is purely performance optimisation but it must work correctly with accessibility features like VoiceOver and Switch Control.
In this diff, View Culling is lazily disabled whenever use of an accessibility feature is detected to make sure all views are present in the view hierarchy.

Reviewed By: NickGerleman, philIip

Differential Revision: D78336010

fbshipit-source-id: 7a201afc8e2ffd8b586d75ed4de2c03d7966750c
2025-07-16 08:16:49 -07:00
Samuel SuslaandFacebook GitHub Bot 9967908e89 introduce UpdateMode::unstable_Immediate (#52604)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52604

changelog: [internal]

For Fabric View Culling to work correctly, content offset changes must be applied synchronously to avoid UI flicker.

The flicker happens because content offset update happens asynchronously and the OS paints scroll position update before React Native has a chance to adjust view hierarchy for the new scroll position.

Reviewed By: lenaic

Differential Revision: D78334322

fbshipit-source-id: dc1f1b3f9db9f9547e5a588dc184fcf21cca2727
2025-07-16 08:16:49 -07:00
Pieter De BaetsandFacebook GitHub Bot a9ece0c302 Use native helpers to accelerate transform processing (#52603)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52603

Processing transforms is expensive in Java, as it requires bridging the entire ReadableNativeArray/Map. Instead, we can use the existing parser logic `resolveTransform` logic to perform this operation in C++.

Ideally, we actually re-use the existing parsed transform from Props, that could be something we revisit after Props 2.0.

As a follow-up, we should consider also moving the matrix decomposition logic from MatrixMathHelper here, and make that the only information we send back to Java.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D78298588

fbshipit-source-id: a698ac8587ccfb2be04665747082398ccdde9294
2025-07-16 06:29:10 -07:00
Pieter De BaetsandFacebook GitHub Bot 5d3d23b32e Use native implementation of equals in ReadableNativeArray (#52611)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52611

We compare the current transform (represented as a ReadableArray) with the incoming one to know whether to invalidate. This can be expensive as it requires to materialize the entire transform data structure over JNI. Instead, we can delegate this comparison to native code, which can compare the underlying folly::dynamic directly.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D78340288

fbshipit-source-id: f44a054e234694c316fb080fe2dbc2017780123a
2025-07-16 06:29:10 -07:00
Rubén NorteandFacebook GitHub Bot bd198324d8 Add support for details field and custom tracks in performance.mark and performance.measure for DevTools (#52613)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52613

Changelog: [internal]

This adds first-class support for the `detail` field in `performance.mark` and `performance.measure`.

Now that we have access the JS entry in native, we can access the `detail` field to propagate it to DevTools (and use it to extract track names for Perfetto).

In order to avoid the performance overhead of always having to extract the `detail` field from the entry, this is done lazily only if we're actively profiling with DevTools or Perfetto.

Reviewed By: sbuggay

Differential Revision: D78340911

fbshipit-source-id: 383dd1cb6fcc8a04be9e65038503986f196e23c9
2025-07-16 05:55:03 -07:00
Rubén NorteandFacebook GitHub Bot 2f67285545 Remove support for specifying track names for Perfetto and RNDT using the "Track:" prefix (#52614)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52614

Changelog: [internal]

We're adding first-class support for custom tracks, so we can remove the legacy mechanism to specify tracks with the "Tracks:" prefix in the event names.

Reviewed By: sbuggay

Differential Revision: D78340910

fbshipit-source-id: cbbadd519baf7bb50072cb97d8cd1ccc87a8a35c
2025-07-16 05:55:03 -07:00
Rubén NorteandFacebook GitHub Bot 4edc33e4e1 Refactor implementation of performance.mark and performance.measure (#52586)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52586

Changelog: [internal]

This fixes a "bug" (or spec-compliance issue) in the `performance.measure` method where `end` and `duration` couldn't be used together (only `start` and `duration`, and `start` and `end` could be used).

This also refactors the API to be "JS-first", preparing the native module methods to support passing instances of entries to fix other issues.

Verified performance impact: `mark` is slightly regressed (~7% slower) due to an additional JSI call to get the default start time and `measure` is significantly optimized (25/30% faster) due to simplified parameter handling in JSI calls.

* Before

| (index) | Task name                                                 | Latency average (ns) | Latency median (ns) | Throughput average (ops/s) | Throughput median (ops/s) | Samples |
| ------- | --------------------------------------------------------- | -------------------- | ------------------- | -------------------------- | ------------------------- | ------- |
| 0       | 'mark (default)'                                          | '1621.03 ± 1.17%'    | '1562.00'           | '636986 ± 0.01%'           | '640205'                  | 616890  |
| 1       | 'mark (with custom startTime)'                            | '1756.88 ± 1.15%'    | '1693.00'           | '586826 ± 0.01%'           | '590667'                  | 569190  |
| 2       | 'measure (default)'                                       | '2424.66 ± 1.35%'    | '2333.00'           | '426122 ± 0.02%'           | '428633'                  | 412429  |
| 3       | 'measure (with start and end timestamps)'                 | '2679.96 ± 1.23%'    | '2574.00'           | '385266 ± 0.02%'           | '388500'                  | 373140  |
| 4       | 'measure (with mark names)'                               | '2713.49 ± 0.50%'    | '2644.00'           | '375383 ± 0.02%'           | '378215'                  | 368530  |
| 5       | 'clearMarks'                                              | '691.13 ± 0.07%'     | '681.00'            | '1467016 ± 0.01%'          | '1468429'                 | 1446900 |
| 6       | 'clearMeasures'                                           | '706.00 ± 0.05%'     | '691.00'            | '1431489 ± 0.01%'          | '1447178'                 | 1416435 |
| 7       | 'mark + clearMarks'                                       | '2083.21 ± 1.14%'    | '2003.00'           | '497974 ± 0.01%'           | '499251'                  | 480028  |
| 8       | 'measure + clearMeasures (with start and end timestamps)' | '3085.14 ± 0.88%'    | '2974.00'           | '334337 ± 0.02%'           | '336247'                  | 324135  |
| 9       | 'measure + clearMeasures (with mark names)'               | '2949.45 ± 0.62%'    | '2884.00'           | '345335 ± 0.02%'           | '346741'                  | 339046  |

* After

| (index) | Task name                                                 | Latency average (ns) | Latency median (ns) | Throughput average (ops/s) | Throughput median (ops/s) | Samples |
| ------- | --------------------------------------------------------- | -------------------- | ------------------- | -------------------------- | ------------------------- | ------- |
| 0       | 'mark (default)'                                          | '1740.06 ± 1.01%'    | '1692.00'           | '587400 ± 0.01%'           | '591017'                  | 574695  |
| 1       | 'mark (with custom startTime)'                            | '1661.64 ± 1.16%'    | '1612.00'           | '617453 ± 0.01%'           | '620347'                  | 601815  |
| 2       | 'measure (default)'                                       | '1808.71 ± 1.28%'    | '1753.00'           | '566516 ± 0.01%'           | '570451'                  | 552882  |
| 3       | 'measure (with start and end timestamps)'                 | '1869.21 ± 1.00%'    | '1823.00'           | '546571 ± 0.01%'           | '548546'                  | 534987  |
| 4       | 'measure (with mark names)'                               | '2016.40 ± 0.74%'    | '1983.00'           | '502987 ± 0.01%'           | '504286'                  | 496075  |
| 5       | 'clearMarks'                                              | '682.18 ± 0.03%'     | '671.00'            | '1476364 ± 0.01%'          | '1490313'                 | 1465899 |
| 6       | 'clearMeasures'                                           | '686.78 ± 0.03%'     | '681.00'            | '1467264 ± 0.01%'          | '1468429'                 | 1456081 |
| 7       | 'mark + clearMarks'                                       | '2148.90 ± 1.28%'    | '2073.00'           | '480925 ± 0.01%'           | '482393'                  | 465356  |
| 8       | 'measure + clearMeasures (with start and end timestamps)' | '2277.26 ± 1.10%'    | '2204.00'           | '451016 ± 0.01%'           | '453721'                  | 439125  |
| 9       | 'measure + clearMeasures (with mark names)'               | '2277.82 ± 0.51%'    | '2243.00'           | '443853 ± 0.01%'           | '445831'                  | 439016  |

Reviewed By: hoxyq

Differential Revision: D78193072

fbshipit-source-id: 03b52927a1999f19a2baf0d02335a959525d7add
2025-07-16 02:48:43 -07:00
Rubén NorteandFacebook GitHub Bot 1b7c9ea523 Add 2 tests demonstrating broken behavior in performance.measure (#52588)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52588

Changelog: [internal]

This adds tests to show how `performance.measure` isn't spec compliant when `end` and `duration` are used. This will be fixed in the following diff.

Reviewed By: javache

Differential Revision: D78193069

fbshipit-source-id: 30ba4874c4d2b4adb20608fc8d5ed61bfd6d92d8
2025-07-16 02:48:43 -07:00
Rubén NorteandFacebook GitHub Bot cb59eb2b57 Reorganize tests for PerformanceObserver and User Timing API (#52587)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52587

Changelog: [internal]

This just re-organizes the tests for the `Performance` API and `PerformanceObserver` as the previous organization didn't make much sense. Now it's a test for `PerformanceObserver` and another for the User Timing API.

Reviewed By: huntie

Differential Revision: D78193070

fbshipit-source-id: f15524bf07d2dc9edc155214279ce3af705cde67
2025-07-16 02:48:43 -07:00
Tim YungandFacebook GitHub Bot 5050d0a89e VirtualView: Fix Window Focus Detection Cleanup (#52621)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52621

In D77261958, I made a typo when implementing the cleanup of window focus detection in `onDetachedFromWindow`. This fixes it.

Changelog:
[Internal]

Reviewed By: mdvacca

Differential Revision: D78366506

fbshipit-source-id: 2a377cd7e8ec08f0c899dbd9cb3757bec580d30f
2025-07-15 20:03:17 -07:00
Andrew DatsenkoandFacebook GitHub Bot 46f3e32019 Add support for meta only code & oss only code (#52583)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52583
Changelog: [Internal]
OSS build is broken atm as there is rn-tester dep in Fantom, needed for Meta only purposes.
Platformizing code to allow for Meta only implementation here and also for OSS only. Using this approach over ifdef.

Reviewed By: christophpurrer

Differential Revision: D78275698

fbshipit-source-id: c3234bb61b4591c0a5045fdb84aa0316f6382ecc
2025-07-15 14:16:06 -07:00
Samuel SuslaandFacebook GitHub Bot 10bb2241fc delete feature flag enableSynchronousStateUpdates (#52607)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52607

changelog: [internal]

The current design of enableSynchronousStateUpdates is not correct and breaks <Modal /> on Android. let's delete it.

Reviewed By: philIip

Differential Revision: D78332201

fbshipit-source-id: 109909ebc706168372c565e8ff6e0c95d7565b10
2025-07-15 14:09:07 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 6b550a279e Fix E2E test script when the ci flag is not specified (#52617)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52617

The `test-release-local` script was failing to execute the npx rreact-native run-ios command for some issues with cocoapods.
That command tries to reinstall the pods so there might be some issues when testing.

As an alternative, we can avoid duplicated work by dropping the npx react-native command and, instead, build the app with xcodebuild and install it in the simulator with xcrun.

This is a backport of [this PR](https://github.com/facebook/react-native/pull/52609)

## Changelog:
[Internal] -

Reviewed By: vzaidman

Differential Revision: D78344397

fbshipit-source-id: cf2d9c032966a9be05670259e9532789829349f2
2025-07-15 12:04:20 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 339dc4979c Update atrifact names to the new ones (#52618)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52618

In 0.81 we dropped the JSC configuration in CI. That means that the artifacts we generate in CI have a slightly different name. The current e2e script failed to run with the ci flag because it was still using the old artifacts name and it was not finding them.

This change adress the problem by:

- using the right artifact names
- removing the --hermes parameter which controlled the Hermes vs JSC scenario.

It is also a port to main of [this PR](https://github.com/facebook/react-native/pull/52606)

## Changelog:
[Internal] -

Reviewed By: cortinico, vzaidman

Differential Revision: D78344244

fbshipit-source-id: a658ba161b867bbad773fe093df9679ea92579b3
2025-07-15 12:04:20 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 21b93d8d7d Fix RefreshControl recycling (#52584)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52584

The method `_initializeUIRefreshControl` creates a new instance of `UIRefreshControl` which has the default values for things like tint color.
However the props that we are keeping in the component are the `_props` before recycling. The actual state of the newly created UIRefreshControl is out of sync w.r.t the props the component thinks to have.

By introducing a `_recycled` state variable, we can force the first `updateProp` call to apply all the props to the newly created component.

## Changelog:
[iOS][Fixed] - Make sure that the recycled refresh control have the right props setup.

Reviewed By: sammy-SC

Differential Revision: D78278207

fbshipit-source-id: 4be20aa43f96eb87828b44a4deedd33a23d1d17f
2025-07-15 10:47:34 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 09daad27ea fix RefreshControl not refreshing on initial mount (#52615)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52615

The refresh control has some issues that this change addresses.

- Issue with zIndex not propagating to RefreshControl.
- Issue when RefreshControl being mounted as refreshing.
- Issue with color props not applied

## Changelog:
[iOS][Fixed] - Correctly propagate props to RefreshControl

Reviewed By: sammy-SC

Differential Revision: D76668478

fbshipit-source-id: c3a5ff04b1b2654d25c9053973c5cff0002a804a
2025-07-15 10:47:34 -07:00
Nicola CortiandFacebook GitHub Bot b4a57dd85f Polish the .editorconfig file
Summary:
We should use indent size 2 everywhere. While we were using 4 for some old reasons. This is causing editing of .kts files and BUCK files inside OSS Android Studio quite painful.

Changelog:
[Internal] -

Reviewed By: cipolleschi

Differential Revision: D78348532

fbshipit-source-id: 97e0e1f54fdc76c8a9cdc44e1f67684c9e97a08f
2025-07-15 10:10:35 -07:00
React Native BotandFacebook GitHub Bot f68e2b47fb Add changelog for v0.81.0-rc.1 (#52605)
Summary:
Add Changelog for 0.81.0-rc.1

## Changelog:
[Internal] - Add Changelog for 0.81.0-rc.1

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

Test Plan: N/A

Reviewed By: cipolleschi

Differential Revision: D78339154

Pulled By: motiz88

fbshipit-source-id: 9977e9dd6bed0fc62a91f469b28bdc1a41b65282
2025-07-15 09:34:31 -07:00
Nicola CortiandFacebook GitHub Bot 188caa04e7 Clarify the deprecation message for react-native-safe-area-context (#52589)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52589

The correct url for react-native-safe-area-context is:
https://github.com/AppAndFlow/react-native-safe-area-context
the former would still work through a redirect but let's be explicit here.

Changelog:
[Internal] [Changed] -

Reviewed By: huntie

Differential Revision: D78272667

fbshipit-source-id: dd8c2d6bf7e8c97e18f260e669e305734d657a51
2025-07-15 08:56:06 -07:00
Nick LefeverandFacebook GitHub Bot eca6c1b965 Fix typo in NullValueStrategy doc comment (#52608)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52608

See title

Changelog: [Internal]

Reviewed By: fabriziocucci

Differential Revision: D78339009

fbshipit-source-id: 70d0e73a38826c2c6bc3425f0a863699b3ed50d3
2025-07-15 08:31:21 -07:00
Mateo GuzmánandFacebook GitHub Bot 42b8921d91 Kotlin: Set up ktfmt in OSS (#52064)
Summary:
This PR adds the basic `ktfmt` setup in OSS to lint Kotlin files before they're imported into the Meta codebase, making collaboration with external contributors smoother for Android related PRs.

I tried to put together certain rules that mimic the current code style and it seems to work well as I get no errors for properly formatted files but this still might need some input to have the correct configuration.

Added two scripts to the main package.json:
- To check the files format you can run: `yarn lint-kotlin-check`
- To apply formatting fixes, run: `yarn lint-kotlin`

## Changelog:

[INTERNAL] - Kotlin: Set up ktfmt in OSS

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

Test Plan:
Unformat any random Kotlin file inside ReactAndroid and then run:
```sh
yarn lint-kotlin-check
yarn lint-kotlin
```

Reviewed By: cipolleschi

Differential Revision: D78272876

Pulled By: cortinico

fbshipit-source-id: 0cf6b976968dfc5c6c478e88d17eb21c18961a34
2025-07-15 08:31:00 -07:00
Samuel SuslaandFacebook GitHub Bot f3b6eeb96e fix view culling in RTL languages (#52602)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52602

changelog: [internal]

fixes RTL issue in View Culling where scroll view offset was not correctly adjusted for RTL. The example failing case is described in a test.

Reviewed By: lenaic

Differential Revision: D78322759

fbshipit-source-id: d60d98aa45d4d9b576b133990f64ef941e6618e8
2025-07-15 06:34:39 -07:00
Abhijeet JhaandFacebook GitHub Bot f004cd39bc Text: Fix isSelectable prop macro conversion (#52599)
Summary:
for IOS and React native windows we can observe that the macro conversion is incorrect in ParagraphProps particularly for selectable prop.

current conversion
```
case ([]() constexpr -> RawPropsPropNameHash {   return facebook::react::fnv1a("isSelectable");  }()): fromRawValue(context, value, isSelectable, defaults.isSelectable); return;
```
issue is that isSelectable is not the raw prop therefore JS to native flow for the prop is not correct .
(Note : this works for Android as ReactProp(name = "selectable"):  https://github.com/facebook/react-native/blob/bbc1e121c71d14803d29a931f642bf8ea6ee2023/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextAnchorViewManager.kt#L97-L100 )

fix
```
RAW_SET_PROP_SWITCH_CASE(isSelectable, selectable)
```

Current implementation selectable prop is not working for IOS and React native windows as the macro conversion is incorrect in ParagraphProps particularly for selectable prop.

## Changelog:
Updated ParagraphProps macro conversion for isSelectable , keeping it backward compatible.

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

Pick one each for the category and type tags:
[IOS] [FIXED] - Fix selectable prop not working correctly
[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

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

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

Test Plan:
Tested on react native windows playground

Sample code

```
export default class Bootstrap extends React.Component {
  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.header}>Selectable vs Non-Selectable Text</Text>

        <Text selectable={true} style={styles.text}>
           This text is selectable. You can long-press and copy it.
        </Text>

        <Text selectable={false} style={styles.text}>
           This text is not selectable. You cannot copy it.
        </Text>
      </View>
    );
  }
}

```
before fix debug output  , native unaware of selectable prop values from JS
```
ReactNative ['Samples\text'] (info): ''[Text.js] NativeText _selectable:', true'
ReactNative ['Samples\text'] (info): ''[Text.js] NativeText _selectable:', false'
[ParagraphComponentView] updateProps - old isSelectable: 0, new isSelectable: 0
[ParagraphComponentView] DrawText - isSelectable: 0
[ParagraphComponentView] DrawText - selection logic would be DISABLED here.
[ParagraphComponentView] updateProps - old isSelectable: 0, new isSelectable: 0
[ParagraphComponentView] DrawText - isSelectable: 0
[ParagraphComponentView] DrawText - selection logic would be DISABLED here.
[ParagraphComponentView] updateProps - old isSelectable: 0, new isSelectable: 0
[ParagraphComponentView] DrawText - isSelectable: 0
[ParagraphComponentView] DrawText - selection logic would be DISABLED here.

```

after fix debug output , native picks up selectable prop values from JS correctly
```
ReactNative ['Samples\text'] (info): ''[Text.js] NativeText _selectable:', true'
ReactNative ['Samples\text'] (info): ''[Text.js] NativeText _selectable:', false'
[ParagraphComponentView] updateProps - old selectable: 0, new selectable: 0
[ParagraphComponentView] DrawText - selectable: 0
[ParagraphComponentView] DrawText - selection logic would be DISABLED here.
[ParagraphComponentView] updateProps - old selectable: 0, new selectable: 1
[ParagraphComponentView] DrawText - selectable: 1
[ParagraphComponentView] DrawText - selection logic would be enabled here.
[ParagraphComponentView] updateProps - old selectable: 0, new selectable: 0
[ParagraphComponentView] DrawText - selectable: 0
[ParagraphComponentView] DrawText - selection logic would be DISABLED here.
```

Reviewed By: rozele

Differential Revision: D78333906

Pulled By: javache

fbshipit-source-id: 4d2f9ea591e991b1aed126e9fed72fdfe1a49ce9
2025-07-15 04:41:55 -07:00
Pieter De BaetsandFacebook GitHub Bot 0d2e0abc45 Do not define default transformOrigin (#52598)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52598

Defining this as {50%, 50%} mean we do unnecessary work as part of every transform. Instead set it to undefined, which means we'll ignore it when determining the final transform.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D78298587

fbshipit-source-id: 9d3b7375fc3bd9ea04f0a6d7e314fbba0fba6949
2025-07-15 04:13:15 -07:00
Rubén NorteandFacebook GitHub Bot 7dc84491e9 Fix reporting of errors without stack traces (#52601)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52601

Changelog: [internal]

Fixes a bug in Fantom when throwing a value that's not an instance of `Error` in a test.

Reviewed By: javache

Differential Revision: D78332756

fbshipit-source-id: 350479dcb7bcea399070c6851aca76a1d1cc2629
2025-07-15 03:45:28 -07:00
Rob HoganandFacebook GitHub Bot 2a93767651 Add flow types for memfs (#52597)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52597

Add a Flow lib def for `memfs`, for use in internal and subsequently Metro tests, now that `metro-memory-fs` is deprecated.

Changelog: [Internal]

Reviewed By: vzaidman

Differential Revision: D78268713

fbshipit-source-id: f714000f2071f4bf45b4436cbd63fc6d74939f98
2025-07-15 02:46:44 -07:00
David VaccaandFacebook GitHub Bot c2f39cfdd8 Revert Refactor ViewManagerInterfaces codegen to generate kotlin classes (#52593)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52593

Revert Refactor ViewManagerInterfaces codegen to generate kotlin classes since commands are not respecting nullability

changelog: [internal] internal

Reviewed By: bvanderhoof

Differential Revision: D78308183

fbshipit-source-id: f3d8017d4bc6473deef0fd49c000543913905cd9
2025-07-14 21:22:21 -07:00
Nick GerlemanandFacebook GitHub Bot 7f224941bb Disable Android Workarounds for Attachment Metrics (#52446)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52446

The logic for retrieving metrics from a placeholder character is kind of insane, and has been around since inline views were added built into TextView in Paper.

One of the workarounds, for old versions of Android on Samsung phones (no more info to bound the versions) causes incorrect behavior, at least in the case where we have RTL text in LTR layout.

Another, explicitly mentions `singleLine` with RTL para, a deprecated TextView prop, that doesn't apply to us here (and also could never apply to BoringLayout, since RTL chars are not boring).

We don't have these workarounds anywhere else (though we have some other workarounds for bidi crash in old Android), including other frameworks I could find.

Let's bias to cleaning this old code up.

Changelog:
[Android][Fixed] - Fix incorrect positioning of inline view at the end of string when RTL text in LTR container

Reviewed By: javache

Differential Revision: D77703906

fbshipit-source-id: f25a5e2f05100f0288f3889132b658cdabf26f22
2025-07-14 19:43:12 -07:00
Nick GerlemanandFacebook GitHub Bot 7cd0b42ca0 Add text examples combining textAlign, attachments, script direction, and layout direction (#52445)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52445

This shows some broken stuff (TM), but also asserts current behaviors

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D77702743

fbshipit-source-id: a20d5b09e84d86a16e2443726ac82416b13796a8
2025-07-14 19:43:12 -07:00
Vitali ZaidmanandFacebook GitHub Bot fc535ef542 Update debugger-frontend from 844f225...8dc0d5b (#52585)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52585

Changelog: [Internal] - Update `react-native/debugger-frontend` from 844f225...8dc0d5b

Resyncs `react-native/debugger-frontend` from GitHub - see `rn-chrome-devtools-frontend` [changelog](https://github.com/facebook/react-native-devtools-frontend/compare/844f225009e6445d088ed0e431d1fc430325ed95...8dc0d5b365e6b4600b78e5a7381aa861d8c1c81e).

### Changelog

| Commit | Author | Date/Time | Subject |
| ------ | ------ | --------- | ------- |
| [8dc0d5b36](https://github.com/facebook/react-native-devtools-frontend/commit/8dc0d5b36) | Vitali Zaidman (vzaidman@gmail.com) | 2025-07-14T18:03:52+01:00 | [improve current session id message selectivity (#192)](https://github.com/facebook/react-native-devtools-frontend/commit/8dc0d5b36) |
| [0a50c353c](https://github.com/facebook/react-native-devtools-frontend/commit/0a50c353c) | Vitali Zaidman (vzaidman@gmail.com) | 2025-07-14T16:33:55+01:00 | [Track Stack Trace Frames Succeed / Fail to Resolve URL (#191)](https://github.com/facebook/react-native-devtools-frontend/commit/0a50c353c) |
| [fc0a2e77e](https://github.com/facebook/react-native-devtools-frontend/commit/fc0a2e77e) | Alex Hunt (hello@alexhunt.dev) | 2025-07-14T12:41:58+01:00 | [Tweak wording for Network dogfooding banner (#193)](https://github.com/facebook/react-native-devtools-frontend/commit/fc0a2e77e) |
| [efa49bd7a](https://github.com/facebook/react-native-devtools-frontend/commit/efa49bd7a) | sbuggay (sbuggay@gmail.com) | 2025-07-11T06:17:05-07:00 | [Update README.md (#190)](https://github.com/facebook/react-native-devtools-frontend/commit/efa49bd7a) |

Reviewed By: huntie

Differential Revision: D78281338

fbshipit-source-id: 2cbc15e0e53919f7164fca009c0dcad93d333c72
2025-07-14 11:03:04 -07:00
Christoph PurrerandFacebook GitHub Bot 04b6735fa5 Apply clang-tidy settings (#52575)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52575

Changelog: [Internal]

Reviewed By: lenaic

Differential Revision: D78223453

fbshipit-source-id: 1f472106324bbd7eb77609f5bc96a0a286eafe89
2025-07-14 09:29:54 -07:00
Christoph PurrerandFacebook GitHub Bot e93afbd407 Mark ReactHost functions noexcept (#52574)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52574

Changelog: [Internal]

The main change here is to catch *all* exceptions in:
- loadScriptFromDevServer
- loadScriptFromBundlePath

so that we can make the `loadScript(...` method `noexcept`

Other methods which only call into `noexcept` methods have been marked with `noexcept` as well

Reviewed By: lenaic

Differential Revision: D78222989

fbshipit-source-id: 174ac2420e88c913662f857c875fef996959c564
2025-07-14 09:22:36 -07:00
Alex HuntandFacebook GitHub Bot a5d61564a8 Support CDP response previews for chunked data (#52582)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52582

Continues integration of `NetworkReporter` (jsinspector-modern) on Android, to enable the Network panel in React Native DevTools.

NOTE: As with iOS, all changes are gated behind the `enableNetworkEventReporting` and `fuseboxNetworkInspectionEnabled` feature flags.

**This diff**

Updates the Android inputs to `NetworkReporter` to support incremental string data HTTP responses (`Transfer-Encoding: chunked`).

Implemented:

- Incremental response case for `Network.getResponseBody` (fetch response previews).
- `Network.dataReceived` (incremental response update event).

This means that incremental responses, such as Metro bundle requests, can be displayed as previews in React Native DevTools.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D77927896

fbshipit-source-id: 6eff2e7b94d3f784bbc33b1fecdc20242f98b39f
2025-07-14 09:07:10 -07:00
Alex HuntandFacebook GitHub Bot 011425358a Support CDP response previews (#52487)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52487

Continues integration of `NetworkReporter` (jsinspector-modern) on Android, to enable the Network panel in React Native DevTools.

NOTE: As with iOS, all changes are gated behind the `enableNetworkEventReporting` and `fuseboxNetworkInspectionEnabled` feature flags.

**This diff**

Integrates `Network.storeRequestBody` on Android (CDP: [`Network.getResponseBody`](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-getResponseBody) CDP event) to populate the "Preview" and "Response" tabs in the React Native DevTools Network panel.

This is integrated with `NetworkingModule.kt` to support synchronously received `text` or `blob` data types, with incremental response support added next in D77927896.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D77799617

fbshipit-source-id: 495baebbb3b447d1ea86705c1680578eed796d78
2025-07-14 09:07:10 -07:00
Pieter De BaetsandFacebook GitHub Bot 2321ae17ea Cleanup react-native-codegen DEFS [reland] (#52506)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52506

* Re-enable tests
* Simplify logic to avoid bypasses for arc focus

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D78000411

fbshipit-source-id: e2960a9848ce27385da00214018e7996d7c27561
2025-07-14 07:42:12 -07:00
generatedunixname89002005287564andFacebook GitHub Bot bb0c370ab7 Fix CQS signal performance-faster-string-find in xplat/js/react-native-github/packages (#52579)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/52579

Reviewed By: javache

Differential Revision: D78252727

fbshipit-source-id: 97c746e6d57901f4995dd733c51e2b33e1f44a17
2025-07-14 07:22:53 -07:00
Nicola CortiandFacebook GitHub Bot 8524c13b5b Bump nexus-publish to 2.0.0 (#52566)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52566

This bumps the plugin we use to publish to Maven Central from 1.3.0 to 2.0.0
as it has better support for the latest Gradle feature.

We're not affected by the breaking changes so we should be good to go (nightlies will tell).

Changelog:
[Internal] [Changed] -

Reviewed By: cipolleschi

Differential Revision: D78161579

fbshipit-source-id: de5178b2cc17885636f17eabdb0eea4e5b1515dd
2025-07-14 02:55:51 -07:00
260 changed files with 3758 additions and 3845 deletions
-9
View File
@@ -9,12 +9,3 @@ end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
[*.gradle]
indent_size = 4
[*.kts]
indent_size = 4
[BUCK]
indent_size = 4
@@ -14,23 +14,23 @@ runs:
uses: actions/download-artifact@v4
with:
name: hermes-workspace
path: 'D:\tmp\hermes'
path: 'C:\tmp\hermes'
- name: Set up workspace
shell: powershell
run: |
mkdir -p D:\tmp\hermes\osx-bin
mkdir -p C:\tmp\hermes\osx-bin
mkdir -p .\packages\react-native\sdks\hermes
cp -r -Force D:\tmp\hermes\hermes\* .\packages\react-native\sdks\hermes\.
cp -r -Force C:\tmp\hermes\hermes\* .\packages\react-native\sdks\hermes\.
cp -r -Force .\packages\react-native\sdks\hermes-engine\utils\* .\packages\react-native\sdks\hermes\.
- name: Windows cache
uses: actions/cache@v4
with:
key: v3-hermes-${{ github.job }}-windows-${{ inputs.hermes-version }}-${{ inputs.react-native-version }}
path: |
D:\tmp\hermes\win64-bin\
D:\tmp\hermes\hermes\icu\
D:\tmp\hermes\hermes\deps\
D:\tmp\hermes\hermes\build_release\
C:\tmp\hermes\win64-bin\
C:\tmp\hermes\hermes\icu\
C:\tmp\hermes\hermes\deps\
C:\tmp\hermes\hermes\build_release\
- name: setup-msbuild
uses: microsoft/setup-msbuild@v1.3.2
- name: Set up workspace
@@ -83,4 +83,4 @@ runs:
uses: actions/upload-artifact@v4.3.4
with:
name: hermes-win64-bin
path: D:\tmp\hermes\win64-bin\
path: C:\tmp\hermes\win64-bin\
+3 -3
View File
@@ -128,9 +128,9 @@ jobs:
runs-on: windows-2025
needs: prepare_hermes_workspace
env:
HERMES_WS_DIR: 'D:\tmp\hermes'
HERMES_TARBALL_ARTIFACTS_DIR: 'D:\tmp\hermes\hermes-runtime-darwin'
HERMES_OSXBIN_ARTIFACTS_DIR: 'D:\tmp\hermes\osx-bin'
HERMES_WS_DIR: 'C:\tmp\hermes'
HERMES_TARBALL_ARTIFACTS_DIR: 'C:\tmp\hermes\hermes-runtime-darwin'
HERMES_OSXBIN_ARTIFACTS_DIR: 'C:\tmp\hermes\osx-bin'
ICU_URL: "https://github.com/unicode-org/icu/releases/download/release-64-2/icu4c-64_2-Win64-MSVC2017.zip"
MSBUILD_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin'
CMAKE_DIR: 'C:\Program Files\CMake\bin'
+3 -3
View File
@@ -125,9 +125,9 @@ jobs:
runs-on: windows-2025
needs: prepare_hermes_workspace
env:
HERMES_WS_DIR: 'D:\tmp\hermes'
HERMES_TARBALL_ARTIFACTS_DIR: 'D:\tmp\hermes\hermes-runtime-darwin'
HERMES_OSXBIN_ARTIFACTS_DIR: 'D:\tmp\hermes\osx-bin'
HERMES_WS_DIR: 'C:\tmp\hermes'
HERMES_TARBALL_ARTIFACTS_DIR: 'C:\tmp\hermes\hermes-runtime-darwin'
HERMES_OSXBIN_ARTIFACTS_DIR: 'C:\tmp\hermes\osx-bin'
ICU_URL: "https://github.com/unicode-org/icu/releases/download/release-64-2/icu4c-64_2-Win64-MSVC2017.zip"
MSBUILD_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin'
CMAKE_DIR: 'C:\Program Files\CMake\bin'
+4 -4
View File
@@ -382,9 +382,9 @@ jobs:
runs-on: windows-2025
needs: prepare_hermes_workspace
env:
HERMES_WS_DIR: 'D:\tmp\hermes'
HERMES_TARBALL_ARTIFACTS_DIR: 'D:\tmp\hermes\hermes-runtime-darwin'
HERMES_OSXBIN_ARTIFACTS_DIR: 'D:\tmp\hermes\osx-bin'
HERMES_WS_DIR: 'C:\tmp\hermes'
HERMES_TARBALL_ARTIFACTS_DIR: 'C:\tmp\hermes\hermes-runtime-darwin'
HERMES_OSXBIN_ARTIFACTS_DIR: 'C:\tmp\hermes\osx-bin'
ICU_URL: "https://github.com/unicode-org/icu/releases/download/release-64-2/icu4c-64_2-Win64-MSVC2017.zip"
MSBUILD_DIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin'
CMAKE_DIR: 'C:\Program Files\CMake\bin'
@@ -583,7 +583,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: ["24", "22"]
node-version: ["24", "22", "20"]
steps:
- name: Checkout
uses: actions/checkout@v4
+30
View File
@@ -1,5 +1,35 @@
# Changelog
## v0.81.0-rc.1
### Added
#### iOS specific
- Add release/debug switch script for React-Core-prebuilt ([42d1a7934c](https://github.com/facebook/react-native/commit/42d1a7934cad4b2c92653e3fa7781c2af8f44df4) by [@chrfalch](https://github.com/chrfalch))
- Added support for using USE_FRAMEWORKS with prebuilt React Native Core ([40e45f5366](https://github.com/facebook/react-native/commit/40e45f53661ce80c3a6fbbf07f52dc900afcad52) by [@chrfalch](https://github.com/chrfalch))
- Add the `ENTERPRISE_REPOSITORY` env variable to cocopaods infra ([23f3bf9239](https://github.com/facebook/react-native/commit/23f3bf9239a849590f1c72b25732d0090780128c) by [@cipolleschi](https://github.com/cipolleschi))
### Changed
- Bump Metro to 0.83.0 ([6b9f5d622f](https://github.com/facebook/react-native/commit/6b9f5d622ffbe79da8f4e7b7d8094504a480425e) by [@robhogan](https://github.com/robhogan))
#### Android specific
- Gradle to 8.14.3 ([6892dde363](https://github.com/facebook/react-native/commit/6892dde36373bbef2d0afe535ae818b1a7164f08) by [@cortinico](https://github.com/cortinico))
- Expose `react_renderer_bridging` headers via prefab ([d1730ff960](https://github.com/facebook/react-native/commit/d1730ff960fcb9a01ee94b9e46e5a9fbb7d73f4a) by [@tomekzaw](https://github.com/tomekzaw))
- Introduce more deprecation warnings for Legacy Arch classes ([625f69f284](https://github.com/facebook/react-native/commit/625f69f284ddfd9c6beecaa4052a871d092053ef) by [@cortinico](https://github.com/cortinico))
### Fixed
- Fixed nodes with `display: contents` set being cloned with the wrong owner ([d4b36b0300](https://github.com/facebook/react-native/commit/d4b36b03003eb2de9eaf5b57bb639bae8cc12f20) by [@j-piasecki](https://github.com/j-piasecki))
#### iOS specific
- Fixed premature return in header file generation from podspec globs ([f2b064c2d4](https://github.com/facebook/react-native/commit/f2b064c2d40c39017ac2a31bf3caf8acef23038c) by [@chrfalch](https://github.com/chrfalch))
## v0.81.0-rc.0
### Breaking
+28
View File
@@ -13,6 +13,7 @@ plugins {
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.binary.compatibility.validator) apply true
alias(libs.plugins.android.test) apply false
alias(libs.plugins.ktfmt) apply true
}
val reactAndroidProperties = java.util.Properties()
@@ -130,3 +131,30 @@ if (project.findProperty("react.internal.useHermesNightly")?.toString()?.toBoole
}
}
}
ktfmt {
blockIndent.set(2)
continuationIndent.set(4)
maxWidth.set(100)
removeUnusedImports.set(false)
manageTrailingCommas.set(false)
}
// Configure ktfmt tasks to include gradle-plugin
listOf("ktfmtCheck", "ktfmtFormat").forEach { taskName ->
tasks.named(taskName) { dependsOn(gradle.includedBuild("gradle-plugin").task(":$taskName")) }
}
allprojects {
// Apply exclusions for specific files that should not be formatted
val excludePatterns =
listOf(
"**/build/**",
"**/hermes-engine/**",
"**/internal/featureflags/**",
"**/systeminfo/ReactNativeVersion.kt")
listOf(
com.ncorti.ktfmt.gradle.tasks.KtfmtCheckTask::class,
com.ncorti.ktfmt.gradle.tasks.KtfmtFormatTask::class)
.forEach { tasks.withType(it) { exclude(excludePatterns) } }
}
+2
View File
@@ -19,6 +19,8 @@
"featureflags": "yarn --cwd packages/react-native featureflags",
"js-api-diff": "node ./scripts/js-api/diff-api-snapshot",
"lint-ci": "./.github/workflow-scripts/analyze_code.sh && yarn shellcheck",
"lint-kotlin-check": "./gradlew ktfmtCheck",
"lint-kotlin": "./gradlew ktfmtFormat",
"lint-markdown": "markdownlint-cli2 2>&1",
"lint": "eslint --max-warnings 0 .",
"prettier": "prettier --write \"./**/*.{js,md,yml,ts,tsx}\"",
+1 -1
View File
@@ -17,7 +17,7 @@
],
"bugs": "https://github.com/facebook/react-native/issues",
"engines": {
"node": ">= 22.14.0"
"node": ">= 20.19.4"
},
"files": [
"path-support.js",
+1 -1
View File
@@ -19,7 +19,7 @@
],
"bugs": "https://github.com/facebook/react-native/issues",
"engines": {
"node": ">= 22.14.0"
"node": ">= 20.19.4"
},
"files": [
"index.js"
+1 -1
View File
@@ -43,6 +43,6 @@
}
},
"engines": {
"node": ">= 22.14.0"
"node": ">= 20.19.4"
}
}
+1 -1
View File
@@ -21,7 +21,7 @@
],
"bugs": "https://github.com/facebook/react-native/issues",
"engines": {
"node": ">= 22.14.0"
"node": ">= 20.19.4"
},
"files": [
"dist"
+2 -2
View File
@@ -1,5 +1,5 @@
@generated SignedSource<<1ce3fb7dd23581737fedaf58528fe575>>
Git revision: 844f225009e6445d088ed0e431d1fc430325ed95
@generated SignedSource<<e2d97b04634bf3b566f33d455f38658f>>
Git revision: 8dc0d5b365e6b4600b78e5a7381aa861d8c1c81e
Built with --nohooks: false
Is local checkout: false
Remote URL: https://github.com/facebook/react-native-devtools-frontend
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -20,6 +20,6 @@
"BUILD_INFO"
],
"engines": {
"node": ">= 22.14.0"
"node": ">= 20.19.4"
}
}
+1 -1
View File
@@ -26,7 +26,7 @@
},
"license": "MIT",
"engines": {
"node": ">= 22.14.0",
"node": ">= 20.19.4",
"electron": ">=36.3.0"
},
"dependencies": {
@@ -10,9 +10,25 @@
// $FlowFixMe[unclear-type] We have no Flow types for the Electron API.
const {app} = require('electron') as any;
const util = require('util');
// Handle global command line arguments which don't require a window
// or the single instance lock to be held.
const {
values: {version = false},
} = util.parseArgs({
options: {version: {type: 'boolean'}},
args: process.argv.slice(app.isPackaged ? 1 : 2),
strict: false,
});
if (version) {
console.log(`${app.getName()} v${app.getVersion()}`);
// Not app.quit() - we want to exit immediately without initialising the graphical subsystem.
app.exit(0);
}
const gotTheLock = app.requestSingleInstanceLock({
argv: process.argv.slice(2),
argv: process.argv.slice(app.isPackaged ? 1 : 2),
});
if (!gotTheLock) {
+1 -1
View File
@@ -35,7 +35,7 @@
"ws": "^6.2.3"
},
"engines": {
"node": ">= 22.14.0"
"node": ">= 20.19.4"
},
"devDependencies": {
"selfsigned": "^2.4.1",
@@ -16,7 +16,7 @@
],
"bugs": "https://github.com/facebook/react-native/issues",
"engines": {
"node": ">= 22.14.0"
"node": ">= 20.19.4"
},
"main": "index.js",
"dependencies": {
@@ -22,6 +22,6 @@
"hermes-eslint": "0.29.1"
},
"engines": {
"node": ">= 22.14.0"
"node": ">= 20.19.4"
}
}
+1 -1
View File
@@ -36,6 +36,6 @@
"hermes-eslint": "0.29.1"
},
"engines": {
"node": ">= 22.14.0"
"node": ">= 20.19.4"
}
}
+22 -1
View File
@@ -5,7 +5,10 @@
* LICENSE file in the root directory of this source tree.
*/
plugins { alias(libs.plugins.kotlin.jvm).apply(false) }
plugins {
alias(libs.plugins.kotlin.jvm).apply(false)
alias(libs.plugins.ktfmt).apply(true)
}
tasks.register("build") {
dependsOn(
@@ -24,3 +27,21 @@ tasks.register("clean") {
":shared:clean",
)
}
tasks.named("ktfmtCheck") {
dependsOn(
":react-native-gradle-plugin:ktfmtCheck",
":settings-plugin:ktfmtCheck",
":shared-testutil:ktfmtCheck",
":shared:ktfmtCheck",
)
}
tasks.named("ktfmtFormat") {
dependsOn(
":react-native-gradle-plugin:ktfmtFormat",
":settings-plugin:ktfmtFormat",
":shared-testutil:ktfmtFormat",
":shared:ktfmtFormat",
)
}
@@ -6,6 +6,7 @@ javapoet = "1.13.0"
junit = "4.13.2"
kotlin = "2.1.20"
assertj = "3.25.1"
ktfmt = "0.22.0"
[libraries]
kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
@@ -18,3 +19,4 @@ assertj = { module = "org.assertj:assertj-core", version.ref = "assertj" }
[plugins]
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
ktfmt = { id = "com.ncorti.ktfmt.gradle", version.ref = "ktfmt" }
+1 -1
View File
@@ -16,7 +16,7 @@
],
"bugs": "https://github.com/facebook/react-native/issues",
"engines": {
"node": ">= 22.14.0"
"node": ">= 20.19.4"
},
"scripts": {
"build": "./gradlew build",
@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.ktfmt)
id("java-gradle-plugin")
}
@@ -18,6 +18,7 @@ import com.facebook.react.tasks.GenerateEntryPointTask
import com.facebook.react.tasks.GeneratePackageListTask
import com.facebook.react.utils.AgpConfiguratorUtils.configureBuildConfigFieldsForApp
import com.facebook.react.utils.AgpConfiguratorUtils.configureBuildConfigFieldsForLibraries
import com.facebook.react.utils.AgpConfiguratorUtils.configureBuildTypesForApp
import com.facebook.react.utils.AgpConfiguratorUtils.configureDevServerLocation
import com.facebook.react.utils.AgpConfiguratorUtils.configureNamespaceForLibraries
import com.facebook.react.utils.BackwardCompatUtils.configureBackwardCompatibilityReactMap
@@ -84,6 +85,7 @@ class ReactPlugin : Plugin<Project> {
configureAutolinking(project, extension)
configureCodegen(project, extension, rootExtension, isLibrary = false)
configureResources(project, extension)
configureBuildTypesForApp(project)
}
// Library Only Configuration
@@ -19,6 +19,7 @@ import java.net.Inet4Address
import java.net.NetworkInterface
import javax.xml.parsers.DocumentBuilder
import javax.xml.parsers.DocumentBuilderFactory
import kotlin.plus
import org.gradle.api.Action
import org.gradle.api.Project
import org.gradle.api.plugins.AppliedPlugin
@@ -27,6 +28,26 @@ import org.w3c.dom.Element
@Suppress("UnstableApiUsage")
internal object AgpConfiguratorUtils {
fun configureBuildTypesForApp(project: Project) {
val action =
Action<AppliedPlugin> {
project.extensions
.getByType(ApplicationAndroidComponentsExtension::class.java)
.finalizeDsl { ext ->
ext.buildTypes {
val debug =
getByName("debug").apply {
manifestPlaceholders["usesCleartextTraffic"] = "true"
}
getByName("release").apply {
manifestPlaceholders["usesCleartextTraffic"] = "false"
}
}
}
}
project.pluginManager.withPlugin("com.android.application", action)
}
fun configureBuildConfigFieldsForApp(project: Project, extension: ReactExtension) {
val action =
Action<AppliedPlugin> {
@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.ktfmt)
id("java-gradle-plugin")
}
@@ -10,7 +10,10 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins { alias(libs.plugins.kotlin.jvm) }
plugins {
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.ktfmt)
}
repositories { mavenCentral() }
@@ -10,7 +10,10 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins { alias(libs.plugins.kotlin.jvm) }
plugins {
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.ktfmt)
}
repositories { mavenCentral() }
+1 -1
View File
@@ -16,7 +16,7 @@
],
"bugs": "https://github.com/facebook/react-native/issues",
"engines": {
"node": ">= 22.14.0"
"node": ">= 20.19.4"
},
"exports": {
".": "./src/index.js",
+1 -1
View File
@@ -30,6 +30,6 @@
}
},
"engines": {
"node": ">= 22.14.0"
"node": ">= 20.19.4"
}
}
@@ -16,6 +16,7 @@ describe('console.timeStamp()', () => {
});
it("doesn't throw when label is not specified", () => {
// $FlowExpectedError[incompatible-call] not passing label intentionally
expect(() => console.timeStamp()).not.toThrow();
});
@@ -25,7 +26,6 @@ describe('console.timeStamp()', () => {
it("doesn't throw when additional arguments are specified", () => {
expect(() =>
// $FlowExpectedError[extra-arg]
console.timeStamp('label', 100, 500, 'Track', 'Group', 'error'),
).not.toThrow();
});
@@ -34,7 +34,7 @@ describe('console.timeStamp()', () => {
// $FlowExpectedError[incompatible-call]
expect(() => console.timeStamp({})).not.toThrow();
expect(() =>
// $FlowExpectedError[extra-arg]
// $FlowExpectedError[incompatible-call]
console.timeStamp('label', true, null, {}, [], () => {}),
).not.toThrow();
});
+10 -6
View File
@@ -569,10 +569,7 @@ function consoleAssertPolyfill(expression, label) {
}
}
// https://developer.mozilla.org/en-US/docs/Web/API/console/timeStamp_static.
// Non-standard API for recording markers on a timeline of the Performance instrumentation.
// The actual logging is not provided by definition.
function consoleTimeStampPolyfill() {}
function stub() {}
if (global.nativeLoggingHook) {
const originalConsole = global.console;
@@ -585,7 +582,11 @@ if (global.nativeLoggingHook) {
}
global.console = {
timeStamp: consoleTimeStampPolyfill,
time: stub,
timeEnd: stub,
timeStamp: stub,
count: stub,
countReset: stub,
...(originalConsole ?? {}),
error: getNativeLogFunction(LOG_LEVELS.error),
info: getNativeLogFunction(LOG_LEVELS.info),
@@ -676,7 +677,6 @@ if (global.nativeLoggingHook) {
});
}
} else if (!global.console) {
function stub() {}
const log = global.print || stub;
global.console = {
@@ -692,6 +692,8 @@ if (global.nativeLoggingHook) {
}
},
clear: stub,
count: stub,
countReset: stub,
dir: stub,
dirxml: stub,
group: stub,
@@ -700,6 +702,8 @@ if (global.nativeLoggingHook) {
profile: stub,
profileEnd: stub,
table: stub,
time: stub,
timeEnd: stub,
timeStamp: stub,
};
+1 -1
View File
@@ -18,7 +18,7 @@
],
"bugs": "https://github.com/facebook/react-native/issues",
"engines": {
"node": ">= 22.14.0"
"node": ">= 20.19.4"
},
"files": [
"console.js",
@@ -13,7 +13,7 @@
],
"license": "MIT",
"engines": {
"node": ">= 22.14.0"
"node": ">= 20.19.4"
},
"main": "src/index.js",
"files": [
+22 -14
View File
@@ -38,19 +38,6 @@ function isFirstParty(fileName) {
// use `this.foo = bar` instead of `this.defineProperty('foo', ...)`
const loose = true;
const defaultPlugins = [
[require('babel-plugin-syntax-hermes-parser'), {parseLangTypes: 'flow'}],
[require('babel-plugin-transform-flow-enums')],
[require('@babel/plugin-transform-block-scoping')],
[require('@babel/plugin-transform-class-properties'), {loose}],
[require('@babel/plugin-transform-private-methods'), {loose}],
[require('@babel/plugin-transform-private-property-in-object'), {loose}],
[require('@babel/plugin-syntax-dynamic-import')],
[require('@babel/plugin-syntax-export-default-from')],
...passthroughSyntaxPlugins,
[require('@babel/plugin-transform-unicode-regex')],
];
// For Static Hermes testing (experimental), the hermes-canary transformProfile
// is used to enable regenerator (and some related lowering passes) because SH
// requires more Babel lowering than Hermes temporarily.
@@ -234,7 +221,28 @@ const getPreset = (src, options) => {
plugins: [require('@babel/plugin-transform-flow-strip-types')],
},
{
plugins: defaultPlugins,
plugins: [
[
require('babel-plugin-syntax-hermes-parser'),
{
parseLangTypes: 'flow',
reactRuntimeTarget: '19',
...options.hermesParserOptions,
},
],
[require('babel-plugin-transform-flow-enums')],
[require('@babel/plugin-transform-block-scoping')],
[require('@babel/plugin-transform-class-properties'), {loose}],
[require('@babel/plugin-transform-private-methods'), {loose}],
[
require('@babel/plugin-transform-private-property-in-object'),
{loose},
],
[require('@babel/plugin-syntax-dynamic-import')],
[require('@babel/plugin-syntax-export-default-from')],
...passthroughSyntaxPlugins,
[require('@babel/plugin-transform-unicode-regex')],
],
},
{
test: isTypeScriptSource,
@@ -14,7 +14,7 @@
],
"license": "MIT",
"engines": {
"node": ">= 22.14.0"
"node": ">= 20.19.4"
},
"main": "src/index.js",
"files": [
@@ -2,7 +2,7 @@
exports[`GeneratePropsJavaInterface can generate for 'ArrayPropsNativeComponent.js' 1`] = `
Object {
"java/com/facebook/react/viewmanagers/ArrayPropsNativeComponentViewManagerInterface.kt": "/**
"java/com/facebook/react/viewmanagers/ArrayPropsNativeComponentViewManagerInterface.java": "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -11,26 +11,27 @@ Object {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface ArrayPropsNativeComponentViewManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setNames(view: T, value: ReadableArray?): Unit
public fun setDisableds(view: T, value: ReadableArray?): Unit
public fun setProgress(view: T, value: ReadableArray?): Unit
public fun setRadii(view: T, value: ReadableArray?): Unit
public fun setColors(view: T, value: ReadableArray?): Unit
public fun setSrcs(view: T, value: ReadableArray?): Unit
public fun setPoints(view: T, value: ReadableArray?): Unit
public fun setEdgeInsets(view: T, value: ReadableArray?): Unit
public fun setDimensions(view: T, value: ReadableArray?): Unit
public fun setSizes(view: T, value: ReadableArray?): Unit
public fun setObject(view: T, value: ReadableArray?): Unit
public fun setArrayOfObjects(view: T, value: ReadableArray?): Unit
public fun setArrayOfMixed(view: T, value: ReadableArray?): Unit
public interface ArrayPropsNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setNames(T view, @Nullable ReadableArray value);
void setDisableds(T view, @Nullable ReadableArray value);
void setProgress(T view, @Nullable ReadableArray value);
void setRadii(T view, @Nullable ReadableArray value);
void setColors(T view, @Nullable ReadableArray value);
void setSrcs(T view, @Nullable ReadableArray value);
void setPoints(T view, @Nullable ReadableArray value);
void setEdgeInsets(T view, @Nullable ReadableArray value);
void setDimensions(T view, @Nullable ReadableArray value);
void setSizes(T view, @Nullable ReadableArray value);
void setObject(T view, @Nullable ReadableArray value);
void setArrayOfObjects(T view, @Nullable ReadableArray value);
void setArrayOfMixed(T view, @Nullable ReadableArray value);
}
",
}
@@ -38,7 +39,7 @@ public interface ArrayPropsNativeComponentViewManagerInterface<T: View>: ViewMan
exports[`GeneratePropsJavaInterface can generate for 'BooleanPropNativeComponent.js' 1`] = `
Object {
"java/com/facebook/react/viewmanagers/BooleanPropNativeComponentViewManagerInterface.kt": "/**
"java/com/facebook/react/viewmanagers/BooleanPropNativeComponentViewManagerInterface.java": "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -47,14 +48,15 @@ Object {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface BooleanPropNativeComponentViewManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setDisabled(view: T, value: Boolean): Unit
public fun setDisabledNullable(view: T, value: Boolean?): Unit
public interface BooleanPropNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setDisabled(T view, boolean value);
void setDisabledNullable(T view, @Nullable Boolean value);
}
",
}
@@ -62,7 +64,7 @@ public interface BooleanPropNativeComponentViewManagerInterface<T: View>: ViewMa
exports[`GeneratePropsJavaInterface can generate for 'ColorPropNativeComponent.js' 1`] = `
Object {
"java/com/facebook/react/viewmanagers/ColorPropNativeComponentViewManagerInterface.kt": "/**
"java/com/facebook/react/viewmanagers/ColorPropNativeComponentViewManagerInterface.java": "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -71,13 +73,14 @@ Object {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface ColorPropNativeComponentViewManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setTintColor(view: T, value: Int?): Unit
public interface ColorPropNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setTintColor(T view, @Nullable Integer value);
}
",
}
@@ -85,7 +88,7 @@ public interface ColorPropNativeComponentViewManagerInterface<T: View>: ViewMana
exports[`GeneratePropsJavaInterface can generate for 'DimensionPropNativeComponent.js' 1`] = `
Object {
"java/com/facebook/react/viewmanagers/DimensionPropNativeComponentViewManagerInterface.kt": "/**
"java/com/facebook/react/viewmanagers/DimensionPropNativeComponentViewManagerInterface.java": "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -94,14 +97,15 @@ Object {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
import com.facebook.yoga.YogaValue;
public interface DimensionPropNativeComponentViewManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setMarginBack(view: T, value: YogaValue?): Unit
public interface DimensionPropNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setMarginBack(T view, @Nullable YogaValue value);
}
",
}
@@ -109,7 +113,7 @@ public interface DimensionPropNativeComponentViewManagerInterface<T: View>: View
exports[`GeneratePropsJavaInterface can generate for 'EdgeInsetsPropNativeComponent.js' 1`] = `
Object {
"java/com/facebook/react/viewmanagers/EdgeInsetsPropNativeComponentViewManagerInterface.kt": "/**
"java/com/facebook/react/viewmanagers/EdgeInsetsPropNativeComponentViewManagerInterface.java": "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -118,12 +122,12 @@ Object {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface EdgeInsetsPropNativeComponentViewManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public interface EdgeInsetsPropNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
// No props
}
",
@@ -132,7 +136,7 @@ public interface EdgeInsetsPropNativeComponentViewManagerInterface<T: View>: Vie
exports[`GeneratePropsJavaInterface can generate for 'EnumPropNativeComponent.js' 1`] = `
Object {
"java/com/facebook/react/viewmanagers/EnumPropNativeComponentViewManagerInterface.kt": "/**
"java/com/facebook/react/viewmanagers/EnumPropNativeComponentViewManagerInterface.java": "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -141,14 +145,15 @@ Object {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface EnumPropNativeComponentViewManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setAlignment(view: T, value: String?): Unit
public fun setIntervals(view: T, value: Int?): Unit
public interface EnumPropNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setAlignment(T view, @Nullable String value);
void setIntervals(T view, @Nullable Integer value);
}
",
}
@@ -156,7 +161,7 @@ public interface EnumPropNativeComponentViewManagerInterface<T: View>: ViewManag
exports[`GeneratePropsJavaInterface can generate for 'EventNestedObjectPropsNativeComponent.js' 1`] = `
Object {
"java/com/facebook/react/viewmanagers/EventNestedObjectPropsNativeComponentViewManagerInterface.kt": "/**
"java/com/facebook/react/viewmanagers/EventNestedObjectPropsNativeComponentViewManagerInterface.java": "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -165,13 +170,13 @@ Object {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface EventNestedObjectPropsNativeComponentViewManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setDisabled(view: T, value: Boolean): Unit
public interface EventNestedObjectPropsNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setDisabled(T view, boolean value);
}
",
}
@@ -179,7 +184,7 @@ public interface EventNestedObjectPropsNativeComponentViewManagerInterface<T: Vi
exports[`GeneratePropsJavaInterface can generate for 'EventPropsNativeComponent.js' 1`] = `
Object {
"java/com/facebook/react/viewmanagers/EventPropsNativeComponentViewManagerInterface.kt": "/**
"java/com/facebook/react/viewmanagers/EventPropsNativeComponentViewManagerInterface.java": "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -188,13 +193,13 @@ Object {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface EventPropsNativeComponentViewManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setDisabled(view: T, value: Boolean): Unit
public interface EventPropsNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setDisabled(T view, boolean value);
}
",
}
@@ -202,7 +207,7 @@ public interface EventPropsNativeComponentViewManagerInterface<T: View>: ViewMan
exports[`GeneratePropsJavaInterface can generate for 'FloatPropsNativeComponent.js' 1`] = `
Object {
"java/com/facebook/react/viewmanagers/FloatPropsNativeComponentViewManagerInterface.kt": "/**
"java/com/facebook/react/viewmanagers/FloatPropsNativeComponentViewManagerInterface.java": "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -211,19 +216,20 @@ Object {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface FloatPropsNativeComponentViewManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setBlurRadius(view: T, value: Float): Unit
public fun setBlurRadius2(view: T, value: Float): Unit
public fun setBlurRadius3(view: T, value: Float): Unit
public fun setBlurRadius4(view: T, value: Float): Unit
public fun setBlurRadius5(view: T, value: Float): Unit
public fun setBlurRadius6(view: T, value: Float): Unit
public fun setBlurRadiusNullable(view: T, value: Float?): Unit
public interface FloatPropsNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setBlurRadius(T view, float value);
void setBlurRadius2(T view, float value);
void setBlurRadius3(T view, float value);
void setBlurRadius4(T view, float value);
void setBlurRadius5(T view, float value);
void setBlurRadius6(T view, float value);
void setBlurRadiusNullable(T view, @Nullable Float value);
}
",
}
@@ -231,7 +237,7 @@ public interface FloatPropsNativeComponentViewManagerInterface<T: View>: ViewMan
exports[`GeneratePropsJavaInterface can generate for 'ImagePropNativeComponent.js' 1`] = `
Object {
"java/com/facebook/react/viewmanagers/ImagePropNativeComponentViewManagerInterface.kt": "/**
"java/com/facebook/react/viewmanagers/ImagePropNativeComponentViewManagerInterface.java": "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -240,14 +246,15 @@ Object {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface ImagePropNativeComponentViewManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setThumbImage(view: T, value: ReadableMap?): Unit
public interface ImagePropNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setThumbImage(T view, @Nullable ReadableMap value);
}
",
}
@@ -255,7 +262,7 @@ public interface ImagePropNativeComponentViewManagerInterface<T: View>: ViewMana
exports[`GeneratePropsJavaInterface can generate for 'IntegerPropNativeComponent.js' 1`] = `
Object {
"java/com/facebook/react/viewmanagers/IntegerPropNativeComponentViewManagerInterface.kt": "/**
"java/com/facebook/react/viewmanagers/IntegerPropNativeComponentViewManagerInterface.java": "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -264,15 +271,15 @@ Object {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface IntegerPropNativeComponentViewManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setProgress1(view: T, value: Int): Unit
public fun setProgress2(view: T, value: Int): Unit
public fun setProgress3(view: T, value: Int): Unit
public interface IntegerPropNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setProgress1(T view, int value);
void setProgress2(T view, int value);
void setProgress3(T view, int value);
}
",
}
@@ -280,7 +287,7 @@ public interface IntegerPropNativeComponentViewManagerInterface<T: View>: ViewMa
exports[`GeneratePropsJavaInterface can generate for 'InterfaceOnlyNativeComponent.js' 1`] = `
Object {
"java/com/facebook/react/viewmanagers/InterfaceOnlyNativeComponentViewManagerInterface.kt": "/**
"java/com/facebook/react/viewmanagers/InterfaceOnlyNativeComponentViewManagerInterface.java": "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -289,13 +296,14 @@ Object {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface InterfaceOnlyNativeComponentViewManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setTitle(view: T, value: String?): Unit
public interface InterfaceOnlyNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setTitle(T view, @Nullable String value);
}
",
}
@@ -303,7 +311,7 @@ public interface InterfaceOnlyNativeComponentViewManagerInterface<T: View>: View
exports[`GeneratePropsJavaInterface can generate for 'MixedPropNativeComponent.js' 1`] = `
Object {
"java/com/facebook/react/viewmanagers/MixedPropNativeComponentViewManagerInterface.kt": "/**
"java/com/facebook/react/viewmanagers/MixedPropNativeComponentViewManagerInterface.java": "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -312,14 +320,14 @@ Object {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import com.facebook.react.bridge.Dynamic;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface MixedPropNativeComponentViewManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setMixedProp(view: T, value: Dynamic): Unit
public interface MixedPropNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setMixedProp(T view, Dynamic value);
}
",
}
@@ -327,7 +335,7 @@ public interface MixedPropNativeComponentViewManagerInterface<T: View>: ViewMana
exports[`GeneratePropsJavaInterface can generate for 'MultiNativePropNativeComponent.js' 1`] = `
Object {
"java/com/facebook/react/viewmanagers/MultiNativePropNativeComponentViewManagerInterface.kt": "/**
"java/com/facebook/react/viewmanagers/MultiNativePropNativeComponentViewManagerInterface.java": "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -336,17 +344,18 @@ Object {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface MultiNativePropNativeComponentViewManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setThumbImage(view: T, value: ReadableMap?): Unit
public fun setColor(view: T, value: Int?): Unit
public fun setThumbTintColor(view: T, value: Int?): Unit
public fun setPoint(view: T, value: ReadableMap?): Unit
public interface MultiNativePropNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setThumbImage(T view, @Nullable ReadableMap value);
void setColor(T view, @Nullable Integer value);
void setThumbTintColor(T view, @Nullable Integer value);
void setPoint(T view, @Nullable ReadableMap value);
}
",
}
@@ -354,7 +363,7 @@ public interface MultiNativePropNativeComponentViewManagerInterface<T: View>: Vi
exports[`GeneratePropsJavaInterface can generate for 'NoPropsNoEventsNativeComponent.js' 1`] = `
Object {
"java/com/facebook/react/viewmanagers/NoPropsNoEventsNativeComponentViewManagerInterface.kt": "/**
"java/com/facebook/react/viewmanagers/NoPropsNoEventsNativeComponentViewManagerInterface.java": "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -363,12 +372,12 @@ Object {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface NoPropsNoEventsNativeComponentViewManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public interface NoPropsNoEventsNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
// No props
}
",
@@ -377,7 +386,7 @@ public interface NoPropsNoEventsNativeComponentViewManagerInterface<T: View>: Vi
exports[`GeneratePropsJavaInterface can generate for 'ObjectPropsNativeComponent.js' 1`] = `
Object {
"java/com/facebook/react/viewmanagers/ObjectPropsNativeComponentManagerInterface.kt": "/**
"java/com/facebook/react/viewmanagers/ObjectPropsNativeComponentManagerInterface.java": "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -386,16 +395,17 @@ Object {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface ObjectPropsNativeComponentManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setObjectProp(view: T, value: ReadableMap?): Unit
public fun setObjectArrayProp(view: T, value: ReadableMap?): Unit
public fun setObjectPrimitiveRequiredProp(view: T, value: ReadableMap?): Unit
public interface ObjectPropsNativeComponentManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setObjectProp(T view, @Nullable ReadableMap value);
void setObjectArrayProp(T view, @Nullable ReadableMap value);
void setObjectPrimitiveRequiredProp(T view, @Nullable ReadableMap value);
}
",
}
@@ -403,7 +413,7 @@ public interface ObjectPropsNativeComponentManagerInterface<T: View>: ViewManage
exports[`GeneratePropsJavaInterface can generate for 'PointPropNativeComponent.js' 1`] = `
Object {
"java/com/facebook/react/viewmanagers/PointPropNativeComponentViewManagerInterface.kt": "/**
"java/com/facebook/react/viewmanagers/PointPropNativeComponentViewManagerInterface.java": "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -412,14 +422,15 @@ Object {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface PointPropNativeComponentViewManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setStartPoint(view: T, value: ReadableMap?): Unit
public interface PointPropNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setStartPoint(T view, @Nullable ReadableMap value);
}
",
}
@@ -427,7 +438,7 @@ public interface PointPropNativeComponentViewManagerInterface<T: View>: ViewMana
exports[`GeneratePropsJavaInterface can generate for 'StringPropNativeComponent.js' 1`] = `
Object {
"java/com/facebook/react/viewmanagers/StringPropNativeComponentViewManagerInterface.kt": "/**
"java/com/facebook/react/viewmanagers/StringPropNativeComponentViewManagerInterface.java": "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -436,14 +447,15 @@ Object {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface StringPropNativeComponentViewManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setPlaceholder(view: T, value: String?): Unit
public fun setDefaultValue(view: T, value: String?): Unit
public interface StringPropNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setPlaceholder(T view, @Nullable String value);
void setDefaultValue(T view, @Nullable String value);
}
",
}
@@ -2,7 +2,7 @@
exports[`GeneratePropsJavaInterface can generate for 'ArrayPropsNativeComponent.js' 1`] = `
Object {
"java/com/facebook/react/viewmanagers/ArrayPropsNativeComponentViewManagerInterface.kt": "/**
"java/com/facebook/react/viewmanagers/ArrayPropsNativeComponentViewManagerInterface.java": "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -11,26 +11,27 @@ Object {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface ArrayPropsNativeComponentViewManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setNames(view: T, value: ReadableArray?): Unit
public fun setDisableds(view: T, value: ReadableArray?): Unit
public fun setProgress(view: T, value: ReadableArray?): Unit
public fun setRadii(view: T, value: ReadableArray?): Unit
public fun setColors(view: T, value: ReadableArray?): Unit
public fun setSrcs(view: T, value: ReadableArray?): Unit
public fun setPoints(view: T, value: ReadableArray?): Unit
public fun setEdgeInsets(view: T, value: ReadableArray?): Unit
public fun setDimensions(view: T, value: ReadableArray?): Unit
public fun setSizes(view: T, value: ReadableArray?): Unit
public fun setObject(view: T, value: ReadableArray?): Unit
public fun setArrayOfObjects(view: T, value: ReadableArray?): Unit
public fun setArrayOfMixed(view: T, value: ReadableArray?): Unit
public interface ArrayPropsNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setNames(T view, @Nullable ReadableArray value);
void setDisableds(T view, @Nullable ReadableArray value);
void setProgress(T view, @Nullable ReadableArray value);
void setRadii(T view, @Nullable ReadableArray value);
void setColors(T view, @Nullable ReadableArray value);
void setSrcs(T view, @Nullable ReadableArray value);
void setPoints(T view, @Nullable ReadableArray value);
void setEdgeInsets(T view, @Nullable ReadableArray value);
void setDimensions(T view, @Nullable ReadableArray value);
void setSizes(T view, @Nullable ReadableArray value);
void setObject(T view, @Nullable ReadableArray value);
void setArrayOfObjects(T view, @Nullable ReadableArray value);
void setArrayOfMixed(T view, @Nullable ReadableArray value);
}
",
}
@@ -38,7 +39,7 @@ public interface ArrayPropsNativeComponentViewManagerInterface<T: View>: ViewMan
exports[`GeneratePropsJavaInterface can generate for 'BooleanPropNativeComponent.js' 1`] = `
Object {
"java/com/facebook/react/viewmanagers/BooleanPropNativeComponentViewManagerInterface.kt": "/**
"java/com/facebook/react/viewmanagers/BooleanPropNativeComponentViewManagerInterface.java": "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -47,14 +48,15 @@ Object {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface BooleanPropNativeComponentViewManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setDisabled(view: T, value: Boolean): Unit
public fun setDisabledNullable(view: T, value: Boolean?): Unit
public interface BooleanPropNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setDisabled(T view, boolean value);
void setDisabledNullable(T view, @Nullable Boolean value);
}
",
}
@@ -62,7 +64,7 @@ public interface BooleanPropNativeComponentViewManagerInterface<T: View>: ViewMa
exports[`GeneratePropsJavaInterface can generate for 'ColorPropNativeComponent.js' 1`] = `
Object {
"java/com/facebook/react/viewmanagers/ColorPropNativeComponentViewManagerInterface.kt": "/**
"java/com/facebook/react/viewmanagers/ColorPropNativeComponentViewManagerInterface.java": "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -71,13 +73,14 @@ Object {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface ColorPropNativeComponentViewManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setTintColor(view: T, value: Int?): Unit
public interface ColorPropNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setTintColor(T view, @Nullable Integer value);
}
",
}
@@ -85,7 +88,7 @@ public interface ColorPropNativeComponentViewManagerInterface<T: View>: ViewMana
exports[`GeneratePropsJavaInterface can generate for 'DimensionPropNativeComponent.js' 1`] = `
Object {
"java/com/facebook/react/viewmanagers/DimensionPropNativeComponentViewManagerInterface.kt": "/**
"java/com/facebook/react/viewmanagers/DimensionPropNativeComponentViewManagerInterface.java": "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -94,14 +97,15 @@ Object {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
import com.facebook.yoga.YogaValue;
public interface DimensionPropNativeComponentViewManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setMarginBack(view: T, value: YogaValue?): Unit
public interface DimensionPropNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setMarginBack(T view, @Nullable YogaValue value);
}
",
}
@@ -109,7 +113,7 @@ public interface DimensionPropNativeComponentViewManagerInterface<T: View>: View
exports[`GeneratePropsJavaInterface can generate for 'EdgeInsetsPropNativeComponent.js' 1`] = `
Object {
"java/com/facebook/react/viewmanagers/EdgeInsetsPropNativeComponentViewManagerInterface.kt": "/**
"java/com/facebook/react/viewmanagers/EdgeInsetsPropNativeComponentViewManagerInterface.java": "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -118,12 +122,12 @@ Object {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface EdgeInsetsPropNativeComponentViewManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public interface EdgeInsetsPropNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
// No props
}
",
@@ -132,7 +136,7 @@ public interface EdgeInsetsPropNativeComponentViewManagerInterface<T: View>: Vie
exports[`GeneratePropsJavaInterface can generate for 'EnumPropNativeComponent.js' 1`] = `
Object {
"java/com/facebook/react/viewmanagers/EnumPropNativeComponentViewManagerInterface.kt": "/**
"java/com/facebook/react/viewmanagers/EnumPropNativeComponentViewManagerInterface.java": "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -141,14 +145,15 @@ Object {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface EnumPropNativeComponentViewManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setAlignment(view: T, value: String?): Unit
public fun setIntervals(view: T, value: Int?): Unit
public interface EnumPropNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setAlignment(T view, @Nullable String value);
void setIntervals(T view, @Nullable Integer value);
}
",
}
@@ -156,7 +161,7 @@ public interface EnumPropNativeComponentViewManagerInterface<T: View>: ViewManag
exports[`GeneratePropsJavaInterface can generate for 'EventNestedObjectPropsNativeComponent.js' 1`] = `
Object {
"java/com/facebook/react/viewmanagers/EventNestedObjectPropsNativeComponentViewManagerInterface.kt": "/**
"java/com/facebook/react/viewmanagers/EventNestedObjectPropsNativeComponentViewManagerInterface.java": "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -165,13 +170,13 @@ Object {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface EventNestedObjectPropsNativeComponentViewManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setDisabled(view: T, value: Boolean): Unit
public interface EventNestedObjectPropsNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setDisabled(T view, boolean value);
}
",
}
@@ -179,7 +184,7 @@ public interface EventNestedObjectPropsNativeComponentViewManagerInterface<T: Vi
exports[`GeneratePropsJavaInterface can generate for 'EventPropsNativeComponent.js' 1`] = `
Object {
"java/com/facebook/react/viewmanagers/EventPropsNativeComponentViewManagerInterface.kt": "/**
"java/com/facebook/react/viewmanagers/EventPropsNativeComponentViewManagerInterface.java": "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -188,13 +193,13 @@ Object {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface EventPropsNativeComponentViewManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setDisabled(view: T, value: Boolean): Unit
public interface EventPropsNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setDisabled(T view, boolean value);
}
",
}
@@ -202,7 +207,7 @@ public interface EventPropsNativeComponentViewManagerInterface<T: View>: ViewMan
exports[`GeneratePropsJavaInterface can generate for 'FloatPropsNativeComponent.js' 1`] = `
Object {
"java/com/facebook/react/viewmanagers/FloatPropsNativeComponentViewManagerInterface.kt": "/**
"java/com/facebook/react/viewmanagers/FloatPropsNativeComponentViewManagerInterface.java": "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -211,19 +216,20 @@ Object {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface FloatPropsNativeComponentViewManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setBlurRadius(view: T, value: Float): Unit
public fun setBlurRadius2(view: T, value: Float): Unit
public fun setBlurRadius3(view: T, value: Float): Unit
public fun setBlurRadius4(view: T, value: Float): Unit
public fun setBlurRadius5(view: T, value: Float): Unit
public fun setBlurRadius6(view: T, value: Float): Unit
public fun setBlurRadiusNullable(view: T, value: Float?): Unit
public interface FloatPropsNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setBlurRadius(T view, float value);
void setBlurRadius2(T view, float value);
void setBlurRadius3(T view, float value);
void setBlurRadius4(T view, float value);
void setBlurRadius5(T view, float value);
void setBlurRadius6(T view, float value);
void setBlurRadiusNullable(T view, @Nullable Float value);
}
",
}
@@ -231,7 +237,7 @@ public interface FloatPropsNativeComponentViewManagerInterface<T: View>: ViewMan
exports[`GeneratePropsJavaInterface can generate for 'ImagePropNativeComponent.js' 1`] = `
Object {
"java/com/facebook/react/viewmanagers/ImagePropNativeComponentViewManagerInterface.kt": "/**
"java/com/facebook/react/viewmanagers/ImagePropNativeComponentViewManagerInterface.java": "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -240,14 +246,15 @@ Object {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface ImagePropNativeComponentViewManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setThumbImage(view: T, value: ReadableMap?): Unit
public interface ImagePropNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setThumbImage(T view, @Nullable ReadableMap value);
}
",
}
@@ -255,7 +262,7 @@ public interface ImagePropNativeComponentViewManagerInterface<T: View>: ViewMana
exports[`GeneratePropsJavaInterface can generate for 'IntegerPropNativeComponent.js' 1`] = `
Object {
"java/com/facebook/react/viewmanagers/IntegerPropNativeComponentViewManagerInterface.kt": "/**
"java/com/facebook/react/viewmanagers/IntegerPropNativeComponentViewManagerInterface.java": "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -264,15 +271,15 @@ Object {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface IntegerPropNativeComponentViewManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setProgress1(view: T, value: Int): Unit
public fun setProgress2(view: T, value: Int): Unit
public fun setProgress3(view: T, value: Int): Unit
public interface IntegerPropNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setProgress1(T view, int value);
void setProgress2(T view, int value);
void setProgress3(T view, int value);
}
",
}
@@ -280,7 +287,7 @@ public interface IntegerPropNativeComponentViewManagerInterface<T: View>: ViewMa
exports[`GeneratePropsJavaInterface can generate for 'InterfaceOnlyNativeComponent.js' 1`] = `
Object {
"java/com/facebook/react/viewmanagers/InterfaceOnlyNativeComponentViewManagerInterface.kt": "/**
"java/com/facebook/react/viewmanagers/InterfaceOnlyNativeComponentViewManagerInterface.java": "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -289,13 +296,14 @@ Object {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface InterfaceOnlyNativeComponentViewManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setTitle(view: T, value: String?): Unit
public interface InterfaceOnlyNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setTitle(T view, @Nullable String value);
}
",
}
@@ -303,7 +311,7 @@ public interface InterfaceOnlyNativeComponentViewManagerInterface<T: View>: View
exports[`GeneratePropsJavaInterface can generate for 'MixedPropNativeComponent.js' 1`] = `
Object {
"java/com/facebook/react/viewmanagers/MixedPropNativeComponentViewManagerInterface.kt": "/**
"java/com/facebook/react/viewmanagers/MixedPropNativeComponentViewManagerInterface.java": "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -312,14 +320,14 @@ Object {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import com.facebook.react.bridge.Dynamic;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface MixedPropNativeComponentViewManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setMixedProp(view: T, value: Dynamic): Unit
public interface MixedPropNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setMixedProp(T view, Dynamic value);
}
",
}
@@ -327,7 +335,7 @@ public interface MixedPropNativeComponentViewManagerInterface<T: View>: ViewMana
exports[`GeneratePropsJavaInterface can generate for 'MultiNativePropNativeComponent.js' 1`] = `
Object {
"java/com/facebook/react/viewmanagers/MultiNativePropNativeComponentViewManagerInterface.kt": "/**
"java/com/facebook/react/viewmanagers/MultiNativePropNativeComponentViewManagerInterface.java": "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -336,17 +344,18 @@ Object {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface MultiNativePropNativeComponentViewManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setThumbImage(view: T, value: ReadableMap?): Unit
public fun setColor(view: T, value: Int?): Unit
public fun setThumbTintColor(view: T, value: Int?): Unit
public fun setPoint(view: T, value: ReadableMap?): Unit
public interface MultiNativePropNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setThumbImage(T view, @Nullable ReadableMap value);
void setColor(T view, @Nullable Integer value);
void setThumbTintColor(T view, @Nullable Integer value);
void setPoint(T view, @Nullable ReadableMap value);
}
",
}
@@ -354,7 +363,7 @@ public interface MultiNativePropNativeComponentViewManagerInterface<T: View>: Vi
exports[`GeneratePropsJavaInterface can generate for 'NoPropsNoEventsNativeComponent.js' 1`] = `
Object {
"java/com/facebook/react/viewmanagers/NoPropsNoEventsNativeComponentViewManagerInterface.kt": "/**
"java/com/facebook/react/viewmanagers/NoPropsNoEventsNativeComponentViewManagerInterface.java": "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -363,12 +372,12 @@ Object {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface NoPropsNoEventsNativeComponentViewManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public interface NoPropsNoEventsNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
// No props
}
",
@@ -377,7 +386,7 @@ public interface NoPropsNoEventsNativeComponentViewManagerInterface<T: View>: Vi
exports[`GeneratePropsJavaInterface can generate for 'ObjectPropsNativeComponent.js' 1`] = `
Object {
"java/com/facebook/react/viewmanagers/ObjectPropsNativeComponentManagerInterface.kt": "/**
"java/com/facebook/react/viewmanagers/ObjectPropsNativeComponentManagerInterface.java": "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -386,16 +395,17 @@ Object {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface ObjectPropsNativeComponentManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setObjectProp(view: T, value: ReadableMap?): Unit
public fun setObjectArrayProp(view: T, value: ReadableMap?): Unit
public fun setObjectPrimitiveRequiredProp(view: T, value: ReadableMap?): Unit
public interface ObjectPropsNativeComponentManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setObjectProp(T view, @Nullable ReadableMap value);
void setObjectArrayProp(T view, @Nullable ReadableMap value);
void setObjectPrimitiveRequiredProp(T view, @Nullable ReadableMap value);
}
",
}
@@ -403,7 +413,7 @@ public interface ObjectPropsNativeComponentManagerInterface<T: View>: ViewManage
exports[`GeneratePropsJavaInterface can generate for 'PointPropNativeComponent.js' 1`] = `
Object {
"java/com/facebook/react/viewmanagers/PointPropNativeComponentViewManagerInterface.kt": "/**
"java/com/facebook/react/viewmanagers/PointPropNativeComponentViewManagerInterface.java": "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -412,14 +422,15 @@ Object {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface PointPropNativeComponentViewManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setStartPoint(view: T, value: ReadableMap?): Unit
public interface PointPropNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setStartPoint(T view, @Nullable ReadableMap value);
}
",
}
@@ -427,7 +438,7 @@ public interface PointPropNativeComponentViewManagerInterface<T: View>: ViewMana
exports[`GeneratePropsJavaInterface can generate for 'StringPropNativeComponent.js' 1`] = `
Object {
"java/com/facebook/react/viewmanagers/StringPropNativeComponentViewManagerInterface.kt": "/**
"java/com/facebook/react/viewmanagers/StringPropNativeComponentViewManagerInterface.java": "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -436,14 +447,15 @@ Object {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface StringPropNativeComponentViewManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setPlaceholder(view: T, value: String?): Unit
public fun setDefaultValue(view: T, value: String?): Unit
public interface StringPropNativeComponentViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setPlaceholder(T view, @Nullable String value);
void setDefaultValue(T view, @Nullable String value);
}
",
}
+1 -1
View File
@@ -18,7 +18,7 @@
],
"bugs": "https://github.com/facebook/react-native/issues",
"engines": {
"node": ">= 22.14.0"
"node": ">= 20.19.4"
},
"scripts": {
"build": "yarn clean && node scripts/build.js --verbose",
@@ -51,12 +51,13 @@ if (!schemaQuery.startsWith('@')) {
const schemaQueryOutputFile = schemaQuery.replace(/^@/, '');
const schemaQueryOutput = fs.readFileSync(schemaQueryOutputFile, 'utf8');
const schemaFiles = schemaQueryOutput.split(' ');
const modules: {
[hasteModuleName: string]: NativeModuleSchema | ComponentSchema,
} = {};
const specNameToFile: {[hasteModuleName: string]: string} = {};
const schemaFiles =
schemaQueryOutput.length > 0 ? schemaQueryOutput.split(' ') : [];
for (const file of schemaFiles) {
const schema: SchemaType = JSON.parse(fs.readFileSync(file, 'utf8'));
@@ -48,15 +48,19 @@ const FileTemplate = ({
* ${'@'}generated by codegen project: GeneratePropsJavaInterface.js
*/
package ${packageName}
package ${packageName};
${imports}
public interface ${className}<T: ${extendClasses}>: ViewManagerWithGeneratedInterface {
public interface ${className}<T extends ${extendClasses}> extends ViewManagerWithGeneratedInterface {
${methods}
}
`;
function addNullable(imports: Set<string>) {
imports.add('import androidx.annotation.Nullable;');
}
function getJavaValueForProp(
prop: NamedShape<PropTypeAnnotation>,
imports: Set<string>,
@@ -66,52 +70,65 @@ function getJavaValueForProp(
switch (typeAnnotation.type) {
case 'BooleanTypeAnnotation':
if (typeAnnotation.default === null) {
return 'value: Boolean?';
addNullable(imports);
return '@Nullable Boolean value';
} else {
return 'value: Boolean';
return 'boolean value';
}
case 'StringTypeAnnotation':
return 'value: String?';
addNullable(imports);
return '@Nullable String value';
case 'Int32TypeAnnotation':
return 'value: Int';
return 'int value';
case 'DoubleTypeAnnotation':
return 'value: Double';
return 'double value';
case 'FloatTypeAnnotation':
if (typeAnnotation.default === null) {
return 'value: Float?';
addNullable(imports);
return '@Nullable Float value';
} else {
return 'value: Float';
return 'float value';
}
case 'ReservedPropTypeAnnotation':
switch (typeAnnotation.name) {
case 'ColorPrimitive':
return 'value: Int?';
addNullable(imports);
return '@Nullable Integer value';
case 'ImageSourcePrimitive':
return 'value: ReadableMap?';
addNullable(imports);
return '@Nullable ReadableMap value';
case 'ImageRequestPrimitive':
return 'value: ReadableMap?';
addNullable(imports);
return '@Nullable ReadableMap value';
case 'PointPrimitive':
return 'value: ReadableMap?';
addNullable(imports);
return '@Nullable ReadableMap value';
case 'EdgeInsetsPrimitive':
return 'value: ReadableMap?';
addNullable(imports);
return '@Nullable ReadableMap value';
case 'DimensionPrimitive':
return 'value: YogaValue?';
addNullable(imports);
return '@Nullable YogaValue value';
default:
(typeAnnotation.name: empty);
throw new Error('Received unknown ReservedPropTypeAnnotation');
}
case 'ArrayTypeAnnotation': {
return 'value: ReadableArray?';
addNullable(imports);
return '@Nullable ReadableArray value';
}
case 'ObjectTypeAnnotation': {
return 'value: ReadableMap?';
addNullable(imports);
return '@Nullable ReadableMap value';
}
case 'StringEnumTypeAnnotation':
return 'value: String?';
addNullable(imports);
return '@Nullable String value';
case 'Int32EnumTypeAnnotation':
return 'value: Int?';
addNullable(imports);
return '@Nullable Integer value';
case 'MixedTypeAnnotation':
return 'value: Dynamic';
return 'Dynamic value';
default:
(typeAnnotation: empty);
throw new Error('Received invalid typeAnnotation');
@@ -125,9 +142,9 @@ function generatePropsString(component: ComponentShape, imports: Set<string>) {
return component.props
.map(prop => {
return `public fun set${toSafeJavaString(
return `void set${toSafeJavaString(
prop.name,
)}(view: T, ${getJavaValueForProp(prop, imports)}): Unit`;
)}(T view, ${getJavaValueForProp(prop, imports)});`;
})
.join('\n' + ' ');
}
@@ -139,19 +156,19 @@ function getCommandArgJavaType(param: NamedShape<CommandParamTypeAnnotation>) {
case 'ReservedTypeAnnotation':
switch (typeAnnotation.name) {
case 'RootTag':
return 'Double';
return 'double';
default:
(typeAnnotation.name: empty);
throw new Error(`Receieved invalid type: ${typeAnnotation.name}`);
}
case 'BooleanTypeAnnotation':
return 'Boolean';
return 'boolean';
case 'DoubleTypeAnnotation':
return 'Double';
return 'double';
case 'FloatTypeAnnotation':
return 'Float';
return 'float';
case 'Int32TypeAnnotation':
return 'Int';
return 'int';
case 'StringTypeAnnotation':
return 'String';
case 'ArrayTypeAnnotation':
@@ -167,11 +184,11 @@ function getCommandArguments(
componentName: string,
): string {
return [
'view: T',
'T view',
...command.typeAnnotation.params.map(param => {
const commandArgJavaType = getCommandArgJavaType(param);
return `${param.name}: ${commandArgJavaType}`;
return `${commandArgJavaType} ${param.name}`;
}),
].join(', ');
}
@@ -184,10 +201,10 @@ function generateCommandsString(
.map(command => {
const safeJavaName = toSafeJavaString(command.name, false);
return `public fun ${safeJavaName}(${getCommandArguments(
return `void ${safeJavaName}(${getCommandArguments(
command,
componentName,
)}): Unit`;
)});`;
})
.join('\n' + ' ');
}
@@ -270,7 +287,7 @@ module.exports = {
.trimRight(),
});
files.set(`${outputDir}/${className}.kt`, replacedTemplate);
files.set(`${outputDir}/${className}.java`, replacedTemplate);
});
});
@@ -65,15 +65,15 @@ const TestTemplate = ({
propValue: string,
}) => `
TEST(${componentName}_${testName}, etc) {
auto propParser = RawPropsParser();
RawPropsParser propParser{};
propParser.prepare<${componentName}>();
auto const &sourceProps = ${componentName}();
auto const &rawProps = RawProps(folly::dynamic::object("${propName}", ${propValue}));
${componentName} sourceProps{};
RawProps rawProps(folly::dynamic::object("${propName}", ${propValue}));
ContextContainer contextContainer{};
PropsParserContext parserContext{-1, contextContainer};
rawProps.parse(propParser, parserContext);
rawProps.parse(propParser);
${componentName}(parserContext, sourceProps, rawProps);
}
`;
@@ -2,7 +2,7 @@
exports[`GeneratePropsJavaInterface can generate fixture ARRAY_PROPS 1`] = `
Map {
"java/com/facebook/react/viewmanagers/ArrayPropsNativeComponentManagerInterface.kt" => "/**
"java/com/facebook/react/viewmanagers/ArrayPropsNativeComponentManagerInterface.java" => "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -11,26 +11,27 @@ Map {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface ArrayPropsNativeComponentManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setNames(view: T, value: ReadableArray?): Unit
public fun setDisableds(view: T, value: ReadableArray?): Unit
public fun setProgress(view: T, value: ReadableArray?): Unit
public fun setRadii(view: T, value: ReadableArray?): Unit
public fun setColors(view: T, value: ReadableArray?): Unit
public fun setSrcs(view: T, value: ReadableArray?): Unit
public fun setPoints(view: T, value: ReadableArray?): Unit
public fun setDimensions(view: T, value: ReadableArray?): Unit
public fun setSizes(view: T, value: ReadableArray?): Unit
public fun setObject(view: T, value: ReadableArray?): Unit
public fun setArray(view: T, value: ReadableArray?): Unit
public fun setArrayOfArrayOfObject(view: T, value: ReadableArray?): Unit
public fun setArrayOfMixed(view: T, value: ReadableArray?): Unit
public interface ArrayPropsNativeComponentManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setNames(T view, @Nullable ReadableArray value);
void setDisableds(T view, @Nullable ReadableArray value);
void setProgress(T view, @Nullable ReadableArray value);
void setRadii(T view, @Nullable ReadableArray value);
void setColors(T view, @Nullable ReadableArray value);
void setSrcs(T view, @Nullable ReadableArray value);
void setPoints(T view, @Nullable ReadableArray value);
void setDimensions(T view, @Nullable ReadableArray value);
void setSizes(T view, @Nullable ReadableArray value);
void setObject(T view, @Nullable ReadableArray value);
void setArray(T view, @Nullable ReadableArray value);
void setArrayOfArrayOfObject(T view, @Nullable ReadableArray value);
void setArrayOfMixed(T view, @Nullable ReadableArray value);
}
",
}
@@ -38,7 +39,7 @@ public interface ArrayPropsNativeComponentManagerInterface<T: View>: ViewManager
exports[`GeneratePropsJavaInterface can generate fixture ARRAY_PROPS_WITH_NESTED_OBJECT 1`] = `
Map {
"java/com/facebook/react/viewmanagers/ArrayPropsNativeComponentManagerInterface.kt" => "/**
"java/com/facebook/react/viewmanagers/ArrayPropsNativeComponentManagerInterface.java" => "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -47,14 +48,15 @@ Map {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface ArrayPropsNativeComponentManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setNativePrimitives(view: T, value: ReadableArray?): Unit
public interface ArrayPropsNativeComponentManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setNativePrimitives(T view, @Nullable ReadableArray value);
}
",
}
@@ -62,7 +64,7 @@ public interface ArrayPropsNativeComponentManagerInterface<T: View>: ViewManager
exports[`GeneratePropsJavaInterface can generate fixture BOOLEAN_PROP 1`] = `
Map {
"java/com/facebook/react/viewmanagers/BooleanPropNativeComponentManagerInterface.kt" => "/**
"java/com/facebook/react/viewmanagers/BooleanPropNativeComponentManagerInterface.java" => "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -71,13 +73,13 @@ Map {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface BooleanPropNativeComponentManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setDisabled(view: T, value: Boolean): Unit
public interface BooleanPropNativeComponentManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setDisabled(T view, boolean value);
}
",
}
@@ -85,7 +87,7 @@ public interface BooleanPropNativeComponentManagerInterface<T: View>: ViewManage
exports[`GeneratePropsJavaInterface can generate fixture COLOR_PROP 1`] = `
Map {
"java/com/facebook/react/viewmanagers/ColorPropNativeComponentManagerInterface.kt" => "/**
"java/com/facebook/react/viewmanagers/ColorPropNativeComponentManagerInterface.java" => "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -94,13 +96,14 @@ Map {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface ColorPropNativeComponentManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setTintColor(view: T, value: Int?): Unit
public interface ColorPropNativeComponentManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setTintColor(T view, @Nullable Integer value);
}
",
}
@@ -108,7 +111,7 @@ public interface ColorPropNativeComponentManagerInterface<T: View>: ViewManagerW
exports[`GeneratePropsJavaInterface can generate fixture COMMANDS 1`] = `
Map {
"java/com/facebook/react/viewmanagers/CommandNativeComponentManagerInterface.kt" => "/**
"java/com/facebook/react/viewmanagers/CommandNativeComponentManagerInterface.java" => "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -117,16 +120,16 @@ Map {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface CommandNativeComponentManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public interface CommandNativeComponentManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
// No props
public fun flashScrollIndicators(view: T): Unit
public fun allTypes(view: T, x: Int, y: Float, z: Double, message: String, animated: Boolean, locations: ReadableArray): Unit
void flashScrollIndicators(T view);
void allTypes(T view, int x, float y, double z, String message, boolean animated, ReadableArray locations);
}
",
}
@@ -134,7 +137,7 @@ public interface CommandNativeComponentManagerInterface<T: View>: ViewManagerWit
exports[`GeneratePropsJavaInterface can generate fixture COMMANDS_AND_PROPS 1`] = `
Map {
"java/com/facebook/react/viewmanagers/CommandNativeComponentManagerInterface.kt" => "/**
"java/com/facebook/react/viewmanagers/CommandNativeComponentManagerInterface.java" => "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -143,17 +146,18 @@ Map {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface CommandNativeComponentManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setAccessibilityHint(view: T, value: String?): Unit
public fun handleRootTag(view: T, rootTag: Double): Unit
public fun hotspotUpdate(view: T, x: Int, y: Int): Unit
public fun addItems(view: T, items: ReadableArray): Unit
public interface CommandNativeComponentManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setAccessibilityHint(T view, @Nullable String value);
void handleRootTag(T view, double rootTag);
void hotspotUpdate(T view, int x, int y);
void addItems(T view, ReadableArray items);
}
",
}
@@ -161,7 +165,7 @@ public interface CommandNativeComponentManagerInterface<T: View>: ViewManagerWit
exports[`GeneratePropsJavaInterface can generate fixture DIMENSION_PROP 1`] = `
Map {
"java/com/facebook/react/viewmanagers/DimensionPropNativeComponentManagerInterface.kt" => "/**
"java/com/facebook/react/viewmanagers/DimensionPropNativeComponentManagerInterface.java" => "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -170,14 +174,15 @@ Map {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
import com.facebook.yoga.YogaValue;
public interface DimensionPropNativeComponentManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setMarginBack(view: T, value: YogaValue?): Unit
public interface DimensionPropNativeComponentManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setMarginBack(T view, @Nullable YogaValue value);
}
",
}
@@ -185,7 +190,7 @@ public interface DimensionPropNativeComponentManagerInterface<T: View>: ViewMana
exports[`GeneratePropsJavaInterface can generate fixture DOUBLE_PROPS 1`] = `
Map {
"java/com/facebook/react/viewmanagers/DoublePropNativeComponentManagerInterface.kt" => "/**
"java/com/facebook/react/viewmanagers/DoublePropNativeComponentManagerInterface.java" => "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -194,18 +199,18 @@ Map {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface DoublePropNativeComponentManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setBlurRadius(view: T, value: Double): Unit
public fun setBlurRadius2(view: T, value: Double): Unit
public fun setBlurRadius3(view: T, value: Double): Unit
public fun setBlurRadius4(view: T, value: Double): Unit
public fun setBlurRadius5(view: T, value: Double): Unit
public fun setBlurRadius6(view: T, value: Double): Unit
public interface DoublePropNativeComponentManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setBlurRadius(T view, double value);
void setBlurRadius2(T view, double value);
void setBlurRadius3(T view, double value);
void setBlurRadius4(T view, double value);
void setBlurRadius5(T view, double value);
void setBlurRadius6(T view, double value);
}
",
}
@@ -213,7 +218,7 @@ public interface DoublePropNativeComponentManagerInterface<T: View>: ViewManager
exports[`GeneratePropsJavaInterface can generate fixture EVENT_NESTED_OBJECT_PROPS 1`] = `
Map {
"java/com/facebook/react/viewmanagers/EventsNestedObjectNativeComponentManagerInterface.kt" => "/**
"java/com/facebook/react/viewmanagers/EventsNestedObjectNativeComponentManagerInterface.java" => "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -222,13 +227,13 @@ Map {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface EventsNestedObjectNativeComponentManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setDisabled(view: T, value: Boolean): Unit
public interface EventsNestedObjectNativeComponentManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setDisabled(T view, boolean value);
}
",
}
@@ -236,7 +241,7 @@ public interface EventsNestedObjectNativeComponentManagerInterface<T: View>: Vie
exports[`GeneratePropsJavaInterface can generate fixture EVENT_PROPS 1`] = `
Map {
"java/com/facebook/react/viewmanagers/EventsNativeComponentManagerInterface.kt" => "/**
"java/com/facebook/react/viewmanagers/EventsNativeComponentManagerInterface.java" => "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -245,13 +250,13 @@ Map {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface EventsNativeComponentManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setDisabled(view: T, value: Boolean): Unit
public interface EventsNativeComponentManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setDisabled(T view, boolean value);
}
",
}
@@ -259,7 +264,7 @@ public interface EventsNativeComponentManagerInterface<T: View>: ViewManagerWith
exports[`GeneratePropsJavaInterface can generate fixture EVENTS_WITH_PAPER_NAME 1`] = `
Map {
"java/com/facebook/react/viewmanagers/InterfaceOnlyComponentManagerInterface.kt" => "/**
"java/com/facebook/react/viewmanagers/InterfaceOnlyComponentManagerInterface.java" => "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -268,12 +273,12 @@ Map {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface InterfaceOnlyComponentManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public interface InterfaceOnlyComponentManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
// No props
}
",
@@ -286,7 +291,7 @@ exports[`GeneratePropsJavaInterface can generate fixture EXCLUDE_ANDROID_IOS 1`]
exports[`GeneratePropsJavaInterface can generate fixture EXCLUDE_IOS_TWO_COMPONENTS_DIFFERENT_FILES 1`] = `
Map {
"java/com/facebook/react/viewmanagers/ExcludedIosComponentManagerInterface.kt" => "/**
"java/com/facebook/react/viewmanagers/ExcludedIosComponentManagerInterface.java" => "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -295,16 +300,16 @@ Map {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface ExcludedIosComponentManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public interface ExcludedIosComponentManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
// No props
}
",
"java/com/facebook/react/viewmanagers/MultiFileIncludedNativeComponentManagerInterface.kt" => "/**
"java/com/facebook/react/viewmanagers/MultiFileIncludedNativeComponentManagerInterface.java" => "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -313,13 +318,13 @@ public interface ExcludedIosComponentManagerInterface<T: View>: ViewManagerWithG
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface MultiFileIncludedNativeComponentManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setDisabled(view: T, value: Boolean): Unit
public interface MultiFileIncludedNativeComponentManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setDisabled(T view, boolean value);
}
",
}
@@ -327,7 +332,7 @@ public interface MultiFileIncludedNativeComponentManagerInterface<T: View>: View
exports[`GeneratePropsJavaInterface can generate fixture FLOAT_PROPS 1`] = `
Map {
"java/com/facebook/react/viewmanagers/FloatPropNativeComponentManagerInterface.kt" => "/**
"java/com/facebook/react/viewmanagers/FloatPropNativeComponentManagerInterface.java" => "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -336,18 +341,18 @@ Map {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface FloatPropNativeComponentManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setBlurRadius(view: T, value: Float): Unit
public fun setBlurRadius2(view: T, value: Float): Unit
public fun setBlurRadius3(view: T, value: Float): Unit
public fun setBlurRadius4(view: T, value: Float): Unit
public fun setBlurRadius5(view: T, value: Float): Unit
public fun setBlurRadius6(view: T, value: Float): Unit
public interface FloatPropNativeComponentManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setBlurRadius(T view, float value);
void setBlurRadius2(T view, float value);
void setBlurRadius3(T view, float value);
void setBlurRadius4(T view, float value);
void setBlurRadius5(T view, float value);
void setBlurRadius6(T view, float value);
}
",
}
@@ -355,7 +360,7 @@ public interface FloatPropNativeComponentManagerInterface<T: View>: ViewManagerW
exports[`GeneratePropsJavaInterface can generate fixture IMAGE_PROP 1`] = `
Map {
"java/com/facebook/react/viewmanagers/ImagePropNativeComponentManagerInterface.kt" => "/**
"java/com/facebook/react/viewmanagers/ImagePropNativeComponentManagerInterface.java" => "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -364,14 +369,15 @@ Map {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface ImagePropNativeComponentManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setThumbImage(view: T, value: ReadableMap?): Unit
public interface ImagePropNativeComponentManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setThumbImage(T view, @Nullable ReadableMap value);
}
",
}
@@ -379,7 +385,7 @@ public interface ImagePropNativeComponentManagerInterface<T: View>: ViewManagerW
exports[`GeneratePropsJavaInterface can generate fixture INSETS_PROP 1`] = `
Map {
"java/com/facebook/react/viewmanagers/InsetsPropNativeComponentManagerInterface.kt" => "/**
"java/com/facebook/react/viewmanagers/InsetsPropNativeComponentManagerInterface.java" => "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -388,14 +394,15 @@ Map {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface InsetsPropNativeComponentManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setContentInset(view: T, value: ReadableMap?): Unit
public interface InsetsPropNativeComponentManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setContentInset(T view, @Nullable ReadableMap value);
}
",
}
@@ -403,7 +410,7 @@ public interface InsetsPropNativeComponentManagerInterface<T: View>: ViewManager
exports[`GeneratePropsJavaInterface can generate fixture INT32_ENUM_PROP 1`] = `
Map {
"java/com/facebook/react/viewmanagers/Int32EnumPropsNativeComponentManagerInterface.kt" => "/**
"java/com/facebook/react/viewmanagers/Int32EnumPropsNativeComponentManagerInterface.java" => "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -412,13 +419,14 @@ Map {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface Int32EnumPropsNativeComponentManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setMaxInterval(view: T, value: Int?): Unit
public interface Int32EnumPropsNativeComponentManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setMaxInterval(T view, @Nullable Integer value);
}
",
}
@@ -426,7 +434,7 @@ public interface Int32EnumPropsNativeComponentManagerInterface<T: View>: ViewMan
exports[`GeneratePropsJavaInterface can generate fixture INTEGER_PROPS 1`] = `
Map {
"java/com/facebook/react/viewmanagers/IntegerPropNativeComponentManagerInterface.kt" => "/**
"java/com/facebook/react/viewmanagers/IntegerPropNativeComponentManagerInterface.java" => "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -435,15 +443,15 @@ Map {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface IntegerPropNativeComponentManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setProgress1(view: T, value: Int): Unit
public fun setProgress2(view: T, value: Int): Unit
public fun setProgress3(view: T, value: Int): Unit
public interface IntegerPropNativeComponentManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setProgress1(T view, int value);
void setProgress2(T view, int value);
void setProgress3(T view, int value);
}
",
}
@@ -451,7 +459,7 @@ public interface IntegerPropNativeComponentManagerInterface<T: View>: ViewManage
exports[`GeneratePropsJavaInterface can generate fixture INTERFACE_ONLY 1`] = `
Map {
"java/com/facebook/react/viewmanagers/InterfaceOnlyComponentManagerInterface.kt" => "/**
"java/com/facebook/react/viewmanagers/InterfaceOnlyComponentManagerInterface.java" => "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -460,13 +468,14 @@ Map {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface InterfaceOnlyComponentManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setAccessibilityHint(view: T, value: String?): Unit
public interface InterfaceOnlyComponentManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setAccessibilityHint(T view, @Nullable String value);
}
",
}
@@ -474,7 +483,7 @@ public interface InterfaceOnlyComponentManagerInterface<T: View>: ViewManagerWit
exports[`GeneratePropsJavaInterface can generate fixture MIXED_PROP 1`] = `
Map {
"java/com/facebook/react/viewmanagers/MixedPropNativeComponentManagerInterface.kt" => "/**
"java/com/facebook/react/viewmanagers/MixedPropNativeComponentManagerInterface.java" => "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -483,14 +492,14 @@ Map {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import com.facebook.react.bridge.Dynamic;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface MixedPropNativeComponentManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setMixedProp(view: T, value: Dynamic): Unit
public interface MixedPropNativeComponentManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setMixedProp(T view, Dynamic value);
}
",
}
@@ -498,7 +507,7 @@ public interface MixedPropNativeComponentManagerInterface<T: View>: ViewManagerW
exports[`GeneratePropsJavaInterface can generate fixture MULTI_NATIVE_PROP 1`] = `
Map {
"java/com/facebook/react/viewmanagers/ImageColorPropNativeComponentManagerInterface.kt" => "/**
"java/com/facebook/react/viewmanagers/ImageColorPropNativeComponentManagerInterface.java" => "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -507,17 +516,18 @@ Map {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface ImageColorPropNativeComponentManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setThumbImage(view: T, value: ReadableMap?): Unit
public fun setColor(view: T, value: Int?): Unit
public fun setThumbTintColor(view: T, value: Int?): Unit
public fun setPoint(view: T, value: ReadableMap?): Unit
public interface ImageColorPropNativeComponentManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setThumbImage(T view, @Nullable ReadableMap value);
void setColor(T view, @Nullable Integer value);
void setThumbTintColor(T view, @Nullable Integer value);
void setPoint(T view, @Nullable ReadableMap value);
}
",
}
@@ -525,7 +535,7 @@ public interface ImageColorPropNativeComponentManagerInterface<T: View>: ViewMan
exports[`GeneratePropsJavaInterface can generate fixture NO_PROPS_NO_EVENTS 1`] = `
Map {
"java/com/facebook/react/viewmanagers/NoPropsNoEventsComponentManagerInterface.kt" => "/**
"java/com/facebook/react/viewmanagers/NoPropsNoEventsComponentManagerInterface.java" => "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -534,12 +544,12 @@ Map {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface NoPropsNoEventsComponentManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public interface NoPropsNoEventsComponentManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
// No props
}
",
@@ -548,7 +558,7 @@ public interface NoPropsNoEventsComponentManagerInterface<T: View>: ViewManagerW
exports[`GeneratePropsJavaInterface can generate fixture OBJECT_PROPS 1`] = `
Map {
"java/com/facebook/react/viewmanagers/ObjectPropsManagerInterface.kt" => "/**
"java/com/facebook/react/viewmanagers/ObjectPropsManagerInterface.java" => "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -557,14 +567,15 @@ Map {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface ObjectPropsManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setObjectProp(view: T, value: ReadableMap?): Unit
public interface ObjectPropsManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setObjectProp(T view, @Nullable ReadableMap value);
}
",
}
@@ -572,7 +583,7 @@ public interface ObjectPropsManagerInterface<T: View>: ViewManagerWithGeneratedI
exports[`GeneratePropsJavaInterface can generate fixture POINT_PROP 1`] = `
Map {
"java/com/facebook/react/viewmanagers/PointPropNativeComponentManagerInterface.kt" => "/**
"java/com/facebook/react/viewmanagers/PointPropNativeComponentManagerInterface.java" => "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -581,14 +592,15 @@ Map {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface PointPropNativeComponentManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setStartPoint(view: T, value: ReadableMap?): Unit
public interface PointPropNativeComponentManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setStartPoint(T view, @Nullable ReadableMap value);
}
",
}
@@ -596,7 +608,7 @@ public interface PointPropNativeComponentManagerInterface<T: View>: ViewManagerW
exports[`GeneratePropsJavaInterface can generate fixture STRING_ENUM_PROP 1`] = `
Map {
"java/com/facebook/react/viewmanagers/StringEnumPropsNativeComponentManagerInterface.kt" => "/**
"java/com/facebook/react/viewmanagers/StringEnumPropsNativeComponentManagerInterface.java" => "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -605,13 +617,14 @@ Map {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface StringEnumPropsNativeComponentManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setAlignment(view: T, value: String?): Unit
public interface StringEnumPropsNativeComponentManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setAlignment(T view, @Nullable String value);
}
",
}
@@ -619,7 +632,7 @@ public interface StringEnumPropsNativeComponentManagerInterface<T: View>: ViewMa
exports[`GeneratePropsJavaInterface can generate fixture STRING_PROP 1`] = `
Map {
"java/com/facebook/react/viewmanagers/StringPropComponentManagerInterface.kt" => "/**
"java/com/facebook/react/viewmanagers/StringPropComponentManagerInterface.java" => "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -628,14 +641,15 @@ Map {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface StringPropComponentManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setAccessibilityHint(view: T, value: String?): Unit
public fun setAccessibilityRole(view: T, value: String?): Unit
public interface StringPropComponentManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setAccessibilityHint(T view, @Nullable String value);
void setAccessibilityRole(T view, @Nullable String value);
}
",
}
@@ -643,7 +657,7 @@ public interface StringPropComponentManagerInterface<T: View>: ViewManagerWithGe
exports[`GeneratePropsJavaInterface can generate fixture TWO_COMPONENTS_DIFFERENT_FILES 1`] = `
Map {
"java/com/facebook/react/viewmanagers/MultiFile1NativeComponentManagerInterface.kt" => "/**
"java/com/facebook/react/viewmanagers/MultiFile1NativeComponentManagerInterface.java" => "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -652,16 +666,16 @@ Map {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface MultiFile1NativeComponentManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setDisabled(view: T, value: Boolean): Unit
public interface MultiFile1NativeComponentManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setDisabled(T view, boolean value);
}
",
"java/com/facebook/react/viewmanagers/MultiFile2NativeComponentManagerInterface.kt" => "/**
"java/com/facebook/react/viewmanagers/MultiFile2NativeComponentManagerInterface.java" => "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -670,13 +684,13 @@ public interface MultiFile1NativeComponentManagerInterface<T: View>: ViewManager
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface MultiFile2NativeComponentManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setDisabled(view: T, value: Boolean): Unit
public interface MultiFile2NativeComponentManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setDisabled(T view, boolean value);
}
",
}
@@ -684,7 +698,7 @@ public interface MultiFile2NativeComponentManagerInterface<T: View>: ViewManager
exports[`GeneratePropsJavaInterface can generate fixture TWO_COMPONENTS_SAME_FILE 1`] = `
Map {
"java/com/facebook/react/viewmanagers/MultiComponent1NativeComponentManagerInterface.kt" => "/**
"java/com/facebook/react/viewmanagers/MultiComponent1NativeComponentManagerInterface.java" => "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -693,16 +707,16 @@ Map {
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface MultiComponent1NativeComponentManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setDisabled(view: T, value: Boolean): Unit
public interface MultiComponent1NativeComponentManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setDisabled(T view, boolean value);
}
",
"java/com/facebook/react/viewmanagers/MultiComponent2NativeComponentManagerInterface.kt" => "/**
"java/com/facebook/react/viewmanagers/MultiComponent2NativeComponentManagerInterface.java" => "/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
@@ -711,13 +725,13 @@ public interface MultiComponent1NativeComponentManagerInterface<T: View>: ViewMa
* @generated by codegen project: GeneratePropsJavaInterface.js
*/
package com.facebook.react.viewmanagers
package com.facebook.react.viewmanagers;
import android.view.View;
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
public interface MultiComponent2NativeComponentManagerInterface<T: View>: ViewManagerWithGeneratedInterface {
public fun setDisabled(view: T, value: Boolean): Unit
public interface MultiComponent2NativeComponentManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
void setDisabled(T view, boolean value);
}
",
}
@@ -19,7 +19,7 @@
],
"bugs": "https://github.com/facebook/react-native/issues",
"engines": {
"node": ">= 22.14.0"
"node": ">= 20.19.4"
},
"exports": {
".": "./src/index.js",
@@ -31,12 +31,8 @@ function mockQueueMicrotask() {
}
describe('Animated', () => {
let ReactNativeFeatureFlags;
beforeEach(() => {
jest.resetModules();
ReactNativeFeatureFlags = require('../../../src/private/featureflags/ReactNativeFeatureFlags');
});
mockQueueMicrotask();
@@ -113,50 +109,7 @@ describe('Animated', () => {
expect(callback.mock.calls.length).toBe(1);
});
it('does not detach on updates', async () => {
ReactNativeFeatureFlags.override({
scheduleAnimatedCleanupInMicrotask: () => false,
});
const opacity = new Animated.Value(0);
jest.spyOn(opacity, '__detach');
const root = await create(<Animated.View style={{opacity}} />);
expect(opacity.__detach).not.toBeCalled();
await update(root, <Animated.View style={{opacity}} />);
expect(opacity.__detach).not.toBeCalled();
await unmount(root);
expect(opacity.__detach).toBeCalled();
});
it('stops animation when detached', async () => {
ReactNativeFeatureFlags.override({
scheduleAnimatedCleanupInMicrotask: () => false,
});
const opacity = new Animated.Value(0);
const callback = jest.fn();
const root = await create(<Animated.View style={{opacity}} />);
Animated.timing(opacity, {
toValue: 10,
duration: 1000,
useNativeDriver: false,
}).start(callback);
await unmount(root);
expect(callback).toBeCalledWith({finished: false});
});
it('detaches only on unmount (in a microtask)', async () => {
ReactNativeFeatureFlags.override({
scheduleAnimatedCleanupInMicrotask: () => true,
});
const opacity = new Animated.Value(0);
jest.spyOn(opacity, '__detach');
@@ -175,10 +128,6 @@ describe('Animated', () => {
});
it('restores default values only on update (in a microtask)', async () => {
ReactNativeFeatureFlags.override({
scheduleAnimatedCleanupInMicrotask: () => true,
});
const __restoreDefaultValues = jest.spyOn(
AnimatedProps.prototype,
'__restoreDefaultValues',
@@ -213,10 +162,6 @@ describe('Animated', () => {
});
it('stops animation when detached (in a microtask)', async () => {
ReactNativeFeatureFlags.override({
scheduleAnimatedCleanupInMicrotask: () => true,
});
const opacity = new Animated.Value(0);
const callback = jest.fn();
@@ -5,7 +5,6 @@
* LICENSE file in the root directory of this source tree.
*
* @fantom_flags enableFixForParentTagDuringReparenting:true
* @fantom_flags enableSynchronousStateUpdates:true
* @fantom_flags enableViewCulling:true
* @flow strict-local
* @format
@@ -2556,3 +2555,56 @@ describe('culling inside ScrollView with overflow visible', () => {
);
});
});
describe('horizontal ScrollView in RTL script', () => {
it('renders item 1', () => {
const root = Fantom.createRoot({viewportWidth: 100, viewportHeight: 100});
Fantom.runTask(() => {
root.render(
<ScrollView
style={{direction: 'rtl', height: 100, width: 100}}
horizontal={true}>
<View nativeID={'item1'} style={{height: 90, width: 90, margin: 5}} />
<View nativeID={'item2'} style={{height: 90, width: 90, margin: 5}} />
</ScrollView>,
);
});
expect(root.takeMountingManagerLogs()).toEqual([
'Update {type: "RootView", nativeID: (root)}',
'Create {type: "ScrollView", nativeID: (N/A)}',
'Create {type: "AndroidHorizontalScrollContentView", nativeID: (N/A)}',
'Create {type: "View", nativeID: "item1"}',
'Insert {type: "View", parentNativeID: (N/A), index: 0, nativeID: "item1"}',
'Insert {type: "AndroidHorizontalScrollContentView", parentNativeID: (N/A), index: 0, nativeID: (N/A)}',
'Insert {type: "ScrollView", parentNativeID: (root), index: 0, nativeID: (N/A)}',
]);
});
it('takes contentOffset into account', () => {
const root = Fantom.createRoot({viewportWidth: 100, viewportHeight: 100});
Fantom.runTask(() => {
root.render(
<ScrollView
style={{direction: 'rtl', height: 100, width: 100}}
horizontal={true}
contentOffset={{x: 100, y: 0}}>
<View nativeID={'item1'} style={{height: 90, width: 90, margin: 5}} />
<View nativeID={'item2'} style={{height: 90, width: 90, margin: 5}} />
</ScrollView>,
);
});
expect(root.takeMountingManagerLogs()).toEqual([
'Update {type: "RootView", nativeID: (root)}',
'Create {type: "ScrollView", nativeID: (N/A)}',
'Create {type: "AndroidHorizontalScrollContentView", nativeID: (N/A)}',
'Create {type: "View", nativeID: "item2"}',
'Insert {type: "View", parentNativeID: (N/A), index: 0, nativeID: "item2"}',
'Insert {type: "AndroidHorizontalScrollContentView", parentNativeID: (N/A), index: 0, nativeID: (N/A)}',
'Insert {type: "ScrollView", parentNativeID: (root), index: 0, nativeID: (N/A)}',
]);
});
});
@@ -10,9 +10,14 @@
import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment';
import type {HostInstance} from 'react-native';
import ensureInstance from '../../../../src/private/__tests__/utilities/ensureInstance';
import * as Fantom from '@react-native/fantom';
import * as React from 'react';
import {createRef} from 'react';
import {View} from 'react-native';
import ReactNativeElement from 'react-native/src/private/webapis/dom/nodes/ReactNativeElement';
describe('<View>', () => {
describe('width and height style', () => {
@@ -181,6 +186,40 @@ describe('<View>', () => {
<rn-view transform='[{"translateX": 10.000000}]' />,
);
});
[
[undefined, {x: -5, y: 0, width: 20, height: 10}],
['50% 50%', {x: -5, y: 0, width: 20, height: 10}],
['top left', {x: 0, y: 0, width: 20, height: 10}],
['right bottom', {x: -10, y: 0, width: 20, height: 10}],
].forEach(([transformOrigin, expectedBounds]) => {
it(`applies transformOrigin correctly for ${String(transformOrigin)}`, () => {
const root = Fantom.createRoot();
const viewRef = createRef<HostInstance>();
Fantom.runTask(() => {
root.render(
<View
ref={viewRef}
style={{
width: 10,
height: 10,
transform: [{scaleX: 2}],
transformOrigin,
}}
/>,
);
});
const viewElement = ensureInstance(viewRef.current, ReactNativeElement);
const viewBounds = viewElement.getBoundingClientRect();
expect(viewBounds.x).toBe(expectedBounds.x);
expect(viewBounds.y).toBe(expectedBounds.y);
expect(viewBounds.width).toBe(expectedBounds.width);
expect(viewBounds.height).toBe(expectedBounds.height);
});
});
});
describe('props', () => {
@@ -49,6 +49,7 @@ function _defineCheckVersionTests() {
// $FlowFixMe[cannot-write]
console.error = jest.fn();
// $FlowFixMe[cannot-write]
// $FlowFixMe[unsafe-addition]
global.console = {error: jest.fn(error => (consoleOutput += error))};
spyOnConsoleError = jest.spyOn(global.console, 'error');
});
+2 -1
View File
@@ -8,12 +8,13 @@
* @format
*/
import Performance from '../../src/private/webapis/performance/Performance';
import NativePerformance from '../../src/private/webapis/performance/specs/NativePerformance';
// In case if the native implementation of the Performance API is available, use it,
// otherwise fall back to the legacy/default one, which only defines 'Performance.now()'
if (NativePerformance) {
const Performance =
require('../../src/private/webapis/performance/Performance').default;
// $FlowExpectedError[cannot-write]
global.performance = new Performance();
} else {
@@ -4,180 +4,32 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @flow strict
* @format
*/
import type {EventSubscription} from '../vendor/emitter/EventEmitter';
import type {Task} from './TaskQueue';
import * as ReactNativeFeatureFlags from '../../src/private/featureflags/ReactNativeFeatureFlags';
import EventEmitter from '../vendor/emitter/EventEmitter';
const BatchedBridge = require('../BatchedBridge/BatchedBridge').default;
const TaskQueue = require('./TaskQueue').default;
const invariant = require('invariant');
export type {Task, SimpleTask, PromiseTask} from './TaskQueue';
export type SimpleTask = {
name: string,
run: () => void,
};
export type PromiseTask = {
name: string,
gen: () => Promise<void>,
};
export type Task = SimpleTask | PromiseTask | (() => void);
export type Handle = number;
const _emitter = new EventEmitter<{
interactionComplete: [],
interactionStart: [],
}>();
const DEBUG_DELAY: 0 = 0;
const DEBUG: false = false;
const InteractionManagerImpl = {
Events: {
interactionStart: 'interactionStart',
interactionComplete: 'interactionComplete',
},
/**
* Schedule a function to run after all interactions have completed. Returns a cancellable
* "promise".
*/
runAfterInteractions(task: ?Task): {
then: <U>(
onFulfill?: ?(void) => ?(Promise<U> | U),
onReject?: ?(error: mixed) => ?(Promise<U> | U),
) => Promise<U>,
cancel: () => void,
...
} {
const tasks: Array<Task> = [];
const promise = new Promise((resolve: () => void) => {
_scheduleUpdate();
if (task) {
tasks.push(task);
}
tasks.push({
run: resolve,
name: 'resolve ' + ((task && task.name) || '?'),
});
_taskQueue.enqueueTasks(tasks);
});
return {
// $FlowFixMe[method-unbinding] added when improving typing for this parameters
then: promise.then.bind(promise),
cancel: function () {
_taskQueue.cancelTasks(tasks);
},
};
},
/**
* Notify manager that an interaction has started.
*/
createInteractionHandle(): Handle {
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
DEBUG && console.log('InteractionManager: create interaction handle');
_scheduleUpdate();
const handle = ++_inc;
_addInteractionSet.add(handle);
return handle;
},
/**
* Notify manager that an interaction has completed.
*/
clearInteractionHandle(handle: Handle) {
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
DEBUG && console.log('InteractionManager: clear interaction handle');
invariant(!!handle, 'InteractionManager: Must provide a handle to clear.');
_scheduleUpdate();
_addInteractionSet.delete(handle);
_deleteInteractionSet.add(handle);
},
// $FlowFixMe[unclear-type] unclear type of _emitter
// $FlowFixMe[method-unbinding] added when improving typing for this parameters
addListener: _emitter.addListener.bind(_emitter) as (
eventType: string,
// $FlowFixMe[unclear-type] unclear type of arguments
listener: (...args: any) => mixed,
context: mixed,
) => EventSubscription,
/**
* A positive number will use setTimeout to schedule any tasks after the
* eventLoopRunningTime hits the deadline value, otherwise all tasks will be
* executed in one setImmediate batch (default).
*/
setDeadline(deadline: number) {
_deadline = deadline;
},
};
const _interactionSet = new Set<number | Handle>();
const _addInteractionSet = new Set<number | Handle>();
const _deleteInteractionSet = new Set<Handle>();
const _taskQueue = new TaskQueue({onMoreTasks: _scheduleUpdate});
let _nextUpdateHandle: $FlowFixMe | TimeoutID = 0;
let _inc = 0;
let _deadline = -1;
/**
* Schedule an asynchronous update to the interaction state.
*/
function _scheduleUpdate() {
if (!_nextUpdateHandle) {
if (_deadline > 0) {
_nextUpdateHandle = setTimeout(_processUpdate, 0 + DEBUG_DELAY);
} else {
_nextUpdateHandle = setImmediate(_processUpdate);
}
}
}
/**
* Notify listeners, process queue, etc
*/
function _processUpdate() {
_nextUpdateHandle = 0;
const interactionCount = _interactionSet.size;
_addInteractionSet.forEach(handle => _interactionSet.add(handle));
_deleteInteractionSet.forEach(handle => _interactionSet.delete(handle));
const nextInteractionCount = _interactionSet.size;
if (interactionCount !== 0 && nextInteractionCount === 0) {
// transition from 1+ --> 0 interactions
/* $FlowFixMe[prop-missing] Natural Inference rollout. See
* https://fburl.com/workplace/6291gfvu */
/* $FlowFixMe[invalid-computed-prop] Natural Inference rollout. See
* https://fburl.com/workplace/6291gfvu */
_emitter.emit(InteractionManager.Events.interactionComplete);
} else if (interactionCount === 0 && nextInteractionCount !== 0) {
// transition from 0 --> 1+ interactions
/* $FlowFixMe[prop-missing] Natural Inference rollout. See
* https://fburl.com/workplace/6291gfvu */
/* $FlowFixMe[invalid-computed-prop] Natural Inference rollout. See
* https://fburl.com/workplace/6291gfvu */
_emitter.emit(InteractionManager.Events.interactionStart);
}
// process the queue regardless of a transition
if (nextInteractionCount === 0) {
while (_taskQueue.hasTasksToProcess()) {
_taskQueue.processNext();
if (
_deadline > 0 &&
BatchedBridge.getEventLoopRunningTime() >= _deadline
) {
// Hit deadline before processing all tasks, so process more later.
_scheduleUpdate();
break;
}
}
}
_addInteractionSet.clear();
_deleteInteractionSet.clear();
// NOTE: The original implementation of `InteractionManager` never rejected
// the returned promise. This preserves that behavior in the stub.
function reject(error: Error): void {
setTimeout(() => {
throw error;
}, 0);
}
/**
@@ -231,11 +83,106 @@ function _processUpdate() {
*
* @deprecated
*/
const InteractionManager = (
ReactNativeFeatureFlags.disableInteractionManager()
? // $FlowFixMe[incompatible-variance]
require('./InteractionManagerStub').default
: InteractionManagerImpl
) as typeof InteractionManagerImpl;
const InteractionManagerStub = {
Events: {
interactionStart: 'interactionStart',
interactionComplete: 'interactionComplete',
},
export default InteractionManager;
/**
* Schedule a function to run after all interactions have completed. Returns a cancellable
* "promise".
*
* @deprecated
*/
runAfterInteractions(task: ?Task): {
then: <U>(
onFulfill?: ?(void) => ?(Promise<U> | U),
onReject?: ?(error: mixed) => ?(Promise<U> | U),
) => Promise<U>,
cancel: () => void,
...
} {
let immediateID: ?$FlowIssue;
const promise = new Promise(resolve => {
immediateID = setImmediate(() => {
if (typeof task === 'object' && task !== null) {
if (typeof task.gen === 'function') {
task.gen().then(resolve, reject);
} else if (typeof task.run === 'function') {
try {
task.run();
resolve();
} catch (error) {
reject(error);
}
} else {
reject(new TypeError(`Task "${task.name}" missing gen or run.`));
}
} else if (typeof task === 'function') {
try {
task();
resolve();
} catch (error) {
reject(error);
}
} else {
reject(new TypeError('Invalid task of type: ' + typeof task));
}
});
});
return {
// $FlowFixMe[method-unbinding] added when improving typing for this parameters
then: promise.then.bind(promise),
cancel() {
clearImmediate(immediateID);
},
};
},
/**
* Notify manager that an interaction has started.
*
* @deprecated
*/
createInteractionHandle(): Handle {
return -1;
},
/**
* Notify manager that an interaction has completed.
*
* @deprecated
*/
clearInteractionHandle(handle: Handle) {
invariant(!!handle, 'InteractionManager: Must provide a handle to clear.');
},
/**
* @deprecated
*/
addListener(
eventType: string,
// $FlowIgnore[unclear-type]
listener: (...args: any) => mixed,
context: mixed,
): EventSubscription {
return {
remove() {},
};
},
/**
* A positive number will use setTimeout to schedule any tasks after the
* eventLoopRunningTime hits the deadline value, otherwise all tasks will be
* executed in one setImmediate batch (default).
*
* @deprecated
*/
setDeadline(deadline: number) {
// Do nothing.
},
};
export default InteractionManagerStub;
@@ -1,184 +0,0 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict
* @format
*/
import type {EventSubscription} from '../vendor/emitter/EventEmitter';
const invariant = require('invariant');
export type Handle = number;
type Task =
| {
name: string,
run: () => void,
}
| {
name: string,
gen: () => Promise<void>,
}
| (() => void);
// NOTE: The original implementation of `InteractionManager` never rejected
// the returned promise. This preserves that behavior in the stub.
function reject(error: Error): void {
setTimeout(() => {
throw error;
}, 0);
}
/**
* InteractionManager allows long-running work to be scheduled after any
* interactions/animations have completed. In particular, this allows JavaScript
* animations to run smoothly.
*
* Applications can schedule tasks to run after interactions with the following:
*
* ```
* InteractionManager.runAfterInteractions(() => {
* // ...long-running synchronous task...
* });
* ```
*
* Compare this to other scheduling alternatives:
*
* - requestAnimationFrame(): for code that animates a view over time.
* - setImmediate/setTimeout(): run code later, note this may delay animations.
* - runAfterInteractions(): run code later, without delaying active animations.
*
* The touch handling system considers one or more active touches to be an
* 'interaction' and will delay `runAfterInteractions()` callbacks until all
* touches have ended or been cancelled.
*
* InteractionManager also allows applications to register animations by
* creating an interaction 'handle' on animation start, and clearing it upon
* completion:
*
* ```
* var handle = InteractionManager.createInteractionHandle();
* // run animation... (`runAfterInteractions` tasks are queued)
* // later, on animation completion:
* InteractionManager.clearInteractionHandle(handle);
* // queued tasks run if all handles were cleared
* ```
*
* `runAfterInteractions` takes either a plain callback function, or a
* `PromiseTask` object with a `gen` method that returns a `Promise`. If a
* `PromiseTask` is supplied, then it is fully resolved (including asynchronous
* dependencies that also schedule more tasks via `runAfterInteractions`) before
* starting on the next task that might have been queued up synchronously
* earlier.
*
* By default, queued tasks are executed together in a loop in one
* `setImmediate` batch. If `setDeadline` is called with a positive number, then
* tasks will only be executed until the deadline (in terms of js event loop run
* time) approaches, at which point execution will yield via setTimeout,
* allowing events such as touches to start interactions and block queued tasks
* from executing, making apps more responsive.
*
* @deprecated
*/
const InteractionManagerStub = {
Events: {
interactionStart: 'interactionStart',
interactionComplete: 'interactionComplete',
},
/**
* Schedule a function to run after all interactions have completed. Returns a cancellable
* "promise".
*
* @deprecated
*/
runAfterInteractions(task: ?Task): {
then: <U>(
onFulfill?: ?(void) => ?(Promise<U> | U),
onReject?: ?(error: mixed) => ?(Promise<U> | U),
) => Promise<U>,
cancel: () => void,
...
} {
let immediateID: ?$FlowIssue;
const promise = new Promise(resolve => {
immediateID = setImmediate(() => {
if (typeof task === 'object' && task !== null) {
if (typeof task.gen === 'function') {
task.gen().then(resolve, reject);
} else if (typeof task.run === 'function') {
try {
task.run();
resolve();
} catch (error) {
reject(error);
}
} else {
reject(new TypeError(`Task "${task.name}" missing gen or run.`));
}
} else if (typeof task === 'function') {
try {
task();
resolve();
} catch (error) {
reject(error);
}
} else {
reject(new TypeError('Invalid task of type: ' + typeof task));
}
});
});
return {
// $FlowFixMe[method-unbinding] added when improving typing for this parameters
then: promise.then.bind(promise),
cancel() {
clearImmediate(immediateID);
},
};
},
/**
* Notify manager that an interaction has started.
*
* @deprecated
*/
createInteractionHandle(): Handle {
return -1;
},
/**
* Notify manager that an interaction has completed.
*
* @deprecated
*/
clearInteractionHandle(handle: Handle) {
invariant(!!handle, 'InteractionManager: Must provide a handle to clear.');
},
/**
* @deprecated
*/
addListener(): EventSubscription {
return {
remove() {},
};
},
/**
* A positive number will use setTimeout to schedule any tasks after the
* eventLoopRunningTime hits the deadline value, otherwise all tasks will be
* executed in one setImmediate batch (default).
*
* @deprecated
*/
setDeadline(deadline: number) {
// Do nothing.
},
};
export default InteractionManagerStub;
-197
View File
@@ -1,197 +0,0 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict
* @format
*/
'use strict';
const invariant = require('invariant');
export type SimpleTask = {
name: string,
run: () => void,
};
export type PromiseTask = {
name: string,
gen: () => Promise<void>,
};
export type Task = SimpleTask | PromiseTask | (() => void);
const DEBUG: false = false;
/**
* TaskQueue - A system for queueing and executing a mix of simple callbacks and
* trees of dependent tasks based on Promises. No tasks are executed unless
* `processNext` is called.
*
* `enqueue` takes a Task object with either a simple `run` callback, or a
* `gen` function that returns a `Promise` and puts it in the queue. If a gen
* function is supplied, then the promise it returns will block execution of
* tasks already in the queue until it resolves. This can be used to make sure
* the first task is fully resolved (including asynchronous dependencies that
* also schedule more tasks via `enqueue`) before starting on the next task.
* The `onMoreTasks` constructor argument is used to inform the owner that an
* async task has resolved and that the queue should be processed again.
*
* Note: Tasks are only actually executed with explicit calls to `processNext`.
*/
class TaskQueue {
/**
* TaskQueue instances are self contained and independent, so multiple tasks
* of varying semantics and priority can operate together.
*
* `onMoreTasks` is invoked when `PromiseTask`s resolve if there are more
* tasks to process.
*/
constructor({onMoreTasks}: {onMoreTasks: () => void, ...}) {
this._onMoreTasks = onMoreTasks;
this._queueStack = [{tasks: [], popable: false}];
}
/**
* Add a task to the queue. It is recommended to name your tasks for easier
* async debugging. Tasks will not be executed until `processNext` is called
* explicitly.
*/
enqueue(task: Task): void {
this._getCurrentQueue().push(task);
}
enqueueTasks(tasks: Array<Task>): void {
tasks.forEach(task => this.enqueue(task));
}
cancelTasks(tasksToCancel: Array<Task>): void {
// search through all tasks and remove them.
this._queueStack = this._queueStack
.map(queue => ({
...queue,
tasks: queue.tasks.filter(task => tasksToCancel.indexOf(task) === -1),
}))
.filter((queue, idx) => queue.tasks.length > 0 || idx === 0);
}
/**
* Check to see if `processNext` should be called.
*
* @returns {boolean} Returns true if there are tasks that are ready to be
* processed with `processNext`, or returns false if there are no more tasks
* to be processed right now, although there may be tasks in the queue that
* are blocked by earlier `PromiseTask`s that haven't resolved yet.
* `onMoreTasks` will be called after each `PromiseTask` resolves if there are
* tasks ready to run at that point.
*/
hasTasksToProcess(): boolean {
return this._getCurrentQueue().length > 0;
}
/**
* Executes the next task in the queue.
*/
processNext(): void {
const queue = this._getCurrentQueue();
if (queue.length) {
const task = queue.shift();
try {
if (typeof task === 'object' && task.gen) {
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
DEBUG && console.log('TaskQueue: genPromise for task ' + task.name);
this._genPromise(task);
} else if (typeof task === 'object' && task.run) {
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
DEBUG && console.log('TaskQueue: run task ' + task.name);
task.run();
} else {
invariant(
typeof task === 'function',
'Expected Function, SimpleTask, or PromiseTask, but got:\n' +
JSON.stringify(task, null, 2),
);
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
DEBUG && console.log('TaskQueue: run anonymous task');
task();
}
} catch (e) {
e.message =
// $FlowFixMe[incompatible-type]
// $FlowFixMe[incompatible-use]
'TaskQueue: Error with task ' + (task.name || '') + ': ' + e.message;
throw e;
}
}
}
_queueStack: Array<{
tasks: Array<Task>,
popable: boolean,
...
}>;
_onMoreTasks: () => void;
_getCurrentQueue(): Array<Task> {
const stackIdx = this._queueStack.length - 1;
const queue = this._queueStack[stackIdx];
if (
queue.popable &&
queue.tasks.length === 0 &&
this._queueStack.length > 1
) {
this._queueStack.pop();
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
DEBUG &&
console.log('TaskQueue: popped queue: ', {
stackIdx,
queueStackSize: this._queueStack.length,
});
return this._getCurrentQueue();
} else {
return queue.tasks;
}
}
_genPromise(task: PromiseTask) {
// Each async task pushes it's own queue onto the queue stack. This
// effectively defers execution of previously queued tasks until the promise
// resolves, at which point we allow the new queue to be popped, which
// happens once it is fully processed.
this._queueStack.push({tasks: [], popable: false});
const stackIdx = this._queueStack.length - 1;
const stackItem = this._queueStack[stackIdx];
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
DEBUG && console.log('TaskQueue: push new queue: ', {stackIdx});
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
DEBUG && console.log('TaskQueue: exec gen task ' + task.name);
task
.gen()
.then(() => {
/* $FlowFixMe[constant-condition] Error discovered during Constant
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
DEBUG &&
console.log('TaskQueue: onThen for gen task ' + task.name, {
stackIdx,
queueStackSize: this._queueStack.length,
});
stackItem.popable = true;
this.hasTasksToProcess() && this._onMoreTasks();
})
.catch(ex => {
setTimeout(() => {
ex.message = `TaskQueue: Error resolving Promise in task ${task.name}: ${ex.message}`;
throw ex;
}, 0);
});
}
}
export default TaskQueue;
@@ -1,342 +0,0 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @noflow
* @format
*/
'use strict';
import type {ReactNativeFeatureFlagsJsOnlyOverrides} from '../../../src/private/featureflags/ReactNativeFeatureFlags';
function importModules(overrides: ReactNativeFeatureFlagsJsOnlyOverrides) {
const ReactNativeFeatureFlags = require('../../../src/private/featureflags/ReactNativeFeatureFlags');
// Make sure to setup overrides before importing any modules.
ReactNativeFeatureFlags.override(overrides);
const BatchedBridge = require('../../BatchedBridge/BatchedBridge').default;
const InteractionManager = require('../InteractionManager').default;
jest.mock('../../vendor/core/ErrorUtils');
jest.mock('../../BatchedBridge/BatchedBridge');
return {
BatchedBridge,
InteractionManager,
};
}
const isWindows = process.platform === 'win32';
const itif = (condition: boolean) => (condition ? it : it.skip);
function expectToBeCalledOnce(
fn: JestMockFn<$ReadOnlyArray<mixed>, mixed>,
): void {
expect(fn.mock.calls.length).toBe(1);
}
describe('InteractionManager', () => {
let InteractionManager;
let interactionStart;
let interactionComplete;
beforeEach(() => {
jest.resetModules();
({InteractionManager} = importModules({
disableInteractionManager: () => false,
}));
interactionStart = jest.fn();
interactionComplete = jest.fn();
InteractionManager.addListener(
InteractionManager.Events.interactionStart,
interactionStart,
);
InteractionManager.addListener(
InteractionManager.Events.interactionComplete,
interactionComplete,
);
});
it('throws when clearing an undefined handle', () => {
// $FlowExpectedError[incompatible-call]
expect(() => InteractionManager.clearInteractionHandle()).toThrow();
});
it('notifies asynchronously when interaction starts', () => {
InteractionManager.createInteractionHandle();
expect(interactionStart).not.toBeCalled();
jest.runAllTimers();
expect(interactionStart).toBeCalled();
expect(interactionComplete).not.toBeCalled();
});
it('notifies asynchronously when interaction stops', () => {
const handle = InteractionManager.createInteractionHandle();
jest.runAllTimers();
interactionStart.mockClear();
InteractionManager.clearInteractionHandle(handle);
expect(interactionComplete).not.toBeCalled();
jest.runAllTimers();
expect(interactionStart).not.toBeCalled();
expect(interactionComplete).toBeCalled();
});
it('does not notify when started & stopped in same event loop', () => {
const handle = InteractionManager.createInteractionHandle();
InteractionManager.clearInteractionHandle(handle);
jest.runAllTimers();
expect(interactionStart).not.toBeCalled();
expect(interactionComplete).not.toBeCalled();
});
it('does not notify when going from two -> one active interactions', () => {
InteractionManager.createInteractionHandle();
const handle = InteractionManager.createInteractionHandle();
jest.runAllTimers();
interactionStart.mockClear();
interactionComplete.mockClear();
InteractionManager.clearInteractionHandle(handle);
jest.runAllTimers();
expect(interactionStart).not.toBeCalled();
expect(interactionComplete).not.toBeCalled();
});
it('runs tasks asynchronously when there are interactions', () => {
const task = jest.fn();
InteractionManager.runAfterInteractions(task);
expect(task).not.toBeCalled();
jest.runAllTimers();
expect(task).toBeCalled();
});
it('runs tasks when interactions complete', () => {
const task = jest.fn();
const handle = InteractionManager.createInteractionHandle();
InteractionManager.runAfterInteractions(task);
jest.runAllTimers();
InteractionManager.clearInteractionHandle(handle);
expect(task).not.toBeCalled();
jest.runAllTimers();
expect(task).toBeCalled();
});
it('does not run tasks twice', () => {
const task1 = jest.fn();
const task2 = jest.fn();
InteractionManager.runAfterInteractions(task1);
jest.runAllTimers();
InteractionManager.runAfterInteractions(task2);
jest.runAllTimers();
expectToBeCalledOnce(task1);
});
it('runs tasks added while processing previous tasks', () => {
const task1 = jest.fn(() => {
InteractionManager.runAfterInteractions(task2);
});
const task2 = jest.fn();
InteractionManager.runAfterInteractions(task1);
expect(task2).not.toBeCalled();
jest.runAllTimers();
expect(task1).toBeCalled();
expect(task2).toBeCalled();
});
it('allows tasks to be cancelled', () => {
const task1 = jest.fn();
const task2 = jest.fn();
const promise1 = InteractionManager.runAfterInteractions(task1);
InteractionManager.runAfterInteractions(task2);
expect(task1).not.toBeCalled();
expect(task2).not.toBeCalled();
promise1.cancel();
jest.runAllTimers();
expect(task1).not.toBeCalled();
expect(task2).toBeCalled();
});
});
describe('promise tasks', () => {
let BatchedBridge;
let InteractionManager;
let sequenceId;
function createSequenceTask(expectedSequenceId: number) {
return jest.fn(() => {
expect(++sequenceId).toBe(expectedSequenceId);
});
}
beforeEach(() => {
jest.resetModules();
({BatchedBridge, InteractionManager} = importModules({
disableInteractionManager: () => false,
}));
sequenceId = 0;
});
it('should run a basic promise task', () => {
const task1 = jest.fn(() => {
expect(++sequenceId).toBe(1);
return new Promise(resolve => resolve());
});
InteractionManager.runAfterInteractions({gen: task1, name: 'gen1'});
jest.runAllTimers();
expectToBeCalledOnce(task1);
});
it('should handle nested promises', () => {
const task1 = jest.fn(() => {
expect(++sequenceId).toBe(1);
return new Promise(resolve => {
InteractionManager.runAfterInteractions({
gen: task2,
name: 'gen2',
}).then(resolve);
});
});
const task2 = jest.fn(() => {
expect(++sequenceId).toBe(2);
return new Promise(resolve => resolve());
});
InteractionManager.runAfterInteractions({gen: task1, name: 'gen1'});
jest.runAllTimers();
expectToBeCalledOnce(task1);
expectToBeCalledOnce(task2);
});
it('should pause promise tasks during interactions then resume', () => {
const task1 = createSequenceTask(1);
const task2 = jest.fn(() => {
expect(++sequenceId).toBe(2);
return new Promise(resolve => {
setTimeout(() => {
InteractionManager.runAfterInteractions(task3).then(resolve);
}, 1);
});
});
const task3 = createSequenceTask(3);
InteractionManager.runAfterInteractions(task1);
InteractionManager.runAfterInteractions({gen: task2, name: 'gen2'});
jest.runOnlyPendingTimers();
expectToBeCalledOnce(task1);
expectToBeCalledOnce(task2);
const handle = InteractionManager.createInteractionHandle();
jest.runAllTimers();
jest.runAllTimers(); // Just to be sure...
expect(task3).not.toBeCalled();
InteractionManager.clearInteractionHandle(handle);
jest.runAllTimers();
expectToBeCalledOnce(task3);
});
it('should execute tasks in loop within deadline', () => {
InteractionManager.setDeadline(100);
BatchedBridge.getEventLoopRunningTime.mockReturnValue(10);
const task1 = createSequenceTask(1);
const task2 = createSequenceTask(2);
InteractionManager.runAfterInteractions(task1);
InteractionManager.runAfterInteractions(task2);
jest.runOnlyPendingTimers();
expectToBeCalledOnce(task1);
expectToBeCalledOnce(task2);
});
it('should execute tasks one at a time if deadline exceeded', () => {
InteractionManager.setDeadline(100);
BatchedBridge.getEventLoopRunningTime.mockReturnValue(200);
const task1 = createSequenceTask(1);
const task2 = createSequenceTask(2);
InteractionManager.runAfterInteractions(task1);
InteractionManager.runAfterInteractions(task2);
jest.runOnlyPendingTimers();
expectToBeCalledOnce(task1);
expect(task2).not.toBeCalled();
jest.runOnlyPendingTimers(); // resolve1
jest.runOnlyPendingTimers(); // task2
expectToBeCalledOnce(task2);
});
const bigAsyncTest = resolveTest => {
jest.useRealTimers();
const task1 = createSequenceTask(1);
const task2 = jest.fn(() => {
expect(++sequenceId).toBe(2);
return new Promise(resolve => {
InteractionManager.runAfterInteractions(task3);
setTimeout(() => {
InteractionManager.runAfterInteractions({
gen: task4,
name: 'gen4',
}).then(resolve);
}, 1);
});
});
const task3 = createSequenceTask(3);
const task4 = jest.fn(() => {
expect(++sequenceId).toBe(4);
return new Promise(resolve => {
InteractionManager.runAfterInteractions(task5).then(resolve);
});
});
const task5 = createSequenceTask(5);
const task6 = createSequenceTask(6);
InteractionManager.runAfterInteractions(task1);
InteractionManager.runAfterInteractions({gen: task2, name: 'gen2'});
InteractionManager.runAfterInteractions(task6);
setTimeout(() => {
expectToBeCalledOnce(task1);
expectToBeCalledOnce(task2);
expectToBeCalledOnce(task3);
expectToBeCalledOnce(task4);
expectToBeCalledOnce(task5);
expectToBeCalledOnce(task6);
resolveTest();
}, 100);
};
itif(!isWindows)(
'resolves async tasks recursively before other queued tasks',
() => {
return new Promise(bigAsyncTest);
},
);
itif(!isWindows)('should also work with a deadline', () => {
InteractionManager.setDeadline(100);
BatchedBridge.getEventLoopRunningTime.mockReturnValue(200);
return new Promise(bigAsyncTest);
});
});
@@ -1,169 +0,0 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @noflow
* @format
*/
'use strict';
const Promise = require('promise');
function expectToBeCalledOnce(fn) {
expect(fn.mock.calls.length).toBe(1);
}
function clearTaskQueue(taskQueue) {
do {
jest.runAllTimers();
taskQueue.processNext();
jest.runAllTimers();
} while (taskQueue.hasTasksToProcess());
}
describe('TaskQueue', () => {
let taskQueue;
let onMoreTasks;
let sequenceId;
function createSequenceTask(expectedSequenceId) {
return jest.fn(() => {
expect(++sequenceId).toBe(expectedSequenceId);
});
}
beforeEach(() => {
jest.resetModules();
onMoreTasks = jest.fn();
const TaskQueue = require('../TaskQueue').default;
taskQueue = new TaskQueue({onMoreTasks});
sequenceId = 0;
});
it('should run a basic task', () => {
const task1 = createSequenceTask(1);
taskQueue.enqueue({run: task1, name: 'run1'});
expect(taskQueue.hasTasksToProcess()).toBe(true);
taskQueue.processNext();
expectToBeCalledOnce(task1);
});
it('should handle blocking promise task', () => {
const task1 = jest.fn(() => {
return new Promise(resolve => {
setTimeout(() => {
expect(++sequenceId).toBe(1);
resolve();
}, 1);
});
});
const task2 = createSequenceTask(2);
taskQueue.enqueue({gen: task1, name: 'gen1'});
taskQueue.enqueue({run: task2, name: 'run2'});
taskQueue.processNext();
expectToBeCalledOnce(task1);
expect(task2).not.toBeCalled();
expect(onMoreTasks).not.toBeCalled();
expect(taskQueue.hasTasksToProcess()).toBe(false);
clearTaskQueue(taskQueue);
expectToBeCalledOnce(onMoreTasks);
expectToBeCalledOnce(task2);
});
it('should handle nested simple tasks', () => {
const task1 = jest.fn(() => {
expect(++sequenceId).toBe(1);
taskQueue.enqueue({run: task3, name: 'run3'});
});
const task2 = createSequenceTask(2);
const task3 = createSequenceTask(3);
taskQueue.enqueue({run: task1, name: 'run1'});
taskQueue.enqueue({run: task2, name: 'run2'}); // not blocked by task 1
clearTaskQueue(taskQueue);
expectToBeCalledOnce(task1);
expectToBeCalledOnce(task2);
expectToBeCalledOnce(task3);
});
it('should handle nested promises', () => {
const task1 = jest.fn(() => {
return new Promise(resolve => {
setTimeout(() => {
expect(++sequenceId).toBe(1);
taskQueue.enqueue({gen: task2, name: 'gen2'});
taskQueue.enqueue({run: resolve, name: 'resolve1'});
}, 1);
});
});
const task2 = jest.fn(() => {
return new Promise(resolve => {
setTimeout(() => {
expect(++sequenceId).toBe(2);
taskQueue.enqueue({run: task3, name: 'run3'});
taskQueue.enqueue({run: resolve, name: 'resolve2'});
}, 1);
});
});
const task3 = createSequenceTask(3);
const task4 = createSequenceTask(4);
taskQueue.enqueue({gen: task1, name: 'gen1'});
taskQueue.enqueue({run: task4, name: 'run4'}); // blocked by task 1 promise
clearTaskQueue(taskQueue);
expectToBeCalledOnce(task1);
expectToBeCalledOnce(task2);
expectToBeCalledOnce(task3);
expectToBeCalledOnce(task4);
});
it('should be able to cancel tasks', () => {
const task1 = jest.fn();
const task2 = createSequenceTask(1);
const task3 = jest.fn();
const task4 = createSequenceTask(2);
taskQueue.enqueue(task1);
taskQueue.enqueue(task2);
taskQueue.enqueue(task3);
taskQueue.enqueue(task4);
taskQueue.cancelTasks([task1, task3]);
clearTaskQueue(taskQueue);
expect(task1).not.toBeCalled();
expect(task3).not.toBeCalled();
expectToBeCalledOnce(task2);
expectToBeCalledOnce(task4);
expect(taskQueue.hasTasksToProcess()).toBe(false);
});
it('should not crash when last task is cancelled', () => {
const task1 = jest.fn();
taskQueue.enqueue(task1);
taskQueue.cancelTasks([task1]);
clearTaskQueue(taskQueue);
expect(task1).not.toBeCalled();
expect(taskQueue.hasTasksToProcess()).toBe(false);
});
it('should not crash when task is cancelled between being started and resolved', () => {
const task1 = jest.fn(() => {
return new Promise(resolve => {
setTimeout(() => {
resolve();
}, 1);
});
});
taskQueue.enqueue({gen: task1, name: 'gen1'});
taskQueue.processNext();
taskQueue.cancelTasks([task1]);
jest.runAllTimers();
});
});
@@ -400,7 +400,6 @@ class XMLHttpRequest extends EventTarget {
if (XMLHttpRequest._profiling) {
console.timeStamp(
'Incremental Data: ' + this._getMeasureURL(),
// $FlowFixMe[extra-arg] Add correct typing for `console.timeStamp`
start,
undefined,
PERFORMANCE_TRACK_NAME,
@@ -455,7 +454,6 @@ class XMLHttpRequest extends EventTarget {
const start = this._startTime;
console.timeStamp(
this._getMeasureURL(),
// $FlowFixMe[extra-arg] Add correct typing for `console.timeStamp`
start,
undefined,
PERFORMANCE_TRACK_NAME,
@@ -10,21 +10,21 @@
import typeof {enable} from 'promise/setimmediate/rejection-tracking';
import LogBox from './LogBox/LogBox';
import ExceptionsManager from './Core/ExceptionsManager';
let rejectionTrackingOptions: $NonMaybeType<Parameters<enable>[0]> = {
allRejections: true,
onUnhandled: (id, rejection = {}) => {
onUnhandled: (id, rejection) => {
let message: string;
let stack: ?string;
// $FlowFixMe[method-unbinding] added when improving typing for this parameters
const stringValue = Object.prototype.toString.call(rejection);
if (stringValue === '[object Error]') {
if (rejection === undefined) {
message = '';
} else if (
// $FlowFixMe[method-unbinding] added when improving typing for this parameters
Object.prototype.toString.call(rejection) === '[object Error]'
) {
// $FlowFixMe[method-unbinding] added when improving typing for this parameters
message = Error.prototype.toString.call(rejection);
const error: Error = (rejection: $FlowFixMe);
stack = error.stack;
} else {
try {
message = require('pretty-format').format(rejection);
@@ -34,37 +34,23 @@ let rejectionTrackingOptions: $NonMaybeType<Parameters<enable>[0]> = {
? rejection
: JSON.stringify((rejection: $FlowFixMe));
}
// It could although this object is not a standard error, it still has stack information to unwind
// $FlowFixMe ignore types just check if stack is there
if (rejection?.stack && typeof rejection.stack === 'string') {
stack = rejection.stack;
}
}
const warning = `Possible unhandled promise rejection (id: ${id}):\n${
message ?? ''
}`;
if (__DEV__) {
LogBox.addLog({
level: 'warn',
message: {
content: warning,
substitutions: [],
ExceptionsManager.handleException(
new Error(
`Uncaught (in promise, id: ${id})${message ? `: "${message}"` : ''}`,
{
cause: rejection,
},
componentStack: [],
componentStackType: null,
stack,
category: 'possible_unhandled_promise_rejection',
});
} else {
console.warn(warning);
}
),
false /* isFatal */,
);
},
onHandled: id => {
const warning =
`Promise rejection handled (id: ${id})\n` +
'This means you can ignore any previous messages of the form ' +
`"Possible unhandled promise rejection (id: ${id}):"`;
`"Uncaught (in promise, id: ${id})"`;
console.warn(warning);
},
};
@@ -24,9 +24,13 @@ using namespace facebook::react;
@end
@implementation RCTPullToRefreshViewComponentView {
BOOL _isBeforeInitialLayout;
UIRefreshControl *_refreshControl;
RCTScrollViewComponentView *__weak _scrollViewComponentView;
// This variable keeps track of whether the view is recycled or not. Once the view is recycled, the component
// creates a new instance of UIRefreshControl, resetting the native props to the default values.
// However, when recycling, we are keeping around the old _props. The flag is used to force the application
// of the current props to the newly created UIRefreshControl the first time that updateProps is called.
BOOL _recycled;
}
- (instancetype)initWithFrame:(CGRect)frame
@@ -36,8 +40,7 @@ using namespace facebook::react;
// attaching and detaching of a pull-to-refresh view to a scroll view.
// The pull-to-refresh view is not a subview of this view.
self.hidden = YES;
_isBeforeInitialLayout = YES;
_recycled = NO;
[self _initializeUIRefreshControl];
}
@@ -63,54 +66,53 @@ using namespace facebook::react;
{
[super prepareForRecycle];
_scrollViewComponentView = nil;
_props = nil;
_isBeforeInitialLayout = YES;
[self _initializeUIRefreshControl];
_recycled = YES;
}
- (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps
{
// Prop updates are ignored by _refreshControl until after the initial layout, so just store them in _props until then
if (_isBeforeInitialLayout) {
_props = std::static_pointer_cast<const PullToRefreshViewProps>(props);
return;
}
const auto &oldConcreteProps = static_cast<const PullToRefreshViewProps &>(*_props);
const auto &newConcreteProps = static_cast<const PullToRefreshViewProps &>(*props);
if (newConcreteProps.tintColor != oldConcreteProps.tintColor) {
if (_recycled || newConcreteProps.tintColor != oldConcreteProps.tintColor) {
_refreshControl.tintColor = RCTUIColorFromSharedColor(newConcreteProps.tintColor);
}
if (newConcreteProps.progressViewOffset != oldConcreteProps.progressViewOffset) {
if (_recycled || newConcreteProps.progressViewOffset != oldConcreteProps.progressViewOffset) {
[self _updateProgressViewOffset:newConcreteProps.progressViewOffset];
}
BOOL needsUpdateTitle = NO;
if (newConcreteProps.title != oldConcreteProps.title) {
if (_recycled || newConcreteProps.title != oldConcreteProps.title) {
needsUpdateTitle = YES;
}
if (newConcreteProps.titleColor != oldConcreteProps.titleColor) {
if (_recycled || newConcreteProps.titleColor != oldConcreteProps.titleColor) {
needsUpdateTitle = YES;
}
[super updateProps:props oldProps:oldProps];
if (needsUpdateTitle) {
if (_recycled || needsUpdateTitle) {
[self _updateTitle];
}
// All prop updates must happen above the call to begin refreshing, or else _refreshControl will ignore the updates
if (newConcreteProps.refreshing != oldConcreteProps.refreshing) {
if (_recycled || newConcreteProps.refreshing != oldConcreteProps.refreshing) {
if (newConcreteProps.refreshing) {
[self beginRefreshingProgrammatically];
} else {
[_refreshControl endRefreshing];
}
}
if (_recycled || newConcreteProps.zIndex != oldConcreteProps.zIndex) {
_refreshControl.layer.zPosition = newConcreteProps.zIndex.value_or(0);
}
_recycled = NO;
}
#pragma mark -
@@ -155,10 +157,12 @@ using namespace facebook::react;
// Attempts to begin refreshing before the initial layout are ignored by _refreshControl. So if the control is
// refreshing when mounted, we need to call beginRefreshing in layoutSubviews or it won't work.
if (_isBeforeInitialLayout) {
_isBeforeInitialLayout = NO;
if (self.window) {
const auto &concreteProps = static_cast<const PullToRefreshViewProps &>(*_props);
[self updateProps:_props oldProps:PullToRefreshViewShadowNode::defaultSharedProps()];
if (concreteProps.refreshing) {
[self beginRefreshingProgrammatically];
}
}
}
@@ -214,11 +218,12 @@ using namespace facebook::react;
// When refreshing programmatically (i.e. without pulling down), we must explicitly adjust the ScrollView content
// offset, or else the _refreshControl won't be visible
UIScrollView *scrollView = _scrollViewComponentView.scrollView;
CGPoint offset = {scrollView.contentOffset.x, scrollView.contentOffset.y - _refreshControl.frame.size.height};
[scrollView setContentOffset:offset];
[_refreshControl beginRefreshing];
if (!_refreshControl.isRefreshing) {
UIScrollView *scrollView = _scrollViewComponentView.scrollView;
CGPoint offset = {scrollView.contentOffset.x, scrollView.contentOffset.y - _refreshControl.frame.size.height};
[scrollView setContentOffset:offset];
[_refreshControl beginRefreshing];
}
}
#pragma mark - Native commands
@@ -112,6 +112,11 @@ RCTSendScrollEventForNativeAnimations_DEPRECATED(UIScrollView *scrollView, NSInt
__weak UIView *_firstVisibleView;
CGFloat _endDraggingSensitivityMultiplier;
// A flag indicating that accessibility API is used.
// It is not restored to the default value in prepareForRecycle.
// Once an accessibility API is used, view culling will be disabled for the entire session.
BOOL _isAccessibilityAPIUsed;
}
+ (RCTScrollViewComponentView *_Nullable)findScrollViewComponentViewForView:(UIView *)view
@@ -134,6 +139,7 @@ RCTSendScrollEventForNativeAnimations_DEPRECATED(UIScrollView *scrollView, NSInt
_isUserTriggeredScrolling = NO;
_shouldUpdateContentInsetAdjustmentBehavior = YES;
_automaticallyAdjustKeyboardInsets = NO;
_isAccessibilityAPIUsed = NO;
[self addSubview:_scrollView];
_containerView = [[UIView alloc] initWithFrame:CGRectZero];
@@ -593,6 +599,38 @@ static inline UIViewAnimationOptions animationOptionsWithCurve(UIViewAnimationCu
return metrics;
}
/**
* When use of accessibility APIs is detected, view culling is disabled to make accessibility work correctly.
*/
- (void)_disableViewCullingIfNecessary
{
if (!_isAccessibilityAPIUsed) {
_isAccessibilityAPIUsed = YES;
[self _updateStateWithContentOffset];
}
}
- (NSInteger)accessibilityElementCount
{
// From empirical testing, method `accessibilityElementCount` is called lazily only
// when accessibility is used.
// Why we don't use UIAccessibilitySwitchControlStatusDidChangeNotification and
// UIAccessibilityVoiceOverStatusDidChangeNotification? The notifications are not called when using Accessibility
// Inspector. We anticipate developers will want to debug accessbility with Accessibility Inspector and don't want to
// break that developer workflow with view culling. Therefore, we are using API use detection to disable view culling
// instead of the notifications.
[self _disableViewCullingIfNecessary];
return [super accessibilityElementCount];
}
- (NSArray<id<UIFocusItem>> *)focusItemsInRect:(CGRect)rect
{
// From empirical testing, method `focusItemsInRect:` is called lazily only
// when keyboard navigation is used.
[self _disableViewCullingIfNecessary];
return [super focusItemsInRect:rect];
}
- (void)_updateStateWithContentOffset
{
if (!_state) {
@@ -600,17 +638,23 @@ static inline UIViewAnimationOptions animationOptionsWithCurve(UIViewAnimationCu
}
auto contentOffset = RCTPointFromCGPoint(_scrollView.contentOffset);
BOOL isAccessibilityAPIUsed = _isAccessibilityAPIUsed;
_state->updateState(
[contentOffset](
[contentOffset, isAccessibilityAPIUsed](
const ScrollViewShadowNode::ConcreteState::Data &oldData) -> ScrollViewShadowNode::ConcreteState::SharedData {
if (oldData.contentOffset == contentOffset) {
// avoid doing a state update if content offset didn't change.
if (oldData.contentOffset == contentOffset && oldData.disableViewCulling == isAccessibilityAPIUsed) {
// avoid doing a state update if content offset and use of accessibility didn't change.
return nullptr;
}
auto newData = oldData;
newData.contentOffset = contentOffset;
newData.disableViewCulling =
UIAccessibilityIsVoiceOverRunning() || UIAccessibilityIsSwitchControlRunning() || isAccessibilityAPIUsed;
return std::make_shared<const ScrollViewShadowNode::ConcreteState::Data>(newData);
});
},
ReactNativeFeatureFlags::enableImmediateUpdateModeForContentOffsetChanges()
? EventQueue::UpdateMode::unstable_Immediate
: EventQueue::UpdateMode::Asynchronous);
}
- (void)prepareForRecycle
@@ -9,7 +9,6 @@
#import "RCTParagraphComponentAccessibilityProvider.h"
#import <MobileCoreServices/UTCoreTypes.h>
#import <React/RCTViewAccessibilityElement.h>
#import <react/renderer/components/text/ParagraphComponentDescriptor.h>
#import <react/renderer/components/text/ParagraphProps.h>
#import <react/renderer/components/text/ParagraphState.h>
@@ -227,10 +226,6 @@ using namespace facebook::react;
for (NSObject *element in elements) {
if ([element isKindOfClass:[UIView class]] && [cooptingCandidates containsObject:((UIView *)element)]) {
return YES;
} else if (
[element isKindOfClass:[RCTViewAccessibilityElement class]] &&
[cooptingCandidates containsObject:((RCTViewAccessibilityElement *)element).view]) {
return YES;
}
}
}
@@ -1,28 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import "RCTViewComponentView.h"
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
/*
* A UIAcccessibilityElement representing a RCTViewComponentView from an
* accessibility standpoint. This enables RCTViewComponentView's to reference
* themselves in `accessibilityElements` without actually being an accessibility
* element. If it were, then iOS would not call into `accessibilityElements`.
*/
@interface RCTViewAccessibilityElement : UIAccessibilityElement
@property (readonly) RCTViewComponentView *view;
- (instancetype)initWithView:(RCTViewComponentView *)view;
@end
NS_ASSUME_NONNULL_END
@@ -1,83 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import "RCTViewAccessibilityElement.h"
@implementation RCTViewAccessibilityElement
- (instancetype)initWithView:(RCTViewComponentView *)view
{
if (self = [super initWithAccessibilityContainer:view]) {
_view = view;
}
return self;
}
- (CGRect)accessibilityFrame
{
return UIAccessibilityConvertFrameToScreenCoordinates(_view.bounds, _view);
}
#pragma mark - Forwarding to _view
- (NSString *)accessibilityLabel
{
return _view.accessibilityLabel;
}
- (NSString *)accessibilityValue
{
return _view.accessibilityValue;
}
- (UIAccessibilityTraits)accessibilityTraits
{
return _view.accessibilityTraits;
}
- (NSString *)accessibilityHint
{
return _view.accessibilityHint;
}
- (BOOL)accessibilityIgnoresInvertColors
{
return _view.accessibilityIgnoresInvertColors;
}
- (BOOL)shouldGroupAccessibilityChildren
{
return _view.shouldGroupAccessibilityChildren;
}
- (NSArray<UIAccessibilityCustomAction *> *)accessibilityCustomActions
{
return _view.accessibilityCustomActions;
}
- (NSString *)accessibilityLanguage
{
return _view.accessibilityLanguage;
}
- (BOOL)accessibilityViewIsModal
{
return _view.accessibilityViewIsModal;
}
- (BOOL)accessibilityElementsHidden
{
return _view.accessibilityElementsHidden;
}
- (BOOL)accessibilityRespondsToUserInteraction
{
return _view.accessibilityRespondsToUserInteraction;
}
@end
@@ -6,7 +6,6 @@
*/
#import "RCTViewComponentView.h"
#import "RCTViewAccessibilityElement.h"
#import <CoreGraphics/CoreGraphics.h>
#import <QuartzCore/QuartzCore.h>
@@ -51,8 +50,6 @@ const CGFloat BACKGROUND_COLOR_ZPOSITION = -1024.0f;
UIView *_containerView;
BOOL _useCustomContainerView;
NSMutableSet<NSString *> *_accessibilityOrderNativeIDs;
NSMutableArray<NSObject *> *_accessibilityElements;
RCTViewAccessibilityElement *_axElementDescribingSelf;
}
#ifdef RCT_DYNAMIC_FRAMEWORKS
@@ -405,7 +402,11 @@ const CGFloat BACKGROUND_COLOR_ZPOSITION = -1024.0f;
[_accessibilityOrderNativeIDs addObject:RCTNSStringFromString(childId)];
}
_accessibilityElements = [NSMutableArray new];
// If we are prop updating and have children we can go ahead and assign this prop.
// Otherwise, we might not have children attached yet and need to wait before then.
if (self.currentContainerView.subviews.count > 0) {
[self updateAccessibilityElements];
}
}
// `accessibilityTraits`
@@ -617,7 +618,6 @@ const CGFloat BACKGROUND_COLOR_ZPOSITION = -1024.0f;
_isJSResponder = NO;
_removeClippedSubviews = NO;
_reactSubviews = [NSMutableArray new];
_accessibilityElements = [NSMutableArray new];
}
- (void)setPropKeysManagedByAnimated_DO_NOT_USE_THIS_IS_BROKEN:(NSSet<NSString *> *_Nullable)props
@@ -1149,43 +1149,37 @@ static RCTBorderStyle RCTBorderStyleFromOutlineStyle(OutlineStyle outlineStyle)
return self;
}
- (NSArray<NSObject *> *)accessibilityElements
- (void)didMoveToSuperview
{
if ([_accessibilityOrderNativeIDs count] <= 0) {
return super.accessibilityElements;
// At this point we are guaranteed to have subviews, if we are going to have them
if (ReactNativeFeatureFlags::enableAccessibilityOrder()) {
[self updateAccessibilityElements];
}
}
// TODO: Currently this ignores changes to descendant nativeID's. While that should rarely, if ever happen, it's an
// edge case we should address. Currently this fixes some app deaths so landing this without addressing that edge case
// for now.
if ([_accessibilityElements count] > 0) {
return _accessibilityElements;
- (void)updateAccessibilityElements
{
if ([_accessibilityOrderNativeIDs count] == 0) {
self.accessibilityElements = nil;
return;
}
NSMutableDictionary<NSString *, UIView *> *nativeIdToView = [NSMutableDictionary new];
[RCTViewComponentView collectAccessibilityElements:self
intoDictionary:nativeIdToView
nativeIds:_accessibilityOrderNativeIDs];
for (auto childId : _props->accessibilityOrder) {
NSMutableArray *accessibilityElements = [NSMutableArray new];
for (const auto &childId : _props->accessibilityOrder) {
NSString *nsStringChildId = RCTNSStringFromString(childId);
// Special case to allow for self-referencing with accessibilityOrder
if ([nsStringChildId isEqualToString:self.nativeId]) {
if (!_axElementDescribingSelf) {
_axElementDescribingSelf = [[RCTViewAccessibilityElement alloc] initWithView:self];
}
_axElementDescribingSelf.isAccessibilityElement = [super isAccessibilityElement];
[_accessibilityElements addObject:_axElementDescribingSelf];
} else {
UIView *viewWithMatchingNativeId = [nativeIdToView objectForKey:nsStringChildId];
if (viewWithMatchingNativeId) {
[_accessibilityElements addObject:viewWithMatchingNativeId];
}
UIView *viewWithMatchingNativeId = [nativeIdToView objectForKey:nsStringChildId];
if (viewWithMatchingNativeId != nil) {
[accessibilityElements addObject:viewWithMatchingNativeId];
}
}
return _accessibilityElements;
self.accessibilityElements = accessibilityElements;
}
+ (void)collectAccessibilityElements:(UIView *)view
@@ -1252,13 +1246,6 @@ static NSString *RCTRecursiveAccessibilityLabel(UIView *view)
return self.contentView.isAccessibilityElement;
}
// If we reference ourselves in accessibilityOrder then we will make a
// UIAccessibilityElement object to represent ourselves since returning YES
// here would mean iOS would not call into accessibilityElements
if ([_accessibilityOrderNativeIDs containsObject:self.nativeId]) {
return NO;
}
return [super isAccessibilityElement];
}
@@ -31,8 +31,8 @@ public abstract class com/facebook/react/HeadlessJsTaskService : android/app/Ser
public fun <init> ()V
public static final fun acquireWakeLockNow (Landroid/content/Context;)V
protected final fun getReactContext ()Lcom/facebook/react/bridge/ReactContext;
protected final fun getReactHost ()Lcom/facebook/react/ReactHost;
protected final fun getReactNativeHost ()Lcom/facebook/react/ReactNativeHost;
protected fun getReactHost ()Lcom/facebook/react/ReactHost;
protected fun getReactNativeHost ()Lcom/facebook/react/ReactNativeHost;
protected fun getTaskConfig (Landroid/content/Intent;)Lcom/facebook/react/jstasks/HeadlessJsTaskConfig;
public fun onBind (Landroid/content/Intent;)Landroid/os/IBinder;
public fun onDestroy ()V
@@ -19,6 +19,7 @@ plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.download)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.ktfmt)
}
version = project.findProperty("VERSION_NAME")?.toString()!!
@@ -620,6 +621,7 @@ dependencies {
api(libs.androidx.autofill)
api(libs.androidx.swiperefreshlayout)
api(libs.androidx.tracing)
api(libs.androidx.window)
api(libs.fbjni)
api(libs.fresco)
@@ -113,7 +113,7 @@ public abstract class HeadlessJsTaskService : Service(), HeadlessJsTaskEventList
* somewhere.
*/
@Suppress("DEPRECATION")
protected val reactNativeHost: ReactNativeHost
protected open val reactNativeHost: ReactNativeHost
get() = (application as ReactApplication).reactNativeHost
/**
@@ -121,7 +121,7 @@ public abstract class HeadlessJsTaskService : Service(), HeadlessJsTaskEventList
* [ReactApplication] and calls [ReactApplication.reactHost]. This method assumes it is called in
* new architecture and returns null if not.
*/
protected val reactHost: ReactHost?
protected open val reactHost: ReactHost?
get() = (application as ReactApplication).reactHost
protected val reactContext: ReactContext?
@@ -135,6 +135,10 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
private void init() {
setRootViewTag(ReactRootViewTagGenerator.getNextRootViewTag());
setClipChildren(false);
if (ReactNativeFeatureFlags.enableFontScaleChangesUpdatingLayout()) {
DisplayMetricsHolder.initDisplayMetrics(getContext().getApplicationContext());
}
}
@Override
@@ -865,7 +869,7 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
private int mDeviceRotation = 0;
/* package */ CustomGlobalLayoutListener() {
DisplayMetricsHolder.initDisplayMetricsIfNotInitialized(getContext().getApplicationContext());
DisplayMetricsHolder.initDisplayMetricsIfNotInitialized(getContext());
mVisibleViewArea = new Rect();
mMinKeyboardHeightDetected = (int) PixelUtil.toPixelFromDIP(60);
}
@@ -988,7 +992,7 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
return;
}
mDeviceRotation = rotation;
DisplayMetricsHolder.initDisplayMetrics(getContext().getApplicationContext());
DisplayMetricsHolder.initDisplayMetrics(getContext());
emitOrientationChanged(rotation);
}
@@ -8,6 +8,7 @@
package com.facebook.react.bridge
import com.facebook.proguard.annotations.DoNotStrip
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags
import java.util.ArrayList
import java.util.Arrays
import kotlin.jvm.JvmStatic
@@ -65,9 +66,16 @@ public open class ReadableNativeArray protected constructor() : NativeArray(), R
if (other !is ReadableNativeArray) {
return false
}
return localArray.contentDeepEquals(other.localArray)
return if (ReactNativeFeatureFlags.useNativeEqualsInNativeReadableArrayAndroid()) {
nativeEquals(other)
} else {
localArray.contentDeepEquals(other.localArray)
}
}
private external fun nativeEquals(other: ReadableNativeArray): Boolean
override fun toArrayList(): ArrayList<Any?> {
val arrayList = ArrayList<Any?>()
repeat(size()) { i ->
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<64faf70fad18019fc27e77681ff41d05>>
* @generated SignedSource<<a90efac589511beb130c499e51150de8>>
*/
/**
@@ -54,6 +54,12 @@ public object ReactNativeFeatureFlags {
@JvmStatic
public fun disableMountItemReorderingAndroid(): Boolean = accessor.disableMountItemReorderingAndroid()
/**
* Disable some workarounds for old Android versions in TextLayoutManager logic for retrieving attachment metrics
*/
@JvmStatic
public fun disableOldAndroidAttachmentMetricsWorkarounds(): Boolean = accessor.disableOldAndroidAttachmentMetricsWorkarounds()
/**
* Turns off the global measurement cache used by TextLayoutManager on Android.
*/
@@ -156,6 +162,12 @@ public object ReactNativeFeatureFlags {
@JvmStatic
public fun enableIOSViewClipToPaddingBox(): Boolean = accessor.enableIOSViewClipToPaddingBox()
/**
* Dispatches state updates for content offset changes synchronously on the main thread.
*/
@JvmStatic
public fun enableImmediateUpdateModeForContentOffsetChanges(): Boolean = accessor.enableImmediateUpdateModeForContentOffsetChanges()
/**
* This is to fix the issue with interop view manager where component descriptor lookup is causing ViewManager to preload.
*/
@@ -222,12 +234,6 @@ public object ReactNativeFeatureFlags {
@JvmStatic
public fun enableResourceTimingAPI(): Boolean = accessor.enableResourceTimingAPI()
/**
* Dispatches state updates synchronously in Fabric (e.g.: updates the scroll position in the shadow tree synchronously from the main thread).
*/
@JvmStatic
public fun enableSynchronousStateUpdates(): Boolean = accessor.enableSynchronousStateUpdates()
/**
* Enables View Culling: as soon as a view goes off screen, it can be reused anywhere in the UI and pieced together with other items to create new UI elements.
*/
@@ -300,12 +306,24 @@ public object ReactNativeFeatureFlags {
@JvmStatic
public fun preparedTextCacheSize(): Double = accessor.preparedTextCacheSize()
/**
* Enables a new mechanism in ShadowTree to prevent problems caused by multiple threads trying to commit concurrently. If a thread tries to commit a few times unsuccessfully, it will acquire a lock and try again.
*/
@JvmStatic
public fun preventShadowTreeCommitExhaustionWithLocking(): Boolean = accessor.preventShadowTreeCommitExhaustionWithLocking()
/**
* Releases the cached image data when it is consumed by the observers.
*/
@JvmStatic
public fun releaseImageDataWhenConsumed(): Boolean = accessor.releaseImageDataWhenConsumed()
/**
* Skip activity identity assertion in ReactHostImpl::onHostPause()
*/
@JvmStatic
public fun skipActivityIdentityAssertionOnHostPause(): Boolean = accessor.skipActivityIdentityAssertionOnHostPause()
/**
* Enables storing js caller stack when creating promise in native module. This is useful in case of Promise rejection and tracing the cause.
*/
@@ -330,6 +348,18 @@ public object ReactNativeFeatureFlags {
@JvmStatic
public fun useFabricInterop(): Boolean = accessor.useFabricInterop()
/**
* Use a native implementation of equals in NativeReadableArray.
*/
@JvmStatic
public fun useNativeEqualsInNativeReadableArrayAndroid(): Boolean = accessor.useNativeEqualsInNativeReadableArrayAndroid()
/**
* Use a native implementation of TransformHelper
*/
@JvmStatic
public fun useNativeTransformHelperAndroid(): Boolean = accessor.useNativeTransformHelperAndroid()
/**
* When enabled, the native view configs are used in bridgeless mode.
*/
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<d09b78184190ec69fcaa937031cd7f04>>
* @generated SignedSource<<b32f66fb09971e786dd1380bbf417720>>
*/
/**
@@ -24,6 +24,7 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
private var cxxNativeAnimatedEnabledCache: Boolean? = null
private var cxxNativeAnimatedRemoveJsSyncCache: Boolean? = null
private var disableMountItemReorderingAndroidCache: Boolean? = null
private var disableOldAndroidAttachmentMetricsWorkaroundsCache: Boolean? = null
private var disableTextLayoutManagerCacheAndroidCache: Boolean? = null
private var enableAccessibilityOrderCache: Boolean? = null
private var enableAccumulatedUpdatesInRawPropsAndroidCache: Boolean? = null
@@ -41,6 +42,7 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
private var enableFontScaleChangesUpdatingLayoutCache: Boolean? = null
private var enableIOSTextBaselineOffsetPerLineCache: Boolean? = null
private var enableIOSViewClipToPaddingBoxCache: Boolean? = null
private var enableImmediateUpdateModeForContentOffsetChangesCache: Boolean? = null
private var enableInteropViewManagerClassLookUpOptimizationIOSCache: Boolean? = null
private var enableLayoutAnimationsOnAndroidCache: Boolean? = null
private var enableLayoutAnimationsOnIOSCache: Boolean? = null
@@ -52,7 +54,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
private var enablePreparedTextLayoutCache: Boolean? = null
private var enablePropsUpdateReconciliationAndroidCache: Boolean? = null
private var enableResourceTimingAPICache: Boolean? = null
private var enableSynchronousStateUpdatesCache: Boolean? = null
private var enableViewCullingCache: Boolean? = null
private var enableViewRecyclingCache: Boolean? = null
private var enableViewRecyclingForTextCache: Boolean? = null
@@ -65,11 +66,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
private var fuseboxNetworkInspectionEnabledCache: Boolean? = null
private var hideOffscreenVirtualViewsOnIOSCache: Boolean? = null
private var preparedTextCacheSizeCache: Double? = null
private var preventShadowTreeCommitExhaustionWithLockingCache: Boolean? = null
private var releaseImageDataWhenConsumedCache: Boolean? = null
private var skipActivityIdentityAssertionOnHostPauseCache: Boolean? = null
private var traceTurboModulePromiseRejectionsOnAndroidCache: Boolean? = null
private var updateRuntimeShadowNodeReferencesOnCommitCache: Boolean? = null
private var useAlwaysAvailableJSErrorHandlingCache: Boolean? = null
private var useFabricInteropCache: Boolean? = null
private var useNativeEqualsInNativeReadableArrayAndroidCache: Boolean? = null
private var useNativeTransformHelperAndroidCache: Boolean? = null
private var useNativeViewConfigsInBridgelessModeCache: Boolean? = null
private var useOptimizedEventBatchingOnAndroidCache: Boolean? = null
private var useRawPropsJsiValueCache: Boolean? = null
@@ -114,6 +119,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
return cached
}
override fun disableOldAndroidAttachmentMetricsWorkarounds(): Boolean {
var cached = disableOldAndroidAttachmentMetricsWorkaroundsCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.disableOldAndroidAttachmentMetricsWorkarounds()
disableOldAndroidAttachmentMetricsWorkaroundsCache = cached
}
return cached
}
override fun disableTextLayoutManagerCacheAndroid(): Boolean {
var cached = disableTextLayoutManagerCacheAndroidCache
if (cached == null) {
@@ -267,6 +281,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
return cached
}
override fun enableImmediateUpdateModeForContentOffsetChanges(): Boolean {
var cached = enableImmediateUpdateModeForContentOffsetChangesCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.enableImmediateUpdateModeForContentOffsetChanges()
enableImmediateUpdateModeForContentOffsetChangesCache = cached
}
return cached
}
override fun enableInteropViewManagerClassLookUpOptimizationIOS(): Boolean {
var cached = enableInteropViewManagerClassLookUpOptimizationIOSCache
if (cached == null) {
@@ -366,15 +389,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
return cached
}
override fun enableSynchronousStateUpdates(): Boolean {
var cached = enableSynchronousStateUpdatesCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.enableSynchronousStateUpdates()
enableSynchronousStateUpdatesCache = cached
}
return cached
}
override fun enableViewCulling(): Boolean {
var cached = enableViewCullingCache
if (cached == null) {
@@ -483,6 +497,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
return cached
}
override fun preventShadowTreeCommitExhaustionWithLocking(): Boolean {
var cached = preventShadowTreeCommitExhaustionWithLockingCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.preventShadowTreeCommitExhaustionWithLocking()
preventShadowTreeCommitExhaustionWithLockingCache = cached
}
return cached
}
override fun releaseImageDataWhenConsumed(): Boolean {
var cached = releaseImageDataWhenConsumedCache
if (cached == null) {
@@ -492,6 +515,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
return cached
}
override fun skipActivityIdentityAssertionOnHostPause(): Boolean {
var cached = skipActivityIdentityAssertionOnHostPauseCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.skipActivityIdentityAssertionOnHostPause()
skipActivityIdentityAssertionOnHostPauseCache = cached
}
return cached
}
override fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean {
var cached = traceTurboModulePromiseRejectionsOnAndroidCache
if (cached == null) {
@@ -528,6 +560,24 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
return cached
}
override fun useNativeEqualsInNativeReadableArrayAndroid(): Boolean {
var cached = useNativeEqualsInNativeReadableArrayAndroidCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.useNativeEqualsInNativeReadableArrayAndroid()
useNativeEqualsInNativeReadableArrayAndroidCache = cached
}
return cached
}
override fun useNativeTransformHelperAndroid(): Boolean {
var cached = useNativeTransformHelperAndroidCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.useNativeTransformHelperAndroid()
useNativeTransformHelperAndroidCache = cached
}
return cached
}
override fun useNativeViewConfigsInBridgelessMode(): Boolean {
var cached = useNativeViewConfigsInBridgelessModeCache
if (cached == null) {
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<b9aa0387de9705e781bac7e522461224>>
* @generated SignedSource<<d1da48f826bc6a1793d1630cb89cb5c1>>
*/
/**
@@ -36,6 +36,8 @@ public object ReactNativeFeatureFlagsCxxInterop {
@DoNotStrip @JvmStatic public external fun disableMountItemReorderingAndroid(): Boolean
@DoNotStrip @JvmStatic public external fun disableOldAndroidAttachmentMetricsWorkarounds(): Boolean
@DoNotStrip @JvmStatic public external fun disableTextLayoutManagerCacheAndroid(): Boolean
@DoNotStrip @JvmStatic public external fun enableAccessibilityOrder(): Boolean
@@ -70,6 +72,8 @@ public object ReactNativeFeatureFlagsCxxInterop {
@DoNotStrip @JvmStatic public external fun enableIOSViewClipToPaddingBox(): Boolean
@DoNotStrip @JvmStatic public external fun enableImmediateUpdateModeForContentOffsetChanges(): Boolean
@DoNotStrip @JvmStatic public external fun enableInteropViewManagerClassLookUpOptimizationIOS(): Boolean
@DoNotStrip @JvmStatic public external fun enableLayoutAnimationsOnAndroid(): Boolean
@@ -92,8 +96,6 @@ public object ReactNativeFeatureFlagsCxxInterop {
@DoNotStrip @JvmStatic public external fun enableResourceTimingAPI(): Boolean
@DoNotStrip @JvmStatic public external fun enableSynchronousStateUpdates(): Boolean
@DoNotStrip @JvmStatic public external fun enableViewCulling(): Boolean
@DoNotStrip @JvmStatic public external fun enableViewRecycling(): Boolean
@@ -118,8 +120,12 @@ public object ReactNativeFeatureFlagsCxxInterop {
@DoNotStrip @JvmStatic public external fun preparedTextCacheSize(): Double
@DoNotStrip @JvmStatic public external fun preventShadowTreeCommitExhaustionWithLocking(): Boolean
@DoNotStrip @JvmStatic public external fun releaseImageDataWhenConsumed(): Boolean
@DoNotStrip @JvmStatic public external fun skipActivityIdentityAssertionOnHostPause(): Boolean
@DoNotStrip @JvmStatic public external fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean
@DoNotStrip @JvmStatic public external fun updateRuntimeShadowNodeReferencesOnCommit(): Boolean
@@ -128,6 +134,10 @@ public object ReactNativeFeatureFlagsCxxInterop {
@DoNotStrip @JvmStatic public external fun useFabricInterop(): Boolean
@DoNotStrip @JvmStatic public external fun useNativeEqualsInNativeReadableArrayAndroid(): Boolean
@DoNotStrip @JvmStatic public external fun useNativeTransformHelperAndroid(): Boolean
@DoNotStrip @JvmStatic public external fun useNativeViewConfigsInBridgelessMode(): Boolean
@DoNotStrip @JvmStatic public external fun useOptimizedEventBatchingOnAndroid(): Boolean
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<fdcaa94192d003c28fa3a1d538fc859c>>
* @generated SignedSource<<c5ed8a904dcda7ade87527233b879b92>>
*/
/**
@@ -31,6 +31,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
override fun disableMountItemReorderingAndroid(): Boolean = false
override fun disableOldAndroidAttachmentMetricsWorkarounds(): Boolean = true
override fun disableTextLayoutManagerCacheAndroid(): Boolean = false
override fun enableAccessibilityOrder(): Boolean = false
@@ -65,6 +67,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
override fun enableIOSViewClipToPaddingBox(): Boolean = false
override fun enableImmediateUpdateModeForContentOffsetChanges(): Boolean = false
override fun enableInteropViewManagerClassLookUpOptimizationIOS(): Boolean = false
override fun enableLayoutAnimationsOnAndroid(): Boolean = false
@@ -87,8 +91,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
override fun enableResourceTimingAPI(): Boolean = false
override fun enableSynchronousStateUpdates(): Boolean = false
override fun enableViewCulling(): Boolean = false
override fun enableViewRecycling(): Boolean = false
@@ -99,7 +101,7 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
override fun enableVirtualViewDebugFeatures(): Boolean = false
override fun enableVirtualViewRenderState(): Boolean = false
override fun enableVirtualViewRenderState(): Boolean = true
override fun enableVirtualViewWindowFocusDetection(): Boolean = false
@@ -113,8 +115,12 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
override fun preparedTextCacheSize(): Double = 200.0
override fun preventShadowTreeCommitExhaustionWithLocking(): Boolean = false
override fun releaseImageDataWhenConsumed(): Boolean = false
override fun skipActivityIdentityAssertionOnHostPause(): Boolean = false
override fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean = false
override fun updateRuntimeShadowNodeReferencesOnCommit(): Boolean = false
@@ -123,6 +129,10 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
override fun useFabricInterop(): Boolean = true
override fun useNativeEqualsInNativeReadableArrayAndroid(): Boolean = false
override fun useNativeTransformHelperAndroid(): Boolean = false
override fun useNativeViewConfigsInBridgelessMode(): Boolean = false
override fun useOptimizedEventBatchingOnAndroid(): Boolean = false
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<d645897d5c2e27e7de611605686d8413>>
* @generated SignedSource<<23605f090bfbebe911caa9d3d834d3e8>>
*/
/**
@@ -28,6 +28,7 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
private var cxxNativeAnimatedEnabledCache: Boolean? = null
private var cxxNativeAnimatedRemoveJsSyncCache: Boolean? = null
private var disableMountItemReorderingAndroidCache: Boolean? = null
private var disableOldAndroidAttachmentMetricsWorkaroundsCache: Boolean? = null
private var disableTextLayoutManagerCacheAndroidCache: Boolean? = null
private var enableAccessibilityOrderCache: Boolean? = null
private var enableAccumulatedUpdatesInRawPropsAndroidCache: Boolean? = null
@@ -45,6 +46,7 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
private var enableFontScaleChangesUpdatingLayoutCache: Boolean? = null
private var enableIOSTextBaselineOffsetPerLineCache: Boolean? = null
private var enableIOSViewClipToPaddingBoxCache: Boolean? = null
private var enableImmediateUpdateModeForContentOffsetChangesCache: Boolean? = null
private var enableInteropViewManagerClassLookUpOptimizationIOSCache: Boolean? = null
private var enableLayoutAnimationsOnAndroidCache: Boolean? = null
private var enableLayoutAnimationsOnIOSCache: Boolean? = null
@@ -56,7 +58,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
private var enablePreparedTextLayoutCache: Boolean? = null
private var enablePropsUpdateReconciliationAndroidCache: Boolean? = null
private var enableResourceTimingAPICache: Boolean? = null
private var enableSynchronousStateUpdatesCache: Boolean? = null
private var enableViewCullingCache: Boolean? = null
private var enableViewRecyclingCache: Boolean? = null
private var enableViewRecyclingForTextCache: Boolean? = null
@@ -69,11 +70,15 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
private var fuseboxNetworkInspectionEnabledCache: Boolean? = null
private var hideOffscreenVirtualViewsOnIOSCache: Boolean? = null
private var preparedTextCacheSizeCache: Double? = null
private var preventShadowTreeCommitExhaustionWithLockingCache: Boolean? = null
private var releaseImageDataWhenConsumedCache: Boolean? = null
private var skipActivityIdentityAssertionOnHostPauseCache: Boolean? = null
private var traceTurboModulePromiseRejectionsOnAndroidCache: Boolean? = null
private var updateRuntimeShadowNodeReferencesOnCommitCache: Boolean? = null
private var useAlwaysAvailableJSErrorHandlingCache: Boolean? = null
private var useFabricInteropCache: Boolean? = null
private var useNativeEqualsInNativeReadableArrayAndroidCache: Boolean? = null
private var useNativeTransformHelperAndroidCache: Boolean? = null
private var useNativeViewConfigsInBridgelessModeCache: Boolean? = null
private var useOptimizedEventBatchingOnAndroidCache: Boolean? = null
private var useRawPropsJsiValueCache: Boolean? = null
@@ -122,6 +127,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
return cached
}
override fun disableOldAndroidAttachmentMetricsWorkarounds(): Boolean {
var cached = disableOldAndroidAttachmentMetricsWorkaroundsCache
if (cached == null) {
cached = currentProvider.disableOldAndroidAttachmentMetricsWorkarounds()
accessedFeatureFlags.add("disableOldAndroidAttachmentMetricsWorkarounds")
disableOldAndroidAttachmentMetricsWorkaroundsCache = cached
}
return cached
}
override fun disableTextLayoutManagerCacheAndroid(): Boolean {
var cached = disableTextLayoutManagerCacheAndroidCache
if (cached == null) {
@@ -292,6 +307,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
return cached
}
override fun enableImmediateUpdateModeForContentOffsetChanges(): Boolean {
var cached = enableImmediateUpdateModeForContentOffsetChangesCache
if (cached == null) {
cached = currentProvider.enableImmediateUpdateModeForContentOffsetChanges()
accessedFeatureFlags.add("enableImmediateUpdateModeForContentOffsetChanges")
enableImmediateUpdateModeForContentOffsetChangesCache = cached
}
return cached
}
override fun enableInteropViewManagerClassLookUpOptimizationIOS(): Boolean {
var cached = enableInteropViewManagerClassLookUpOptimizationIOSCache
if (cached == null) {
@@ -402,16 +427,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
return cached
}
override fun enableSynchronousStateUpdates(): Boolean {
var cached = enableSynchronousStateUpdatesCache
if (cached == null) {
cached = currentProvider.enableSynchronousStateUpdates()
accessedFeatureFlags.add("enableSynchronousStateUpdates")
enableSynchronousStateUpdatesCache = cached
}
return cached
}
override fun enableViewCulling(): Boolean {
var cached = enableViewCullingCache
if (cached == null) {
@@ -532,6 +547,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
return cached
}
override fun preventShadowTreeCommitExhaustionWithLocking(): Boolean {
var cached = preventShadowTreeCommitExhaustionWithLockingCache
if (cached == null) {
cached = currentProvider.preventShadowTreeCommitExhaustionWithLocking()
accessedFeatureFlags.add("preventShadowTreeCommitExhaustionWithLocking")
preventShadowTreeCommitExhaustionWithLockingCache = cached
}
return cached
}
override fun releaseImageDataWhenConsumed(): Boolean {
var cached = releaseImageDataWhenConsumedCache
if (cached == null) {
@@ -542,6 +567,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
return cached
}
override fun skipActivityIdentityAssertionOnHostPause(): Boolean {
var cached = skipActivityIdentityAssertionOnHostPauseCache
if (cached == null) {
cached = currentProvider.skipActivityIdentityAssertionOnHostPause()
accessedFeatureFlags.add("skipActivityIdentityAssertionOnHostPause")
skipActivityIdentityAssertionOnHostPauseCache = cached
}
return cached
}
override fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean {
var cached = traceTurboModulePromiseRejectionsOnAndroidCache
if (cached == null) {
@@ -582,6 +617,26 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
return cached
}
override fun useNativeEqualsInNativeReadableArrayAndroid(): Boolean {
var cached = useNativeEqualsInNativeReadableArrayAndroidCache
if (cached == null) {
cached = currentProvider.useNativeEqualsInNativeReadableArrayAndroid()
accessedFeatureFlags.add("useNativeEqualsInNativeReadableArrayAndroid")
useNativeEqualsInNativeReadableArrayAndroidCache = cached
}
return cached
}
override fun useNativeTransformHelperAndroid(): Boolean {
var cached = useNativeTransformHelperAndroidCache
if (cached == null) {
cached = currentProvider.useNativeTransformHelperAndroid()
accessedFeatureFlags.add("useNativeTransformHelperAndroid")
useNativeTransformHelperAndroidCache = cached
}
return cached
}
override fun useNativeViewConfigsInBridgelessMode(): Boolean {
var cached = useNativeViewConfigsInBridgelessModeCache
if (cached == null) {
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<8168412a7d792853fa19e10a621012c4>>
* @generated SignedSource<<780793412b76f101be1569d7a866c435>>
*/
/**
@@ -31,6 +31,8 @@ public interface ReactNativeFeatureFlagsProvider {
@DoNotStrip public fun disableMountItemReorderingAndroid(): Boolean
@DoNotStrip public fun disableOldAndroidAttachmentMetricsWorkarounds(): Boolean
@DoNotStrip public fun disableTextLayoutManagerCacheAndroid(): Boolean
@DoNotStrip public fun enableAccessibilityOrder(): Boolean
@@ -65,6 +67,8 @@ public interface ReactNativeFeatureFlagsProvider {
@DoNotStrip public fun enableIOSViewClipToPaddingBox(): Boolean
@DoNotStrip public fun enableImmediateUpdateModeForContentOffsetChanges(): Boolean
@DoNotStrip public fun enableInteropViewManagerClassLookUpOptimizationIOS(): Boolean
@DoNotStrip public fun enableLayoutAnimationsOnAndroid(): Boolean
@@ -87,8 +91,6 @@ public interface ReactNativeFeatureFlagsProvider {
@DoNotStrip public fun enableResourceTimingAPI(): Boolean
@DoNotStrip public fun enableSynchronousStateUpdates(): Boolean
@DoNotStrip public fun enableViewCulling(): Boolean
@DoNotStrip public fun enableViewRecycling(): Boolean
@@ -113,8 +115,12 @@ public interface ReactNativeFeatureFlagsProvider {
@DoNotStrip public fun preparedTextCacheSize(): Double
@DoNotStrip public fun preventShadowTreeCommitExhaustionWithLocking(): Boolean
@DoNotStrip public fun releaseImageDataWhenConsumed(): Boolean
@DoNotStrip public fun skipActivityIdentityAssertionOnHostPause(): Boolean
@DoNotStrip public fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean
@DoNotStrip public fun updateRuntimeShadowNodeReferencesOnCommit(): Boolean
@@ -123,6 +129,10 @@ public interface ReactNativeFeatureFlagsProvider {
@DoNotStrip public fun useFabricInterop(): Boolean
@DoNotStrip public fun useNativeEqualsInNativeReadableArrayAndroid(): Boolean
@DoNotStrip public fun useNativeTransformHelperAndroid(): Boolean
@DoNotStrip public fun useNativeViewConfigsInBridgelessMode(): Boolean
@DoNotStrip public fun useOptimizedEventBatchingOnAndroid(): Boolean
@@ -23,10 +23,6 @@ import com.facebook.react.common.build.ReactBuildConfig
@SuppressLint("UseReactNativeNewArchitectureFeatureFlagDetector")
public object ReactNativeNewArchitectureFeatureFlags {
@JvmStatic
public fun isNewArchitectureStrictModeEnabled(): Boolean =
ReactBuildConfig.UNSTABLE_ENABLE_MINIFY_LEGACY_ARCHITECTURE
@JvmStatic
public fun enableBridgelessArchitecture(): Boolean {
if (ReactBuildConfig.UNSTABLE_ENABLE_MINIFY_LEGACY_ARCHITECTURE) {
@@ -35,7 +35,6 @@ import java.util.HashMap
import java.util.UUID
import okhttp3.MediaType
import okhttp3.RequestBody
import okhttp3.ResponseBody
import okio.ByteString
@ReactModule(name = NativeBlobModuleSpec.NAME)
@@ -72,7 +71,7 @@ public class BlobModule(reactContext: ReactApplicationContext) :
return !isRemote && responseType == "blob"
}
override fun fetch(uri: Uri): WritableMap {
override fun fetch(uri: Uri): Pair<WritableMap, ByteArray> {
val data = getBytesFromUri(uri)
val blob = Arguments.createMap()
@@ -85,7 +84,7 @@ public class BlobModule(reactContext: ReactApplicationContext) :
blob.putString("name", getNameFromUri(uri))
blob.putDouble("lastModified", getLastModifiedFromUri(uri))
return blob
return blob to data
}
}
@@ -119,8 +118,7 @@ public class BlobModule(reactContext: ReactApplicationContext) :
return responseType == "blob"
}
override fun toResponseData(body: ResponseBody): WritableMap {
val data = body.bytes()
override fun toResponseData(data: ByteArray): WritableMap {
val blob = Arguments.createMap()
blob.putString("blobId", store(data))
blob.putInt("offset", 0)
@@ -58,10 +58,33 @@ internal object InspectorNetworkReporter {
expectedDataLength: Long
)
/**
* Report when additional chunks of the response body have been received.
*
* Corresponds to `Network.dataReceived` in CDP.
*/
@JvmStatic external fun reportDataReceived(requestId: Int, dataLength: Int)
/**
* Report when a network request is complete and we are no longer receiving response data.
* - Corresponds to `Network.loadingFinished` in CDP.
* - Corresponds to `PerformanceResourceTiming.responseEnd`.
*/
@JvmStatic external fun reportResponseEnd(requestId: Int, encodedDataLength: Long)
/**
* Store response body preview. This is an optional reporting method, and is a no-op if CDP
* debugging is disabled.
*/
@JvmStatic
external fun maybeStoreResponseBody(requestId: Int, body: String, base64Encoded: Boolean)
/**
* Incrementally store a response body preview, when a string response is received in chunks.
* Buffered contents will be flushed to `NetworkReporter` with `reportResponseEnd`.
*
* As with `maybeStoreResponseBody`, calling this method is optional and a no-op if CDP debugging
* is disabled.
*/
@JvmStatic external fun maybeStoreResponseBodyIncremental(requestId: Int, data: String)
}
@@ -10,6 +10,7 @@
package com.facebook.react.modules.network
import android.os.Bundle
import android.util.Base64
import com.facebook.react.bridge.Arguments
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.bridge.WritableMap
@@ -65,6 +66,10 @@ internal object NetworkEventUtil {
progress: Long,
total: Long
) {
if (ReactNativeFeatureFlags.enableNetworkEventReporting() && data != null) {
InspectorNetworkReporter.reportDataReceived(requestId, data.encodeToByteArray().size)
InspectorNetworkReporter.maybeStoreResponseBodyIncremental(requestId, data)
}
reactContext?.emitDeviceEvent(
"didReceiveNetworkIncrementalData",
buildReadableArray {
@@ -92,7 +97,16 @@ internal object NetworkEventUtil {
}
@JvmStatic
fun onDataReceived(reactContext: ReactApplicationContext?, requestId: Int, data: String?) {
fun onDataReceived(
reactContext: ReactApplicationContext?,
requestId: Int,
data: String?,
responseType: String
) {
if (ReactNativeFeatureFlags.enableNetworkEventReporting()) {
InspectorNetworkReporter.maybeStoreResponseBody(
requestId, data.orEmpty(), responseType == "base64")
}
reactContext?.emitDeviceEvent(
"didReceiveNetworkData",
buildReadableArray {
@@ -102,7 +116,16 @@ internal object NetworkEventUtil {
}
@JvmStatic
fun onDataReceived(reactContext: ReactApplicationContext?, requestId: Int, data: WritableMap?) {
fun onDataReceived(
reactContext: ReactApplicationContext?,
requestId: Int,
data: WritableMap,
rawData: ByteArray
) {
if (ReactNativeFeatureFlags.enableNetworkEventReporting()) {
InspectorNetworkReporter.maybeStoreResponseBody(
requestId, Base64.encodeToString(rawData, Base64.NO_WRAP), true)
}
reactContext?.emitDeviceEvent(
"didReceiveNetworkData",
Arguments.createArray().apply {
@@ -60,8 +60,10 @@ public class NetworkingModule(
/** Returns if the handler should be used for an URI. */
public fun supports(uri: Uri, responseType: String): Boolean
/** Fetch the URI and return the JS body payload. */
@Throws(IOException::class) public fun fetch(uri: Uri): WritableMap
/**
* Fetch the URI and return a tuple containing the JS body payload and the raw response body.
*/
@Throws(IOException::class) public fun fetch(uri: Uri): Pair<WritableMap, ByteArray>
}
/** Allows adding custom handling to build the [RequestBody] from the JS body payload. */
@@ -79,7 +81,7 @@ public class NetworkingModule(
public fun supports(responseType: String): Boolean
/** Returns the JS body payload for the [ResponseBody]. */
@Throws(IOException::class) public fun toResponseData(body: ResponseBody): WritableMap
@Throws(IOException::class) public fun toResponseData(data: ByteArray): WritableMap
}
private val client: OkHttpClient
@@ -254,7 +256,7 @@ public class NetworkingModule(
// Check if a handler is registered
for (handler in uriHandlers) {
if (handler.supports(uri, responseType)) {
val res = handler.fetch(uri)
val (res, rawBody) = handler.fetch(uri)
val encodedDataLength = res.toString().toByteArray().size
// fix: UriHandlers which are not using file:// scheme fail in whatwg-fetch at this line
// https://github.com/JakeChampion/fetch/blob/main/fetch.js#L547
@@ -266,7 +268,7 @@ public class NetworkingModule(
.message("OK")
.build()
NetworkEventUtil.onResponseReceived(reactApplicationContext, requestId, url, response)
NetworkEventUtil.onDataReceived(reactApplicationContext, requestId, res)
NetworkEventUtil.onDataReceived(reactApplicationContext, requestId, res, rawBody)
NetworkEventUtil.onRequestSuccess(
reactApplicationContext, requestId, encodedDataLength.toLong())
return
@@ -543,8 +545,10 @@ public class NetworkingModule(
// Check if a handler is registered
for (responseHandler in responseHandlers) {
if (responseHandler.supports(responseType)) {
val res = responseHandler.toResponseData(responseBody)
NetworkEventUtil.onDataReceived(reactApplicationContext, requestId, res)
val responseData = responseBody.bytes()
val res = responseHandler.toResponseData(responseData)
NetworkEventUtil.onDataReceived(
reactApplicationContext, requestId, res, responseData)
NetworkEventUtil.onRequestSuccess(
reactApplicationContext, requestId, responseBody.contentLength())
return
@@ -582,7 +586,7 @@ public class NetworkingModule(
responseString = Base64.encodeToString(responseBody.bytes(), Base64.NO_WRAP)
}
NetworkEventUtil.onDataReceived(
reactApplicationContext, requestId, responseString)
reactApplicationContext, requestId, responseString, responseType)
NetworkEventUtil.onRequestSuccess(
reactApplicationContext, requestId, responseBody.contentLength())
} catch (e: IOException) {
@@ -253,11 +253,18 @@ public class ReactHostImpl(
val currentActivity = this.currentActivity
if (currentActivity != null) {
val currentActivityClass = currentActivity.javaClass.simpleName
val activityClass = if (activity == null) "null" else activity.javaClass.simpleName
Assertions.assertCondition(
activity === currentActivity,
"Pausing an activity that is not the current activity, this is incorrect! Current activity: $currentActivityClass Paused activity: $activityClass")
val isSameActivity = activity === currentActivity
if (!isSameActivity) {
val currentActivityClass = currentActivity.javaClass.simpleName
val activityClass = if (activity == null) "null" else activity.javaClass.simpleName
val isNotSameActivityMessage =
"Pausing an activity that is not the current activity, this is incorrect! Current activity: $currentActivityClass Paused activity: $activityClass"
if (ReactNativeFeatureFlags.skipActivityIdentityAssertionOnHostPause()) {
log(method, isNotSameActivityMessage)
} else {
Assertions.assertCondition(isSameActivity, isNotSameActivityMessage)
}
}
}
maybeEnableDevSupport(false)
@@ -13,8 +13,10 @@ import android.util.DisplayMetrics
import android.view.WindowManager
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.window.layout.WindowMetricsCalculator
import com.facebook.react.bridge.WritableMap
import com.facebook.react.bridge.WritableNativeMap
import com.facebook.react.views.view.isEdgeToEdgeFeatureFlagOn
/**
* Holds an instance of the current DisplayMetrics so we don't have to thread it through all the
@@ -62,9 +64,19 @@ public object DisplayMetricsHolder {
@JvmStatic
public fun initDisplayMetrics(context: Context) {
val displayMetrics = context.resources.displayMetrics
windowDisplayMetrics = displayMetrics
val windowDisplayMetrics = DisplayMetrics()
val screenDisplayMetrics = DisplayMetrics()
windowDisplayMetrics.setTo(displayMetrics)
screenDisplayMetrics.setTo(displayMetrics)
if (isEdgeToEdgeFeatureFlagOn) {
WindowMetricsCalculator.getOrCreate().computeCurrentWindowMetrics(context).let {
windowDisplayMetrics.widthPixels = it.bounds.width()
windowDisplayMetrics.heightPixels = it.bounds.height()
}
}
val wm = context.getSystemService(Context.WINDOW_SERVICE) as WindowManager
// Get the real display metrics if we are using API level 17 or higher.
// The real metrics include system decor elements (e.g. soft menu bar).
@@ -72,6 +84,8 @@ public object DisplayMetricsHolder {
// See:
// http://developer.android.com/reference/android/view/Display.html#getRealMetrics(android.util.DisplayMetrics)
@Suppress("DEPRECATION") wm.defaultDisplay.getRealMetrics(screenDisplayMetrics)
DisplayMetricsHolder.windowDisplayMetrics = windowDisplayMetrics
DisplayMetricsHolder.screenDisplayMetrics = screenDisplayMetrics
}
@@ -19,7 +19,7 @@ import com.facebook.react.uimanager.PixelUtil.toDIPFromPixel
import com.facebook.react.uimanager.events.Event
/** Event used to notify JS component about changes of its position or dimensions. */
@LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR)
@LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.WARNING)
public class OnLayoutEvent private constructor() : Event<OnLayoutEvent>() {
@VisibleForTesting internal var x: Int = 0
@VisibleForTesting internal var y: Int = 0
@@ -60,7 +60,7 @@ public class OnLayoutEvent private constructor() : Event<OnLayoutEvent>() {
public companion object {
init {
LegacyArchitectureLogger.assertLegacyArchitecture(
"OnLayoutEvent", LegacyArchitectureLogLevel.ERROR)
"OnLayoutEvent", LegacyArchitectureLogLevel.WARNING)
}
private val EVENTS_POOL: SynchronizedPool<OnLayoutEvent> = SynchronizedPool<OnLayoutEvent>(20)
@@ -8,10 +8,12 @@
package com.facebook.react.uimanager
import com.facebook.common.logging.FLog
import com.facebook.react.bridge.NativeArray
import com.facebook.react.bridge.ReadableArray
import com.facebook.react.bridge.ReadableMap
import com.facebook.react.bridge.ReadableType
import com.facebook.react.common.ReactConstants
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags
public object TransformHelper {
@@ -69,6 +71,14 @@ public object TransformHelper {
transformOrigin: ReadableArray?,
allowPercentageResolution: Boolean
) {
if (allowPercentageResolution &&
ReactNativeFeatureFlags.useNativeTransformHelperAndroid() &&
transforms is NativeArray &&
transformOrigin is NativeArray?) {
nativeProcessTransform(transforms, result, viewWidth, viewHeight, transformOrigin)
return
}
val helperMatrix = helperMatrix.get()!!
MatrixMathHelper.resetIdentityMatrix(result)
val offsets =
@@ -220,4 +230,13 @@ public object TransformHelper {
return doubleArrayOf(newTranslateX, newTranslateY, newTranslateZ)
}
@JvmStatic
private external fun nativeProcessTransform(
transforms: NativeArray,
result: DoubleArray,
viewWidth: Float,
viewHeight: Float,
transformOrigin: NativeArray?
)
}
@@ -377,6 +377,9 @@ public class ReactScrollView extends ScrollView
}
ReactScrollViewHelper.emitLayoutEvent(this);
if (mVirtualViewContainerState != null) {
mVirtualViewContainerState.updateState();
}
}
@Override
@@ -486,6 +489,9 @@ public class ReactScrollView extends ScrollView
this,
mOnScrollDispatchHelper.getXFlingVelocity(),
mOnScrollDispatchHelper.getYFlingVelocity());
if (mVirtualViewContainerState != null) {
mVirtualViewContainerState.updateState();
}
}
} finally {
Systrace.endSection(Systrace.TRACE_TAG_REACT);
@@ -11,6 +11,7 @@ import android.graphics.Rect
import android.view.ViewGroup
import com.facebook.common.logging.FLog
import com.facebook.react.common.build.ReactBuildConfig
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags
import com.facebook.react.views.virtual.VirtualViewMode
import java.util.*
@@ -45,22 +46,19 @@ private fun rectsOverlap(rect1: Rect, rect2: Rect): Boolean {
return true
}
internal class VirtualViewContainerState(private val scrollView: ViewGroup) :
ReactScrollViewHelper.ScrollListener {
internal class VirtualViewContainerState(private val scrollView: ViewGroup) {
private val prerenderRatio: Int = 1
private val prerenderRatio: Double = ReactNativeFeatureFlags.virtualViewPrerenderRatio()
private val virtualViews: MutableSet<VirtualView> = mutableSetOf()
private val emptyRect: Rect = Rect()
private val visibleRect: Rect = Rect()
private val prerenderRect: Rect = Rect()
init {
ReactScrollViewHelper.addScrollListener(this)
}
public fun add(virtualView: VirtualView) {
assert(virtualViews.add(virtualView)) {
"Attempting to add duplicate VirtualView: ${virtualView.virtualViewID}"
public fun onChange(virtualView: VirtualView) {
if (virtualViews.add(virtualView)) {
debugLog("add", { "virtualViewID=${virtualView.virtualViewID}" })
} else {
debugLog("update", { "virtualViewID=${virtualView.virtualViewID}" })
}
updateModes(virtualView)
}
@@ -69,35 +67,13 @@ internal class VirtualViewContainerState(private val scrollView: ViewGroup) :
assert(virtualViews.remove(virtualView)) {
"Attempting to remove non-existent VirtualView: ${virtualView.virtualViewID}"
}
debugLog("remove", { "virtualViewID=${virtualView.virtualViewID}" })
}
// ReactScrollViewHelper.ScrollListener.onLayout
// Emitted from ScrollView's onLayout
override fun onLayout(scrollView: ViewGroup?) {
// ReactScrollViewHelper is global
if (this.scrollView == scrollView) {
debugLog("ReactScrollViewHelper.onLayout")
updateModes()
}
}
// ReactScrollViewHelper.ScrollListener.onScroll
// Emitted from ScrollView's onLayout
override fun onScroll(
scrollView: ViewGroup?,
scrollEventType: ScrollEventType?,
xVelocity: Float,
yVelocity: Float
) {
// ReactScrollViewHelper is global
if (this.scrollView == scrollView) {
debugLog("ReactScrollViewHelper.onScroll")
updateModes()
}
}
public fun update(virtualView: VirtualView) {
updateModes(virtualView)
// Called on ScrollView onLayout or onScroll
public fun updateState() {
debugLog("VirtualViewContainer.updateState")
updateModes()
}
private fun updateModes(virtualView: VirtualView? = null) {
@@ -110,17 +86,26 @@ internal class VirtualViewContainerState(private val scrollView: ViewGroup) :
val virtualViewsIt = if (virtualView != null) listOf(virtualView) else virtualViews
virtualViewsIt.forEach { vv ->
val rect = vv.containerRelativeRect
var mode = VirtualViewMode.Hidden
var thresholdRect = emptyRect
when {
rect.isEmpty -> {}
rectsOverlap(rect, visibleRect) -> {
vv.onModeChange(VirtualViewMode.Visible, visibleRect)
mode = VirtualViewMode.Visible
thresholdRect = visibleRect
}
rectsOverlap(rect, prerenderRect) -> {
vv.onModeChange(VirtualViewMode.Prerender, prerenderRect)
}
else -> {
vv.onModeChange(VirtualViewMode.Hidden, emptyRect)
mode = VirtualViewMode.Prerender
thresholdRect = prerenderRect
}
else -> {}
}
debugLog(
"updateModes",
{ "virtualView=${vv.virtualViewID} mode=$mode rect=$rect thresholdRect=$thresholdRect" })
vv.onModeChange(mode, thresholdRect)
}
}
}
@@ -1102,7 +1102,8 @@ internal object TextLayoutManager {
// There's a bug on Samsung devices where calling getPrimaryHorizontal on
// the last offset in the layout will result in an endless loop. Work around
// this bug by avoiding getPrimaryHorizontal in that case.
if (start == text.length - 1) {
if (!ReactNativeFeatureFlags.disableOldAndroidAttachmentMetricsWorkarounds() &&
start == text.length - 1) {
val endsWithNewLine = text.length > 0 && text[layout.getLineEnd(line) - 1] == '\n'
val lineWidth = if (endsWithNewLine) layout.getLineMax(line) else layout.getLineWidth(line)
placeholderLeftPosition =
@@ -1127,7 +1128,9 @@ internal object TextLayoutManager {
placeholderLeftPosition =
if (characterAndParagraphDirectionMatch) layout.getPrimaryHorizontal(start)
else layout.getSecondaryHorizontal(start)
if (isRtlParagraph && !isRtlChar) {
if (!ReactNativeFeatureFlags.disableOldAndroidAttachmentMetricsWorkarounds() &&
isRtlParagraph &&
!isRtlChar) {
// Adjust `placeholderLeftPosition` to work around an Android bug.
// The bug is when the paragraph is RTL and `setSingleLine(true)`, some layout
// methods such as `getPrimaryHorizontal`, `getSecondaryHorizontal`, and
@@ -101,7 +101,7 @@ public class ReactVirtualView(context: Context) :
ReactScrollViewHelper.removeScrollListener(this)
ReactScrollViewHelper.removeLayoutChangeListener(this)
if (detectWindowFocus) {
viewTreeObserver.addOnWindowFocusChangeListener(onWindowFocusChangeListener)
viewTreeObserver.removeOnWindowFocusChangeListener(onWindowFocusChangeListener)
}
cleanupLayoutListeners()
}
@@ -34,6 +34,7 @@ public class ReactVirtualViewExperimental(context: Context) :
override val containerRelativeRect: Rect = Rect()
private var offsetX: Int = 0
private var offsetY: Int = 0
private var hadLayout: Boolean = false
internal val nativeId: String?
get() = getTag(R.id.view_tag_native_id) as? String
@@ -45,14 +46,20 @@ public class ReactVirtualViewExperimental(context: Context) :
@VisibleForTesting
internal fun doAttachedToWindow() {
// Assuming that layout has been called before this
scrollView = getScrollView()?.also { scrollView?.virtualViewContainerState?.add(this) }
scrollView = getScrollView()
// onAttachedToWindow is usually called before layout but there are cases where it's called
// after. If called after, we need to report the updated layout to the VirtualViewContainer
if (hadLayout) {
updateParentOffset()
reportChangeToContainer()
}
}
/** From [View#onLayout] */
// This is when the view itself has layout changes
override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) {
super.onLayout(changed, left, top, right, bottom)
hadLayout = true
if (changed) {
containerRelativeRect.set(
left + offsetX,
@@ -60,7 +67,7 @@ public class ReactVirtualViewExperimental(context: Context) :
right + offsetX,
bottom + offsetY,
)
updateContainer()
reportChangeToContainer()
}
}
@@ -77,24 +84,8 @@ public class ReactVirtualViewExperimental(context: Context) :
oldBottom: Int
) {
if (oldLeft != left || oldTop != top) {
val virtualViewScrollView = scrollView ?: return
offsetX = 0
offsetY = 0
var parent: ViewParent? = parent
while (parent != null && parent != virtualViewScrollView) {
if (parent is View) {
offsetX += parent.left
offsetY += parent.top
}
parent = parent.parent
}
containerRelativeRect.set(
left + offsetX,
top + offsetY,
right + offsetX,
bottom + offsetY,
)
updateContainer()
updateParentOffset()
reportChangeToContainer()
}
}
@@ -109,6 +100,8 @@ public class ReactVirtualViewExperimental(context: Context) :
scrollView = null
mode = null
modeChangeEmitter = null
hadLayout = false
containerRelativeRect.setEmpty()
}
override val virtualViewID: String
@@ -156,8 +149,28 @@ public class ReactVirtualViewExperimental(context: Context) :
}
}
private fun updateContainer() {
scrollView?.virtualViewContainerState?.update(this)
private fun updateParentOffset() {
val virtualViewScrollView = scrollView ?: return
offsetX = 0
offsetY = 0
var parent: ViewParent? = parent
while (parent != null && parent != virtualViewScrollView) {
if (parent is View) {
offsetX += parent.left
offsetY += parent.top
}
parent = parent.parent
}
containerRelativeRect.set(
left + offsetX,
top + offsetY,
right + offsetX,
bottom + offsetY,
)
}
private fun reportChangeToContainer() {
scrollView?.virtualViewContainerState?.onChange(this)
}
private fun getScrollView(): VirtualViewContainer? = traverseParentStack(true)
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<2a33de4ea9c5d0c332845046053a9598>>
* @generated SignedSource<<f310a5dc27fd655eab4445cb25d4c85c>>
*/
/**
@@ -63,6 +63,12 @@ class ReactNativeFeatureFlagsJavaProvider
return method(javaProvider_);
}
bool disableOldAndroidAttachmentMetricsWorkarounds() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("disableOldAndroidAttachmentMetricsWorkarounds");
return method(javaProvider_);
}
bool disableTextLayoutManagerCacheAndroid() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("disableTextLayoutManagerCacheAndroid");
@@ -165,6 +171,12 @@ class ReactNativeFeatureFlagsJavaProvider
return method(javaProvider_);
}
bool enableImmediateUpdateModeForContentOffsetChanges() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableImmediateUpdateModeForContentOffsetChanges");
return method(javaProvider_);
}
bool enableInteropViewManagerClassLookUpOptimizationIOS() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableInteropViewManagerClassLookUpOptimizationIOS");
@@ -231,12 +243,6 @@ class ReactNativeFeatureFlagsJavaProvider
return method(javaProvider_);
}
bool enableSynchronousStateUpdates() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableSynchronousStateUpdates");
return method(javaProvider_);
}
bool enableViewCulling() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableViewCulling");
@@ -309,12 +315,24 @@ class ReactNativeFeatureFlagsJavaProvider
return method(javaProvider_);
}
bool preventShadowTreeCommitExhaustionWithLocking() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("preventShadowTreeCommitExhaustionWithLocking");
return method(javaProvider_);
}
bool releaseImageDataWhenConsumed() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("releaseImageDataWhenConsumed");
return method(javaProvider_);
}
bool skipActivityIdentityAssertionOnHostPause() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("skipActivityIdentityAssertionOnHostPause");
return method(javaProvider_);
}
bool traceTurboModulePromiseRejectionsOnAndroid() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("traceTurboModulePromiseRejectionsOnAndroid");
@@ -339,6 +357,18 @@ class ReactNativeFeatureFlagsJavaProvider
return method(javaProvider_);
}
bool useNativeEqualsInNativeReadableArrayAndroid() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("useNativeEqualsInNativeReadableArrayAndroid");
return method(javaProvider_);
}
bool useNativeTransformHelperAndroid() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("useNativeTransformHelperAndroid");
return method(javaProvider_);
}
bool useNativeViewConfigsInBridgelessMode() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("useNativeViewConfigsInBridgelessMode");
@@ -405,6 +435,11 @@ bool JReactNativeFeatureFlagsCxxInterop::disableMountItemReorderingAndroid(
return ReactNativeFeatureFlags::disableMountItemReorderingAndroid();
}
bool JReactNativeFeatureFlagsCxxInterop::disableOldAndroidAttachmentMetricsWorkarounds(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::disableOldAndroidAttachmentMetricsWorkarounds();
}
bool JReactNativeFeatureFlagsCxxInterop::disableTextLayoutManagerCacheAndroid(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::disableTextLayoutManagerCacheAndroid();
@@ -490,6 +525,11 @@ bool JReactNativeFeatureFlagsCxxInterop::enableIOSViewClipToPaddingBox(
return ReactNativeFeatureFlags::enableIOSViewClipToPaddingBox();
}
bool JReactNativeFeatureFlagsCxxInterop::enableImmediateUpdateModeForContentOffsetChanges(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::enableImmediateUpdateModeForContentOffsetChanges();
}
bool JReactNativeFeatureFlagsCxxInterop::enableInteropViewManagerClassLookUpOptimizationIOS(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::enableInteropViewManagerClassLookUpOptimizationIOS();
@@ -545,11 +585,6 @@ bool JReactNativeFeatureFlagsCxxInterop::enableResourceTimingAPI(
return ReactNativeFeatureFlags::enableResourceTimingAPI();
}
bool JReactNativeFeatureFlagsCxxInterop::enableSynchronousStateUpdates(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::enableSynchronousStateUpdates();
}
bool JReactNativeFeatureFlagsCxxInterop::enableViewCulling(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::enableViewCulling();
@@ -610,11 +645,21 @@ double JReactNativeFeatureFlagsCxxInterop::preparedTextCacheSize(
return ReactNativeFeatureFlags::preparedTextCacheSize();
}
bool JReactNativeFeatureFlagsCxxInterop::preventShadowTreeCommitExhaustionWithLocking(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::preventShadowTreeCommitExhaustionWithLocking();
}
bool JReactNativeFeatureFlagsCxxInterop::releaseImageDataWhenConsumed(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::releaseImageDataWhenConsumed();
}
bool JReactNativeFeatureFlagsCxxInterop::skipActivityIdentityAssertionOnHostPause(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::skipActivityIdentityAssertionOnHostPause();
}
bool JReactNativeFeatureFlagsCxxInterop::traceTurboModulePromiseRejectionsOnAndroid(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::traceTurboModulePromiseRejectionsOnAndroid();
@@ -635,6 +680,16 @@ bool JReactNativeFeatureFlagsCxxInterop::useFabricInterop(
return ReactNativeFeatureFlags::useFabricInterop();
}
bool JReactNativeFeatureFlagsCxxInterop::useNativeEqualsInNativeReadableArrayAndroid(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::useNativeEqualsInNativeReadableArrayAndroid();
}
bool JReactNativeFeatureFlagsCxxInterop::useNativeTransformHelperAndroid(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::useNativeTransformHelperAndroid();
}
bool JReactNativeFeatureFlagsCxxInterop::useNativeViewConfigsInBridgelessMode(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::useNativeViewConfigsInBridgelessMode();
@@ -713,6 +768,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
makeNativeMethod(
"disableMountItemReorderingAndroid",
JReactNativeFeatureFlagsCxxInterop::disableMountItemReorderingAndroid),
makeNativeMethod(
"disableOldAndroidAttachmentMetricsWorkarounds",
JReactNativeFeatureFlagsCxxInterop::disableOldAndroidAttachmentMetricsWorkarounds),
makeNativeMethod(
"disableTextLayoutManagerCacheAndroid",
JReactNativeFeatureFlagsCxxInterop::disableTextLayoutManagerCacheAndroid),
@@ -764,6 +822,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
makeNativeMethod(
"enableIOSViewClipToPaddingBox",
JReactNativeFeatureFlagsCxxInterop::enableIOSViewClipToPaddingBox),
makeNativeMethod(
"enableImmediateUpdateModeForContentOffsetChanges",
JReactNativeFeatureFlagsCxxInterop::enableImmediateUpdateModeForContentOffsetChanges),
makeNativeMethod(
"enableInteropViewManagerClassLookUpOptimizationIOS",
JReactNativeFeatureFlagsCxxInterop::enableInteropViewManagerClassLookUpOptimizationIOS),
@@ -797,9 +858,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
makeNativeMethod(
"enableResourceTimingAPI",
JReactNativeFeatureFlagsCxxInterop::enableResourceTimingAPI),
makeNativeMethod(
"enableSynchronousStateUpdates",
JReactNativeFeatureFlagsCxxInterop::enableSynchronousStateUpdates),
makeNativeMethod(
"enableViewCulling",
JReactNativeFeatureFlagsCxxInterop::enableViewCulling),
@@ -836,9 +894,15 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
makeNativeMethod(
"preparedTextCacheSize",
JReactNativeFeatureFlagsCxxInterop::preparedTextCacheSize),
makeNativeMethod(
"preventShadowTreeCommitExhaustionWithLocking",
JReactNativeFeatureFlagsCxxInterop::preventShadowTreeCommitExhaustionWithLocking),
makeNativeMethod(
"releaseImageDataWhenConsumed",
JReactNativeFeatureFlagsCxxInterop::releaseImageDataWhenConsumed),
makeNativeMethod(
"skipActivityIdentityAssertionOnHostPause",
JReactNativeFeatureFlagsCxxInterop::skipActivityIdentityAssertionOnHostPause),
makeNativeMethod(
"traceTurboModulePromiseRejectionsOnAndroid",
JReactNativeFeatureFlagsCxxInterop::traceTurboModulePromiseRejectionsOnAndroid),
@@ -851,6 +915,12 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
makeNativeMethod(
"useFabricInterop",
JReactNativeFeatureFlagsCxxInterop::useFabricInterop),
makeNativeMethod(
"useNativeEqualsInNativeReadableArrayAndroid",
JReactNativeFeatureFlagsCxxInterop::useNativeEqualsInNativeReadableArrayAndroid),
makeNativeMethod(
"useNativeTransformHelperAndroid",
JReactNativeFeatureFlagsCxxInterop::useNativeTransformHelperAndroid),
makeNativeMethod(
"useNativeViewConfigsInBridgelessMode",
JReactNativeFeatureFlagsCxxInterop::useNativeViewConfigsInBridgelessMode),
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<509e0e4d8b2568e2b682797cfb83c79a>>
* @generated SignedSource<<8c1da07c0b7d2053f7fdaac4326c3ac1>>
*/
/**
@@ -42,6 +42,9 @@ class JReactNativeFeatureFlagsCxxInterop
static bool disableMountItemReorderingAndroid(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool disableOldAndroidAttachmentMetricsWorkarounds(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool disableTextLayoutManagerCacheAndroid(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
@@ -93,6 +96,9 @@ class JReactNativeFeatureFlagsCxxInterop
static bool enableIOSViewClipToPaddingBox(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool enableImmediateUpdateModeForContentOffsetChanges(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool enableInteropViewManagerClassLookUpOptimizationIOS(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
@@ -126,9 +132,6 @@ class JReactNativeFeatureFlagsCxxInterop
static bool enableResourceTimingAPI(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool enableSynchronousStateUpdates(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool enableViewCulling(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
@@ -165,9 +168,15 @@ class JReactNativeFeatureFlagsCxxInterop
static double preparedTextCacheSize(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool preventShadowTreeCommitExhaustionWithLocking(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool releaseImageDataWhenConsumed(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool skipActivityIdentityAssertionOnHostPause(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool traceTurboModulePromiseRejectionsOnAndroid(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
@@ -180,6 +189,12 @@ class JReactNativeFeatureFlagsCxxInterop
static bool useFabricInterop(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool useNativeEqualsInNativeReadableArrayAndroid(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool useNativeTransformHelperAndroid(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool useNativeViewConfigsInBridgelessMode(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
@@ -31,13 +31,14 @@ add_library(
OnLoad-common.cpp
ReadableNativeArray.cpp
ReadableNativeMap.cpp
TransformHelper.cpp
WritableNativeArray.cpp
WritableNativeMap.cpp
)
target_merge_so(reactnativejni_common)
target_include_directories(reactnativejni_common PUBLIC ../../)
target_link_libraries(reactnativejni_common fbjni folly_runtime react_cxxreact)
target_link_libraries(reactnativejni_common fbjni folly_runtime react_cxxreact rrc_view)
target_compile_reactnative_options(reactnativejni_common PRIVATE)
target_compile_options(reactnativejni_common PRIVATE -Wno-unused-lambda-capture)
@@ -11,6 +11,9 @@
#include <cstddef>
#include <string>
#ifdef REACT_NATIVE_DEBUGGER_ENABLED
#include <unordered_map>
#endif
using namespace facebook::jni;
using namespace facebook::react::jsinspector_modern;
@@ -49,6 +52,13 @@ std::string limitRequestBodySize(std::string requestBody) {
} // namespace
#ifdef REACT_NATIVE_DEBUGGER_ENABLED
// Dictionary to buffer incremental response bodies (CDP debugging active only)
static std::unordered_map<int, std::string> responseBuffers;
#endif
/* static */ void InspectorNetworkReporter::reportRequestStart(
const jni::alias_ref<jclass> /*unused*/,
jint requestId,
@@ -93,12 +103,63 @@ std::string limitRequestBodySize(std::string requestBody) {
static_cast<std::int64_t>(encodedDataLength));
}
/* static */ void InspectorNetworkReporter::reportDataReceived(
jni::alias_ref<jclass> /*unused*/,
jint requestId,
jint dataLength) {
NetworkReporter::getInstance().reportDataReceived(
std::to_string(requestId), dataLength, std::nullopt);
}
/* static */ void InspectorNetworkReporter::reportResponseEnd(
jni::alias_ref<jclass> /*unused*/,
jint requestId,
jlong encodedDataLength) {
NetworkReporter::getInstance().reportResponseEnd(
std::to_string(requestId), static_cast<std::int64_t>(encodedDataLength));
#ifdef REACT_NATIVE_DEBUGGER_ENABLED
// Debug build: Check for buffered response body and flush to NetworkReporter
auto buffer = responseBuffers[requestId];
if (!buffer.empty()) {
NetworkReporter::getInstance().storeResponseBody(
std::to_string(requestId), buffer, false);
responseBuffers.erase(requestId);
}
#endif
}
/* static */ void InspectorNetworkReporter::maybeStoreResponseBody(
jni::alias_ref<jclass> /*unused*/,
jint requestId,
jni::alias_ref<jstring> body,
jboolean base64Encoded) {
#ifdef REACT_NATIVE_DEBUGGER_ENABLED
// Debug build: Process response body and report to NetworkReporter
auto& networkReporter = NetworkReporter::getInstance();
if (!networkReporter.isDebuggingEnabled()) {
return;
}
networkReporter.storeResponseBody(
std::to_string(requestId), body->toStdString(), base64Encoded != 0u);
#endif
}
/* static */ void InspectorNetworkReporter::maybeStoreResponseBodyIncremental(
jni::alias_ref<jclass> /*unused*/,
jint requestId,
jni::alias_ref<jstring> data) {
#ifdef REACT_NATIVE_DEBUGGER_ENABLED
// Debug build: Buffer incremental response body contents
auto& networkReporter = NetworkReporter::getInstance();
if (!networkReporter.isDebuggingEnabled()) {
return;
}
auto& buffer = responseBuffers[requestId];
buffer += data->toStdString();
#endif
}
/* static */ void InspectorNetworkReporter::registerNatives() {
@@ -107,11 +168,19 @@ std::string limitRequestBodySize(std::string requestBody) {
"reportRequestStart", InspectorNetworkReporter::reportRequestStart),
makeNativeMethod(
"reportResponseStart", InspectorNetworkReporter::reportResponseStart),
makeNativeMethod(
"reportResponseEnd", InspectorNetworkReporter::reportResponseEnd),
makeNativeMethod(
"reportConnectionTiming",
InspectorNetworkReporter::reportConnectionTiming),
makeNativeMethod(
"reportDataReceived", InspectorNetworkReporter::reportDataReceived),
makeNativeMethod(
"reportResponseEnd", InspectorNetworkReporter::reportResponseEnd),
makeNativeMethod(
"maybeStoreResponseBody",
InspectorNetworkReporter::maybeStoreResponseBody),
makeNativeMethod(
"maybeStoreResponseBodyIncremental",
InspectorNetworkReporter::maybeStoreResponseBodyIncremental),
});
}
@@ -39,11 +39,27 @@ class InspectorNetworkReporter
jni::alias_ref<jni::JMap<jstring, jstring>> responseHeaders,
jlong encodedDataLength);
static void reportDataReceived(
jni::alias_ref<jclass> /*unused*/,
jint requestId,
jint dataLength);
static void reportResponseEnd(
jni::alias_ref<jclass> /*unused*/,
jint requestId,
jlong encodedDataLength);
static void maybeStoreResponseBody(
jni::alias_ref<jclass> /*unused*/,
jint requestId,
jni::alias_ref<jstring> body,
jboolean base64Encoded);
static void maybeStoreResponseBodyIncremental(
jni::alias_ref<jclass> /*unused*/,
jint requestId,
jni::alias_ref<jstring> data);
static void registerNatives();
private:

Some files were not shown because too many files have changed in this diff Show More