Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge from upstream through 2020-07-31 #825

Merged

Conversation

amgleitman
Copy link
Member

@amgleitman amgleitman commented Sep 2, 2021

Please select one of the following

  • I am removing an existing difference between facebook/react-native and microsoft/react-native-macos 👍
  • I am cherry-picking a change from Facebook's react-native into microsoft/react-native-macos 👍
  • I am making a fix / change for the macOS implementation of react-native
  • I am making a change required for Microsoft usage of react-native

Summary

Merge facebook/react-native's main branch into react-native-macos's main branch through 2020-07-31 23:59:59 PDT (specifically, e0e33fc).

These changes were made by repeatedly running git merge and resolving merge conflicts as needed.

Notes

  • As a result of 4409642, we're also resolving differences between here and upstream in Libraries/Components/StatusBar/NativeStatusBarManagerAndroid.js. We've gotten approval that we don't need these differences anymore.
  • Part of d1c3c2d involves adding two TODO(macOS GH#774) tags in Libraries/NativeAnimation/RCTNativeAnimatedTurboModule.mm. These are simply replacing UIView with RCTPlatformView to make sure things compile on macOS.
  • 3093010 involves a lot of refactoring, which explains why there are so many files changed in this PR. However, most of these should be caught by the compiler.
  • This also resolves Unable to update eslint due to resulting configuration errors #813 by fixing a regex in jest.config.js.

Validation

  • yarn lint
    • ✖ 68 problems (0 errors, 68 warnings)
  • yarn flow-check-ios
  • yarn flow-check-macos
  • yarn flow-check-android
  • yarn test
    • Test Suites: 131 passed, 131 total
    • Tests: 1 skipped, 1281 passed, 1282 total
    • Snapshots: 595 passed, 595 total
  • RNTester
    • Compiles on macOS and iOS
    • All unit tests within Xcode pass except for WebSocketTest (this is expected for now)
    • No new regressions have been found

jayesh15111988 and others added 30 commits July 19, 2020 13:59
Summary:
As a part of the "Lean Core" effort we are moving many React Native open source modules into React Native. Through this task, we reduced the app size of all React Native applications!

For this task, I moved the ART iOS files to Facebook internal.

Changelog:
[iOS][Changed] - Moved ART iOS files from React Native to Facebook internal

Reviewed By: PeteTheHeat

Differential Revision: D22560856

fbshipit-source-id: 4ed982b0361fef3e875374b6c3df0204037c2bfa
Summary:
This PR is to fix facebook#29279, which image cannot show in iOS 14
As facebook#29279 (comment) mention, this issue can be fixed by calling ` [super displayLayer:layer];` it it is still image, to let `UIImageView` handle still image rendering

## Changelog

[iOS] [Fixed] - Fix image cannot show in iOS 14

Pull Request resolved: facebook#29420

Test Plan:
Image can be shown in iOS 14 build with Xcode 12 beta, using
```js
<Image source={require('./images/some_local_image.jpg')}/>
```

It may also need to test gif image is render correctly
```js
<Image source={{uri: 'https://some_remote_gif_image.gif'}}/>
```

Reviewed By: p-sun

Differential Revision: D22619448

Pulled By: shergin

fbshipit-source-id: f4d0ad83af945a6b8099d4eaea5a5f1933c7bfd2
Summary:
Changelog: [Internal] Fabric-specific internal change.
This diff introduces a new value for `YGPositionType`: `YGPositionTypeStatic`.
No part of Yoga, RN, Litho or CK uses this value yet. `relative` and `static` values behave the same way for now. We also do not change any defaults. So, it should be fine.

Reviewed By: SidharthGuglani

Differential Revision: D22386732

fbshipit-source-id: 39cd9e818458ac2a91efb175f24a74c8c303ff08
Summary:
Changelog:
[Internal] - Remove const from text in RawTextProps

Reviewed By: shergin

Differential Revision: D22607120

fbshipit-source-id: 18f7ab716342c3e5a8e469b12c5437a617be8583
Summary:
This fixes facebook#29397. Without this, apps that specify `android:windowTranslucentNavigation` draw the `LogBox` buttons underneath the soft navigation bar, making the buttons unpressable.

Before             |  After
:-------------------------:|:-------------------------:
<img src="http://ashoat.com/AndroidTranslucentNavigationLogBox.png" width="300" />  |  <img src="http://ashoat.com/AndroidTranslucentNavigationLogBoxFixed.png" width="300" />

## Changelog

[Android] [Fixed] - Set LogBox windowTranslucentNavigation to false

Pull Request resolved: facebook#29399

Test Plan: I tested this change on the [repo](https://github.com/Ashoat/LogBoxTest) I set up to reproduce the issue. I set it up to [build `ReactAndroid` from source](Ashoat/LogBoxTest@3a2cdab) and then edited `node_modules/react-native/ReactAndroid/src/main/res/devsupport/values/styles.xml` directly.

Reviewed By: rickhanlonii

Differential Revision: D22602970

Pulled By: mdvacca

fbshipit-source-id: 8c2adc149aa0157825075022f00bb695956d3121
…ayMetrics in Android API level <= 16

Summary:
This diff fixex a NoSuchMethodException when calling DisplayMetricsHolder.initDisplayMetrics in Android API level <= 16.

changelog: [Android][Fixed] Fix NoSuchMethodException when calling DisplayMetricsHolder.initDisplayMetrics in Android API level <= 16

Reviewed By: fkgozali

Differential Revision: D22630603

fbshipit-source-id: d2a95445beb5745a89ee1eefdf0d24ce3e0b8893
…ms being executed

Summary:
This could help somewhat with solving crashes in production.

Changelog: [internal]

Reviewed By: mdvacca

Differential Revision: D22631593

fbshipit-source-id: 2caebf1d6611d98764bccf5a6608040e5c892614
Summary: Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D22627947

fbshipit-source-id: 40831018a340ffe620cdfffb9033e6916492a9d3
Summary:
`js1 upgrade metro -v 0.61.0`.

Newest Metro release: https://github.com/facebook/metro/releases/tag/v0.61.0

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D22644020

fbshipit-source-id: e4276bf6b76892f5d3cbd4ff132359031f511962
Summary:
Changelog:
When the JSLocation is nil, checking whether the address is running is unnesarry and wasting time, adding a JSLocation length check to mitigate that.

Reviewed By: cpojer

Differential Revision: D22644574

fbshipit-source-id: c51fc1a8976ebc25cba2653581e1bfa479a1d70d
Summary:
Cleaning up a bunch of legacy JS (var) and removing some variable names for stuff that is just used once.

Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D22627397

fbshipit-source-id: 783af84b17cbf37df3b8e2ae10bb39d50dd8180d
Summary: Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D22625944

fbshipit-source-id: 1d97550c92115eb637da57e8f38c28e8139f3a8b
Summary:
This template for new projects isn't configured with exact objects by default, which could cause issues with code in react-native assuming this option is enabled.

Changelog: [Changed] Enabled exact_by_default in Flow for new projects using the template

Reviewed By: cpojer

Differential Revision: D22571745

fbshipit-source-id: da5affe903114484384764be2142e1c46244bfac
Summary:
| Group | Before | After | Change |
| Untyped | 50 | 49 | -1 |
| flow | 197 | 155 | -42 |
| flow strict-local | 226 | 185 | -41 |
| flow strict | 33 | 117 | +84

Changelog: [Changed] Improved Flow typing of multiple modules (with migrations to `flow strict` and `flow strict-local`

Reviewed By: motiz88

Differential Revision: D22549140

fbshipit-source-id: ed29415332cfce15b244ee4dea9e13d035543175
Summary:
RN removed support for iOS 9 last year, therefore iOS10+ is always available.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D22655069

fbshipit-source-id: 77e85e0403ea7ea0febc8766c10bb6f94ea417ad
Summary: Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D22628865

fbshipit-source-id: 66ff311b2dab4e0c42f906d5a2642997b1570ae4
Summary:
The max heap size currently is 512 MB for OSS apps using Hermes on Android.

Some users (see facebook/hermes#295) are experiencing
long pauses when reaching this ceiling.
Increasing this limit to 1 GB should reduce the frequency of these pauses occurring
for apps where the expected heap usage is near 512 MB.

Changelog: [Internal] Set Hermes's default max heap size to 1 GB

Reviewed By: mhorowitz

Differential Revision: D22577343

fbshipit-source-id: 2d7d688e38e95a082692dca52d010d0449a6e64b
Summary:
Passes the `globalPrefix` option from the Metro config object into `metro-babel-transformer`. This currently has no effect in OSS.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D22594663

fbshipit-source-id: 668b71cd6bec988313e9286b316f9006d61ad871
Summary:
Pull Request resolved: facebook#29453

Problem Statement: A native module needs to call a function on `ReactInstance` (in this case `loadScript`). Typically, this is handled by the bridge.
Current Bridgeless Solution: Create a new protocol (in this case `RCTJSScriptLoaderModule`) which lets a block be passed in TM init to forward the method call to `ReactInstance`. This is the best thing I could think of right now.

Changelog:[Internal]

Reviewed By: RSNara

Differential Revision: D22512748

fbshipit-source-id: e6559279b6e299e17d1199407129ad3902c41e6b
Summary:
This notification was never used, I'd rather not have someone start relying on it, and need to figure out how to migrate them in bridgeless mode.

Changelog:[Internal]

Reviewed By: cpojer, RSNara

Differential Revision: D22513602

fbshipit-source-id: 80b179af8408abc6646a73380b4a66cade3f75f2
Summary:
Unfortunately LayoutAnimations index adjustment is a bit tricky. There was one (hopefully only one!) remaining issue where a specific series of delayed removes, inserts, and removes would trip up index adjustment. Namely in this case: Preexisting delayed removes, and then a later animated commit with immediate inserts followed by higher-index removes.

This case is now resolved and I took time to test and verify other index adjustment paths.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D22709915

fbshipit-source-id: 16ba5bb358608d384f44628dbb6cc691deb8164a
Summary: Changelog: [Internal]

Reviewed By: TheSavior

Differential Revision: D22644750

fbshipit-source-id: f1b24c7e72819650517b7b42f93eeeed9c1e627b
Summary:
Cleaning up the test for switching to the shared RuntimeExecutor, and removing the jsContext arg from Fabric's Android APIs entirely.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D22026752

fbshipit-source-id: df70faa70eaa2a04717ae89e8ad3216dfd486a35
Summary:
bypass-lint
allow-large-files

Changelog: [Internal]

Reviewed By: dsainati1

Differential Revision: D22734783

fbshipit-source-id: e2f115153afb9c17a327bb87d3953903098871ba
Summary: For the JS TurboModule Codegen, we'll have to have `__turboModuleProxy` accept an additional argument: information containing what methods are supported on the TurboModule object. This diff makes calling `__turboModuleProxy` with two arguments valid.

Reviewed By: shergin

Differential Revision: D22743294

fbshipit-source-id: fd0050fc0373b43dc7089695c8e341137cad21f1
Summary:
In the current Fabric model, we compute layout during the commit phase on the caller thread synchronously. Even though, in general, it's by design the correct way to do it, there are cases where it's *not* a requirement. In such cases, it's more optimal to yield early and continue execution of the commit process on a different thread asynchronously.
One of such cases potentially is `completeRoot` call. There we don't need to return anything and can resume JavaScript execution immediately.
The performance implications of that are not clear but there is a hope that it can free up to ~100ms of JavaScript execution time which is currently spent waiting for layout calculation (and other aspects of the commit phase).

This is an implementation in the core. The plan is to test that on iOS first and then, in case if the results of the experiment are positive, to implement it on Android as well.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D22743723

fbshipit-source-id: 846a13152c5a419de0eaef0e6283ea4277c907dc
Summary:
This is an implementation of `BackgroundExecutor` on iOS.
In case if the experiment is successful, we will make it mandatory for all platforms.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D22743722

fbshipit-source-id: 7756d2947e962720b9970d48c74929ab407c0440
Summary:
For debugging, add prettyPrint method to AnimatedNode classes.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D22752292

fbshipit-source-id: ce1f08fc4fd97f38629dd82151c6ea762026c7c9
…n instead of crashing

Summary:
Due to subtle differences in lifecycle on the native side, as well as in JS, Fabric constructs partial graphs more frequently than non-Fabric RN did.

We still crash if we detect a cycle, which we check for more explicitly now; and we still always crash in non-Fabric. But if we detect a partial graph in Fabric,
we warn instead of crashing. We also print the state of the graph before crashing/warning, to assist in debugging in production.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D22752291

fbshipit-source-id: f452892678fbe7b5a49f93644d39d3b6ae5bda75
Summary:
In W3C standard, `zIndex` prop can have `auto` value which is the default.
In classic React Native and in Fabric before this diff, the default value was `0`. The only difference between `auto` and `0` is that nodes with `auto` do not form stacking context whereas nodes with `0` (or any other numeric value) do. This worked fine in pre-Fabric RN where every view always formed staking context but in Fabric we need to finally implement it right.

https://developer.mozilla.org/en-US/docs/Web/CSS/z-index
https://stackoverflow.com/a/57892072/496389

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D22403383

fbshipit-source-id: 6532d180a00f22bde763e3ebadd6683b344a0672
RSNara and others added 25 commits July 31, 2020 12:49
Summary:
This instruments the following marker:
- MODULE_CREATE

**Note:** This marker isn't necessary to test the JS TurboModule codegen, since the JS codegen should only affect the C++ portion of the TurboModule infra. However, I implemented this while I was in this area of the code, for completeness.

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D22679888

fbshipit-source-id: aa04822bd5a7c889813fcd13ca23c0b7a1d8444a
…-codegen

Summary:
This babel plugin will also take care of the JS TurboModule Codegen. Therefore, we should rename this into something more generic.

Changelog:
[General][Changed] Rename babel-plugin-inline-view-configs to react-native/babel-plugin-codegen

Reviewed By: rickhanlonii, cpojer

Differential Revision: D22803209

fbshipit-source-id: 416c97fea6fa0820d25bbc91033a0cbbbbbff825
Summary:
This diff updates the minsdkversion of RN OSS template to API level 19

changelog: [Android][Deprecated] Deprecate support of Android API levels 16 to 18. The new minSDK version will be 19+ moving forward

Reviewed By: JoshuaGross

Differential Revision: D22874852

fbshipit-source-id: 1df98e422dc9debd40ab2021aafc7b165312d14b
Summary:
This diff moves fabric C++ code from ReactCommon/fabric to ReactCommon/react/renderer
As part of this diff I also refactored components, codegen and callsites on CatalystApp, FB4A and venice

Script: P137350694

changelog: [internal] internal refactor

Reviewed By: fkgozali

Differential Revision: D22852139

fbshipit-source-id: f85310ba858b6afd81abfd9cbe6d70b28eca7415
Summary:
Unfortunately, the new codegen doesn't allow us to import types from other files. Therefore, I've inlined the interface specification of NativeAnimatedModule into NativeAnimatedTurboModule.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D22858790

fbshipit-source-id: 759bb960240afaba6b70c2730c3359b7e8c46c83
Summary:
This diff:
- Moves the NativeModule flow types to the bottom of `CodegenSchema.js`.
- Re-organizes the NativeModuel flow type declarations based on when they're first used. Essentially, we start off by declaring a giant 'NativeModuleShape' type, which uses smaller undeclared types. Then we declare all the undeclared children of `NativeModuleShape`, and on and on. This way, you know where to start reading the types, and you can easily tell how every type relates to every other type.

Changelog: [Internal]

Differential Revision: D22828840

fbshipit-source-id: 5b4b9466a41b9bcb92a1de159bcbc12e4dc01df3
Summary:
If `__turboModuleProxy` is called with a second argument, we'll now forward that `jsi::Value` to TurboModuleManager on iOS and Android, so that the TurboModuleManager can eventually use this `jsi::Value` to read data required to perform method invocation on the TurboModule object.

**Note:** This diff is basically a no-op right now.

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D22828838

fbshipit-source-id: 19db2adcae6a58b4885fcd11bef23f9d5882bfce
Summary:
`babel-plugin-codegen` will run the NativeModules codegen on each NativeModule spec, and inline the generated schema into the spec's `TurboModuleRegistry.get(Enforcing)?` call. This diff will forward that schema to `__turboModuleProxy` function (i.e: the TurboModule C++ infra).

**Note:** Both this and D2280384 can't be landed until D22743294 (facebook@650c0f6) hits production (1-2 weeks).

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D22832730

fbshipit-source-id: aecaf9943f9b01be805ff6b90249a6cbc6abdd20
Summary:
Sometimes mobile build systems just needs to provide the JS root dir to scan for NativeModules + NativeComponents, so let's support that directly in the CLI. This way, each build system doesn't have to do its own grep/crawling/filtering of files.

This will be needed for CocoaPods/Gradle integration.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D22850011

fbshipit-source-id: fe202fa5e5a490af6d76fd10e761c9c3805fc11f
Summary:
* Allow generate-native-modules-specs-cli.js to generate Android specific files
* Add stub impl for Java spec generation (the output are still incomplete, see the next diffs for missing impl + tests)
* Adjust the CLI to only produce modules stuffs, there's no need to produce components code

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D22860936

fbshipit-source-id: 38aae390189f143f6c6216995437ac1ff15a1788
Summary:
This builds on the previous commit and complete all current NativeModule spec support for React Native Android:
* method param (nullable) typing
* promise return support
* sync method
* getConstants() special Android runtime validation

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D22862422

fbshipit-source-id: abc6d46fb8ce5863677910de1acc8bb6a927e7da
Summary:
Introduced `architecture.gradle` that sets up pluggable build-time codegen steps for Gradle so that:
* Libraries, including core ReactAndroid, can produce the new architecture codegen (NativeModule **Java** specs in this diff) during build time
* Hosting app (e.g. RNTester) can produce its own set of codegen specs separately

**Please note that this is still work in progress, hence app templates have not been updated to use it yet.**

In order to activate this setup, the env variable `USE_CODEGEN=1` must be set. Eventually, this var will be removed from the logic.

With this change, RNTester:
* Will see all the generated specs populated in the Gradle build dir, which should be equivalent to the currently [**checked in version**](https://github.com/facebook/react-native/tree/master/ReactAndroid/src/main/java/com/facebook/fbreact/specs).
* The specs will compile, but **have not been validated** vs the existing NativeModule .java classes through out the core -- that will be the next step
* The specs are under `com.facebook.fbreact.specs.beta` namespace, which will be configurable in the future. `.beta` is added to avoid conflict with the existing files in the repo.

### Is this all we need to enable TurboModule in Android?
No. There are a few more pieces needed:
* C++ codegen output for JNI layer for each NativeModule spec
* The C++ module lookup for TurboModule Manager
* The JNI build setup in Gradle for these C++ output
* Toggle to enable TurboModule system in the entire app

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D22838581

fbshipit-source-id: d972e2fbb37bdbd3354e72b014fc8bb27a33b9ac
Summary:
It is now required to call RCTBridge.setRCTTurboModuleRegistry for turbo modules to work properly on iOS.

## Changelog

[Internal] [Fix] - Fix RNTester TurboModules loading

Pull Request resolved: facebook#29538

Test Plan: Tested that images in RNTester now loads properly and Redbox module missing warning are gone.

Reviewed By: JoshuaGross

Differential Revision: D22884163

Pulled By: fkgozali

fbshipit-source-id: daf2fccdb518ec4a382b80b7f7b02004405a7564
This allows us to merge in 0b68f3c and
a4757d2, thereby resolving microsoft#822.
@amgleitman amgleitman requested a review from alloy as a code owner September 2, 2021 20:01
@Saadnajmi
Copy link
Collaborator

Something interesting I noticed that I wanted to call out for future reference:
This PR contains this change (amgleitman@ab56ed7) which creates a new package "@react-native/normalize-color" which looks pretty useful... and maybe we need to add tests later for macOS specific platform colors

@amgleitman amgleitman merged commit 777bcaf into microsoft:master Sep 3, 2021
@amgleitman amgleitman deleted the amgleitman/0.64-merge-2020-07-31 branch September 3, 2021 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to update eslint due to resulting configuration errors