Commit Graph
28648 Commits
Author SHA1 Message Date
Phillip Pan 676676c954 kill RCTFabricSurfaceHostingProxyRootView (#38864)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38864

## Changelog:

[iOS][Breaking] - Deleting RCTFabricSurfaceHostingProxyRootView

We currently have 3 different container view classes in new architecture: `RCTFabricSurfaceHostingProxyRootView`, `RCTSurfaceHostingProxyRootView`, and `RCTSurfaceHostingView`. it's a little complicated for the current use case, so there's an opportunity to simplify.

in this PR, i get rid of `RCTFabricSurfaceHostingProxyRootView` by relying on the composable behavior of surface and host views instead of existing internal reflection logic that depends on inheritance. these are cleaned up in D48140101 and D48140317.

i checked GH search and no one is really using this in a fundamental way.

bypass-github-export-checks

Reviewed By: cipolleschi

Differential Revision: D48139820

fbshipit-source-id: 068b994a8b068a4107397f1862356b8fa1da961f
2023-08-16 13:34:54 -07:00
Kolin Krewinkel 02408e1df2 Override canScrollHorizontally() to expose when scrolling is disabled
Summary:
**Context**
We have a bug where a ReactHorizontalScrollView is set to scrollEnabled = false. However, it still has a "scrollable width." When other components evaluate how to handle touches, they assume this view wants it...but `onInterceptTouch()` will return NO. To fix this in the most generic way and without making the other code aware of this class, I'm overriding `View.canScrollHorizontally()`.

**Notes**
- I also considered making the other code invoke onInterceptTouch(), but I don't want to have non-OS code invoking that and messing up state. The order of the input events matters.
- The [docs explicitly state](https://developer.android.com/reference/android/view/View#canScrollHorizontally(int)) "this is without regard to whether the view is enabled or not, or if it will scroll in response to user input or not"
  - I'm not so sure this is useful.
  - Other Android OS classes disregard it. :)
    - https://cs.android.com/android/platform/superproject/+/master:packages/apps/Messaging/src/com/android/messaging/ui/PagingAwareViewPager.java;l=91?q=%20canScrollHorizontally%5C(&start=21
    - https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/packages/SystemUI/src/com/android/systemui/qs/NonInterceptingScrollView.java;l=107?q=canScrollHorizontal

Reviewed By: NickGerleman

Differential Revision: D48343681

fbshipit-source-id: 4e133bc5509f68efdf510115f26aa56cfa115d94
2023-08-16 13:28:17 -07:00
Xin Chen c8a479c641 Update example description to help understand them better (#38797)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38797

Changelog:
[Internal] - Refactor description to performance comparison examples in RNTester

Reviewed By: christophpurrer

Differential Revision: D47892300

fbshipit-source-id: 8006cbef9f30472adc54ebf0f87a8b52c840a824
2023-08-16 13:27:40 -07:00
giolaq 35b913017b Migrated UIManagerModuleConstantsTest.java to UIManagerModuleConstant… (#38994)
Summary:
This PR converts UIManagerModuleConstantsTest.java into Kotlin as requested in [https://github.com/facebook/react-native/issues/38825](https://github.com/facebook/react-native/issues/38825)

## Changelog:

[INTERNAL] [CHANGED] - Convert to UIManagerModuleConstantsTest.java to UIManagerModuleConstantsText.kt

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

Test Plan:
```./gradlew :packages:react-native:ReactAndroid:test``` must pass and CI must be green

<img width="1297" alt="Screenshot 2023-08-14 at 17 43 14" src="https://github.com/facebook/react-native/assets/2865799/13a9c2b0-3f47-48da-b663-87e2cb652c69">

Reviewed By: mdvacca, rshest

Differential Revision: D48387980

Pulled By: cortinico

fbshipit-source-id: d5ab3f9a4ada2d0442daecb6c893458d9baa7558
2023-08-16 12:16:03 -07:00
Sam Zhou 0a0ce8403e Also parse js.flow files with hermes-parser (#39048)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39048

Similar to D48047348, we should also use hermes-parser to parse .js.flow files to support newer Flow syntax.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D48398780

fbshipit-source-id: 280ac546493361c4421449f86bf3f735b93a18e8
2023-08-16 11:27:13 -07:00
Samuel Susla 492c9d1041 Fix condition to detect use of Paper renderer in TextInput on Android
Summary:
changelog: [internal]

In D47993140 I removed FabricViewStateManager but made a mistake during refactoring in one of the conditions that detects if we are in paper or fabric.. This fixes it.

Reviewed By: cipolleschi

Differential Revision: D48390478

fbshipit-source-id: ff6e728f3eaae755b2200e9cd8edd3acdc4708aa
2023-08-16 10:07:33 -07:00
Riccardo Cipolleschi e7f6f079cb Implement retry mechanism during yarn installation (#39020)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39020

Sometimes yarn fails to intall, we are implementing a retry mechanism

## Changelog:
[Internal] - Add retry mechanism in template jobs.

Reviewed By: cortinico

Differential Revision: D48234860

fbshipit-source-id: ece3c40051ff143837ed79db2390fbb599fa8ae2
2023-08-16 08:31:44 -07:00
Riccardo Cipolleschi 623f44c7ce Revert D48118162: Split CircleCI config
Differential Revision:
D48118162

Original commit changeset: 73c8071a7e80

Original Phabricator Diff: D48118162

fbshipit-source-id: f070601c8631a9b91bb298ce94a9eb7cee13e059
2023-08-16 05:46:52 -07:00
Intl Scheduler 61255a3013 translation auto-update for i18n/fb4a.config.json on master
Summary:
Chronos Job Instance ID: 1125907940106395
Sandcastle Job Instance ID: 4503600647715906
allow-large-files
ignore-conflict-markers
opt-out-review

Differential Revision: D48391625

fbshipit-source-id: 30cd0bc7e26fa433a690d465c97c125b751e97f5
2023-08-16 05:38:06 -07:00
Rubén Norte 0ba9808c88 Fix NullPointerException when reporting mounts for mount hooks (#39022)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39022

Fixes a possible NullPointerException thrown when trying to access the binding after the instance has been destroyed to report mounts.

I added a check for the mount item just in case 😅

Changelog: [internal]

Reviewed By: lenaic

Differential Revision: D48355738

fbshipit-source-id: 401d2e0a52b0764ed89498ecc0176d160226e509
2023-08-16 04:38:47 -07:00
Riccardo Cipolleschi 67f8d4014e Split CircleCI config (#38793)
Summary:
Right now, every PR runs the whole test suite. For example, a changelog PR, will run all the tests. As of last month, that meant quite a few $s per single run.

With this PR, we are going to leverage dynamic configuration and file filtering to create a config.yml on the flight, depending on the files changed by the commit/pr.

They way it works is the following:
- It starts a setup workflow in CircleCI.
- This workflow fetch the list of files that have been changed in the current commit.
- It executes a bunch of filtering and computation to understand which tests makes sense to run.
- It creates a config on the flight to run those.
- It continue the pipeline on that config.

Currently, the way it works is the following:
- If a `.md` file has been modified => run nothing
- If only files in the `ReactAndroid` folder are modified => run tests for android only
- If only files in the `React` folder are modified or `ruby` files are modified => run only iOS tests
- If only js files, not in the scripts folder are modified => run only JS tests
- if only files in the e2e folder are modified => run only e2e tests
- else => run everything.

Of course, we can play and modify those filters t make sure that they reflect the work and the tests to the best we can.

bypass-github-export-checks

## Changelog:

[Internal] - Split circleci config and run test selectively.

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

Test Plan:
- [X] Tested on the local branch for general sanity check.
- [X] Import it in fbsource
- [x] Create a stacked diff which changes only a md file => verify that no tests are run.
- [x] Create a stacked diff which changes only files in ReactAndroid => verify that only android tests run.
- [x] Create a stacked diff which changes only files in React => verify that only iOS tests run.
- [x] Create a stacked diff which changes only ruby files => verify that only iOS tests run.
- [x] Create a stacked diff which changes ruby files and file in React => verify that only iOS tests run.
- [x] Create a stacked diff which changes only files JS not in the script folder => verify that JS tests run.
- [x] Create a stacked diff which changes only JS files in the script folder => verify that the whole suite starts.
- [x] Create a stacked diff which changes only files in the E2E folder => verify that only E2E files runs.
- [x] Trigger a nightly pipeline => verify that parameters are passed to the generated config.

Reviewed By: rshest

Differential Revision: D48118162

Pulled By: cipolleschi

fbshipit-source-id: 73c8071a7e80cd930fe538f77d7bb5de75f22ab7
2023-08-16 04:30:54 -07:00
Nick Gerleman be2bb51c70 ListMetricAggregator UTs - cell offset APIs (#38732)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38732

Unit tests for cell offset APIs. Mostly the same as previous UTs for VirtualizedList a layer higher.

Changelog: [Internal]

Reviewed By: rozele

Differential Revision: D47978633

fbshipit-source-id: 8cb8a2e8125bc7370eabf9f01a3f7529043171c2
2023-08-15 21:56:25 -07:00
Nick Gerleman 966f97acdc ListMetricAggregator UTs - cached measurement adjustment after layout changes (#38936)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38936

Unit tests that validate we continue to return correct measurement results through the lifetime of the list when cells are unmounted, or layout of the list shifts.

Changelog: [Internal]

Reviewed By: lenaic

Differential Revision: D47978632

fbshipit-source-id: b700fafb699e8820de6825f0ead1ef02c6d8f168
2023-08-15 21:56:25 -07:00
Xin Chen 50638714f5 Add init react runtime start time in performance API (#38858)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38858

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

This diff adds the two extra markers `initializeRuntimeStart` and `initializeRuntimeEnd` to the startup performance API. The runtime start time matches the existing android marker `GET_REACT_INSTANCE_MANAGER_START`, which is the first marker we have on the RN android app.

Changelog:
[Android][Added] - Add `performance.reactNativeStartupTiming.initializeRuntimeStart` and `performance.reactNativeStartupTiming.initializeRuntimeEnd` API

Reviewed By: rshest

Differential Revision: D47941110

fbshipit-source-id: d7e65f822f1c60a46dccacc8fd5bba84174f9f31
2023-08-15 18:51:07 -07:00
Vincent Viego a4da5da42e Only execute expired tasks once per batched event group (#39013)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39013

Changelog: [internal]

Reviewed By: sammy-SC

Differential Revision: D48210131

fbshipit-source-id: 1410aab2f70b75e71fd8a6ace8f4653682daaf90
2023-08-15 18:31:31 -07:00
Vincent Viego 8cfd80f52c Default to AsynchronousBatched priority (#39011)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39011

Changelog: [internal]

Reviewed By: sammy-SC

Differential Revision: D48210134

fbshipit-source-id: aac2aec11c35dd6a47bc8fd4bf74f2fa00ab3d7e
2023-08-15 18:31:31 -07:00
Tim Yung a99c9764aa Flow: Cleanup Platform Suffix Ignore Patterns (#39028)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39028

The regular expressions that we use to ignore other platform suffixes are wrong or unnecessarily complicated.

This diff cleans them up to be idiomatic regular expressions without any extra constructs.

Changelog:
[Internal]

Reviewed By: samwgoldman

Differential Revision: D48377329

fbshipit-source-id: e6d6c36b3dd6f524cc28a3cfb2938abb06dd8ab6
2023-08-15 18:29:00 -07:00
Tim Yung e637a3385b JS: Upgrade to v8-compile-cache@^2.4.0 & eslint@^8.23.1 (#39012)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39012

Upgrades many of our projects to `v8-compile-cache@^2.4.0`, which includes [zertosh/v8-compile-cache#45](https://github.com/zertosh/v8-compile-cache/pull/45). This fixes a very opaque segmentation fault when `v8-compile-cache` is used on Apple Silicon with mixed architecture modes.

This also upgrades our projects to `eslint@^2.3.1`, which no longer has the dependency on an outdated version of `v8-compile-cache`.

Changelog:
[Internal]

Reviewed By: zertosh, NickGerleman

Differential Revision: D48336030

fbshipit-source-id: afa73d1f00bff826a8b76fa09949b9d35a97905b
2023-08-15 15:49:33 -07:00
Yasin Çidem 66d6384d4d Kotlinify ReactTextInputPropertyTest class (#38981)
Summary:
This PR converts ReactTextInputPropertyTest.java to Kotlin. https://github.com/facebook/react-native/issues/38825
## Changelog:
[INTERNAL] [CHANGED] - Kotlinify ReactTextInputPropertyTest.java
<!-- 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

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

Test Plan:
`./gradlew :packages:react-native:ReactAndroid:test` must pass

### Screenshot
<img width="40%" alt="image" src="https://github.com/facebook/react-native/assets/13544246/456622f0-2260-47c3-ada7-725c59ecbc09">

### FYI:

https://github.com/facebook/react-native/blob/ae88aef12c755d61a821ccf98ebb4b75f7c2dfc9/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/views/textinput/ReactTextInputPropertyTest.java#L385

**testSelection** function removed because selection prop removed from ReactTextInputManager.java https://github.com/facebook/react-native/commit/84a1cacfa5cdaf484b93d1d9402c65d0c7084fad

Reviewed By: yungsters

Differential Revision: D48351651

Pulled By: cortinico

fbshipit-source-id: 750668dbc409f08827eff1f11886b3d12c3b240c
2023-08-15 15:20:40 -07:00
Vincent Riemer 894b88307f Adjust RawPropsPropNameLength's type to account for increased number of props (#39008)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39008

Changelog: [Internal] - Adjust RawPropsPropNameLength's type to account for increased number of props

While investigating why we needed to back out D48288752 I discovered that the root cause was that the `items_` vector in `RawProsKeyMap` was now a size greater than 255 which becomes an issue because `items_`'s indices are statically cast to `RawPropsPropNameLength` (previously alias to `uint8_t`).

This diff updates `RawPropsPropNameLength` to be an alias to `uint16_t` so the current issue is resolved as well as adding an assert to ensure (however unlikely) that this happens again.

Reviewed By: rozele

Differential Revision: D48331909

fbshipit-source-id: f6bc3e4825f2f293d79d8cd90c40ced7cba0e3c5
2023-08-15 14:15:01 -07:00
Arushi Kesarwani b012027962 Remove Flipper jobs from CircleCI (#38911)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38911

Flipper is going to be deprecated in 0.73. So we can decide to remove the CircleCI tests that run Flipper:

- test_ios_template-NewArch-Debug-WithFlipper-Hermes-StaticLibraries
- test_ios_template-NewArch-Debug-WithFlipper-JSC-StaticLibraries
- test_ios_template-OldArch-Debug-WithFlipper-JSC-StaticLibraries

Changelog:

[Internal] [Changed] - Remove Flipper jobs from Circle CI

Reviewed By: cipolleschi

Differential Revision: D48209184

fbshipit-source-id: f43613d17093c4cc883409d4f083c577da924b78
2023-08-15 13:52:57 -07:00
David Vacca 3b43d56f38 Ez refactor in NetworkingModule (#38970)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38970

Ez refactor in NetworkingModule to remove to lint warns

changelog: [internal] internal

Reviewed By: arushikesarwani94

Differential Revision: D48275729

fbshipit-source-id: a0fb66ebeeee1b8360bd6ab3d3be6c8626f2faab
2023-08-15 12:26:12 -07:00
Riccardo Cipolleschi 540c41be91 Publish dSYM to Maven when doing a release (#38992)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38992

This Diff publishes the Hermes dSYMs to Maven while doing a release.
These were missing and so the Stack traces can't be fully symbolicated when a crash occurs.

## Changelog:
[Internal] - Publish dSYM to Maven

Reviewed By: cortinico

Differential Revision: D48309198

fbshipit-source-id: a5514e544587daadd0a0d7614f25a30fccd16a5b
2023-08-15 03:48:47 -07:00
Riccardo Cipolleschi 27c53ddbd1 Create dSYM tarball in CI (#38983)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38983

Creates the dSYMs and store them as artifact in CircleCI

## Changelog:
[Internal] - Create the dSYM archive and upload it to CircleCI

Reviewed By: cortinico

Differential Revision: D48301851

fbshipit-source-id: 49c447b41573dcc567b3e62ad0b2a519562942c2
2023-08-15 03:48:47 -07:00
Riccardo Cipolleschi e9b565381c Add script poll Maven for Artifacts (#38985)
Summary:
This local change adds a script to poll Maven automatically after the release has happened.
This should allow the Release Crew not to repeatedly and manually refresh Maven urls in order to see whether the artifacts are there or not.
As soon as this job is green, artifacts are out!

Cost wise, we are using a small machine, which costs 5 credits per minute.

## Changelog:
[Internal] -Add script and CI job to poll for maven after a release.

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

Test Plan:
Tested locally, running the JS script.
[Verified that the CI job can execute it.](https://app.circleci.com/pipelines/github/facebook/react-native/29634/workflows/5966d5f9-12ca-40b1-9185-758fe98d3aee/jobs/944107)

We can only test this for real while doing a proper release.

Reviewed By: cortinico

Differential Revision: D48309874

Pulled By: cipolleschi

fbshipit-source-id: 5c38b588c29c1311b1fa4e4ca44785583db0b701
2023-08-15 03:26:58 -07:00
Nicola Corti 45cf6ee7c9 Bump Android compile-sdk to 34 (#38987)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38987

As now we do have the buildTools version 34 in the docker container,
I'm bumping compileSdkVersion for all the targets to 34.

I'm also cleaning up the `test_windows` setup as it had old references
of NDK 20, build tools 33 and was installing the Android SDK but not
actually using it.

Changelog:
[Android] [Changed] - Bump Android compile-sdk to 34

Reviewed By: cipolleschi

Differential Revision: D48311828

fbshipit-source-id: c5b1d20a6183b577fba520af95b33e7656477101
2023-08-15 03:13:35 -07:00
Samuel Susla 3fb94e7c13 Delete FabricViewStateManager (#38958)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38958

changelog: [internal]

This is an unnecessary abstraction, let's remove it.

It originally served as a retry mechanism for C++ state update but it no longer serves that purpose. It obscures visibility into StateWrapper state.

jest_e2e[run_all_tests]

Reviewed By: mdvacca, luluwu2032

Differential Revision: D47993140

fbshipit-source-id: 81e81153d2de90f69d1495b14db66ee66670ba0f
2023-08-15 02:42:27 -07:00
Alex Hunt 2f3fcb6600 Replace Metro stdout check with dep_graph_loaded event (#38960)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38960

Code cleanup following `cli-plugin-metro` import.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D48188228

fbshipit-source-id: 45fd971a839ab1435be1b8f1eafdbf36743e1046
2023-08-15 02:33:22 -07:00
Alex Hunt 39a41fa2a0 Convert community-cli-plugin to Flow strict (#38961)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38961

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D48066180

fbshipit-source-id: 72b8b25a70062a71ab13aa1d62f3418582e99013
2023-08-15 02:33:22 -07:00
Alex Hunt 164133cada Sync latest cli-plugin-metro changes (#38944)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38944

- Update `cli-commands` package to reflect latest source `react-native-community/cli-plugin-metro` changes.
	- https://github.com/react-native-community/cli/pull/2021
	- https://github.com/react-native-community/cli/pull/2024
	- https://github.com/react-native-community/cli/pull/2043
	- https://github.com/react-native-community/cli/pull/2047

### To do

WARNING: ~~This PR is non-functional until the next CLI alpha is published and bumped in `package.json` — since it depends on corresponding new APIs in `react-native-community/cli-tools` (https://github.com/react-native-community/cli/pull/2021). This package (and the upcoming work which integrates it) has been tested against locally linked copies of latest CLI.~~

- [x] Bump CLI dependencies when next alpha published.
- [x] Ensure Metro bump from `0.77.0` to `0.78.0` is consistently applied with this.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D48066179

fbshipit-source-id: b3dc8891cf33e537788f942dcaddff4d2f11a31f
2023-08-15 02:33:22 -07:00
Alex Hunt fdcb94ad13 Upgrade CLI and Metro, update status check refs (#38988)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38988

- Upgrade to RN CLI `12.0.0-alpha.9`, including Metro bump to `0.78.0`.
- Update test scripts, since this CLI release made a breaking change to the `/status` response.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D48311214

fbshipit-source-id: bb0be3c32edb629355b9fbbd754b28f9878f47ef
2023-08-15 02:33:22 -07:00
Tim Yung 857bc0562f RN: Add @flow to ProgressBarAndroid.js (#39004)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39004

Adds `flow` to this file. Even thought it is a stub, it still deserves to be checkable by Flow.

Changelog:
[Internal]

Reviewed By: SamChou19815

Differential Revision: D48325186

fbshipit-source-id: a3417bfa12258b85c1eb51744348a1c8aba63a8c
2023-08-14 14:35:34 -07:00
Alex Hunt a978d343a6 Add auto-generation of TypeScript definitions on build (#38990)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38990

This PR adds auto-generation of Typescript definitions from Flow source code for packages using the shared monorepo build setup (https://github.com/facebook/react-native/pull/38718).

Today, these are the following Node.js packages:

- `packages/community-cli-plugin`
- `packages/dev-middleware` (⬅️ `emitTypeScriptDefs` enabled)

This also improves emitted Flow definitions (`.js.flow`), by using [`flow-api-translator`](https://www.npmjs.com/package/flow-api-translator) to strip implementations.

**All changes**

- Include `flow-api-translator` and configure this to emit type definitions as part of `yarn build`.
    - Add translation from Flow source to TypeScript definitions (`.d.ts`) adjacent to each built file.
    - Improve emitted Flow definitions (`.js.flow`), by using `flow-api-translator` to strip implementations (previously, source files were copied). The Flow and TS defs now mirror each other.
-  Add `emitFlowDefs` and `emitTypeScriptDefs` options to build config to configure the above.
- Integrate TypeScript compiler to perform program validation on emitted `.d.ts` files.
     - This is based on this guide: https://github.com/microsoft/TypeScript-wiki/blob/main/Using-the-Compiler-API.md#a-minimal-compiler.
- Throw an exception on the `rewritePackageExports` step if a package does not define an `"exports"` field.
- Add minimal `flow-typed` definitions for `typescript` 😄.

**Notes on [`flow-api-translator`](https://www.npmjs.com/package/flow-api-translator)**

This project is experimental but is in a more mature state than when we evaluated it earlier in 2023.
- It's now possible to run this tool on our new Node.js packages, since they are exclusively authored using `import`/`export` syntax (a requirement of the tool).
- As a safety net, we run the TypeScript compiler against the generated program, which will fail the build.

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D48312463

fbshipit-source-id: 817edb35f911f52fa987946f2d8fc1a319078c9d
2023-08-14 12:12:10 -07:00
e44fdfed60 Set up test to reduce the amount of failed commits in ShadowTree (#38706)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38706

Fabric has a mechanism to resolve conflicts when there are race conditions committing new versions in different threads. This mechanism forces commits to be done in order, retrying commits when they didn't have time to finish before another concurrent commit.

{F1061612667}

This mechanism has an important drawback. If we have a continuous stream of short commits (e.g.: animations via Reanimated) and we want to do a large commit (e.g.: coming from React), the large commit could exhaust all attempts to finish and ultimately fail. Every time we tried to commit the large one, another small one would have had a chance to finish, forcing another retry.

{F1061614717}

In most of the cases where this happens, we didn't even need to fail the commits in the first place!

**The only reason why we retry commits is so we make sure we are propagating the last state** (when state propagation is enabled in that commit). We don't reconcile the contents of the commits themselves (the tree we retry is exactly the same, if we exclude state).

We can reduce the number of reconciliation failures (and completely remove them in the case of animations) if instead of checking if the base revision for a commit changed, we checked if the version of the state we propagated changed.

We would have 3 scenarios when doing that:
1.  Commit creating state vs. commit reusing state. If the commit creating the state went first, we would have to retry the commit reusing the state (to make sure we're reusing the new state). If the commit reusing the state went first, we wouldn't have conflicts, and we would just apply the new state on top of it. {F1061617730}
2. Commit reusing state vs. another commit reusing state. In this case the order doesn't matter and we don't need to trigger a conflict. Commits would be updated in the order in which they are applied.  {F1061618406}
3. Commit creating state vs. commit creating state. In this case, we are not propagating state, so retrying the commits wouldn't do anything. We can ignore the conflicts in this case too.  {F1061618689}

Changelog: [internal]

Reviewed By: sammy-SC

Differential Revision: D47915384

fbshipit-source-id: bb4510c59bf32ca342c02f3bdb7029b545f56d99

Co-authored-by: Samuel Susla <samuel.susla@gmail.com>
Co-authored-by: David Vacca
Co-authored-by: Tomek Zawadzki <tomasz.zawadzki@swmansion.com>
Co-authored-by: Krzysztof Piaskowy <krzysztof.piaskowy@swmansion.com>
2023-08-14 08:49:02 -07:00
Riccardo Cipolleschi e29b5bbf5d Store artifacts only on main and stable branches (#38954)
Summary:
This change stores artifacts in CI only when it runs in main or in a stable branch

## Changelog:

[Internal] - Store CI artifacts only on main or on stable branches

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

Test Plan: CircleCI stays green and we don't store anything on pr branch

Reviewed By: cortinico

Differential Revision: D48267659

Pulled By: cipolleschi

fbshipit-source-id: 6257270948c770e09492691c995cbe84d7a085ac
2023-08-14 05:24:37 -07:00
fortmarek 29258729ad Add 0.72.4 changelog (#38986)
Summary:
Adds changelog for the 0.72.4 patch.

## 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] - Add 0.72.4 changelog

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

Reviewed By: cipolleschi

Differential Revision: D48310875

Pulled By: huntie

fbshipit-source-id: e7993ba28892b481aca3bad18479c870e659b007
2023-08-14 04:41:33 -07:00
Nicola Corti 54033fd334 Introduce react.internal.useHermesNightly (#38886)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38886

This change introduces a property called `react.internal.useHermesNightly`

This allows users building RN-Tester or just ReactAndroid to fetch Hermes from the latest
nightly, without having to build it from source.

The change could be useful to speedup local development, but it should not be enabled on CI or when doing releases.

Changelog:
[Internal] [Changed] - Introduce react.internal.useHermesNightly

Reviewed By: mdvacca, cipolleschi

Differential Revision: D48188769

fbshipit-source-id: cb4330cb9082e9db0c7ba82e48b2d10030637353
2023-08-14 00:45:07 -07:00
Nicola Corti 913e92737e Bump Mockito to 3.x and remove PowerMock (#38924)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38924

## The Problem
We're currently compiling React Native with two JDK, 11 and 17.
This is necessary as we use PowerMock to mock static classes in our tests. PowerMock is effectively unmaintained and is preventing us from using only JDK 17.
Using two JDKs requires a bigger docker container and leads to build failures when contributors try to contribute to RN so we should be moving to use only a single JDK (also we can expect Google to bumpthe requirement to JDK 21 at some point in the future).

## The Solution
Practically, Mockito 3 offers the same capabilities that PowerMock offers.
I've removed PowerMock from our codebase and bumped Mockito to 3.

I've verified that all the un-ignored tests are green both with Gradle and Buck.
I've updated the Ignore-d tests to don't use PowerMock (as the project won't compile otherwise).
When we un-suppress them we will have to make sure everything works.
I've also left some TODOs referencing the old code for the future.

Changelog:
[Internal] [Changed] - Bump Mockito to 3.x and remove PowerMock

Reviewed By: cipolleschi

Differential Revision: D48228603

fbshipit-source-id: 5d4af902d813f347f19fc17361d53a73b685544d
2023-08-13 23:31:22 -07:00
Nicola Corti 1a765b6d08 Cleanup and scope all the Gradle Properties (#38885)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38885

We do have several Gradle Properties that are used to configure the build.

I've refactored them all and moved them inside the PropertyUtils file:
https://github.com/facebook/react-native/blob/main/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/PropertyUtils.kt

Specifically properties should be 'scoped' under `react.` if public, and `react.internal.` if for internal usage.

Property that I cleaned up are:
- REACT_NATIVE_MAVEN_LOCAL_REPO becomes react.internal.mavenLocalRepo
- REACT_WINDOWS_BASH becomes react.internal.windowsBashPath
- GROUP becomes react.internal.publishingGroup

I've also added support for scoping for public properties with backward compat (so both the scoped and unscoped properties are accepted):
- react.newArchEnabled
- react.hermesEnabled
- react.nativeArchitectures

Changelog:
[Android] [Changed] - Cleanup and scope all the Gradle Properties

Reviewed By: mdvacca

Differential Revision: D48188310

fbshipit-source-id: 1a92d31105270a4c2f80029b7d36bcb33916d0fb
2023-08-13 23:11:29 -07:00
Intl Scheduler 0279a7074e translation auto-update for i18n/fb4a.config.json on master
Summary:
Chronos Job Instance ID: 1125907939833620
Sandcastle Job Instance ID: 18014399528190591
allow-large-files
ignore-conflict-markers
opt-out-review

Differential Revision: D48302683

fbshipit-source-id: 0d1d54cef22427c5f91e40b57fb53a4385197d39
2023-08-13 13:15:51 -07:00
Eric Rozell ae88aef12c Back out "Refactor conditional event emitting to the C++ layer" (#38973)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38973

Original commit changeset: 6c00c2fcfdfd

Original Phabricator Diff: D47852371

When #38674 and #38959 are combined, they cause Android apps on Fabric to crash. #38959 is the more urgent fix, so backing out #38674.

## Changelog:
[General] [Fixed] - Rolling back change that broke e2e tests until we can figure out why the e2e tests are broken

Reviewed By: NickGerleman

Differential Revision: D48288752

fbshipit-source-id: b52e28936bbebd21bd3b2f49f9a233f295ba6248
2023-08-11 21:36:01 -07:00
Eric Rozell 9f7dfcc35f Temporary hotfix for broken view flattening on Android (#38968)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38968

A previous change introduced a bug where elevation was no longer being parsed on Android, which caused views that were previously flattened to no longer get flattened. This is a hotfix that could be pushed to affected builds without native code changes, but will not restore the shadow UX.

## Changelog:
[General] [Internal] - Internal

Reviewed By: bvanderhoof

Differential Revision: D48271545

fbshipit-source-id: ebbecd8073a074525ff7b95a6298612d0bb304c6
2023-08-11 17:20:42 -07:00
Bogusz Kaszowski 3ef5e7a9a6 migrate MyNativeView to Kotlin (#38951)
Summary:
This PR converts MyNativeView into Kotlin as requested in https://github.com/facebook/react-native/issues/38825 .

## Changelog:

[INTERNAL] [CHANGED] - Migrate MyNativeView to Kotlin

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

Test Plan:
1. run `yarn android`
2. Check whether RN Tester runs as expected

Reviewed By: philIip, bvanderhoof

Differential Revision: D48281685

Pulled By: mdvacca

fbshipit-source-id: e57d6ab9418b3b1df630de13591af4011bd126b0
2023-08-11 15:34:55 -07:00
Phillip Pan 6d822b4ca3 make notch detection more future proof (#38940)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38940

## Changelog:
[Internal] - make notch detection more future proof

current implementation of `isIPhoneX_deprecated` is not completely correct and is already 2 iphones behind. i update the implementation so we don't have to change it with every new iphone that comes out.

Reviewed By: cipolleschi

Differential Revision: D48254737

fbshipit-source-id: a7f45d70b06ab6c6d4fe036885c8a623fed0958e
2023-08-11 14:35:47 -07:00
David Vacca e17c4a2ac9 Enable 'allWarningsAsErrors' for CI android build (#38969)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38969

As we migrate java to kotlin I noticed that we've introduced few warnings here and there.
In this diff I'm enabling allWarningsAsErrors in the CI

The reasoning is that we are just starting with Kotlin and I believe we should enable 'allWarningsAsErrors' for CI android builds to make sure the codebase grow healthy, this will also help us to cleanup apis. e.g. create APIs for
deprecated java APIs.

changelog: [internal] internal

Reviewed By: NickGerleman

Differential Revision: D48239603

fbshipit-source-id: dd7a5df98cea82bf9bab6b26c4b1baa9f743ccbf
2023-08-11 14:31:05 -07:00
Luna Wei 824c1c6d07 Math.floor the top, bottom values of an item in a VirtualizedList (#38962)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38962

Changelog: [General][Changed] Math.floor the top and bottom dimensions of a cell item when determining viewability.

Reviewed By: NickGerleman

Differential Revision: D48212402

fbshipit-source-id: 0ba7d5c218477c257a4504391940d916e4832f91
2023-08-11 13:57:21 -07:00
Luna Wei ed0f60f017 RNTester: Remove extra padding on RNTesterPage affecting e2e test (#38938)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38938

Changelog: [Internal] - Remove padding in RNTesterPage

Reviewed By: makovkastar

Differential Revision: D48205648

fbshipit-source-id: edc036144e256d3838cdb3741266bf9c93aa5a71
2023-08-11 13:57:21 -07:00
Eric Rozell 68c7cfe62d Fixes regression of prop parsing for elevation (#38959)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38959

When refactoring ViewProps in D47492635, `elevation` prop parsing was dropped. This restores it.

## Changelog:
[General] [Fixed] - Fabric regression for elevation prop in Android

Reviewed By: sammy-SC, mdvacca

Differential Revision: D48269510

fbshipit-source-id: 91867a6689857d0f07cf464ea6e5d6e7cee1af54
2023-08-11 12:44:05 -07:00
Vincent Riemer 7cd69962d0 Refactor conditional event emitting to the C++ layer (#38674)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38674

Changelog: [Internal] - Refactor conditional pointer event emitting to the C++ layer

Some background: early on in the implementation of Pointer Events a concern was brought up that events related to hovering pointers could saturate the JS thread if they were fired all the time unconditionally, so as a mitigation we would check in native to see if listeners in the tree were listening for those events and only fire them if there were listeners.

Now since we're going to be moving some of the event derivation logic to the C++ layer we need to receive all the events — but recreate the conditional firing in the C++ layer so we can still avoid saturating the JS thread. That's what this diff does.

The only change I see being potentially contraversial is the fact that I needed a way to turn an `EventTarget` (the only information I receive regarding which node the event is firing on) to its cooresponding `ShadowNode` which I did in the method `GetShadowNodeFromEventTarget`. It essentially does the exact same thing the `getNodeFromInternalInstanceHandle` method in `ReactNativePublicCompat.js`, but in C++ against the JSI API. I don't know if there's a better way to do this but this was the best one I came up with that actually works.

Reviewed By: NickGerleman

Differential Revision: D47852371

fbshipit-source-id: 6c00c2fcfdfd49314c96d044d36272e028e074ff
2023-08-11 12:23:22 -07:00
Rob Hogan 86968c1104 Use modern timers in monorepo Jest tests (#38955)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38955

Jest introduced "modern" timers based on `sinon/fake-timers` in Jest 26 ([release announcement](https://jestjs.io/blog/2020/05/05/jest-26#new-fake-timers)), and they became the default in Jest 27, in May 2021.

Modern timers have more capabilities - they were introduced with support for `queueMicrotask`, mocking `Date`, etc., and they've continued to receive more attention from the Jest team since - they're now much more comprehensive and more configurable than legacy timers.

Importantly, because they're not based on Jest mocks, they're not affected in surprising ways by eg `jest.resetAllMocks()` (a particularly confusing side-effect when fake timers are enabled globally, as in our setup).

This migrates RN's own tests and config to modern fake timers, or real timers where that's more appropriate.

NOTE: In cases where non-trivial changes to the tests are required, four test files are individually opted-in to `legacyFakeTimers` with a `TODO(legacy-fake-timers)`. I'll open these up for community contributions to fix.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D48189907

fbshipit-source-id: 2e7ce74cc60e80679d81d7c16d599ad1bbe2c921
2023-08-11 11:01:06 -07:00