Commit Graph

26849 Commits

Author SHA1 Message Date
Pieter De Baets 06e55ec5ea Avoid double glog init internally
Summary:
glog logging was being sent to adb logcat twice since `fbgloginit` uses `force_static = True` and was being linked as two separate copies.

Changelog: [Internal]

Reviewed By: sshic

Differential Revision: D43842295

fbshipit-source-id: da4233d29dbddc2b3cefdca979c873479672b11c
2023-03-08 05:38:55 -08:00
Riccardo Cipolleschi d72697ca95 Prepare to break the Dependency Cycle between React-graphics and React-Fabric (#36385)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36385

This change moves the `graphics/conversions.h` files from `ReactCommon/react/renderer/graphics` to `ReactCommon/react/renderer/core`, renaming it to `graphicsConversions.h`.

This is required because React-Fabric imports graphics, but graphics imports React-Fabric due to this file.

The change would be breaking, but we don't want to break the ecosystem without even a warning. So, we put back the `conversions.h` file, which now just `include` the new one and outputs a warning when building. This actually maintain the dep cycle for the current version, but at least users are warned.

## Changelog:
[iOS][Deprecated] - Deprecate the `ReactCommon/react/renderer/graphics/conversions.h` in favor of `ReactCommon/react/core/graphicsConversions.h`

Reviewed By: cortinico, dmytrorykun

Differential Revision: D43836261

fbshipit-source-id: ffe53a8ce2b0ea2dd1e1e5aaf6b3d3c5b57ad46d
2023-03-08 03:59:55 -08:00
Riccardo Cipolleschi a055e07c3e Use the new CLI properties for codegen the legacy components
Summary:
This change updates the way in which we consume the list of components from the `react-native.config.js` files so that it is aligned to what Android does.

## Changelog:
[iOS][Changed] - Update how the `react-native.config.js` is consumed to add elements in the interop layer.

Reviewed By: cortinico

Differential Revision: D43875395

fbshipit-source-id: e359c98a9144f4efe62967096d48318491718958
2023-03-08 02:28:32 -08:00
Nick Gerleman 7858a2147f Enforce compatibility with exactOptionalPropertyTypes (#36345)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36345

`exactOptionalPropertyTypes` is a TypeScript 4.4+ option set by users which changes behavior of optional properties, to disable accepting explicit `undefined`.

This is not enabled when using `--strict`, and is stricter than Flow, leading to most of the typings having an `| undefined` unique to TypeScript (added with https://github.com/DefinitelyTyped/DefinitelyTyped/commit/694c663a9486dbe7794d5eb894a691ee9ded318a).

We have not always followed this (I have myself previously assumed the two are equivalent). We can enforce that the convention is followed with a plugin `eslint-plugin-redundant-undefined`. This forces us to declare that every optional property accepts an explicit undefined (which Flow would allow). Alternatively, if we do not want to support this, we can enable the existing dtslint rule `no-redundant-undefined`.

Changelog:
[General][Fixed] - Enforce compatibility with `exactOptionalPropertyTypes`

Reviewed By: lunaleaps

Differential Revision: D43700862

fbshipit-source-id: 996094762b28918177521a9471d868ba87f0f263
2023-03-08 00:14:56 -08:00
Xin Chen f4e56fdf19 Refactor performance memory API implementation
Summary:
This diff refactors performance memory API and the RN Tester example.

- The returned value from C++ is number, so no need to cast
- Reuse `MemoryInfo` in RNTester example

Changelog:
[General][Internal] - Code refactor for performance memory API implementation

Reviewed By: rubennorte

Differential Revision: D43523878

fbshipit-source-id: 37d1f6a829a8eac45f7e3791ad36be0c199c6041
2023-03-07 18:32:20 -08:00
Genki Kondo 96659f8e83 Fix overflowInset to take into account hitSlop
Summary:
Previously, the touch area could never extend past the parent view bounds. Thus, hitSlop would not have any effect if it extended beyond any ancestor view's view bounds.

In this diff, we apply hitSlop when calculating overflowInset. Specifically, we make sure to union the hit slop areas of all children when calculating the contentFrame.

overflowInset is then used for hit testing (as in [TouchTargetHelper.java](https://www.internalfb.com/code/fbsource/[b0f630bb24271d8ed543e98ff144590290e19805]/xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/uimanager/TouchTargetHelper.java?lines=195)).

A risk is that other optimizations that may potentially rely on overflowInset beyond hit testing (such as clipToBounds) may not be as efficient with a large hitSlop.

Changelog:
[General][Fixed] - Fix touch handling so that hitSlop can extend beyond parent view bounds.

Reviewed By: javache

Differential Revision: D43854774

fbshipit-source-id: 160bef135b8487c28c4ada662577c35a7a36f484
2023-03-07 12:30:14 -08:00
Riccardo Cipolleschi f264fe12df Bump Xcode to 14.2.0 in circleCI (#36388)
Summary:
In CricleCI we are still using Xcode 14.0.1.
This version will be removed from CircleCI this Thursday, so we have to update it.

## Changelog
[Internal] - Bump xcode in CircleCI to 14.2.0

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

Test Plan: CircleCI should be Green

Reviewed By: dmytrorykun

Differential Revision: D43873750

Pulled By: cipolleschi

fbshipit-source-id: 8b796c0961647fce103d2659036bf5f9037fe90a
2023-03-07 08:45:22 -08:00
Pieter De Baets 3a06cca9dc Add feature flag to use JSI NativeState instead of HostObject (#36395)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36395

NativeState is a lighter-weight alternative to HostObject, which may simplify some of our use-cases of interacting with JS in the renderer. The down-side is that this approach doesn't allow exposing custom props or functions.

This diffs adds new feature flags to enable experimenting with this functionality and measure any perf impact.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D41553421

fbshipit-source-id: 3065bd7b60f0fa7b63c390e92a785582eee7e613
2023-03-07 08:11:02 -08:00
Ryan Schoppmeyer 4a925c43c2 Support HermesAPILeanOrFull in react native apps (#36202)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36202

This changes all of the in-built dependencies in react native app components upon hermes from HermesAPI to HermesAPIFullOrLean.

HermesAPI (full) includes the bytecode compiler and thus has support for eval().
HermesAPILean does not include the bytecode compiler. It throws at runtime if eval is called. The native dependencies are significantly smaller without the bytecode compiler.

The HermesAPIFullOrLean target toggles between full and lean modes based on the value of buckconfig field `hermes.lean_vm` (default is false). Therefore, without overriding this config option, this change is a no-op and should result in react native apps being built with exactly the same dependencies as before.

If you do specify it, you lose eval support at runtime and gain an apk size savings of a few hundred kB after compression.

This also removes the vestigial `hermes_api_dep()` build macro.

skip-frl-buck-targeting

Reviewed By: javache

Differential Revision: D43283200

fbshipit-source-id: 0157be4a9339f70e73d29d694c18b31805107000
2023-03-07 06:33:14 -08:00
Pieter De Baets 419025df22 Remove unused LongLivedObject include (#36391)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36391

This include isn't required and was causing issues in the Cocoapods build.

Changelog: [iOS][Fixed] Unbreak cocoapods build

Reviewed By: cipolleschi

Differential Revision: D43870523

fbshipit-source-id: 7e31049d19ef025e9e16284712fb2a80dbdf235e
2023-03-07 04:43:37 -08:00
Janic Duplessis 59c4db85fb Add fabric support for maintainVisibleContentPosition on iOS (#36095)
Summary:
Reland of https://github.com/facebook/react-native/issues/35319 with a fix for custom pull to refresh components.

Custom pull to refresh component in fabric will need to conform to the `RCTCustomPullToRefreshViewProtocol` protocol, this way we know that the view is a pull to refresh and not the content view.

## Changelog

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

Pick one each for the category and type tags:

[IOS] [ADDED] - Add fabric support for maintainVisibleContentPosition on iOS

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

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

Test Plan:
This will need to be tested internally in the product the crash happened.

Take a local build of Wilde open Marketplace.

Reviewed By: jacdebug

Differential Revision: D43128163

Pulled By: cipolleschi

fbshipit-source-id: 6cf8ddff92aeb446072a3d847434e21b9e38af61
2023-03-07 04:20:31 -08:00
MaeIg a448c6d80f Extract the functions to compute partial properties in the Flow and TypeScript parsers. (#36373)
Summary:
This PR aims to extract  the switch(configType) block from the buildSchema function into a separate function in a shared file between typescript and flow. It is a task of https://github.com/facebook/react-native/issues/34872:
> [Codegen 77 - assigned to MaeIg] Extract the functions to compute partial properties from the index.js file ([Flow](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/modules/index.js#L180-L194) and [TypeScript](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/modules/index.js#L261-L278))in the Flow and TypeScript parsers.

## 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 the functions to compute partial properties in the Flow and TypeScript parsers.

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

Test Plan:
yarn flow:
<img width="560" alt="image" src="https://user-images.githubusercontent.com/40902940/222934040-97e88691-c1d6-44a1-b7ee-e500b4698cd2.png">

yarn lint:
<img width="509" alt="image" src="https://user-images.githubusercontent.com/40902940/222934137-05b6f1fd-a755-4323-baac-5954d36fd613.png">

yarn test
<img width="388" alt="image" src="https://user-images.githubusercontent.com/40902940/222934145-76a2bc38-7469-4c30-9301-bc21cfadded4.png">

Reviewed By: cipolleschi

Differential Revision: D43867937

Pulled By: rshest

fbshipit-source-id: f78fe399ff7d7d2cf8f44d1165418566b0a25628
2023-03-07 03:15:52 -08:00
Pieter De Baets b73dd6726d Use WeakObject for new turbomodule binding mechanism
Summary:
A previous version of this experiment saw crashes on iOS once rolled out. Switching to WeakObject to make sure we're not accessing invalid references, and setting up the ability to experiment with this on iOS.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D41552667

fbshipit-source-id: dc0c54edc2ad18c1947941119ffd50038a47c5f6
2023-03-07 01:17:44 -08:00
Pieter De Baets c28c6f2531 JavaTurboModule/LongLivedObject cleanup (#36367)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36367

* Don't iterate over JSI Value to get args, convert each of the args individually instead
* Make LongLivedObjectCollection constructor private
* allowRelease does not need to be virtual
* Move away from const-ness as a thread-safety indicator

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D43354535

fbshipit-source-id: eaf8eb931ab6ec307a3dc2690eabeb34bb6afa77
2023-03-07 01:17:44 -08:00
Ruslan Shestopalyuk ea354d4e22 Unit tests/fixes for PerformanceEntryObserver::get/clearEntries (#36384)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36384

## Changelog:
[Internal] - Adds more test coverage to PerformanceEntryObserver functionality related to buffering of the marks/measures, as well as making fixes for certain corner cases handled incorrectly (which are now covered by tests).

Reviewed By: rubennorte

Differential Revision: D43835928

fbshipit-source-id: fc8adbd6c2a2b6b201f1f14bdf51245268c5eabd
2023-03-06 15:23:02 -08:00
Gijs Weterings 24dbb5df0a Back out "Migrate packages to not eager initialize view managers"
Summary:
Original commit changeset: fd172fc664d6

Original Phabricator Diff: D43711708 (https://github.com/facebook/react-native/commit/d7eb3bfcb3df43d787af34cbd16730b2a12b6714)

Reviewed By: huntie

Differential Revision: D43843828

fbshipit-source-id: af977dd51135505e1823c440e3cbaf9d4ea02545
2023-03-06 10:29:45 -08:00
Mikhail Mikhaylov 0ecb4e64f0 Fixes JSDoc in Clipboard setString (#36381)
Summary:
There was a JSDoc mismatch in `Clipboard.setString` method, `the` was considered as a parameter name, not `content`. Added correct param name and kept the same description as before, separated with a hyphen.

## Changelog

[GENERAL] [FIXED] - Fixes JSDoc in Cliapboard setString

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

Test Plan: No tests needed

Reviewed By: yungsters

Differential Revision: D43839086

Pulled By: cortinico

fbshipit-source-id: 126035d9796e66938402704eaf9bc8646ee9b78b
2023-03-06 10:25:32 -08:00
Pieter De Baets e088f81375 Remove force_static from ReactCommon/react/renderer/core
Summary: This will cause the library to be included multiple times in different dynamic libraries, leading to potentially different values of `CoreFeatures`.

Reviewed By: christophpurrer

Differential Revision: D43772552

fbshipit-source-id: 4590bb9aef7c2330b6e488fa1640eda2720b6e7b
2023-03-06 07:21:58 -08:00
Saad Najmi d00c1503bd Import OCMock as a pod for RNTester on iOS (#36239)
Summary:
This is a change we have implemented in React Native macOS that I am now upstreaming: https://github.com/microsoft/react-native-macos/pull/1257

The library `ocMock` is currently imported as a checked in binary by RN-Tester to help run unit tests on iOS. That binary is only compiled for x86 on macOS, which meant we could not run tests on M1 / M2 Macs. Switching  it so that we import from source as a pod should make maintenance easier for both iOS and macOS! :)

Original change notes:

>Previously, we've been unable to test RNTester for macOS on an M1 machine. This is because we were using a framework that was prebuilt for Intel architecture, so the test components would fail to build.
>
> The fix is to build OCMock from source directly instead of using a prebuilt version.
>
> This is only necessary on macOS. The iOS version is already built for ARM architecture, as iOS devices have been running exclusively on ARM for a while now.

## Changelog

[INTERNAL] [CHANGED] -  Import OCMock as a pod

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

Test Plan: CI should pass as it did before.

Reviewed By: dmytrorykun

Differential Revision: D43732219

Pulled By: cipolleschi

fbshipit-source-id: 028b5a7f384042145bf1966c8c2730d7437940ec
2023-03-06 05:23:42 -08:00
Ruslan Shestopalyuk 350c055e3d Set up C++ unit tests for WebPerformance
Summary:
## Changelog:
[Internal] - Add unit tests for the WebPerformance library (PerformanceEntryReporter)

This sets up a C++ unit test suite for `PerformanceEntryReporter` (the core part of the native side of WebPerformance) and adds test coverage for its core functionality.

Reviewed By: sammy-SC

Differential Revision: D43771370

fbshipit-source-id: ad3e0f3f206701c2ea6a5c9386458a76699e7c80
2023-03-06 03:53:16 -08:00
Lulu Wu d7eb3bfcb3 Migrate packages to not eager initialize view managers
Summary:
Migrate packages need for Catalyst app to use lazy view manager initialisation

Changelog:
[Android][Changed] - Migrate packages to not eager initialize view managers

Reviewed By: javache

Differential Revision: D43711708

fbshipit-source-id: fd172fc664d68fb7ee1d5a980516cdf48e30a979
2023-03-06 03:28:32 -08:00
Janic Duplessis d2dd79f3c5 Don't download hermes nightly tarball if it exists (#36368)
Summary:
Currently the hermes tarball will be re-downloaded every time we run pod update even if the file already exists. This adds a check to avoid downloading it if it already exists. To avoid partial downloads causing issues (if the script is interrupted) we download first to a different file and rename it when done.

## Changelog

[IOS] [FIXED] - Don't download hermes nightly tarball if it exists

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

Test Plan: Tested in an app using nightly builds that the download is only done once when running multiple pod update.

Reviewed By: sshic

Differential Revision: D43815772

Pulled By: cipolleschi

fbshipit-source-id: 9dedb79cab1f1cb37cd82b425d93515c6e1728c1
2023-03-06 02:59:35 -08:00
Riccardo Cipolleschi aac71507fa Add tests with more recent Rubies (#36376)
Summary:
This change add more tests for iOS, using different versions of Ruby

## Changelog
[iOS][Added] - Added smoke tests for iOS with Ruby 2.7.7 and 3.2.0

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

Test Plan: CircleCI must be green.

Reviewed By: blakef

Differential Revision: D43825344

Pulled By: cipolleschi

fbshipit-source-id: 8d3f5a2d9688f4d58f0ad5573d7b21e059cab523
2023-03-06 02:56:26 -08:00
Riccardo Cipolleschi b6f8210811 Use Ruby 2.6.10 in CI (#36361)
Summary:
Starting from RN 0.72, we would like to be more permissive in which version of Ruby our users can use. This means that we have to make sure that our pipeline works with various
versions of Ruby, especially the lowest one, which is 2.6.10.

This change make sure that we run all the CI jobs with version 2.6.10

## Changelog

[IOS] [CHANGED] - Use Ruby 2.6.10 in CI

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

Test Plan: CircleCI must be green

Reviewed By: blakef

Differential Revision: D43824143

Pulled By: cipolleschi

fbshipit-source-id: ecbeb66667a29d9ed07b86c099ad424380a934a7
2023-03-06 02:56:26 -08:00
Marshall Roch 947751fbe4 Upgrade to Flow 0.201.0
Summary: Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D43772813

fbshipit-source-id: 563c6f3dfb00bc9247ac0505d7f841afad1eb43e
2023-03-03 17:06:58 -08:00
Riccardo Cipolleschi 0f53d3195f Update offline mirrors for iOS
Summary:
Update the Offline mirrors for iOS

allow-large-files

## Changelog:
[Internal] - Update iOS offline mirrors

Reviewed By: cortinico

Differential Revision: D43768478

fbshipit-source-id: 5e7aa6d409f85786ddef795bc4f0261dcdcb4506
2023-03-03 14:44:57 -08:00
Riccardo Cipolleschi 4d7753eb9a Add Legacy Component to RNTester with Interop Layer (#36360)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36360

This change is the iOS equivalent of D43731219 (https://github.com/facebook/react-native/commit/ab55e123da8749d982964f2aee6ce6b0bffdc7fc), but only for what concerns the RNTester example as the interop layer was already present in the codebase and exposed to the OSS.

## Changelog
[internal] - Add example on how to consume a Legacy component in Fabric with the interop layer

Reviewed By: cortinico

Differential Revision: D43735699

fbshipit-source-id: 6cb5a3591e7e4a606c274566226025af91849c16
2023-03-03 14:44:57 -08:00
Riccardo Cipolleschi e4257a4dfb Attach a script to React-RCTAppDelegate to register Legacy Components in the interop layer (#36335)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36335

This change depends on [this PR](https://github.com/react-native-community/cli/pull/1849) of the CLI that introduces the `unstable_reactLegacyComponent` field in the `react-native.config.js` file.

This change introduce a JS script that reads that fields and generated a method in an object to return a list of components to be registered. The `RCTAppDelegate` has been updated to read those components and to automatically register them into the interop layer.

Notice that a user can just update the `react-native.config.js` and rebuild the app to integrate these changes, there is no need to reinstall the pods.

The idea behind this logic is to let the user know which components they are using with the interop layer, rather than rely on some black magic that could leave them blind to the need of actually migrate their apps.

## Changelog:
[iOS][Changed] - Implement mechanism to register legacy components in the iOS Fabric interop layer

Reviewed By: cortinico, dmytrorykun

Differential Revision: D43665973

fbshipit-source-id: b4e8d71fa1bbed7a6130ee4f83a6221394d5306e
2023-03-03 14:44:57 -08:00
Nicola Corti 574653319a Add labels to bypass stale bot (#36365)
Summary:
Tweaking stale bot to have labels that bypass the stale bot.

## Changelog

[INTERNAL] - Add labels to bypass stale bot

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

Test Plan: n/a

Reviewed By: cipolleschi

Differential Revision: D43771191

Pulled By: cortinico

fbshipit-source-id: 55962a9fe4480e962f94cb0456501e09d88f00da
2023-03-03 10:09:00 -08:00
Ruslan Shestopalyuk 5dd8e72589 Get rid of unneeded iOS platfrom dependency when running core C++ unit tests in RN (#36364)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36364

## Changelog

[Internal] -

Fixes dependencies, so we don't pull in unneeded iOS ones when we don't care about them (in this case, when running C++ tests for the RN core).

The iOS dependencies came from the `ReactCommon/react/utils` library, that was including ObjectiveC files unconditionally.

Reviewed By: cortinico, dmytrorykun

Differential Revision: D43769718

fbshipit-source-id: e6414e9ee8c5464754a12901f39668331817396e
2023-03-03 08:46:26 -08:00
Ruslan Shestopalyuk eb2f86a46a Fix typing for TS AnimatableStringValue (#36366)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36366

## Changelog:

[General][Fixed] -

https://github.com/facebook/react-native/pull/36346 added some typing improvements, however there was a typo in `AnimatableStringValue` type definition, that broke tests on CI.

Reviewed By: cortinico, cipolleschi, hoxyq

Differential Revision: D43770412

fbshipit-source-id: 7b4f234b5cf04df9271e0c98cf51655c87e3bebb
2023-03-03 07:09:02 -08:00
Xin Chen ec99ba1413 Add android app start time implementation
Summary:
This diff adds the android `appStartTime` implementation for `ReactMarker`.

Changelog:
[Android][Internal] - Add the android `appStartTime` implementation for `ReactMarker`

Reviewed By: rshest

Differential Revision: D43523607

fbshipit-source-id: 9dc95db30e36e7c1bfb262c74598f0ac249522f2
2023-03-02 22:40:12 -08:00
Nick Gerleman 02e29abead Improve handling of invalid DimensionValue usage (#36346)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36346

1. Remove Paper native assertions for converting DimensionValue string to Yoga unit, and fix a case where Fabric could throw on invalid value.
2. Move DimensionValue types in TypeScript to use template literal types, to show malformed strings in-editor, during typechecking. Update min TS version to allow this (in conformance with the min TS version used by DefinitelyTyped).

Changelog:
[General][Added] - Improve handling of invalid DimensionValue usage

Reviewed By: javache

Differential Revision: D43153075

fbshipit-source-id: db4e813df6e81cbd3158edad7c07c7a90c009803
2023-03-02 20:23:08 -08:00
Xin Chen c1023c73b0 Add performance.reactNativeStartupTiming API
Summary:
This diff adds the `performance.reactNativeStartupTiming` API to the performance global object for RN. This property does not exist in web, and we are free to make up our own list of properties in the startup metrics to track RN app startup process. In our case, we have the following six properties to begin with (we may extend and add more to this list in the future):

```
- `(start|end)Time`: The time ‘zero’ for the startup timing and the end of app startup. RN has no knowledge of app start time, which will be provided by the platform. The `endTime` will be the time when the first JS bundle finishes executing (Note that RN supports multiple JS bundles, which can be loaded async)
  - `executeJavaScriptBundleEntryPoint(Start|End)`: The time for RN to execute the JS entry point (and finish all sync job)

```

Changelog:
[General][Added] - Add new JS performance API to support getting RN app startup timings

Reviewed By: rshest

Differential Revision: D43326564

fbshipit-source-id: 7b4c7cae70ff64ba1714a1630cd5e183df6c06b0
2023-03-02 20:04:42 -08:00
Genki Kondo ba9327dc98 Add unit tests for proper order of create and connect operations for native animated
Summary:
Adds unit tests to test multiple animated values that connect to either transform, style, or props, to verify that the create operations are queued before connect operations. See D43717819 (https://github.com/facebook/react-native/commit/c72c592ecd9d31ec1661958d4e5f77f8dfb37cac) for context.

Changelog:
[Internal] - Add unit tests for proper order of create and connect operations for native animated

Reviewed By: mdvacca

Differential Revision: D43741191

fbshipit-source-id: 9143ba1fce86b546bc5a5a781c08ef0ca2d946d6
2023-03-02 16:20:03 -08:00
Nick Gerleman aab9df3710 Gracefully handle out-of-bounds initialScrollIndex
Summary:
Changelog:
[General][Fixed] - Gracefully handle out-of-bounds initialScrollIndex

Reviewed By: rshest

Differential Revision: D43672964

fbshipit-source-id: dbd9007c538015fc586e573d268135b7557dc908
2023-03-02 16:13:04 -08:00
Nicola Corti 31b4550a17 Bump all the usages of published packages in the monorepo (#36356)
Summary:
This bumps all the usages of the packages in the monorepo to the latest published.

## Changelog

[INTERNAL] - Bump all the usages of published packages

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

Test Plan: n/a

Reviewed By: jacdebug

Differential Revision: D43735714

Pulled By: cortinico

fbshipit-source-id: 746af2a2f34e65e1093d0670cd79dae5484f21c2
2023-03-02 14:25:58 -08:00
Wei Han caf80d442b Fix crash from setProperty in RCTTurboModule
Summary:
Changelog[Internal]:
[iOS][Fixed] - Fix crash from calling setProperty in RCTTurboModule

The crash is caused by passing a utf8 encoded string to a Object::setProperty overload which only allows ascii inputs.

Reviewed By: RSNara

Differential Revision: D43705999

fbshipit-source-id: b3f1b3fd27d43d40fe0a170d4c2e60faecc26dad
2023-03-02 10:31:21 -08:00
Genki Kondo c72c592ecd Fix order of operations when creating native DAG
Summary:
## Issue

You will run into an exception like:
  Animated node with tag (child) [8] does not exist
when attempting to convert an Animated node (or starting a native animation) to native when there are multiple non-style props that have AnimatedValues (this should be a very rare case, unless you have a custom native component, as most animated props are in style).

## Root cause

Due to how __makeNative is recursively called up and down the node graph, in a specific case where multiple AnimatedValues have an AnimatedProps as their child, the "connect" operation will occur before the "create" operation for the AnimatedProps node. For example:

- When a native animation is fired via Animated.timing().start(), __makeNative is called on the AnimatedValue (call this node AnimatedValueA) that is being animated. This results in the following sequence of events:
  - AnimatedValueA iterates through its children (in this case, AnimatedProps) and calls child.__makeNative
  - AnimatedProps iterates through all props with AnimatedValue values and calls __makeNative on them (call these nodes AnimatedValueB and AnimatedValueC).
  - AnimatedValueA.__makeNative is called again, but this time, the call early exits and does not do anything.
  - AnimatedValueB.__makeNative is called. This in turn calls AnimatedProps.__makeNative, which early exits (ROOT CAUSE OF BUG).
    - connectAnimatedNodes is queued (undesired)

## Fix

Short of completely refactoring of how we handle converting the DAG to native (which we should do at some point - the current implementation is error prone and suboptimal. Tracking in T146991336), for now we can make AnimatedProps.__makeNative behavior consistent with AnimatedTransform and AnimatedStyle by just avoiding the early exit, so that the connectAnimatedNodes calls all occur after all native nodes have been created

Changelog:
[General][Fixed] - Fixed error during native DAG creation when there are multiple AnimatedValue props

Reviewed By: rshest

Differential Revision: D43717819

fbshipit-source-id: 258682300a2be65935646b499591acf41eabc56e
2023-03-02 10:28:30 -08:00
Marshall Roch b044ece594 presuppress Flow v0.201 errors
Summary: Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D43720099

fbshipit-source-id: 6931548c90deb82cfc7e3d8173ccfc6aa7f0e1c8
2023-03-02 08:43:56 -08:00
Pranav Yadav 05454fa866 Merge Parse-Module-Name anon fn of Flow & TS parsers' (#36297)
Summary:
Part of Umbrella https://github.com/facebook/react-native/issues/34872
> [**Codegen 84** - assigned to Pranav-yadav] It depends on [Codegen 83] export the parseModuleName anonymous function (Flow, TypeScript) in a common parseModuleName function in the parsers-commons.js file.

- merged Parse Module-Name _**anon**_ fn of `Flow` & `TS` parsers; into a common `parseModuleName` fn in the `parsers-commons.js`
- added **tests** for `parseModuleName` fn from `parsers-commons.js`
- added `callExpressionTypeParameters` method to **_parsers_**
- added **tests** for `callExpressionTypeParameters` method of _parsers_
- used `parser.callExpressionTypeParameters` method in `parseModuleName` fn

PS: fixed merge conflicts several times :(

Overall :)

## Changelog

[INTERNAL] [CHANGED] - Merge Parse-Module-Name anon fn of `Flow` & `TS` and add `callExpressionTypeParameters` method to **_parsers_**

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

Test Plan: - `yarn lint && yarn run flow && yarn test react-native-codegen`  ==> 

Reviewed By: rshest

Differential Revision: D43694563

Pulled By: cipolleschi

fbshipit-source-id: 99cf40ada0a567cd9ff91078f66fd4ac3684f7cc
2023-03-02 08:28:49 -08:00
Nicola Corti b0863e1239 Bumping all the changes we have on main (#36355)
Summary:
This will publish several changes we have pending on main, specifically changes to React Native Gradle Plugin which are needed to unblock nightlies.

#publish-packages-to-npm

## Changelog

[INTERNAL] - Bumping all the changes we have on main

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

Test Plan: n/a

Reviewed By: hoxyq

Differential Revision: D43733634

Pulled By: cortinico

fbshipit-source-id: 9c041f7557cd8e494dfc942ae89e13e55353bb48
2023-03-02 07:11:43 -08:00
christopher.hines@hybridheroes.de 5093e557ef Move yargs to a dependency to avoid script failures (#35912)
Summary:
yargs depdendency is unavailable on npm ci breaking certain CI builds.

Fixes https://github.com/facebook/react-native/issues/35893#issuecomment-1397494372

Changelog: [Internal]

Prevent script failures on certain npm CI setups

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

Test Plan: waitforsandcastle

Reviewed By: hoxyq

Differential Revision: D43730837

Pulled By: cortinico

fbshipit-source-id: 926182ee8482cd0c7fd183ea3e993a9322680567
2023-03-02 05:48:23 -08:00
Nicola Corti ab55e123da Expose UnstableReactLegacyComponentDescriptor inside rrc_legacyviewmanagerinterop
Summary:
This adds the `UnstableReactLegacyComponentDescriptor`, part of the Fabric Interop Layer for Android.

Summary of the changes are:
* Expose a new `rrc_legacyviewmanagerinterop` native module via prefab
* Extend default App Cmake setup so `rrc_legacyviewmanagerinterop` is exposed by default
* Add a sample legacy component inside RN Tester

Changelog:
[Internal] [Changed] - Expose UnstableReactLegacyComponentDescriptor inside react/renderer/core

Reviewed By: cipolleschi

Differential Revision: D43731219

fbshipit-source-id: ee26d7e9d7eff5ef6a3e22853f8ea363b9198567
2023-03-02 05:10:45 -08:00
Ruslan Lesiutin b72dc7f2c4 fix: update publishing packages tag message prefix (#36348)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36348

Changelog: [Internal]

Turns out that Phabricator strips `@` symbol from `@...` tags when exports commits to GitHub. Proposing to use `#` instead.

#publish-packages-to-npm

Reviewed By: cortinico

Differential Revision: D43712415

fbshipit-source-id: 86fc728eb0cb63afb6a9fe592a9ae998da2ce2e4
2023-03-02 03:55:51 -08:00
Riccardo Cipolleschi dce9d8d5de Prepare cocoapods to accept the ENABLE_HERMES_PROFILER flag (#36352)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36352

WIP

## Changelog:
[iOS][Changed] - Add support to enable the Hermes Sampling Profiler

Reviewed By: mdvacca

Differential Revision: D43699036

fbshipit-source-id: 9da5aed94541e09c705909fb7166623c36ce2a3e
2023-03-02 03:06:14 -08:00
Tim Yung 2780ba38ff EventEmitter: Enforce Function Type of Listener
Summary:
Currently, `EventEmitter#addListener` defines the type (via TypeScript and Flow) of its second argument as a non-nullable function, and the implementation of `EventEmitter#emit` depends on this.

However, not everyone may be using a static type system. We're seeing some people encounter a poor developer experience when they supply non-function values to `EventEmitter#addListener`, because the type mismatch is not surfaced as an error until `EventEmitter#emit` throws later on.

This changes `EventEmitter#addListener` so that it throws when the second argument is not a function. This will make it easier for developers to identify the problematic call site because the stack trace will include the source of the non-function `listener` parameter.

Changelog:
[General][Changed] - `EventEmitter#addListener` now throws if the 2nd argument is not a function.

Reviewed By: rshest

Differential Revision: D43705465

fbshipit-source-id: 34ca91ac92862b31435bd12b7c9cb6da870a2a32
2023-03-02 02:52:20 -08:00
Simeng Pang 851c8c671a Revert D43500868: Expose UnstableReactLegacyComponentDescriptor inside react/renderer/components/legacyviewmanagerinterop
Differential Revision:
D43500868 (https://github.com/facebook/react-native/commit/071f6d2ca697ad298f41572e3d70a238f00ae8a3)

Original commit changeset: acfcd89efc42

Original Phabricator Diff: D43500868 (https://github.com/facebook/react-native/commit/071f6d2ca697ad298f41572e3d70a238f00ae8a3)

fbshipit-source-id: bb354015b2dcc812491b0219c6dd4d9c6321dc0b
2023-03-01 23:09:13 -08:00
Nicola Corti 071f6d2ca6 Expose UnstableReactLegacyComponentDescriptor inside react/renderer/components/legacyviewmanagerinterop (#36344)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36344

This adds the `UnstableReactLegacyComponentDescriptor`, part of the Fabric Interop Layer,
inside the `react/renderer/components/legacyviewmanagerinterop` module so that it can be included by the user externally.

If we wish to place it somewhere else, I'm more than happy to move it around.

Changelog:
[Internal] [Changed] - Expose UnstableReactLegacyComponentDescriptor inside react/renderer/components/legacyviewmanagerinterop

Reviewed By: mdvacca, cipolleschi

Differential Revision: D43500868

fbshipit-source-id: acfcd89efc42ff7a4ee6cb0a1cbd71d69f79721f
2023-03-01 17:58:07 -08:00
Yuan Du 4e117cb09d Revert D43186870: Move yargs to a dependency to avoid script failures
Differential Revision:
D43186870 (https://github.com/facebook/react-native/commit/32931b78d017ff321554f340586b8b3a91a57b80)

Original commit changeset: d7a64daac71b

Original Phabricator Diff: D43186870 (https://github.com/facebook/react-native/commit/32931b78d017ff321554f340586b8b3a91a57b80)

fbshipit-source-id: be64e88c67e8a0c2b7df04656ab651feb894e9b5
2023-03-01 13:27:41 -08:00