Commit Graph
32109 Commits
Author SHA1 Message Date
David Vacca 9f24df015d Cache Spannables during rendering of Text (#36885)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36885

Create cache to hold Spannables during measurment and rendering of Text

We used to have a similar cache in the past, it was removed because it seemed not have an implact.
We are incorporating this again to measure while rendering 1000s of text components

changelog: [internal] internal

Reviewed By: cipolleschi

Differential Revision: D44918981

fbshipit-source-id: 581d22978841e1b62a1709da0fec2baba6c59cea
2023-04-12 15:51:01 -07:00
Moti Zilberman b66ab690fe Implement caching in __loadBundleAsync (#36809)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36809

Changelog: [General][Added] [2/n] Support lazy bundling in development

Implements caching in `__loadBundleAsync` in line with https://github.com/react-native-community/discussions-and-proposals/pull/628.

Reviewed By: jacdebug

Differential Revision: D44630077

fbshipit-source-id: f1a19217f54493e5cf0c8bba910a6a6e14c10c03
2023-04-12 14:21:48 -07:00
Moti Zilberman 799b0f4be8 Inject __loadBundleAsync global in development (#36808)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36808

Changelog: [General][Added] [1/n] Support lazy bundling in development

Implements part of the [lazy bundling RFC](https://github.com/react-native-community/discussions-and-proposals/blob/main/proposals/0605-lazy-bundling.md#__loadbundleasync-in-react-native):

> In development builds, React Native will provide an implementation of `__loadBundleAsync` that fetches a bundle URL from the currently connected Metro server, integrates with Fast Refresh and LogBox, and provides feedback to the developer on the progress of loading a bundle.

NOTE: This implementation of `__loadBundleAsync` is currently unused in OSS, pending a handful of changes to Metro and React Native that have not landed yet. The plan is to land everything in time for React Native 0.73.

Reviewed By: robhogan

Differential Revision: D43600052

fbshipit-source-id: 9342d5894eaf4b90b30598148bd55b0c956a8b08
2023-04-12 14:21:48 -07:00
Christoph Purrer 846ec6dd25 Remove reference to non existing butter/mutex.h (#36879)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36879

Changelog: [Internal]

Removed in https://github.com/facebook/react-native/commit/e665a0f9952a7852c5506bf334452f8156991ad2

Reviewed By: sammy-SC

Differential Revision: D44901760

fbshipit-source-id: a2a037649d3eb24684d5ff691ae563a28d3f5398
2023-04-12 10:26:08 -07:00
Rubén Norte 4fdad9e765 Use FB-specific renderers when running tests in Meta infra (#36877)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36877

This diffs allows having Meta-specific tests and modules that are only used when running tests in Meta's infra. Meta-specific modules aren't synced to Github, so the OSS versions will be used when running tests on Github.

This is needed because we recently some files from React to React Native, including a test that now uses the `ReactFabric` module to test the behavior of public instances in React Native. This module is always using the OSS version of the renderer, but at Meta we have a custom version that's being ignored in tests.

Changelog: [internal]

Reviewed By: cortinico

Differential Revision: D44874631

fbshipit-source-id: e3112041f134240601495a28ba643bce45d802fb
2023-04-12 05:17:01 -07:00
Kevin Gozali d49f1ebc65 rn_codegen: define a method to convert package.json codegenConfig into Buck format (#36868)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36868

Given a codegenConfig definition in a library's package.json, convert it into Buck specific codegen format, as defined by the kwargs of rn_codegen().

Reference:
https://reactnative.dev/docs/next/new-architecture-library-intro#configure-codegen

Changelog: [Internal]

Reviewed By: cortinico, mdvacca

Differential Revision: D44857743

fbshipit-source-id: 82011161d43cebe701cd2b129208054c21d3175a
2023-04-11 17:45:40 -07:00
Olga Zinoveva ad4a857d3a Fix occasional failures of triage-issue job (#36846)
Summary:
I added a new step to the triage-issue job last week, to add descriptive labels to issues based on their title. This job has occasionally be failing, [like this](https://github.com/facebook/react-native/actions/runs/4630279135/jobs/8191646900). This happens when no applicable labels are found, and we send up an empty array to the add labels endpoint. Adding an array length check to protect against this case.

## Changelog:
[INTERNAL] [FIXED] - Fixed occasional failures in the issue triage pipeline related to issue labeling

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

Test Plan:
Repro run in my repository before the fix: https://github.com/SlyCaptainFlint/react-native/actions/runs/4631843716 (note that the error is the same as in the example failure listed in the description)
And here is a success on the same issue after the fix: https://github.com/SlyCaptainFlint/react-native/actions/runs/4631920441

Reviewed By: cipolleschi

Differential Revision: D44866639

Pulled By: cortinico

fbshipit-source-id: ace6ebece46d7a160f8be39a6099121e11201318
2023-04-11 11:33:10 -07:00
Rob Hogan 3c9d915330 Internal Jest setup - improve workaround for Babel registration (#36838)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36838

Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D44715939

fbshipit-source-id: fe3cbd934a39666e5590962941b1927b0f8e2610
2023-04-11 10:08:53 -07:00
Yurii Nakonechnyi 6f4bfdd3d6 Minor formatting: added space in YGNodeMarkDirty assert message (#1243)
Summary:
Currently `YGNodeMarkDirty()` assert message displayed **without** space between 2 lines:
```
"Only leaf nodes with custom measure functionsshould manually mark themselves as dirty"
                                     ^^^^^^^^^^^^^^^
```
This minor PR fixes it :)

X-link: https://github.com/facebook/yoga/pull/1243

Reviewed By: jacdebug

Differential Revision: D44870410

Pulled By: javache

fbshipit-source-id: 58db50106e8e2980ec84c99976f569b94b739d9b
2023-04-11 08:28:00 -07:00
Rubén Norte 6eebc99742 React Native sync for revisions 77ba161...ca01f35
Summary:
This sync includes the following changes:
- **[ca01f359b](https://github.com/facebook/react/commit/ca01f359b )**: Remove skipUnmountedBoundaries ([#26489](https://github.com/facebook/react/pull/26489)) //<Ricky>//
- **[43a70a610](https://github.com/facebook/react/commit/43a70a610 )**: Limit the meaning of "custom element" to not include `is` ([#26524](https://github.com/facebook/react/pull/26524)) //<Sebastian Markbåge>//
- **[1308e49a6](https://github.com/facebook/react/commit/1308e49a6 )**: [Flight Plugin] Scan for "use client" ([#26474](https://github.com/facebook/react/pull/26474)) //<dan>//
- **[1a1d61fed](https://github.com/facebook/react/commit/1a1d61fed )**: Warn for ARIA typos on custom elements ([#26523](https://github.com/facebook/react/pull/26523)) //<Sebastian Markbåge>//
- **[73deff0d5](https://github.com/facebook/react/commit/73deff0d5 )**: Refactor DOMProperty and CSSProperty ([#26513](https://github.com/facebook/react/pull/26513)) //<Sebastian Markbåge>//
- **[2d51251e6](https://github.com/facebook/react/commit/2d51251e6 )**: Clean up deferRenderPhaseUpdateToNextBatch ([#26511](https://github.com/facebook/react/pull/26511)) //<Andrew Clark>//
- **[0ffc7f632](https://github.com/facebook/react/commit/0ffc7f632 )**: Update useMemoCache test to confirm that cache persists across errors ([#26510](https://github.com/facebook/react/pull/26510)) //<Joseph Savona>//
- **[29a3be78b](https://github.com/facebook/react/commit/29a3be78b )**: Move ReactDOMFloat to react-dom/src/ ([#26514](https://github.com/facebook/react/pull/26514)) //<Sebastian Markbåge>//
- **[4c2fc0190](https://github.com/facebook/react/commit/4c2fc0190 )**: Generate safe javascript url instead of throwing with disableJavaScriptURLs is on ([#26507](https://github.com/facebook/react/pull/26507)) //<Sebastian Markbåge>//
- **[f0aafa1a7](https://github.com/facebook/react/commit/f0aafa1a7 )**: Convert a few more tests to waitFor test helpers ([#26509](https://github.com/facebook/react/pull/26509)) //<Andrew Clark>//
- **[90995ef8b](https://github.com/facebook/react/commit/90995ef8b )**: Delete "triangle" resuming fuzz tester ([#26508](https://github.com/facebook/react/pull/26508)) //<Andrew Clark>//
- **[f118b7ceb](https://github.com/facebook/react/commit/f118b7ceb )**: [Flight] Gated test for dropped transport of undefined object values ([#26478](https://github.com/facebook/react/pull/26478)) //<Sebastian Silbermann>//
- **[fd0511c72](https://github.com/facebook/react/commit/fd0511c72 )**: [Flight] Add support BigInt support ([#26479](https://github.com/facebook/react/pull/26479)) //<Sebastian Silbermann>//
- **[85de6fde5](https://github.com/facebook/react/commit/85de6fde5 )**: Refactor DOM special cases per tags including controlled fields ([#26501](https://github.com/facebook/react/pull/26501)) //<Sebastian Markbåge>//
- **[1f5cdf8c7](https://github.com/facebook/react/commit/1f5cdf8c7 )**: Update Suspense fuzz tests to use `act` ([#26498](https://github.com/facebook/react/pull/26498)) //<Andrew Clark>//
- **[f62cb39ee](https://github.com/facebook/react/commit/f62cb39ee )**: Make disableSchedulerTimeoutInWorkLoop a static ff ([#26497](https://github.com/facebook/react/pull/26497)) //<Ricky>//
- **[41b4714f1](https://github.com/facebook/react/commit/41b4714f1 )**: Remove disableNativeComponentFrames ([#26490](https://github.com/facebook/react/pull/26490)) //<Ricky>//
- **[fc90eb636](https://github.com/facebook/react/commit/fc90eb636 )**: Codemod more tests to waitFor pattern ([#26494](https://github.com/facebook/react/pull/26494)) //<Andrew Clark>//
- **[e0bbc2662](https://github.com/facebook/react/commit/e0bbc2662 )**: Improve tests that deal with microtasks ([#26493](https://github.com/facebook/react/pull/26493)) //<Andrew Clark>//
- **[8faf75193](https://github.com/facebook/react/commit/8faf75193 )**: Codemod some expiration tests to waitForExpired ([#26491](https://github.com/facebook/react/pull/26491)) //<Andrew Clark>//
- **[8342a0992](https://github.com/facebook/react/commit/8342a0992 )**: Remove unused feature flag disableSchedulerTimeoutBasedOnReactExpirationTime ([#26488](https://github.com/facebook/react/pull/26488)) //<Jan Kassens>//
- **[afea1d0c5](https://github.com/facebook/react/commit/afea1d0c5 )**: [flow] make Flow suppressions explicit on the error ([#26487](https://github.com/facebook/react/pull/26487)) //<Jan Kassens>//
- **[768f965de](https://github.com/facebook/react/commit/768f965de )**: Suspensily committing a prerendered tree ([#26434](https://github.com/facebook/react/pull/26434)) //<Andrew Clark>//
- **[d12bdcda6](https://github.com/facebook/react/commit/d12bdcda6 )**: Fix Flow types of useEffectEvent ([#26468](https://github.com/facebook/react/pull/26468)) //<Sebastian Silbermann>//
- **[73b6435ca](https://github.com/facebook/react/commit/73b6435ca )**: [Float][Fiber] Implement waitForCommitToBeReady for stylesheet resources ([#26450](https://github.com/facebook/react/pull/26450)) //<Josh Story>//
- **[175962c10](https://github.com/facebook/react/commit/175962c10 )**: Fix remaining CommonJS imports after Rollup upgrade ([#26473](https://github.com/facebook/react/pull/26473)) //<dan>//
- **[909c6dacf](https://github.com/facebook/react/commit/909c6dacf )**: Update Rollup to 3.x ([#26442](https://github.com/facebook/react/pull/26442)) //<Mark Erikson>//
- **[9c54b29b4](https://github.com/facebook/react/commit/9c54b29b4 )**: Remove ReactFabricPublicInstance and used definition from ReactNativePrivateInterface ([#26437](https://github.com/facebook/react/pull/26437)) //<Rubén Norte>//
- **[f77099b6f](https://github.com/facebook/react/commit/f77099b6f )**: Remove layout effect warning on the server ([#26395](https://github.com/facebook/react/pull/26395)) //<Ricky>//
- **[51a7c45f8](https://github.com/facebook/react/commit/51a7c45f8 )**: Bugfix: SuspenseList incorrectly forces a fallback ([#26453](https://github.com/facebook/react/pull/26453)) //<Andrew Clark>//
- **[afb3d51dc](https://github.com/facebook/react/commit/afb3d51dc )**: Fix enableClientRenderFallbackOnTextMismatch flag ([#26457](https://github.com/facebook/react/pull/26457)) //<Sebastian Markbåge>//
- **[8e17bfd14](https://github.com/facebook/react/commit/8e17bfd14 )**: Make InternalInstanceHandle type opaque in ReactNativeTypes ([#26461](https://github.com/facebook/react/pull/26461)) //<Rubén Norte>//
- **[b93b4f074](https://github.com/facebook/react/commit/b93b4f074 )**: Should not throw for children of iframe or object ([#26458](https://github.com/facebook/react/pull/26458)) //<Sebastian Markbåge>//
- **[c0b34bc5f](https://github.com/facebook/react/commit/c0b34bc5f )**: chore: update links of docs and api ([#26455](https://github.com/facebook/react/pull/26455)) //<Leedom>//
- **[ffb6733ee](https://github.com/facebook/react/commit/ffb6733ee )**: fix docs link for useSyncExternalStore ([#26452](https://github.com/facebook/react/pull/26452)) //<Valor(华洛)>//
- **[12a1d140e](https://github.com/facebook/react/commit/12a1d140e )**: Don't prerender siblings of suspended component  ([#26380](https://github.com/facebook/react/pull/26380)) //<Andrew Clark>//

Changelog:
[General][Changed] - React Native sync for revisions 77ba161...ca01f35

jest_e2e[run_all_tests]

bypass-github-export-checks

Reviewed By: sammy-SC

Differential Revision: D44669450

fbshipit-source-id: f160aad4719a00df3ceeca78d5f3fcd0aa0f8437
2023-04-11 04:50:05 -07:00
Kevin Gozali 511bf4f3e9 Buck: renamed rn_library() kwarg: native_module_android_package_name -> android_package_name (#36867)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36867

This will make it consistent with rn_codegen() kwargs, and because android_package_name is not just limited to native_module's

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D44857744

fbshipit-source-id: 37a8a69b443ffc8bfbaa145b0f21270a0f3515d4
2023-04-11 02:48:42 -07:00
Kevin Gozali 9193c4f50c rn_codegen: renamed src_prefix to codegen_src_prefix (#36866)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36866

For consistency with internal build rules, rename this kwarg. This will make it easier to keep both internal and external usages consistent.

Changelog: [General][Changed] react-native-codegen: Buck-only: renamed src_prefix kwarg

Reviewed By: sammy-SC

Differential Revision: D44857745

fbshipit-source-id: 475658281a6c2846be42e130f81e23dfcae5856b
2023-04-11 02:48:42 -07:00
Vincent Riemer 71506cefbf Add basic emitting of click event (#36616)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36616

Changelog: [iOS][Internal] - Add basic emitting of click event

This diff adds the basic implementation of click event emitting, particularlly focused on ensuring clicks are only fired if the pointer interaction ends within the same tree "branch" of elements as which it started.

Reviewed By: yungsters

Differential Revision: D44148427

fbshipit-source-id: 9e91c32fe0e1ca8a5c50e72cd819625294e070f4
2023-04-10 13:08:03 -07:00
Christoph Purrer a6690bfb7b Share between mobile and desktop (#36852)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36852

Changelog:
[Internal]

Reviewed By: shwanton

Differential Revision: D44796009

fbshipit-source-id: 614dd3c2bb002b068b0cd51f546d30d010768bda
2023-04-07 14:47:30 -07:00
Christoph Purrer 95dabeb53c code-gen: Enable opt-in to mobile dependencies when building for Apple Catalyst (#36851)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36851

Changelog:
[Internal]

Differential Revision: D44795138

fbshipit-source-id: 4d667531a50d41b8da8146be3c0a9b8854eb6bd1
2023-04-07 12:46:03 -07:00
Shawn Dempsey 247a913af0 Refactor react native codegen to export macOS specific deps (#36805)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36805

**Changelog:** Export macOS specific dependencies for react-native-codgen

[Internal][Changed] - RN macOS uses an older version of React Native (0.68) so we need to specify macOS specific dependencies when running codegen for RN Desktop

Reviewed By: christophpurrer

Differential Revision: D44687704

fbshipit-source-id: 9dcabc88d4abf17845db0844c952f1cb4a13e3ad
2023-04-06 17:37:53 -07:00
Kevin Gozali bfaedfe6f1 rn_codegen Buck: process TS spec files for native components as well (#36843)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36843

It already consumes .ts files for native module specs, but not for native components, so let's enable it.

Changelog: [General][Fixed] react-native-codegen Buck support: also process .ts files for native component specs

Reviewed By: cortinico

Differential Revision: D44735387

fbshipit-source-id: 7173e07280dfaec06f08347838824827ef88e31a
2023-04-06 16:11:55 -07:00
Alex Danoff a27270f492 W3CPointerEvents: use description to indicate HW requirements for tests (#36840)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36840

Changelog: [Internal] - W3CPointerEvents: use description to indicate HW requirements for tests

As title. This lets users/testers know whether additional hardware is required to run each test and can give info on the test status (e.g. whether it's expected to fail). Tests with no description should be assumed to work without any special requirements.

Reviewed By: vincentriemer

Differential Revision: D44687709

fbshipit-source-id: 6a23344c4cce6917f3cf5cd3ada0c75b813b5abe
2023-04-06 13:06:10 -07:00
Riccardo Cipolleschi 610b14e4f3 Move min ios version to 13.4 for OSS (#36795)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36795

This change bump the min iOS version for React Native to 13.4, to align with company guidelines.

## Changelog:
[iOS][Changed] - Moved the min iOS version to 13.4

Reviewed By: cortinico

Differential Revision: D44634663

fbshipit-source-id: 035e8fcbb395f7394f8253e3ec485ad9937531c2
2023-04-06 12:07:26 -07:00
Gijs Weterings 03e78010ae add customizeStack hook (#36819)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36819

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

This diff creates a new hook to the Metro symbolicator. `customizeStack` aims to provide a whole stack modification hook on the output of the `/symbolicate` endpoint.

The purpose of this hook is to be able to apply callsite-based modifications to the stack trace. One such example is user-facing frame skipping APIs like FBLogger internally.

Consider the following API:

```
  FBLogger('my_project')
    .blameToPreviousFile()
    .mustfix(
      'This error should refer to the callsite of this method',
    );
```

In this particular case, we'd want to skip all frames from the top that come from the same source file. To do that, we need knowledge of the entire symbolicated stack, neither a hook before symbolication nor an implementation in `symbolicator.customizeFrame` are sufficient to be able to apply this logic.

This diff creates the new hook, which allows for mutations of the entire symbolicated stack via a `symbolicator.customizeStack` hook. The default implementation of this simply returns the same stack, but it can be wrapped similar to `symbolicator.customizeFrame`.

To actually have information for this hook to act on, I've created the possibility to send additional data to the metro `/symbolicate` endpoint via an `extraData` object. This mirrors the `extraData` from https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Core/NativeExceptionsManager.js#L33, and I've wired up LogBox to send that object along with the symbolicate call.

Changelog:
[General][Added] - Added customizeStack hook to Metro's `/symbolicate` endpoint to allow custom frame skipping logic on a stack level.

Reviewed By: motiz88

Differential Revision: D44257733

fbshipit-source-id: 05cd57f5917a1e97b0520e772692ce64029fbf8a
2023-04-06 11:43:23 -07:00
Gijs Weterings ad46bc6d77 Remove DevServerHelper.symbolicateStackTrace and DevServerHelper.openStackFrameCall. (#36652)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36652

I can't find any usecases for them, and JavaScript stack symbolication during development should probably just exclusively be done from the JS environment.

Changelog:
[Android][Removed] - Deleted obsolete native methods DevServerHelper.symbolicateStackTrace and DevServerHelper.openStackFrameCall

Reviewed By: motiz88

Differential Revision: D44257731

fbshipit-source-id: d090ecf413526c31d5fb028507d22fc7992e74b7
2023-04-06 11:43:23 -07:00
Ruslan Shestopalyuk 6bcf904f77 Fix for potential breakage due to incompatibility between binary and JS code in NativePerformanceObserver (#36841)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36841

## Changelog:
[Internal] -

A follow-up to D44712550, which did not take into account that there may be incompatibility between app's binary and JS code.

Note that this is for VR apps only, as other platforms don't (yet) use the module in question (WebPerformance).

Reviewed By: javache

Differential Revision: D44751928

fbshipit-source-id: 6a029f5725dd45abded7dda3325debe864f29ca0
2023-04-06 11:38:06 -07:00
Ruslan Shestopalyuk 3506c8d740 Ability to always log certain performance entry types (#36820)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36820

## Changelog:
[Internal] -

A follow-up to the D44584166 (which was abandoned, but this change makes sense nevertheless).

This allows to selectively enable logging of certain event types regardless of whether they are observed or not. For now it's marks and measures, but potentially it may be also e.g. navigation/resource entries.

Also expands unit tests for the JS side of the `Performance` API correspondingly.

Note that "always logged" and "observed" have different semantics. An "always logged" entry won't be sent back from native to JS, unless either:
* explicitly requested via `Performance.getEntries*`
* actually observed via `PerformanceObserver`

Reviewed By: rubennorte

Differential Revision: D44712550

fbshipit-source-id: 7fc891b09bd00fa9b510d1dc059cf908d5caea07
2023-04-06 08:08:07 -07:00
Lorenzo Sciandra caa3fd83a6 fix(e2e script): fix the script post monorepo & metro-config work (#36836)
Summary:
Just backporting to main a couple of fixes we've done in the 0.72 branch plus removing the old bash script to avoid confusion (since now it's more broken than ever)

## Changelog:

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

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

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

[INTERNAL] [FIXED] - fix the local e2e script post monorepo & metro-config work

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

Test Plan:
Run `yarn test-e2e-local` successfully, both for RNTester & RNTestProject scenarios.

Here's a screenshot if RNTestProject working successfully:
<img width="1501" alt="Screenshot 2023-04-06 at 14 20 54" src="https://user-images.githubusercontent.com/16104054/230394301-49ea5752-27ad-4800-b56e-004fd88e9c44.png">

Reviewed By: rshest

Differential Revision: D44748037

Pulled By: cipolleschi

fbshipit-source-id: d00438bd766e8f228120f7bbceef2013cf9c966f
2023-04-06 08:01:54 -07:00
Nicola Corti f874a7e7d3 Update react-native-xcode.sh to do not point users towards our issue … (#36837)
Summary:
Pointing users towards our issue tracker is not really effective as the underlying issue is a misconfiguration of their environment. I'm tweaking this error message.

## Changelog:

[INTERNAL] - Update react-native-xcode.sh to do not point users towards our issue …

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

Test Plan: n/a just a string change

Reviewed By: cipolleschi

Differential Revision: D44748094

Pulled By: cortinico

fbshipit-source-id: 6d960268eb7324b86ff5e4d3d5ddf4bbe67c2349
2023-04-06 07:37:13 -07:00
Nicola Corti 01100a2fc8 Rename cleanAll to clean and refine it (#36832)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36832

We used to use `cleanAll` instead of `clean` to do cleaning of everything due to a bug on AGP on how clean was performed.
The bug is resolved, so we can now use `clean` properly.
Moreover, we have sporadic failures when the codegen/lib/ folder is not cleaned up. This fixes it.

Changelog:
[Internal] [Changed] - Rename cleanAll to clean and refine it

Reviewed By: cipolleschi

Differential Revision: D44745849

fbshipit-source-id: 4da5d34bcb0ee5c9f6b0e0f4e5b919bcc3171270
2023-04-06 05:54:15 -07:00
Vincent Viego 49f1237526 Rename FabricMountItem.* to MountItem.* (#36722)
Summary:
Changelog: [Android] [Breaking] - Renamed FabricMountItem.* files to MountItem.* to better match the name of the struct.

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

Reviewed By: cortinico, cipolleschi

Differential Revision: D44540079

fbshipit-source-id: 79d8aa7c6f6b908be52009c51c4ea2f601f788fd
2023-04-06 05:03:22 -07:00
Genki Kondo 08588538fe Introduce RCTObjectAnimatedNode (#36804)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36804

AnimatedObject is a more generic version of AnimatedTransform, able to handle animated values within arrays and objects. This is useful for props of native components that may need to be animated per field.

This diff adds the native (iOS) counterpart to AnimatedObject node in JS. The node handles array and map value types.

Changelog:
[Internal][Added] - Introduce ObjectAnimatedNode iOS-side node for handling array and object prop values

Reviewed By: philIip

Differential Revision: D44678162

fbshipit-source-id: 7cdc075229a55fcb450f23ba5667b3ddd48c24df
2023-04-05 16:22:44 -07:00
Vincent Riemer 54a6922bdc Add plumbing/boilerplate for an iOS implementation of the click event (#36615)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36615

Changelog: [Internal] - Add plumbing/boilerplate for an iOS implementation of the `click` event

This diff simply adds the boilerplate necessary to hook up a click event to the fabric iOS touch handler. This diff does not contain any actual implementation of the click's behavior as that will occur in future diffs.

Reviewed By: necolas

Differential Revision: D43129366

fbshipit-source-id: 71488b893c789d21c833533471745275062c0730
2023-04-05 15:00:05 -07:00
Zihan Chen (MSFT) 9bb71650c9 Add @react-native/codegen-typescript-test to verify .d.ts files in @react-native/codegen (1) (#36562)
Summary:
- Add a typescript project to test `CodegenSchema.d.ts`. More tests for other .d.ts files will be added in future pull requests.
- The build script scans all snapshots from `react-native/codegen`'s typescript frontend and generates .ts files for each snapshot, but they are .gitignore-ed.
- `npm run build` will build these .ts files against `CodegenSchema.d.ts` after generating them.
- A failed jest case is included to ensure CI catch it, it will be removed before merged.

bypass-github-export-checks

## Changelog:

[General] [Added] - Add react-native/codegen-typescript-test to verify .d.ts files in react-native/codegen (1)

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

Test Plan:
`npm run build` in `packages/react-native-codegen-typescript-test` and see all test files appear in `__generated__`.

## Screenshot

![Untitled](https://user-images.githubusercontent.com/53799235/226757755-cab4cb29-7d22-46a1-9ecb-d6732122ed38.png)

Reviewed By: rshest

Differential Revision: D44292277

Pulled By: cipolleschi

fbshipit-source-id: 8d79fe913f9563d64c92aae7c4f4e97a24ae9a21
2023-04-05 07:38:25 -07:00
Genki Kondo a248456d18 Introduce ObjectAnimatedNode (#36742)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36742

AnimatedObject is a more generic version of AnimatedTransform, able to handle animated values within arrays and objects. This is useful for props of native components that may need to be animated per field.

This diff adds the native (Android) counterpart to AnimatedObject node in JS. The node handles array and map value types.

Changelog:
[Internal][Added] - Introduce ObjectAnimatedNode Java-side node for handling array and object prop values

Reviewed By: mdvacca

Differential Revision: D44466563

fbshipit-source-id: bd026cbd921ec51ae17eab08417708f3272c0418
2023-04-05 07:27:38 -07:00
Janic Duplessis 1f384f75da Add fabric support for maintainVisibleContentPosition on Android (#35994)
Summary:
Implement a few missing bits for `maintainVisibleContentPosition` to work with fabric. The main thing needed is to add 2 fabric renderer listener methods to allow to hook into specific parts of the rendering process. We need some code to execute before view updates are executed and after view updates are executed. The current methods that are exposed do not work for this case. `willDispatchViewUpdates` is called from JS thread, and there doesn't seem to be a way to add UI blocks that will be executed at the right time like we do in paper. `didDispatchMountItems` is called for every frame which we don't want and will cause lots of overhead.

After that we simply need to call the right methods in the new renderer listener methods.

## Changelog

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

Pick one each for the category and type tags:

[ANDROID] [ADDED] - Add fabric support for maintainVisibleContentPosition on Android

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

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

Test Plan: Tested in RN tester maintainVisibleContentPosition example on Android with fabric enabled.

Reviewed By: cipolleschi

Differential Revision: D44131763

Pulled By: cortinico

fbshipit-source-id: 32c0b5867d460537b18a70d472fd58052da6cf80
2023-04-05 07:09:33 -07:00
Antoine Doubovetzky 8fbcfcea8d Extract throwIfConfigNotfound and throwIfMoreThanOneConfig from findComponentConfig function (#36719)
Summary:
This PR contains tasks 96 and 97 from https://github.com/facebook/react-native/issues/34872:

>[Codegen 96 - assigned to AntoineDoubovetzky] Create a throwIfConfigNotfound in the error-utils.js file and extract the error code from [Flow](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/components/index.js#L61-L63) and [TS](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/components/index.js#L62-L64)
 [Codegen 97 - assigned to AntoineDoubovetzky] Create a throwIfMoreThanOneConfig in the error-utils.js file and extract the error code from [Flow](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/components/index.js#L64-L66) and [TS](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/components/index.js#L65-L67)

## Changelog:

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

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

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

[Internal] [Changed] - Extract throwIfConfigNotfound and throwIfMoreThanOneConfig from findComponentConfig function

bypass-github-export-checks

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

Test Plan: I tested using Jest and Flow commands.

Reviewed By: rshest

Differential Revision: D44539681

Pulled By: cipolleschi

fbshipit-source-id: c778ad1620d1c3f60b10c25c51efcb11173b3037
2023-04-05 06:55:47 -07:00
Gijs Weterings edc5ea11bb Add Meta header to xplat/js/react-native-github/tools/build_defs/oss/preload.bzl (#36814)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36814

Working through the backlog of failing open source requirements (T139285789). Most files that are violating Copyright rules are due to the exemptions being outdated, but this file actually needs a header.

Changelog: [Internal]

Reviewed By: cortinico, cipolleschi

Differential Revision: D44705585

fbshipit-source-id: 0319be3be0726a76cd98448205f5af76343ad356
2023-04-05 06:55:34 -07:00
Finn Pauls f0893cf72f Support font-variant-ligatures values (#36740)
Summary:
The text style prop `fontVariant` in React Native is supposed to map to the CSS `font-variant` property. The CSS property is a short-hand for the following CSS properties:

- [font-variant-alternates](https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-alternates)
- [font-variant-caps](https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-caps)
- [font-variant-east-asian](https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-east-asian)
- [font-variant-emoji](https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-emoji)
- [font-variant-ligatures](https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-ligatures) 👈
- [font-variant-numeric](https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-numeric)
- [font-variant-position](https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-position)

Currently React Native only supports a subset of the values from `font-variant-numeric` and `font-variant-caps`.

This change increases the `font-variant` support by adding all values from `font-variant-ligatures`.

## Changelog:

[iOS] [Added] - Add all fontVariant values for font-variant-ligatures
[Android] [Added] - Add all fontVariant values for font-variant-ligatures

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

Test Plan:
See https://github.com/facebook/react-native/pull/36740#issuecomment-1492546631
## Resources
- [Apple True Type Reference](https://developer.apple.com/fonts/TrueType-Reference-Manual/RM09/AppendixF.html)
- [Webkit Source Code](https://opensource.apple.com/source/WebCore/WebCore-7602.1.50.1.1/platform/graphics/cocoa/FontCacheCoreText.cpp)
- [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-ligatures)
- [Android TextView Documentation](https://developer.android.com/reference/android/widget/TextView#setFontFeatureSettings(java.lang.String))

Reviewed By: cipolleschi

Differential Revision: D44705513

Pulled By: cortinico

fbshipit-source-id: 1cde5fcc23ba99fd2f98fa73d934c8e51b0d292e
2023-04-05 06:16:15 -07:00
Nicola Corti de2f01d9d7 Do not store scripts inside .github/workflows (#36811)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36811

Editing frequently the `.github/workflow` folder makes harder to use the
`/rebase` command as it fails if there are edits to such folder in the middle
of a rebase.
I'm moving the .js files outside of that folder.

Changelog:
[Internal] [Changed] - Do not store scripts inside .github/workflows

Reviewed By: sshic

Differential Revision: D44705878

fbshipit-source-id: a8007d6c126dbda2a1ee9d8cb0397df5df43fd63
2023-04-05 05:25:35 -07:00
Rubén Norte 1476d99048 Extract ReactFabricHostComponent into a separate module
Summary:
Small refactor in preparation for adding `ReactNativeElement` as an alternative implementation for `ReactFabricHostComponent`.

Changelog: [internal]

bypass-github-export-checks

Reviewed By: yungsters

Differential Revision: D44299619

fbshipit-source-id: b1bc43f6a6ae5b75dca43d7e08cd15acdc49bb79
2023-04-05 04:59:46 -07:00
Rubén Norte 4bff977869 Add behavior from React repo to FabricUIManager mock
Summary:
We recently added an implementation of the native binding for UIManager (`global.nativeFabricUIManager`) in JavaScript. This brings the logic we had in that mock in the React repository so we can properly use it for testing (as integration tests instead of unit tests).

Changelog: [internal]

bypass-github-export-checks

Reviewed By: yungsters

Differential Revision: D44298377

fbshipit-source-id: 6085df93993302c2ddce7220c73e614ad6301667
2023-04-05 04:59:46 -07:00
Nicola Corti d1174535f7 Remove the update-ruby script as it's now unnecessary (#36802)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36802

As we now support a broader range of ruby version, we don't need `update-ruby.sh` anymore
and we also don't need to call it during the set-rn-version script.

Changelog:
[Internal] [Changed] - Remove the update-ruby script as it's now unnecessary

Reviewed By: cipolleschi

Differential Revision: D44670361

fbshipit-source-id: b23abab28ccbd27408e4d76670101faeb463bc6b
2023-04-05 03:50:40 -07:00
Pieter De Baets 58ee6b2f7a Remove unused fields from AndroidTextInputState (#36797)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36797

defaultParentShadowView and defaultTextAttributes are never used

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D44665067

fbshipit-source-id: 5e607ab323020bef5c9708a6e683582ac47acb2a
2023-04-05 02:33:21 -07:00
Samuel Susla deaef09d7f Avoid double assignment of runtime scheduler (#36801)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36801

changelog: [internal]

This looks like a typo.

Reviewed By: cipolleschi

Differential Revision: D44670852

fbshipit-source-id: 59891a6256be366601e4791a733df9b68e8c2a68
2023-04-05 01:45:32 -07:00
Genki Kondo 7aa9936835 Modify AnimatedProps and AnimatedStyle to use AnimatedObject (#36798)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36798

AnimatedObject is a more generic version of AnimatedTransform, able to handle animated values within arrays and objects. This is useful for props of native components that may need to be animated per field.

This diff hooks up AnimatedObject to AnimatedProps and AnimatedStyle for values that are arrays or objects.

Changelog:
[Internal][Added] - Modify AnimatedProps and AnimatedStyle to use AnimatedObject

Reviewed By: rshest

Differential Revision: D44637985

fbshipit-source-id: c70b9d40e40d0782c2c1a332f1f22358fe0abe64
2023-04-04 18:37:20 -07:00
Brian Long 816598975c ObjectPreview support (#36785)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36785

D43553742 adds support for ObjectPreviews in CDP messages; this diff implements support in the Inspector for honoring generatePreview requests and returning ObjectPreviews in the relevant request messages.

Changelog: [Internal]

Reviewed By: mattbfb

Differential Revision: D44522932

fbshipit-source-id: 216debe36b4e61c822fa3ae513e5eba399fad019
2023-04-04 18:29:08 -07:00
Olga Zinoveva d038e4e3bf Add github workflow for automatic API, topic, and component labeling of issues (#36712)
Summary:
Adding a new github workflow script, which will run as part of the existing triage job that is triggered when an issue is  labeled with the "Needs: Triage" label (this typically happens automatically when the issue is created).
This script will add an extensive list of possible labels corresponding to APIs, components, and topics (see the code for the full list).
The motivation for this change is to replace the last bit of meaningful functionality performed by react-native-bot, which will allow us to decommission that bot in favor of using github workflows for all issue and PR automation.

## Changelog:

[INTERNAL] [CHANGED] - Updated API, topic, component labeling on issues to run from a GH workflow rather than an external bot action

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

Test Plan:
For examples of issues being labeled by this new script, see the open issues here: https://github.com/SlyCaptainFlint/react-native/issues
I did not test every possible label, but I tested at least one from each category (API, component, topic), and a combination of one or two of each.

Reviewed By: cortinico, cipolleschi

Differential Revision: D44593658

Pulled By: SlyCaptainFlint

fbshipit-source-id: 93758d05a70d02bed76ab0b6149271e757e0a12f
2023-04-04 15:49:01 -07:00
Dmitry Rykun fdbc89d10b Re-land "[react-native][PR] [Upstream][Security] Use execFileSync over exec for cases with uncontrolled absolute paths" (#36791)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36791

This is a re-land of D44635949. It was reverted as it was a suspected cause of CircleCI fails. It turned out the diff was unrelated, and the cause was something else.

## Changelog
[Internal][Security] - Use execFileSync over exec for cases with uncontrolled absolute paths

Reviewed By: cortinico

Differential Revision: D44663132

fbshipit-source-id: dfb3d09dbfbe3312ef54bcbbc43c8b4062d787a8
2023-04-04 15:17:44 -07:00
Brian Long de35e2881e msggen support for cdp previews (#36781)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36781

----

Add support to msggen for types like:

* Runtime.CustomPreview
* Runtime.EntryPreview
* Runtime.ObjectPreview
* Runtime.PropertyPreview

And their related use as properties.

There was quite a gap here. The work involves:

* Upgrade devtools-protocol to 0.0.1107588 even pick up the schema definitions in the first place.
* Next problem: all the preview stuff is experimental. Had to add support to --include-experimental flag for targeting types AND properties.
* Next problem: the protocol schema for previews is cyclical. ObjectPreview refers to PropertyPreview and EntryPreview, which both refer back to ObjectPreview. msggen only allowed for DAGs. Added support for allowing cycles.
* Next problem: Forward declarations are not enough to compensate for the cyclical references, because of the incomplete type definitions. This breaks optional, vector, and simple containment. To address this:
  * In the graph traversal code, where before we would error if the graph had a cycle, we allow for the cycle, but record the cyclical reference from a property on Type B's to Type A.
  * Whenever we emit the definition of Type B, its references to Type A are not naked, they are now wrapped in a unique_ptr.
  * However, because the unique_ptr only has a forward declaration, and not a complete type, we need to specify a custom deleter.
* Next problem: There are lots of cases where these types that now contain unique_ptrs were being copied, which no longer works. So, make all these codegen'd types move-only, and change a few places where were copying root objects, to move them instead.
* Many tests required changes to avoid copy construction/assignment that were occuring. MessageTypes are not copyable construcrtible/assignable now.

Changelog: [Internal]

Reviewed By: jpporto

Differential Revision: D43553742

fbshipit-source-id: 1e4c495aa600feb6f1901e6bc013d517ba8d8a2d
2023-04-04 14:17:43 -07:00
Phillip Pan aa15fd44a6 decouple DialogModuleTest from PowerMock (#36778)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36778

Changelog: [Internal]

we can just use mockito for this suite

Reviewed By: mdvacca

Differential Revision: D44603023

fbshipit-source-id: b8f6f37fccba38990fe498d8f5e479f174ff93af
2023-04-04 13:49:37 -07:00
Dmitry Rykun 62c4da1421 Bump activesupport to 6.1.7.3 to address CVE-2023-28120 (#36803)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36803

Changelog:
[Internal][Changed] - Bump activesupport to 6.1.7.3 to address CVE-2023-28120

Reviewed By: christophpurrer

Differential Revision: D44673150

fbshipit-source-id: 3df10132c7da2d22956edb7193db963cdf0b5f54
2023-04-04 12:49:17 -07:00
David Vacca c0b4883058 Deprecate and mark for removal com.facebook.react.common.StandardCharsets (#36779)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36779

Deprecate and mark for removal com.facebook.react.common.StandardCharsets, this class was originally created because java.nio.charset.StandardCharsets only exists in Android API level 19+

As part of this diff I also migrate all internal usages of  com.facebook.react.common.StandardCharsets

Changelog:
[Android][Deprecated] - Deprecate and mark for removal com.facebook.react.common.StandardCharsets, please use java.nio.charset.StandardCharsets instead

Reviewed By: rshest

Differential Revision: D44592721

fbshipit-source-id: c3f4286766209a733b466d19dc36891f12d69be1
2023-04-04 10:43:56 -07:00
Nicola Corti 990971186f Fix a crash new app template when createRootView is invoked with null bundle (#36796)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36796

As the title says, this fixes a instacrash on template when `createRootView` is invoked with
a bundle being null. The crash was happening as the parameter, despite being not used, is
specified as `Bundle` and is not nullable. When the Java caller passes `null`, the app crashes.

Changelog:
[Android] [Fixed] - Fix a crash new app template when `createRootView` is invoked with null bundle

Reviewed By: cipolleschi

Differential Revision: D44668305

fbshipit-source-id: 1150ddac26f19765e7340878c8850d8462c6f3fd
2023-04-04 09:40:57 -07:00