Commit Graph
28700 Commits
Author SHA1 Message Date
Sam Zhou ffcbff8374 Deploy 0.215.0 to xplat (#39098)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39098

Changelog: [Internal]

Reviewed By: pieterv

Differential Revision: D48535689

fbshipit-source-id: 67ab2ea08a6ae7530fe25c14021dfc1b952a3db6
2023-08-21 17:08:00 -07:00
Rob Hogan 3c323382fe Update Jest to ^29.6.3 (#39096)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39096

## React Native

Changelog:
[General][Changed]: Bump Jest version in the new project template from `^29.2.1` to `^29.6.3`

## Metro

[Internal]

Reviewed By: motiz88

Differential Revision: D48519694

fbshipit-source-id: 201f76402ac72da1f5c297a29a1212b167d1b7e4
2023-08-21 16:33:35 -07:00
Ramanpreet Nara f312d6eccd Ensure TM system has consistent view of interop flags (#39086)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39086

Our largest blocker for the TurboModule interop layer is a "module not found" issue.

**Hypothesis:** This is a gating-related bug.

## Changes
This diff tries to simplify the gating of the TurboModule interop layer: Instead of reading the flags again and again from two different classes (the module manager and its delegate), just read the flags once, when the module system is initialized:

https://www.internalfb.com/code/fbsource/[ae79b760626ec81ceadbf2829e1593199d4df031]/xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/ReactInstance.java?lines=106-113%2C210-215%2C217-223%2C251

This will ensure that the TurboModule system has one consistent view of the interop layer flags, throughout its lifetime.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D48489274

fbshipit-source-id: 05eb64c5f7bd89dd65aac7390c3eb09234d87f96
2023-08-21 15:44:07 -07:00
Xin Chen 489d8903ab Add example to not render offscreen content (#38800)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38800

Changelog:
[General][Internal] - Add performance comparison example to not render offscreen content

Reviewed By: rshest

Differential Revision: D47892462

fbshipit-source-id: dd5bbd83c3baaf229c4b6fea89904cf4bb7b37de
2023-08-21 14:34:10 -07:00
Xin Chen 80685d52b8 Add systrace for event type when calling RCTDeviceEventEmitter (#39085)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39085

Adding arguments in systrace for event emitter event types. This is helpful to understand why sometimes JS render is triggered from native side.

Changelog:
[Internal] - Add event type information from native to js event emitter calls

Reviewed By: rshest

Differential Revision: D48448904

fbshipit-source-id: cbb4b86e781384d56205fec23931cd773e4a58a8
2023-08-21 13:25:31 -07:00
Ramanpreet Nara 606a92f0b3 Show RedBox when reloads fail
Summary:
When reloads fail, React Native currently just renders a blank screen.

We should provde some sort of feedback to the developer. Hence, this diff makes the RedBox show up.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D48335851

fbshipit-source-id: 0681cd40f8c83960f9133853481013765634f5cf
2023-08-21 12:43:42 -07:00
Ramanpreet Nara 80b665966f Clean up pre-rendered surfaces properly during teardowns (#39000)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39000

Whenever React Native tears down (including on logout), we need to drop unconsumed Pre-rendering surfaces.

D45012714 initially implemented this change, but this diff wasn't complete: it would only drop unconsumed pre-rendered surfaces when ***the Facebook infra* initiated** React Native to tear down. But, React Native could initiate tear down **by iteself** (e.g: via an uncaught exception on the Native Modules thread).

## Changes
In this diff, make the React Manager support an onBeforeDestroy listener. Then, integrate these listeners into the teardown/reload algorithms. That way, no matter how React Native tears down, we **alwasy** drop unconsumed pre-rendered surfaces.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D48323647

fbshipit-source-id: 28f99500eea457b0e3c420fed28c434f8794ac23
2023-08-21 12:43:42 -07:00
Ramanpreet Nara f437224042 Enhance/fix error reporting in reload and destroy
Summary:
The new reload/create/destroy methods work by chaining tasks together.

This task chain has the type Task<ReactInstance>.

**The problem:** If any step in the chain fails, task.getResult() actually returns null - not the ReactInstance. Many steps in the existing reload() and destroy() task chains don't account for this case. So:
- The reload() and destroy() task chains sometimes swallow errors.
- Sometimes steps in the reload() and destroy() task chains don't execute: they use .successTask

This diff makes two changes:
1. Ensure each step **always** executes (i.e: use .continueWith vs .success)
2. Ensure each step first checks if the Task<ReactInstance> isn't faulted/cancelled. If the task is faulted/cancelled, a soft exception gets reported, and the current ReactInstance gets returned.

Changelog: [Internal

Reviewed By: mdvacca

Differential Revision: D48080779

fbshipit-source-id: 22f03ef1a54b538d01eeb5ecde6d82a84d32f1f8
2023-08-21 12:43:42 -07:00
Ramanpreet Nara 1f0094e40a Fix: RedBoxes don't show up after teardowns (#38997)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38997

After React Native gets destroyed (e.g: via an exception), the ReactHost resets its current activity.

## Problem
React Native can display RedBoxes after React Native destruction (e.g: in the case of an exception).

Displaying RedBoxes requires the current activity, which gets nullified. So, the RedBox might not show up after destruction.

## Changes
This diff makes ReactHost keep a track of its last non-null activity in a WeakRef.
Then, the DevMenu just uses the last non-null activity to display RedBoxes (and everything else).

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D48076893

fbshipit-source-id: 6baddf8f329c03efe92f93ef1bfc6eb9569c1b38
2023-08-21 12:43:42 -07:00
Ramanpreet Nara aec22574cc Refactor: Use get/setCurrentActivity in ReactHost (#38998)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38998

Instead of using the mActivity reference directly, let's just use getCurrentActivity() and setCurrentActivity().

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D48076896

fbshipit-source-id: d988deaf8778bf0e3726d13f96e9e6e480d8fdc0
2023-08-21 12:43:42 -07:00
Ramanpreet Nara 75c5d74ea2 Fix: React Native reloads after teardown render a "blank screen" (#38999)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38999

After React Native tears down, a RedBox can appear, prompting the user to reload.

**Problem:** After React Native reloads, the React Native screen wouldn't show up.

**Cause:** ReactContext.onHostResume() wasn't executed.

Why:
- React Native teardown moves the React manager into the **onHostDestroy()** state.
- During initialization, React Native only calls ReactContext.onHostResume(), if the React manager was *already* in the **onHostResume()** state.

https://www.internalfb.com/code/fbsource/[f82938c7cc9a0ee722c85c33d1027f326049d37c]/xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/ReactHost.java?lines=924-925

**Question:** Why does React Native only call ReactContext.onHostResume(), **if the React manager was already in the onHostResume() state?**

In short, we want ReactContext.onHostResume() to be delayed until the user navigates to the first React Native screen. Please read the comments in the code to understand why.

## The fix
If we're initializing React Native during a reload, just always call ReactContext.onHostResume().

If React Native is reloading, it seems reasonable to assume that:
1. We must have navigated to a React Native screen in the past, or
2. We must be on a React Native screen.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D48076895

fbshipit-source-id: 6794105920ee30d62cebd745256bb5dea805e891
2023-08-21 12:43:42 -07:00
Ramanpreet Nara ecd2feeea0 Fix: React Native teardown crashes app
Summary:
During React Native teardown, we should stop all React surfaces. Otherwise, the app could crash with this error:

```
08-06 14:54:08.644 14843 14843 F DEBUG   : Abort message: 'xplat/js/react-native-github/packages/react-native/ReactCommon/react/renderer/scheduler/Scheduler.cpp:171: function ~Scheduler: assertion failed (surfaceIds.empty() && "Scheduler was destroyed with outstanding Surfaces.")'
```

When can teardown occur? One case: an exception occurs on the NativeModules thread.

NOTE: This diff impacts the **new** Bridgeless mode lifecycle methods.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D47926966

fbshipit-source-id: 62be90eb49091773976dfb18db5c2a7c0668c382
2023-08-21 12:43:42 -07:00
Ramanpreet Nara 3be4452de5 Easy: Rename adb logs: Rename old/newPreload() -> old/newStart() (#39001)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39001

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D48076894

fbshipit-source-id: c1c845f2629810f77f1f1c0ff63a0ead3ccfd804
2023-08-21 12:43:42 -07:00
Vincent Riemer 22ee08e70e Refactor conditional event emitting to the C++ layer (#39021)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39021

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.

(This is a second attempt at landing D48288752 which had to be backed out. It should be fine this time because of D48331909 which this diff now depends on)

Reviewed By: rozele

Differential Revision: D48322586

fbshipit-source-id: 7674c123e96ae71b18c8a3a780667ffaa2f25e7c
2023-08-21 11:42:10 -07:00
Moti Zilberman f4f18940d7 Create unstable API for event logging (#39091)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39091

Changelog: [Internal]

Adds a simple typed logging hook to `react-native/dev-middleware`. This is intended to allow integrators to receive events from the dev server, apply any relevant sampling/processing, and log them to a backend. (To be clear, the open source version of React Native does not and will not collect any data.)

WARNING: The API will evolve over the coming weeks/months and is *not guaranteed to be stable* - it might even break between patch releases.

Reviewed By: huntie

Differential Revision: D48466760

fbshipit-source-id: ed1e21fb0dac5d6199ff1ee26017a1d33d9b7d92
2023-08-21 10:31:50 -07:00
Samuel Susla 910a9567f4 Change use of nativeId to collapsable (#39047)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39047

changelog: [internal]

nativeID was used to fix broken behaviour of collapsable. Now, collapsable is fixed, let's remove that.

Reviewed By: rozele

Differential Revision: D48349235

fbshipit-source-id: a0a74ea2cf69adbc5065a0731ac4059712068e6f
2023-08-21 08:01:10 -07:00
Dmitry Rykun a66ebc5d97 Make react-native use JSI headers from ReactCommon instead of the copy from Hermes tarball (#38922)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38922

Changelog: [Internal]
This diff alows react-native to use its own copy of JSI from `ReactCommom/jsi` instead of consuming headers vendored with Hermes.

Reviewed By: NickGerleman

Differential Revision: D48152876

fbshipit-source-id: 89c7eaf899b5bfc262fbb06517db260abcc18592
2023-08-21 06:49:19 -07:00
Dmitry Rykun 71a384072c Fix hermes-engine Xcode integration (#38896)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38896

This diff fixes a typo in hermes-engine build scripts input/output files. This typo prevented execution of `[RN] [1] Build Hermesc` build script in certain scenarios.
Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D48192671

fbshipit-source-id: 5a3b7d5dfd66f36328ef1941a40f4ecb47fb9054
2023-08-21 06:00:33 -07:00
MJMoshiri 30ab7a45ec add userSelect to TextStyles attributes (#39024)
Summary:
This PR addresses the missing userSelect style support in the TypeScript definitions. While support for userSelect was introduced in commit [fc42d5bbb9](https://github.com/facebook/react-native/commit/fc42d5bbb9906c37c2f62d26c46f6e3191cccd01), the associated TypeScript definitions were overlooked. This oversight led to issue https://github.com/facebook/react-native/issues/39015. This PR rectifies that by updating the type definitions accordingly.

## Changelog:

[GENERAL] [FIXED] - Updated TypeScript definitions to include userSelect style support. Refer to commit [2e4d8b6c14](https://github.com/facebook/react-native/commit/2e4d8b6c145ed36b600a0481d7f65157a78abbeb) for the specific changes.

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

Reviewed By: rozele

Differential Revision: D48412051

Pulled By: NickGerleman

fbshipit-source-id: 425fc011af9052c8c4bde98e8524b7784493c546
2023-08-21 05:19:23 -07:00
Dmitry Rykun 52e54ed8a6 Resolve redirects instead of manually downloading nightly Hermes (#38920)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38920

Maven does not provide stable URLs for stored artifacts. Instead there can be a series of redirects for the actual download URL.
CocoaPods does not follow redirects when such URL is set as a `source` in a `podspec`. To mitigate that we download Hermes prebuild manually, and that set the `source` to that file.
This diff removes this manual download step, and utilizes `curl` to resolve redirects, and then assign final endpoint to `source[:http]` of the `hermes-engine.podspec`.
Changelog: [Internal] - Resolve redirects instead of manually downloading nightly Hermes.

Reviewed By: cipolleschi

Differential Revision: D48225199

fbshipit-source-id: d13f9ef79f7c89c317b854da1170ca8321823d8a
2023-08-21 04:24:21 -07:00
Nicola Corti ffa5742699 Cleanup BUCK setup for our JVM tests (#39061)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39061

We're suppressing JVM tests using BUCK which is causing misalignment between which tests we run on Buck vs Gradle.
Instead we should be using the Ignore annotation (which we already do) to decide which tests to skip, so that Buck can just pick all the Java/Kotlin file in this folder.

Changelog:
[Internal] [Changed] - Cleanup BUCK setup for our JVM tests

Reviewed By: cipolleschi

Differential Revision: D48433432

fbshipit-source-id: 31070ef848932aefa5d2710a8e11f97646e4b51c
2023-08-21 04:20:41 -07:00
Ramanpreet Nara eb3d5a4b83 DeviceInfo: Improve logging to undersatnd module registry = nil issue
Summary:
For some reason, the module registry is nil inside RCTDeviceInfo.

**Hypothesis:** DeviceInfo is outliving React Native teardown (somehow).

This diff adds additional logging inside RCTDeviceInfo so that we could better undersatnd the problem.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D48237716

fbshipit-source-id: 459306dab5cddd4da50ed767087b93e33085be67
2023-08-19 19:53:40 -07:00
Ramanpreet Nara adb9cbc0f3 DeviceInfo: Simplify RCTExportedDimensions's API
Summary:
RCTExportedDimensions doesn't need access to the ModuleRegistry, or the bridge. It just uses those two things to get the fontScale.

We could make RCTExportedDimensions easier to understand, by making it do fewer things (i.e: computing the fontScale up front, and passing it into RCTExportedDimensions). Let's just do that.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D48237715

fbshipit-source-id: b3af648d88276846742d0e1192d33d180ee49dbb
2023-08-19 19:53:40 -07:00
Intl Scheduler 84e5934290 translation auto-update for i18n/fb4a.config.json on master
Summary:
Chronos Job Instance ID: 1125907940206333
Sandcastle Job Instance ID: 31525198414697888
allow-large-files
ignore-conflict-markers
opt-out-review

Differential Revision: D48491307

fbshipit-source-id: d5c6b29f2700196b3201a0d24aef6c5a017f49bf
2023-08-18 18:59:02 -07:00
Kudo Chien bdfa368060 Fix build errors when importing React-Core module from Swift (#38993)
Summary:
supersedes https://github.com/facebook/react-native/issues/38806
the errors are actually coming from https://github.com/facebook/react-native/commit/42d67452eb9a#diff-226ff5f87f146abfebd14a69eeb7d95c358d53da30533321e3ae9281c8acc6f0L102. we should keep c++ headers as cocoapods private headers, so that those headers will not expose into the umbrella header.

this pr also adds a swift test file to rn-tester, so we can verify the fix and prevent the similar build errors in the future.

## Changelog:

[IOS] [FIXED] - Fix build errors when importing React-Core module from Swift

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

Test Plan: add a swift file in rn-tester and make sure it builds successfully

Reviewed By: cipolleschi

Differential Revision: D48414292

Pulled By: NickGerleman

fbshipit-source-id: d65273adc4bfab927d7c3db1db6bb48d3e48349e
2023-08-18 17:31:01 -07:00
Riccardo Cipolleschi 4deb29ae1b Make prettier ignore generated folders (#39076)
Summary:
This change introduce the `.prettierignore` file to skip some generated folders.
Prettier was checking that the JS files inside the Pods/ and the sdks/ folders were properly formatted.
However, we don't control those folders.

Running prettier in those folders was taking extra 10s to 30s on average, some time we can now save.

## Changelog:

[Internal] - Make prettier skip generated folders

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

Test Plan:
Tested locally

| Before | After |
| --- | --- |
| <img width="593" alt="Screenshot 2023-08-18 at 11 28 51" src="https://github.com/facebook/react-native/assets/11162307/65eb773b-1966-49cd-bd51-6310fe48cf3b"> | <img width="515" alt="Screenshot 2023-08-18 at 11 29 09" src="https://github.com/facebook/react-native/assets/11162307/969ff9e4-f05b-43bf-9a95-7b37dea7d3d0"> |

Reviewed By: christophpurrer

Differential Revision: D48466583

Pulled By: cipolleschi

fbshipit-source-id: 60a4335af2c337c6d3d143d8d5b56d4a41073feb
2023-08-18 08:42:13 -07:00
Tim Yung ffc9ff066a RN: Enforce Manifest Constraints w/ ESLint (#39064)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39064

Creates a new lint rule that enforces the following constraints:

- `react-native/monorepo` cannot have `dependencies`.
- `react-native` cannot have `devDependencies`.

This also includes a lengthy comment in the rule definition explaining why these constraints exist, so that future contributors can make an informed decision when reconsidering these constraints.

Changelog:
[Internal]

Reviewed By: NickGerleman

Differential Revision: D48448633

fbshipit-source-id: 26b0d74b9120ddfd2a6a72bb91f86a98c8d679ef
2023-08-18 07:48:56 -07:00
Moti Zilberman be469c1b86 Resolve absolute paths of Babel presets/plugins in Node build config (#39079)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39079

Changelog: [Internal]

The Babel config for Node packages in the RN repo, added in D47760330 / D48312463, relies on [name normalization](https://babeljs.io/docs/options#name-normalization) to resolve the Babel presets and plugins that it references. This works for OSS but can cause other integrations to fail to resolve the packages, depending on the details of how they're installed. Here we eagerly resolve the packages when constructing the Babel config.

Reviewed By: huntie

Differential Revision: D48469386

fbshipit-source-id: d9c15883169e30984d93fc6a5d9544752db5d2c8
2023-08-18 07:32:46 -07:00
Riccardo Cipolleschi 641be98b1e Split Config.yml to run jobs selectively (#39042)
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-exports-checks

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

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

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: NickGerleman

Differential Revision: D48394437

Pulled By: cipolleschi

fbshipit-source-id: 771f3e68daa8318d2b73dd91ce85a41488110c04
2023-08-18 07:22:22 -07:00
Stewart Sum 3dbb759506 Convert Java tests for JSDebuggerWebSocketClient to Kotlin (#38941)
Summary:
Migrate Java tests to Kotlin for the JSDebuggerWebSocketClient class.

## Changelog:

Pick one each for the category and type tags:

[ANDROID] [CHANGED] - Update Java tests to Kotlin for the referenced file

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

Test Plan: All unit tests passed.

Reviewed By: mdvacca, rshest

Differential Revision: D48354172

Pulled By: cortinico

fbshipit-source-id: e8d3c98216b4e2c3ff462433c7e37d628d06f0c6
2023-08-18 05:22:09 -07:00
Riccardo Cipolleschi c326ec0475 Add retry mechanism to test_e2e_android to reduce flakyness (#39068)
Summary:
We figured that android e2e tests are a bit flakier than needed. This change add a retry mechanism to rerun the tests up to 3 times in order to try and reduce the flakyness there.

## Changelog:

[Internal] - Add retry to Android e2e tests

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

Test Plan: CircleCI stays green

Reviewed By: cortinico

Differential Revision: D48463517

Pulled By: cipolleschi

fbshipit-source-id: cdf3dca047dce89cc5d2dccc9b847283b93bbd36
2023-08-18 04:08:56 -07:00
Nicola Corti 606e14552d Set android.suppressUnsupportedCompileSdk=34 for the root project
Summary:
Android is currently raising a warning as we're using AGP 8.1 with SDK 34.
I'm suppressing this warning that we can remove once we bump to AGP 8.2

Changelog:
[Internal] [Changed] - Set android.suppressUnsupportedCompileSdk=34 for the root project

Reviewed By: mdvacca

Differential Revision: D48437747

fbshipit-source-id: 6d2ed5f4f021052934206fd9149c048cdd5350df
2023-08-18 03:07:41 -07:00
Alex Hunt c82cf64a22 Move metro-inspector-proxy into dev-middleware (#39045)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39045

## Context

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

## Changes

- Relocates `metro-inspector-proxy` source from the Metro repo into the React Native repo as part of the `react-native/dev-middleware` package.
    - Drops the `runInspectorProxy` entry point.
- Attaches the Inspector Proxy to the `createDevMiddleware()` API as the new integration point for this functionality.
- Documents migrated endpoints + usage of `createDevMiddleware()` in README.

Changelog: [Internal]
Metro changelog: None (`metro-inspector-proxy` is now an internal component of `react-native`, covered in the [release notes for 0.78.1](https://github.com/facebook/metro/releases/tag/v0.78.1))

Reviewed By: motiz88, blakef

Differential Revision: D48066213

fbshipit-source-id: 3fbef5d881f6f451cb5955dcbbc362c53347437e
2023-08-18 01:38:10 -07:00
Nick Gerleman 2ec920e65f Bump protobufjs
Summary:
Update to 6.11.4 and 7.2.4 to address alert for CVE-2023-36665

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D48382181

fbshipit-source-id: 32f00d968e6383efb448cd41cb3fa659723ecf3a
2023-08-18 00:09:03 -07:00
Nick Gerleman 5d47bad74f Fix segfault calling YGJNILogFunc (#39051)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39051

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

`YGJNILogFunc` has a bug where it uses a `va_list` to determine the length of a printf string, then reuses the same `va_list` later after it has already been iterated through. Even if no arguments are present, this may cause a crash looking something like:

```
C  [libsystem_platform.dylib+0xf12]  _platform_strlen+0x12
C  [libsystem_c.dylib+0x31bf]  __vfprintf+0x1339
C  [libsystem_c.dylib+0x307ce]  _vsnprintf+0x100
C  [libsystem_c.dylib+0x6965]  vsnprintf+0x44
C  [libyoga.dylib+0x5161]  YGJNILogFunc(YGConfig*, YGNode*, YGLogLevel, void*, char const*, __va_list_tag*)+0x59
```

Fixing this fixes crashing unit tests which are not explicitly disabled.

Reviewed By: yungsters

Differential Revision: D48388548

fbshipit-source-id: 492e7a89aeb5f9d15485ce31641875a295356bef
2023-08-18 00:07:51 -07:00
Evan Charlton 04fb0122b2 feat(rn-tester): Improve the Modal tester (#38977)
Summary:
## Summary:

The modal tester in the sandbox was lacking a bit of functionality that the Modal component exposes -- especially on Android. This change revamps the Modal page to more-closely resemble the API documentation by exposing all of the options, and annotating which ones are reserved for the different platforms.

Additionally, this change puts the modal controls into the created modal itself. This allows the user to more-easily test what happens if the props change during the lifespan of the modal (related PR: https://github.com/facebook/react-native/issues/38947).

 ## 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] - Revamp Modal tester in rn-tester

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

Test Plan:
| Control page | Modal (with `transparent=true` on Android) |
|:--:|:--:|
| ![image](https://github.com/facebook/react-native/assets/418560/ef49cb94-14d8-4ebe-ade5-699b8e67ba5c) | ![image](https://github.com/facebook/react-native/assets/418560/d4bb6ef5-7d8c-4d5f-b4d8-37b8d736b19a) |

Reviewed By: yungsters

Differential Revision: D48414351

Pulled By: NickGerleman

fbshipit-source-id: 54bece639f4c64132dfb21c54c91d46972f5a335
2023-08-17 23:58:28 -07:00
Saad Najmi 3eeee11d7a Guard JSGlobalContextSetInspectable behind a compile time check for Xcode 14.3+ (#39037)
Summary:
An earlier [change](https://github.com/facebook/react-native/commit/8b1bf058c4bcbf4e5ca45b0056217266a1ed870c) I made (that huntie resubmitted) only works on Xcode 14.3+ (See more info [here](https://github.com/react-native-community/discussions-and-proposals/discussions/687)). This change adds the appropriate compiler checks so that the change is compatible with Xcode 14.2 and earlier, and therefore cherry-pickable to 0.71 and 0.72.

The check works by checking if iOS 16.4+ is defined, which is the closest proxy I could find for "Is this Xcode 14.3".

## Changelog:

[IOS] [CHANGED] - Guard `JSGlobalContextSetInspectable` behind a compile time check for Xcode 14.3+

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

Test Plan: I can't actually test on Xcode 14.2 (it won't launch on my MacBook 😢), but I made a similar [PR](https://github.com/microsoft/react-native-macos/pull/1848) in React Native macOS, whose CI checks run against Xcode 14.2 and I'm getting passing checks there.

Reviewed By: huntie

Differential Revision: D48414196

Pulled By: NickGerleman

fbshipit-source-id: ba10a6505dd11d982cc56c02bf9f7dcdc104bbec
2023-08-17 22:04:44 -07:00
Nick Gerleman c522837d9e ListMetricAggregator UTs - contentLength caching (#38738)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38738

UTs about returned cached content length and cached content length requirement in RTL.

Changelog: [Internal]

Reviewed By: rozele

Differential Revision: D47978634

fbshipit-source-id: 509b2b60cae4a8755745710fb5872da27c8ce7a3
2023-08-17 21:31:31 -07:00
Nick Gerleman 298d297e54 Null out ListMetricsAggregator contentLength on orientation change (#38937)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38937

It is a logic error to query for list metrics when a valid list content length has not yet been observed.

An invariant is meant to catch this if it happens, but a non-default orientation causes us to zero out a value which is null, and our null check does not catch this, and we return a nonsense value.

Change from zeroing out the field to nulling it out instead.

Changelog: [Internal]

Reviewed By: lenaic

Differential Revision: D48251645

fbshipit-source-id: 5c7e16f694db4ddb0d37b6092de2e75ee8d6c7d3
2023-08-17 21:31:31 -07:00
Lynden Kuwada 9f47b6af71 Revert D48140317: delete unused RCTSurfaceHostingView selectors
Differential Revision:
D48140317

Original commit changeset: 930c79b3828e

Original Phabricator Diff: D48140317

fbshipit-source-id: b1a16b9c08dc2ee19aa39b63c9234fbf9fa81c35
2023-08-17 18:23:57 -07:00
Phillip Pan f2b102485f Back out "remove RCTSurfaceSizeMeasureMode from public contract of RCTSurfaceHostingProxyRootView"
Summary:
Original commit changeset: c3240ad4c1e6

Original Phabricator Diff: D48140102

Changelog: [Internal]

i suck

bypass-github-export-checks

Reviewed By: makovkastar

Differential Revision: D48449490

fbshipit-source-id: e398726dda8b8f08ab55326c1f210b3b01b09dc5
2023-08-17 17:27:58 -07:00
Phillip Pan 8548eb5d2a delete unused RCTSurfaceHostingView selectors (#38869)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38869

## Changelog:

[iOS][Breaking]- After [#38866](https://github.com/facebook/react-native/pull/38866) and [#38868](https://github.com/facebook/react-native/pull/38868), these are not needed anymore. instead of depending on the host view and overriding `createSurfaceWithBridge:` in a subclass create a specialized surface, we just rely on composition instead and provide a surface to the hosting view.

Reviewed By: mdvacca, cipolleschi

Differential Revision: D48140317

fbshipit-source-id: 930c79b3828e0197c5dd2841875b830fc211e2a6
2023-08-17 16:59:44 -07:00
Zeya Peng 915e9bd227 executeMount: declare ternary fallback value beforehand (#38991)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38991

Changelog: [Internal]

Reviewed By: jlhe97, sammy-SC

Differential Revision: D48198573

fbshipit-source-id: 222beb27f4648750877fd6b42904b7b3eab5c9ce
2023-08-17 13:48:51 -07:00
Xin Chen 17f957aadd Update startup perf api to accept undefined/null values (#38323)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38323

This change makes the returned values from `performance.reactNativeStartupTiming` to accept null or undefined. This is done as some platforms may not have certain startup timing information, and as a default value, it's discussed that null/undefined is better than zero.

- Use `unorderedMap` instead of custom timing object for the C++ native module return value
- Use `std::nan` as initialized value for unset doubles
- Update examples to reflect the latest changes

Changelog:
[General][Internal] - Make the return values for `reactNativeStartupTiming` possible to be null or undefined

Reviewed By: mdvacca

Differential Revision: D43885535

fbshipit-source-id: f35292f2e9cdf98750d0d80b9e3bcdcddc560fb7
2023-08-17 12:35:57 -07:00
Thiago Brezinski 4a48fd2bb5 Convert ReactPropConstantsTest to Kotlin (#39005)
Summary:
Converts ReactPropConstantsTest to Kotlin, as requested in https://github.com/facebook/react-native/issues/38825

## 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] - Convert ReactPropConstantsTest to Kotlin
[INTERNAL] [CHANGED] - Add null-check to ViewManagersPropertyCache.java

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

Test Plan:
1. Run `./gradlew :packages:react-native:ReactAndroid:test`.
2. All tests should pass.

Reviewed By: mdvacca, rshest

Differential Revision: D48430460

Pulled By: cortinico

fbshipit-source-id: cc425f14bf15ec6e5a334c631d52ca962d06a2a9
2023-08-17 11:02:29 -07:00
Fábio Henriques 10feddcf03 Convert MatrixMathHelperTest to Kotlin (#39046)
Summary:
This PR converts `MatrixMathHelperTest.java` to Kotlin as requested in [this issue](https://github.com/facebook/react-native/issues/38825).

## Changelog:

[INTERNAL] [CHANGED] - Convert MatrixMathHelperTest to Kotlin

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

Test Plan:
1. Run `./gradlew :packages:react-native:ReactAndroid:test`.
2. All tests should pass.

Reviewed By: mdvacca

Differential Revision: D48430157

Pulled By: cortinico

fbshipit-source-id: d371e6958a561797ffd8f9e14382a144f82f105e
2023-08-17 10:35:58 -07:00
Intl Scheduler d1e2cbb4b3 translation auto-update for i18n/fb4a.config.json on master
Summary:
Chronos Job Instance ID: 1125907940152907
Sandcastle Job Instance ID: 1024566126
allow-large-files
ignore-conflict-markers
opt-out-review

Differential Revision: D48431884

fbshipit-source-id: e6eb7f6002121abe6c7dea907b55fce4875d1bf7
2023-08-17 06:09:52 -07:00
Phillip Pan 8b4a3533e8 delete unused RCTSurfaceHostingProxyRootView initializers (#38868)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38868

## Changelog:

[iOS][Breaking] - After [#38864](https://github.com/facebook/react-native/pull/38864), these are not needed anymore. there's some logic with the bridge, but since we're treating new arch as one piece moving forward, i don't really think they're that important. plus that logic is like really old.

Reviewed By: mdvacca

Differential Revision: D48140101

fbshipit-source-id: 0137becbfca493589d20f9ac8abace2b4c908ddd
2023-08-17 01:52:48 -07:00
Arushi Kesarwani aafbe7a458 Fixing getSurfaceHandler() to package in ReactSurface (#39029)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39029

Reducing visibility of `getSurfaceHandler()` in ReactSurface

changelog: [internal] internal

Reviewed By: luluwu2032

Differential Revision: D48376643

fbshipit-source-id: 6e0873372d96435cc5a3b8baa54b1b592e7327c4
2023-08-16 21:23:56 -07:00
Arushi Kesarwani 8fa19abd71 Refactor ReactSurfaceImpl.detach() (#39050)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39050

Adding `detach()` to the interface `ReactSurface`

changelog: [internal] internal

Reviewed By: mdvacca

Differential Revision: D48377508

fbshipit-source-id: 210bd39ae96f0bce4d929afbc985811fe0cc0aa2
2023-08-16 17:46:24 -07:00