Commit Graph

28489 Commits

Author SHA1 Message Date
Arushi Kesarwani a34ce64bbb Fix lint warns in ReactHostInterface (#38762)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38762

Fix lint warns in ReactHostInterface

Reviewed By: cortinico

Differential Revision: D48018980

fbshipit-source-id: 51fe510ce4d7f903caae2e2fc995fec872df24ea
2023-08-03 16:29:02 -07:00
Arushi Kesarwani b47403eb09 Refactoring ReactSurface & adding ReactSurfaceImpl (#38167)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38167

1.  Moving out
- `getSurfaceID()`
- `getSurfaceHandler()`
- `getModuleName()`
- `getContext()`
- `clear()`

functions out of `ReactSurface` to interface `ReactSurface` as part of stable APIs.

2. Refactoring usages of `ReactSurface` to rely on interface `ReactSurface`.

3. `ReactSurfaceInterface` -> `ReactSurface`

4. `ReactSurface` -> `ReactSurfaceImpl`

Reviewed By: mdvacca

Differential Revision: D47109982

fbshipit-source-id: ce9fb12b33fcbb5f243f95f9e7dca8662bb64102
2023-08-03 16:29:02 -07:00
Vicky Ahuja f493adcf4a Update Switch.d.ts (#38636)
Summary:
updated type for activeThumbColor prop for Switch component

To help community users with all possible properties

## 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
--> GENERAL CHANGED - added new prop in type of switch component

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

Reviewed By: cortinico

Differential Revision: D47800523

Pulled By: lunaleaps

fbshipit-source-id: 25b22a97a3c02ad01c8100fdd1f3e808f296c14c
2023-08-03 15:46:46 -07:00
Arushi Kesarwani 379f1495c9 Using TaskInterface for prerenderSurface (#38758)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38758

Using TaskInterface for prerenderSurface

Reviewed By: christophpurrer, cortinico

Differential Revision: D48006771

fbshipit-source-id: 989a0c4cf7930a67d3f8f2c3284450a5188b306e
2023-08-03 14:00:43 -07:00
Arushi Kesarwani 51263ccaa0 Moving SurfaceHandler to react.interfaces.fabric (#38759)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38759

As part of refactoring the `ReactSurface`, moving the `SurfaceHandler` interface to `react.interfaces.fabric`.

changelog: [internal] internal

Reviewed By: christophpurrer

Differential Revision: D48006184

fbshipit-source-id: 09297fccc2b405a5e807d35bfa9eb2a9a4c52a16
2023-08-03 14:00:43 -07:00
Arushi Kesarwani 801b477909 Revert D47915065 (#38756)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38756

In order to expose getSurfaceHandler() from an interface ReactSurface we need this to be public. All methods in an interface are public and the implementing class can not have a restricted visibility than the interface.

Reviewed By: christophpurrer

Differential Revision: D48003816

fbshipit-source-id: 7f0d0bd91cc9cde9c2430fd8dcde7a94966fd217
2023-08-03 14:00:43 -07:00
Sam Zhou 55fd0262a4 Unify and cleanup Platform Flow typing (#38731)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38731

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D47965692

fbshipit-source-id: ad61acd28a3362b64fa90f413a876c29c1166132
2023-08-03 11:44:13 -07:00
Guil Varandas 08688d3b9f fix: Correctly assign the hermes-engine pod tag when installing pods from a different folder (#38754)
Summary:
This PR aims to fix an issue where installing iOS pods from a different directory causes the `hermes-engine` `:tag:` not to be properly resolved.

Ever since https://github.com/facebook/react-native/issues/37148 was merged, the `setup_hermes` script tries to resolve the `node_modules/react-native/sdks/.hermesversion` file and use its content to generate the pod tag, in order to verify when it changes over time.
This works perfectly when installing pods within the `ios` folder, as the `react_native_path` should point to the correct relative folder (`../node_modules/react-native` by default).

However, when installing pods from a different directory (the project root, for example) and leveraging the `--project-directory` flag, the file fails to resolve, as the current working directory is considered when resolving the `.hermesversion` file.

### Quick Example:

- `react_native_path`: `../node_modules/react-native` (the default config)

**Installing pods from the `ios` folder:**
- `cd ios`
- `bundle exec pod install`
- `hermestag_file` resolved path: `$project_root/node_modules/react-native` 
- `hermes-engine` `:tag:`: `hermes-2023-03-20-RNv0.72.0-49794cfc7c81fb8f69fd60c3bbf85a7480cc5a77` 

**Installing pods from the `$project_root` folder**
- `bundle exec pod install --project-directory=ios`
- `hermestag_file` resolved path: `$parent_folder/$project_root/node_modules/react-native` 
- `hermes-engine` `:tag:`: `''` 

### The fix

Turns out that the same file had a resolved reference to the `react-native` folder, assigned to the `react_native_dir` variable:
```ruby
react_native_dir = Pod::Config.instance.installation_root.join(react_native_path)
```

By resolving the `.hermesversion` using that folder, we guarantee that the relative path will always reference the directory where the `Podfile` is defined, which is the expected behaviour.

## Changelog:

[Internal] - Fix an issue where installing pods from a different directory would fail to resolve `hermes-engine` tags correctly.

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

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

Test Plan:
- Init a new `react-native` repo
- Remove the generated `Podfile.lock` file
- Navigate to the project root folder
- `bundle exec pod install -project-directory=ios`
- Check that the `hermes-engine` entry has a properly populated `:tag:` attribute:

**Before:**
```
hermes-engine:
    :podspec: "../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec"
    :tag: ''
```

**After:**
```
hermes-engine:
    :podspec: "../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec"
    :tag: hermes-2023-03-20-RNv0.72.0-49794cfc7c81fb8f69fd60c3bbf85a7480cc5a77
```

Reviewed By: cortinico

Differential Revision: D48029413

Pulled By: cipolleschi

fbshipit-source-id: 82d465abd5c888eeb9eacd32858fa4ecf4f8c217
2023-08-03 08:02:11 -07:00
Alex Hunt cd8f5d176a Add shared monorepo build setup (#38718)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38718

> NOTE: Replaces https://github.com/facebook/react-native/pull/38240

## Context

RFC: Decoupling Flipper from React Native core: https://github.com/react-native-community/discussions-and-proposals/pull/641

## Changes

To support incoming new React Native packages around debugging (including migrating over [`react-native-community/cli-plugin-metro`](https://github.com/react-native-community/cli/tree/main/packages/cli-plugin-metro)) — which target Node.js and require a build step, this PR adds a minimal shared build setup across the `react-native` monorepo.

The setup is closely inspired/based on the build scripts in Jest, Metro, and React Native CLI — and is a simple set of script wrappers around Babel. These are available as build commands at the root of the repo:

- `yarn build` — Builds all configured packages. Functionally, this:
  - Outputs a `dist/` directory with built files.
  - Rewrites package.json `"exports"` to update every `./src/*` reference to `./dist/*` (source of truth).
- `scripts/build/babel-register.js` — Allows running all Node.js entry points from source, similar to the current setup in [facebook/metro](https://github.com/facebook/metro). (Example entry point file in this PR: `packages/dev-middleware/src/index.js`)

Build configuration (i.e. Babel config) is shared as a set standard across the monorepo, and **packages are opted-in to requiring a build**, configured in `scripts/build.config.js`.

```
const buildConfig /*: BuildConfig */ = {
  // The packages to include for build and their build options
  packages: {
    'dev-middleware': {target: 'node'},
  },
};
```

For now, there is a single `target: 'node'` option — this is necessary as `react-native`, unlike the above other projects, is a repository with packages targeting several runtimes. We may, in future, introduce a build step for other, non-Node, packages — which may be useful for things such as auto-generated TypeScript definitions.

 {F1043312771}

**Differences from the Metro setup**

- References (and compiles out) repo-local `scripts/build/babel-register.js` — removing need for an npm-published dependency.

## Current integration points

- **CircleCI** — `yarn build` is added to the `build_npm_package` and `find_and_publish_bumped_packages` jobs.

**New Node.js package(s) are not load bearing quite yet**: There are not yet any built packages added to the dependencies of `packages/react-native/`, so this will be further tested in a later PR (and is actively being done in an internal commit stack).

### Alternative designs

**Per-package config file**

Replace `scripts/build/config.js` with a package-defined key in in `package.json`, similar to Jest's [`publishConfig`](https://github.com/jestjs/jest/blob/1f019afdcdfc54a6664908bb45f343db4e3d0848/packages/jest-cli/package.json#L87C3-L89C4).

```
"buildConfig": {
  "type": "node"
},
```

This would be the only customisation required, with a single Babel config still standardised. Another option this might receive in future is `enableTypeScriptCodgeen`.

**Rollup**

More sophisticated build tool for Node.js, used by the React codebase (albeit within a custom script setup as well).

**Lerna and Nx**

- Most sophisticated setup enabling caching and optimised cloud runs.
- Probably the most likely thing we'll move towards at a later stage.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D47760330

fbshipit-source-id: 38ec94708ce3d9946a197d80885781e9707c5841
2023-08-03 04:42:30 -07:00
Ruslan Shestopalyuk 0fb71630c7 Add .cpplsp-buck-out to .gitignore files
Summary:
## Changelog:
[Internal] -

This must be some new thing coming from the C++ language service provider (from the VSCode plugins?..), but this keeps popping up since recently as untracked files in the yoga subfolder.

Add it to .gitignore.

Reviewed By: NickGerleman

Differential Revision: D48022954

fbshipit-source-id: dad608f303f3d50b701d776795f6e25f007811b2
2023-08-03 02:10:25 -07:00
Ruslan Shestopalyuk 8a1d1ad149 Ensure consistent usage of the RN_DEBUG_STRING_CONVERTIBLE flag in C++ (#38765)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38765

## Changelog:
[Internal] -

The `RN_DEBUG_STRING_CONVERTIBLE` was interchangeably used via both `#if` and `#ifdef` (the latter being incorrect), which led to both inconsistency, or even the code plain not compiling it `RN_DEBUG_STRING_CONVERTIBLE=0` explicitly.

Furthermore there was no guarantee it's defined, which can generate warnings with `-Wundef`/`-Wall` (or even errors with `-Werror` on top of that).

This fixes all the usages to be uniform and makes sure the flag is defined when it's used to prevent compiler warnings.

Reviewed By: christophpurrer

Differential Revision: D48021565

fbshipit-source-id: 653b6af96bb0361e6f1d62c1b545ec01309760e8
2023-08-03 01:53:48 -07:00
Intl Scheduler 6ddd0ca7aa translation auto-update for i18n/fb4a.config.json on master
Summary:
Chronos Job Instance ID: 1125907933999265
Sandcastle Job Instance ID: 13510799891437489
allow-large-files
ignore-conflict-markers
opt-out-review

Differential Revision: D48021820

fbshipit-source-id: 475a0aa1c993b48f4d9822fadd57bdf1b1c6bda7
2023-08-02 23:01:30 -07:00
Nick Gerleman 33d6da01ea Cache ScrollView content length before calling scrollToIndex (#38736)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38736

`scrollToIndex` relies on cached layout information, so we should cache the results from `onContentSizeChange` before attempting the scroll. Otherwise we will fail to scroll in RTL.

Changelog:
[General][Fixed] Cache ScrollView content length before calling `scrollToIndex`

Reviewed By: lenaic

Differential Revision: D47978635

fbshipit-source-id: 27f2a4702650e8a73e8812128821ca03f36216dd
2023-08-02 21:13:43 -07:00
Sam Zhou 90c0e3be14 Align types for different ios/android implementation files (#38761)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38761

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D48014272

fbshipit-source-id: d70c2b9442cedf87e72be336c7a25372daea8f28
2023-08-02 19:57:12 -07:00
Nick Gerleman 0a1c2efcc1 Update facebook::react::kNumberOfPropsPerComponentSoftCap
Summary:
`butter::small_vector` is backed by a `folly:small_vector` on non-Android platforms in release mode.

It uses the small vector optimization, keeping a fixed size buffer, then falling back to heap allocation.

When I was debugging through props parsing code to figure out a prop not getting passed to Fabric (was being filtered in ViewConfig), I noticed this vector is filled with 199 elements for ViewProps. So It always overflows the current capacity and falls back to heap allocation. This bumps the capacity basde on what I observed with some more headroom.

Changelog:
[Internal]

Reviewed By: sammy-SC

Differential Revision: D47981105

fbshipit-source-id: 3870d8e4fee9748c487d01cc82284de865ea370d
2023-08-02 13:42:14 -07:00
Intl Scheduler 8d8455c3c3 translation auto-update for i18n/fb4a.config.json on master
Summary:
Chronos Job Instance ID: 1125907933601560
Sandcastle Job Instance ID: 36028798028351327
allow-large-files
ignore-conflict-markers
opt-out-review

Differential Revision: D48002839

fbshipit-source-id: 1cc870ea8dbbc84e1ef8c641b5ec1a758d87176c
2023-08-02 11:50:08 -07:00
Intl Scheduler e6066f4940 translation auto-update for i18n/creatorstudio.config.json on master
Summary:
Chronos Job Instance ID: 1125907933601560
Sandcastle Job Instance ID: 36028798028351327
allow-large-files
ignore-conflict-markers
opt-out-review

Differential Revision: D48002854

fbshipit-source-id: 16c15924f0cbd8d443e75615790e5f4544513a8d
2023-08-02 11:50:08 -07:00
Riccardo Cipolleschi 79122abe8a Split Hermes build for iOS on different executors to speed up CI and Releases (#38619)
Summary:
This PR splits the build of Hermes for iOS in multiple jobs.

Before, we were building all the slices of Hermes serially. So, we were:
- building the hermesc
- building hermes for iPhone
- building hermes for iPhonesimulator
- building hermes for Macos
- building hermes for Catalyst
- packaging the framework
This job was taking up to 45-50 minutes.

The the four slices (iPhone, iPhonesimulator, Macos, Catalyst) can be parallelized to harvest a speedup in execution.
The following tables contains the executions before and after this change.

- Full Clean Build -> Before:  51' 35" | After:  17'33" ( 3x improvement)

| BEFORE | AFTER |
| --- | --- |
| <img width="1164" alt="Screenshot 2023-07-28 at 11 48 24" src="https://github.com/facebook/react-native/assets/11162307/49cc519c-16f0-4868-b847-602b1cb21f3e"> | <img width="1120" alt="Screenshot 2023-07-28 at 11 16 32" src="https://github.com/facebook/react-native/assets/11162307/85034cd7-751e-4056-ae4f-ed09ac8343e8"> |
| Total time (critical path): `build_hermes_macos-Debug` = 51' 35" | Total time (critical path): `build_hermesc_apple` (2' 56") + `build_apple_slices_hermes-Debug-macosx` (9'23") + `build_hermes_macos-Debug` (5'14") = 17'33" |

- Fully Cached Build -> Before:  4'35" | After:  32" ( 9x improvement)

| BEFORE | AFTER |
| --- | --- |
| <img width="497" alt="Screenshot 2023-07-28 at 14 38 12" src="https://github.com/facebook/react-native/assets/11162307/978eba4d-3524-45ab-bfa5-d9cb9ba63df1"> | <img width="1099" alt="Screenshot 2023-07-28 at 16 12 17" src="https://github.com/facebook/react-native/assets/11162307/f2a8f0bb-545c-4d6f-9b81-cda87151bb62"> |
| Total Time (critical path): `build_hermes_macos-Debug` (4'35") | Total Time (critical path): `build_hermesc_apple` (7") + `build_apple_slices_hermes-Debug-macosx` (7") + `build_hermes_macos-Debug` (32") = 46" |

## Changelog:

[Internal] - Split hermes build to speedup CI and Release

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

Test Plan:
- CircleCI stays green
- Hermes artifact still works for RNTester and app from the template

Reviewed By: cortinico, dmytrorykun

Differential Revision: D47896833

Pulled By: cipolleschi

fbshipit-source-id: 3b9e8d5de9b2a6fb6671444fda09d77b96123ac2
2023-08-02 09:42:56 -07:00
Intl Scheduler a7510a8e7a translation auto-update for Apps/Wilde/scripts/intl-config.json on master
Summary:
Chronos Job Instance ID: 1125907933664878
Sandcastle Job Instance ID: 4503600635477354
allow-large-files
ignore-conflict-markers
opt-out-review

Differential Revision: D47995993

fbshipit-source-id: a8410fe5a175d0300037a54043696de2b9034921
2023-08-02 09:09:27 -07:00
Samuel Susla 1f24750d81 Mark Paragraph as clean if it hasn't changed (#38749)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38749

changelog: [internal]

# Request for comment

I'll gate this and extend this to TextInput if we think this is appropriate solution.

## Problem
Paragraph and TextInput have custom measure functions. They outsource measurements to the host platform. On Android, this means going through JNI (expensive).

When we architected YogaLayoutableShadowNode, we made intentional decision to dirty those nodes on every clone. This was to lower the complexity.

## Solution

One possible to solution is to just check if children, props or textAttributes have changed. If not, nothing has affected the layout and it is safe to mark the node as clean.

Reviewed By: NickGerleman

Differential Revision: D47914641

fbshipit-source-id: ab448fa18599eb2266984eba9f5d935caad1caed
2023-08-02 05:56:31 -07:00
Samuel Susla 95e7a74a50 Do not swapLeftAnd right if not in RTL (#38748)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38748

changelog: [internal]

Android was setting flag `swapLeftAndRightInRTL` to true regardless if the context was RTL or LTR. This causes unnecessary tree traversal + invalidation of all yoga nodes. This is a completely unnecessary work when layout direction is left to right.

To fix this, I made sure Android not longer sets `swapLeftAndRightInRTL` to true and in Fabric we only check the flag for RTL context.

Reviewed By: NickGerleman

Differential Revision: D47913605

fbshipit-source-id: 1d938b0dc9ba16a73b076f626055055162e3495f
2023-08-02 05:56:31 -07:00
Nicola Corti 704efe590c Remove test_android_docker_image
Summary:
This job is now unnecessary and we can safely remove it as its work is effectively already
executed by the `test_android` job and is causing us just to spent more CI credits.

Changelog:
[Internal] [Changed] - Remove test_android_docker_image

Reviewed By: cipolleschi

Differential Revision: D47716008

fbshipit-source-id: 68ff2b28da8cfb69e013476f84e903cf3001d5d3
2023-08-02 03:44:50 -07:00
szymonrybczak 378aa72ed6 Unify test-e2e command in rn-tester-e2e pacakge (#38701)
Summary:
This PR is small cleanup in scripts in `rn-tester-e2e` package, it creates unified script so that we can easily pass platform as an argument. Context: https://github.com/facebook/react-native/pull/36267#discussion_r1269378065

## Changelog:
[INTERNAL] [CHANGED] - Unify `test-e2e` command in `rn-tester-e2e` package

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

Test Plan: CI Green 

Reviewed By: NickGerleman, cipolleschi

Differential Revision: D47949821

Pulled By: cortinico

fbshipit-source-id: 90bbc96281e89dec505999ff5e51db7ca78da6dc
2023-08-02 03:38:08 -07:00
zhuwencheng 00b142f59a fix: adapt min_ios_version_supported (#38685)
Summary:
Adapt to the minimum version of iOS and fix unnecessary, incorrect code and comments.

## Changelog:
[IOS] [FIXED] - adapt min_ios_version_supported.

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

Reviewed By: NickGerleman

Differential Revision: D47960465

Pulled By: ryancat

fbshipit-source-id: ae91fc89307709359cef0e4a8106b03beb1fa57a
2023-08-01 21:06:25 -07:00
Andrea Cassani c616148a05 Fix Android ScrollView not responding to Keyboard events when nested inside a KeyboardAvoidingView (#38728)
Summary:
Starting from RN 0.72.0, when we nest a ScrollView inside a KeyboardAvoidingView, the ScrollView doesn't respond properly to the Keyboard on Android.

https://github.com/facebook/react-native/assets/32062066/a62b5a42-6817-4093-91a2-7cc9e4a315bb

This issue is due to a change made in https://github.com/facebook/react-native/issues/36104, which was added to fix https://github.com/facebook/react-native/issues/32235.

That commit changed this line of code to abort the Scroller animation if a new call to the `scrollTo` method was made:

https://github.com/facebook/react-native/blob/aab52859a447a8257b106fe307008af218322e3d/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java#L1073

Apparently, this is the same method that scrolls the ScrollView in response to the Keyboard opening on Android.

So, here comes my proposal for a fix that doesn't break https://github.com/facebook/react-native/issues/36104 and fixes https://github.com/facebook/react-native/issues/38152.

When we open the Keyboard, the call stack is as follows:
- InputMethodManager
- AndroidIME
- InsetsController
- `ReactScrollView.scrollTo` gets called

When we use the ScrollView method `scrollTo` directly from the UI, the call stack is different as it goes through:
- ReactScrollViewCommandHelper
- ReactScrollViewManager
- `ReactScrollView.scrollTo` gets called

We can move `mScroller.abortAnimation();` from `ReactScrollView.scrollTo` to the `ReactScrollViewManager.scrollTo` method so that it gets called only when we call `scrollTo` from the UI and not when the `scrollTo` method is called by other sources.

https://github.com/facebook/react-native/assets/32062066/9c10ded3-08e5-48e0-9a85-0987d62de011

## Changelog:

[ANDROID] [FIXED] - Fixed ScrollView not responding to Keyboard events when nested inside a KeyboardAvoidingView

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

Test Plan: You can see the issue and the proposed fixes in this repo: [kav-test-android](https://github.com/andreacassani/kav-test-android). Please refer to the `kav_test_fix` folder and to the [readme](https://github.com/andreacassani/kav-test-android/blob/main/README.md).

Reviewed By: NickGerleman

Differential Revision: D47972445

Pulled By: ryancat

fbshipit-source-id: e58758d4b3d5318b947b42a88a56ad6ae69a539c
2023-08-01 20:21:04 -07:00
Tomasz Sapeta 7c79e3107f Allow RCTAppDelegate pod to be imported as a module (#38717)
Summary:
If another pod wants to depend on `React-RCTAppDelegate` and is written in Swift, the user needs to enable modular headers for this pod in the Podfile. This is not very convenient as this cannot be changed as part of the podspec, thus requires additional steps from the user. In Expo, our autolinking just fixes that automatically for all pods that require it (not only for RN's pods).

## Changelog:

[IOS] [CHANGED] - Set DEFINES_MODULE xcconfig in React-RCTAppDelegate to generate a module map for this pod

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

Test Plan:
- rn-tester builds
- `pod install` with a dependency containing Swift code and depending on `React-RCTAppDelegate` no longer requires the user to use modular headers for this pod

Reviewed By: NickGerleman

Differential Revision: D47955835

Pulled By: cipolleschi

fbshipit-source-id: 779516a8396925e52c28b87d6fcf096357333bf5
2023-08-01 19:17:46 -07:00
Xin Chen 3fded52fb4 Create performance comparison example in RNTester (#38673)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38673

This diff adds performance comparison examples to RNTester. In each of the comparison we have bad and good examples, which could be used for the following purposes:

- Collect common performance pitfalls
- Use as testbed on performance tools and metrics for validation hypothesis

Changelog:
[Internal] - Add performance comparison example in RNTester

Reviewed By: rshest

Differential Revision: D47821109

fbshipit-source-id: ea0242ea50724d27c7713bb116335a465e24d1a7
2023-08-01 19:08:19 -07:00
Neil Dhar 1b1097de1d Run JSI tests in Hermes CMake build (#38659)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38659

Run JSI tests against all the Hermes implementations exposed by
`APITestFactory`. To build with the older version of gtest available in
Hermes, the test needed to be slightly modified.

Changelog: [Internal]

Reviewed By: avp

Differential Revision: D47373805

fbshipit-source-id: 58958b4a60dac25f1b7defa490b888f21a665b0c
2023-08-01 16:12:50 -07:00
Nick Gerleman b65dbf68d0 Bump template @types/react to 18.2.6 (#38713)
Summary:
Match the `react` dependency minor of `18.2` and specify a min version of `18.2.6`, which is the first version which includes `React.JSX` namespace. This enables usage of `React.JSX.Element`, now default as part of the template.

Note that `18.2.6` satisfied the previous semver, so new templates are already pulling in a version even newer than this, but updating projects may not do this automatically.

Changelog:
[General][Fixed] - Bump template types/react to 18.2.6

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

Test Plan: CircleCI will build and typecheck a new template app.

Reviewed By: yungsters

Differential Revision: D47943524

Pulled By: NickGerleman

fbshipit-source-id: 49e587f8c2ebfce9fd1f00793a858d72ac0aa09e
2023-08-01 15:57:43 -07:00
Xin Chen 6ab062dfec Fix concurrent consumers issue with ReactMarker (#38710)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38710

Fix a race condition when multiple consumers try to access ReactMarker and trigger calls to native module. Even though ReactMarker uses `ConcurrentLinkedQueue`, the loop itself could race and cause NPE.

Changelog:
[Android][Fixed] - Fix race condition with ReactMarker calls to its native module

Reviewed By: rshest

Differential Revision: D47933993

fbshipit-source-id: a56e5e4f3564922d534235991da5b6842248bf24
2023-08-01 12:19:17 -07:00
Sam Zhou 743799078b Parse .js.flow files with hermes-parser (#38726)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38726

Changelog: [Internal]

Needed to fix spurious parser errors

Reviewed By: pieterv

Differential Revision: D47959263

fbshipit-source-id: 95ce244de41c5b4b53fd56c542d660944b7e216f
2023-08-01 11:17:07 -07:00
Ruslan Shestopalyuk 4b84a2b913 Add .cpplsp-buck-out to .gitignore (#38723)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38723

## Changelog:
[Internal] -

Add a buck-specific (on Windows) non-source file type to .gitignore.

Reviewed By: christophpurrer

Differential Revision: D47957053

fbshipit-source-id: 732fdc554730037da5b5daa11ebff58a56f21c21
2023-08-01 10:56:21 -07:00
David Vacca b28e3c16ed Reduce visibility of ReactHost.prerenderSurface (#38699)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38699

Reduce visibility of ReactHost.prerenderSurface since this is only used from ReactSurface

changelog: [internal] internal

Reviewed By: christophpurrer

Differential Revision: D47915588

fbshipit-source-id: 953b04b531d718434170d63e9f66d22758d26ddf
2023-08-01 08:55:40 -07:00
David Vacca 30a312c25f Move ReactHost.destroy to ReactHostInterface (#38697)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38697

Move ReactHost.destroy to ReactHostInterface

changelog: [internal] internal

Reviewed By: rshest

Differential Revision: D47915485

fbshipit-source-id: 491af8fa76cb6eb738acc9a87922ac8099e7547e
2023-08-01 08:55:40 -07:00
David Vacca 4e44fda261 Add reload to ReactHostInterface (#38698)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38698

Add reload to ReactHostInterface

changelog: [internal] internal

Reviewed By: rshest

Differential Revision: D47915444

fbshipit-source-id: f423b7daf2f086370c80b3135c2139315e32c9f5
2023-08-01 08:55:40 -07:00
David Vacca 7e44d2cca4 Reduce visibility of ReactHost.stopSurface to package only (#38695)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38695

Reduce visibility of ReactHost.stopSurface to package only

changelog: [internal] internal

Reviewed By: christophpurrer

Differential Revision: D47915446

fbshipit-source-id: 570c4d195b6f7a028aad8707a4149a94d8e9ca1d
2023-08-01 08:55:40 -07:00
David Vacca 9eabf48c26 Reduce visibility of ReactHost.startSurface to package only (#38694)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38694

Reduce visibility of ReactHost.startSurface to package only

changelog: [internal] internal

Reviewed By: christophpurrer

Differential Revision: D47915445

fbshipit-source-id: 94f7e1822c4e758815daea24cfe4193e99cd1b7e
2023-08-01 08:55:40 -07:00
David Vacca 2403acfae8 Move ReactHost.start method to interface (#38696)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38696

Move ReactHost.start method to interface

changelog: [internal] internal

Reviewed By: rshest

Differential Revision: D47915277

fbshipit-source-id: f7a4c5f4a4c4405a3809db7303d1292bd7c7b005
2023-08-01 08:55:40 -07:00
David Vacca bfc2cb972a Reduce visibility of ReactSurface.getSurfaceHandler() (#38693)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38693

Reduce visibility of ReactSurface.getSurfaceHandler()

changelog: [internal] internal

Reviewed By: christophpurrer

Differential Revision: D47915065

fbshipit-source-id: e1501f075c9bb8858d859681fa7053dd0f9bbcfa
2023-08-01 08:55:40 -07:00
David Vacca 9ece027bdc Fix lint warn (#38700)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38700

Fix lint warn in DevOptionHandler.java

changelog: [internal] internal

Reviewed By: rshest

Differential Revision: D47915066

fbshipit-source-id: 3584a749ef042c6e2b491ae5170adf1cfad95106
2023-08-01 08:55:40 -07:00
Phillip Pan 8cd5b2a57d delete RCT_EXPORT_PRE_REGISTERED_MODULE (#38707)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38707

Changelog: [iOS][Breaking]

seemed like a confusing api, so getting rid of it

also did not see any libraries using this in GH: https://github.com/search?q=RCT_EXPORT_PRE_REGISTERED_MODULE&type=code, so can just delete this safely

Reviewed By: fkgozali

Differential Revision: D47919116

fbshipit-source-id: 6f6393bdf80a2f9836cbe5e1508da80d6bdc2e2d
2023-08-01 08:38:37 -07:00
Dmitry Rykun 1c3b3a09b6 Add @react-native/babel-plugin-codegen to @react-native/babel-preset (#38227)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38227

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

This diff enables react-native/babel-plugin-codegen to react-native/babel-preset. This will enable static view configs generation for properly schematized native components.

Changelog: [General][Changed] - react-native/babel-plugin-codegen to react-native/babel-preset

Reviewed By: christophpurrer

Differential Revision: D46688516

fbshipit-source-id: ebecc5fd610ca4b86c55355879ad3fd36d51cae9
2023-08-01 07:49:23 -07:00
Phillip Pan a79cde689f delete unused feature flag (#38708)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38708

Changelog: [Internal]

as title

Reviewed By: fkgozali

Differential Revision: D47924734

fbshipit-source-id: e55a9c6ce80f9e1f843cc9bbb9a555b76e4e4548
2023-08-01 06:36:26 -07:00
Alex Hunt bfd5fe27b3 Fix react_native_pods_utils copy step under Eden (#38719)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38719

This removes a point of friction where the `moveOutputs` script step would fail to copy extended file attributes under [EdenFS](https://github.com/facebook/sapling/blob/29362eb4fd06b63a2184f5cce729c304c70b0582/eden/fs/docs/Overview.md).

Changelog: [Internal]

Reviewed By: cipolleschi, dmytrorykun

Differential Revision: D47951246

fbshipit-source-id: 0a22d623b5e8c60c68778d3458a9046aeafbe87f
2023-08-01 05:35:44 -07:00
Denis 5eaf28b247 add emitUnionProp in parser primitives (#38705)
Summary:
[Codegen 131] This PR add a function `emitUnionProp` to the parser-primitives, as requested on https://github.com/facebook/react-native/issues/34872

## Changelog:

[INTERNAL] [ADDED] - Add `emitUnionProp` function to parser-primitives

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

Test Plan: `yarn test react-native-codegen`

Reviewed By: christophpurrer

Differential Revision: D47921708

Pulled By: rshest

fbshipit-source-id: c2c081c6317928e5eb8b0c1d0640c7b7f40a4b0b
2023-08-01 01:43:31 -07:00
szymonrybczak 529c952499 Move script checking Appium server status to separate file (#38692)
Summary:
This PR is small cleanup in `.circleci/config.yml` file. Request here: https://github.com/facebook/react-native/pull/36267#discussion_r1272050735

## Changelog:
[INTERNAL] [CHANGED] - move script checking Appium server status to separate file

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

Test Plan: CI Green 

Reviewed By: NickGerleman

Differential Revision: D47926222

Pulled By: ryancat

fbshipit-source-id: eeff338ca018549762dce46a744b80f659b4bd5d
2023-07-31 21:36:49 -07:00
Cao Doan 2856bef721 Fix nullable-to-nonnull-conversion warnings (#38677)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38677

Cleaning up some build warnings when Wnullable-to-nonnull-conversion is enabled.

Changelog: Fixes nullability warnings from `RCTConverstions.h`.

Reviewed By: christophpurrer

Differential Revision: D47886567

fbshipit-source-id: 71d33951f8565e58ba6c9414dc4a40debf94785d
2023-07-31 18:54:47 -07:00
Tim Yung ec96641a17 RN: Upgrade Deprecated ListView / PropTypes Packages (#38680)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38680

Upgrades to the recently published versions of `deprecated-react-native-listview` and `deprecated-react-native-prop-types`.

Changelog:
[Internal]

Reviewed By: NickGerleman

Differential Revision: D47893357

fbshipit-source-id: 430cbb51086cfd1c346a6a5c15b2e90358ab6565
2023-07-31 17:45:47 -07:00
Nick Gerleman 3eccc53629 Remove default 50ms Scroll Event Throttling in VirtualizedList (#38648)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38648

https://github.com/facebook/react-native/pull/38475 made this code no longer no-op on Android, which caused regressions documented in https://github.com/facebook/react-native/issues/38470#issuecomment-1639620459 due to VirtualizedList having more out-of-date information.

We are already coalescing scroll events on both Android and iOS, which will ensure we are not flooded with events. VirtualizedList also already inserts an artificial 50ms delay to new renders by default when high priority work is not happening (see `updateCellsBatchingPeriod`). This limits the heavy work done by VirtualizedList (no new renders or expensive math on scroll events), while letting the list still have the most recent events.

We can eventually remove this once VirtualizedList is able to use OffScreen universally.

Changelog:
[General][Changed] - Remove default 50ms Scroll Event Throttling in VirtualizedList

Reviewed By: ryancat

Differential Revision: D47823772

fbshipit-source-id: 55d22a1074235ccc1b2cf167f6b1758640c79edb
2023-07-31 13:58:56 -07:00
Eric Rozell b0a8d45e28 More consistent platform for out-of-tree platform extensions (#38703)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38703

This change consolidates the pattern for setting up out-of-tree platform options for core classes like ViewProps and ViewEventEmitter. A similar pattern was used for Touch.h. As we move towards documenting how to build an out-of-tree platform, it would be nice to specify a set of HostPlatformX classes that need to be implemented and made resolvable from specific header paths.

At this point, there is:
- HostPlatformViewProps
- HostPlatformViewEventEmitter
- HostPlatformViewTraitsInitializer
- HostPlatformTouch
- HostPlatformColor

The other benefit of this pattern is to DRY helper aliases like SharedViewEventEmitter and SharedViewProps.

## Changelog:
[General] [Added] - Use more consistent pattern for out-of-tree platform Fabric C++ class extensions

Reviewed By: christophpurrer

Differential Revision: D47917598

fbshipit-source-id: 58ee9677eefd34eb0bc2d321103314642c457cd8
2023-07-31 11:38:36 -07:00