Skip to content

[pull] master from microsoft:master #12

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

Merged
merged 165 commits into from
Oct 21, 2021
Merged

Conversation

pull[bot]
Copy link

@pull pull bot commented Oct 15, 2021

See Commits and Changes for more details.


Created by pull[bot]

Can you help keep this open source service alive? 💖 Please sponsor : )

hramos and others added 30 commits October 15, 2020 06:16
Summary:
The codegen output for the native modules in `Libraries/` has been verified to work with RNTester.
Publishing a new version as a prerequisite to start using the codegen at build time in open source.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D24314972

fbshipit-source-id: edd0066c1cf33ba8e536cc5f145c057ca992eec1
Summary:
This NativeModule is actualy not used! Removing this now.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D24324362

fbshipit-source-id: 1322c5e072961f1c6c54bfc6dbd562d42f9e5b3f
Summary:
The iOS and Android NativeModules are very different. It's better to split the two interfaces, than to have one merged interface.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D24324247

fbshipit-source-id: 097273829ffc719eff006ed2dde55f0dd6bd7d95
…SQLiteDBStorage

Summary:
Although the interface for both NativeModules is the same, we'd like to enforce 1 `TurboModuleRegistry.get` call per NativeModule spec file. Therefore this diff splits the one spec into two.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D24325260

fbshipit-source-id: f18718e4235b7b8ccbfc44a7e48571ecf483a36c
Summary:
Changelog: [internal]

Fabric uses view commands instead of setNativeProps. This diff removes what's left of setNativeProps from the core.

Reviewed By: JoshuaGross

Differential Revision: D24309999

fbshipit-source-id: 70e54f0a984f8c36f77ba2cd59f59fc6923bc832
Summary:
RCTSurfaceTouchHandler is not a thread-safe object and must be used (and initialized) on the main thread. Therefore we need to move the initialization to `view` method which is guaranteed to be called on the main thread.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D24290776

fbshipit-source-id: fc1f2f157599aff6fca053451f89bf7cca3c812a
Summary:
We will need it soon.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D24290775

fbshipit-source-id: a312e537a3c3954e709a10c8792b3462b574054a
Summary:
In D24324247 (facebook@56c363e), I split NativeLinking into NativeLinkingManager and NativeIntentAndroid. There was this line in NativeLinking.js, that I didn't migrate correctly:

```
export default ((Platform.OS === 'android'
  ? TurboModuleRegistry.getEnforcing<Spec>('IntentAndroid')
  : TurboModuleRegistry.getEnforcing<Spec>('LinkingManager')): Spec);
```

I separated this conditional statement into two others:
```
export default TurboModuleRegistry.getEnforcing<Spec>('IntentAndroid');
export default TurboModuleRegistry.getEnforcing<Spec>('LinkingManager');
```

The problem here is that now on iOS, we're hard requiring IntentAndroid, and on Android, we're hard requiring LinkingManager. Understandably, this started throwing errors in our e2e infra. This diff fixes this problem by:
1. Changing the relevant `getEnforcing` calls into `get` calls.
2. Wrapping all usages of NativeIntentAndroid, and NativeLinkingManager, which are already guarded by `Platform.OS` checks, by a nullthrows. This should satisfy flow. **Note:** NativeIntentAndroid is only used on Android, where it must be available. Similarly, NativeLinkingManager is only used on iOS, where it must be available.

Changelog: [Internal]

build-break
overriding_review_checks_triggers_an_audit_and_retroactive_review

Oncall Short Name: fbandroid_sheriff

Differential Revision: D24338558

fbshipit-source-id: b0d22cba77e67837834269deaa317dc73d2457dc
Summary:
changelog: [internal]

Prevents 2 type converions:
1. int <-> size_t
2. int <-> int32_t

# Why is using size_t better when working with indexes.

## 1. Type conversion isn't for free.

Take this example

```
size_t calculate(int number) {
  return number + 1;
}
```

It generates following assembly (generated with armv8-a clang 10.0.0):

```
calculate(int):                          // calculate(int)
sub     sp, sp, #16                     // =16
str     w0, [sp, #12]
ldr     w8, [sp, #12]
add     w9, w8, #1                      // =1
mov     w8, w9
sxtw    x0, w8
add     sp, sp, #16                     // =16
ret
```

That's 9 instructions.

If we get rid of type conversion:

```
size_t calculate(size_t number) {
  return number + 1;
}
```

Assembly (generated with armv8-a clang 10.0.0):

```
calculate(unsigned long):                          // calculate(unsigned long)
sub     sp, sp, #16             // =16
str     x0, [sp, #8]
ldr     x8, [sp, #8]
add     x0, x8, #1              // =1
add     sp, sp, #16             // =16
ret
```

Compiler now produces only 7 instructions.

## Semantics

When using int for indexing, the type doesn't say much. By using `size_t`, just by looking at the type, it gives the reader more information about where it is coming from.

Reviewed By: JoshuaGross

Differential Revision: D24332248

fbshipit-source-id: 87ef982829ec14906ed9e002ea2e875fda4a0cd8
Summary:
NOTE: Flow and Jest won't pass on this diff. Sandcastle, should, however, be green on D24236405 (i.e: the tip of this stack).

## Description
The Codegen deals with "Modules". Hence:
```
type SchemaType = {
  modules: {
    [moduleName]: ...
  }
};
```

Each "Module" has a name, and represents a file. The `moduleName` is the base name of the file. This file can contain a component specification or a NativeModule specification. Hence:

```
type SchemaType = {
  modules: {
    [moduleName]: ComponentSchema | NativeModuleSchema
  }
};
```

The `ComponentSchema` can contain specifications for many different components. Hence:

```
type ComponentSchema = {
  type: 'Component'
  components: {
    [componentName]: ComponentShape
  }
}
```

The `NativeModuleSchema` contains
1. Type aliases (no surprises/nothing new).
2. One Flow interface that extends `TurboModule`.
3. Potentially many different NativeModule requires (for now) via `TurboModuleRegistry.get(Enforcing)?<specName>('moduleName')`.

Hence, the shape looks like:
```
type NativeModuleSchema = {
  type: 'NativeModule',
  aliases: NativeModuleAliasMap, // nothing new
  spec: NativeModuleSpec,
  moduleNames: $ReadOnlyArray<string>
}

type NativeModuleSpec = {
  properties: $ReadOnlyArray<...>,
}
```

## Major Notes
1. We now parse the NativeModule requires (TurboModuleRegistry.get(Enforcing)?<Spec> calls) and record them in the schema.
2. A Codegen "Module" can contain either a Component schema, or a NativeModule schema, but **not** both.

## Snapshot Updates
The changes to the schema are visible in the snapshots updated in D24236505.

Changelog: [Internal]

(Note: this ignores all push blocking failures!)

Reviewed By: fkgozali

Differential Revision: D24236510

fbshipit-source-id: bd344d67136418725d840e7332fd2f6957326bb4
Summary:
NOTE: Flow and Jest won't pass on this diff. Sandcastle, should, however, be green on D24236405 (i.e: the tip of this stack).

## Changes
1. Update the RN Codegen Component Parser
2. Update all RN Codegen Component Parser snapshots.

Changelog: [Internal]

(Note: this ignores all push blocking failures!)

Reviewed By: PeteTheHeat

Differential Revision: D24236503

fbshipit-source-id: 975d97dd29bb5ca08e5de96e7814290c3dc4357b
Summary:
NOTE: Flow and Jest won't pass on this diff. Sandcastle, should, however, be green on D24236405 (i.e: the tip of this stack).

## Changes
1. Update the RN Codegen Module Parser
2. Update all RN Codegen Module Parser Jest tests & snapshots.

Changelog: [Internal]

(Note: this ignores all push blocking failures!)

Reviewed By: PeteTheHeat

Differential Revision: D24236505

fbshipit-source-id: e24a39b4837c75a90fb4c957c56dfcf789511cc9
Summary:
NOTE: Flow and Jest won't pass on this diff. Sandcastle, should, however, be green on D24236405 (i.e: the tip of this stack).

Changelog: [Internal]

(Note: this ignores all push blocking failures!)

Reviewed By: PeteTheHeat

Differential Revision: D24236509

fbshipit-source-id: 1b603e8728d7be1e8bdede5878f57d6556b5c52f
Summary:
NOTE: Flow and Jest won't pass on this diff. Sandcastle, should, however, be green on D24236405 (i.e: the tip of this stack).

Changelog: [Internal]

(Note: this ignores all push blocking failures!)

Reviewed By: PeteTheHeat

Differential Revision: D24236502

fbshipit-source-id: 288c6d9588bde177732fe8165d3374eeacad999d
Summary:
NOTE: Flow and Jest won't pass on this diff. Sandcastle, should, however, be green on D24236405 (i.e: the tip of this stack).

Changelog: [Internal]

(Note: this ignores all push blocking failures!)

Reviewed By: PeteTheHeat

Differential Revision: D24236507

fbshipit-source-id: 2ffa0414db731a6ee844a2d1a5b07dc32bc763cb
Summary:
NOTE: Flow and Jest won't pass on this diff. Sandcastle, should, however, be green on D24236405 (i.e: the tip of this stack).

## Changes
Previously, the "Module" schema could either contain a `components` property, or a `nativeModules` property. The existence of the `components` property was used to determine (1) if the generators would run and (2) filter schemas on which the generators would run. Now, we simply check whether the type of the "Module" schema is `Component`.

Changelog: [Internal]

(Note: this ignores all push blocking failures!)

Reviewed By: PeteTheHeat

Differential Revision: D24236508

fbshipit-source-id: 68cb3f25178b6757c9a4aee767bb6173db4932a6
Summary:
NOTE: Flow and Jest won't pass on this diff. Sandcastle, should, however, be green on D24236405 (i.e: the tip of this stack).

Changelog: [Internal]

(Note: this ignores all push blocking failures!)

Reviewed By: PeteTheHeat

Differential Revision: D24236504

fbshipit-source-id: 0ca70101a855fb713fa15ed63849b138eb73dc6c
Summary:
NOTE: Flow and Jest won't pass on this diff. Sandcastle, should, however, be green on D24236405 (i.e: the tip of this stack).

## Changes
1. NativeModule generators now use the new RN Codegen NativeModule schema.
2. Tangential: We're no longer removing the `Native` prefix from the NativeModule filename, assuming that that's the module name (problem: wrong), and prefixing again with Native (problem: redundant), when we're generating code. Instead, like the internal codegen, we simply pass the filename to the Codegen output. Our linters enforce that all NativeModule specs are contained with files that start off with `Native`.
3. `GenerateModuleCpp` was fixed to use the actual module name as opposed to the spec name. I added a comment inline.

Changelog: [Internal]

(Note: this ignores all push blocking failures!)

Reviewed By: PeteTheHeat

Differential Revision: D24236405

fbshipit-source-id: ccd6b5674d252c350be0ec8a86e7ca5f2f614778
Summary:
Changelog: [Internal]

(Note: this ignores all push blocking failures!)

Reviewed By: fkgozali

Differential Revision: D24236813

fbshipit-source-id: 1fa573fade09914da673cd3750d78e4619ff4581
Summary:
Adding support to the pointData to Android React Native
Changelog: [internal]

Reviewed By: swillard13

Differential Revision: D24256346

fbshipit-source-id: b970f771047cff580d9ebe7d6e2ad737394d6416
Summary: Adding support for boolean annotation in UserFlow API.

Reviewed By: cdinh

Differential Revision: D24337853

fbshipit-source-id: 52ed295c64a5650afbb02890f918939fb9d020d6
Summary:
Changelog:
[General][Added] - Adds the Hermes runtime bytecode version number to the JS bundle requestURL. This allows Metro with Bytecode to work with prebuilt binaries.

Reviewed By: cpojer

Differential Revision: D24327852

fbshipit-source-id: e8ee8db4f9b01f0500ab9dd851b5818c4adf3303
Summary:
Fabric has a feature that preallocates views before mounting even need them. We never tested the impact of this feature thought. This diff adds a way to enable/disable it and run an experiment.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D24355612

fbshipit-source-id: fefd653e57232044cd7b28b160e12a4ef85dbb8b
Summary:
The manual lookup logic was needed before we properly parse the module names from the spec js files. This is no longer necessary after the commit stack starting with facebook@3a75b37

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D24370567

fbshipit-source-id: fc307d93cdda240a977e37dfe602502bd3f7c2a4
Summary:
Some existing NativeModules have either Android or IOS suffix to denote the exclusive intent for that platform. For now, note this in the codegen schema output, so that the generator can skip irrelevant modules. Long term, each Flow type for module Spec should denote the intended/excluded platforms directly.

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D24370568

fbshipit-source-id: 8f725bdb39107d73c1aba0689db7f47ed7c374b0
Summary:
If a native module schema has `excludedPlatforms` defined, honor it and skip the module that doesn't belong to the platform.

E.g. NativeImagePickerIOS shouldn't generate anything for Android codegen output.
Similarly, IntentAndroid shouldn't generate anything for iOS codegen output.

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D24373092

fbshipit-source-id: cfeb455a18c92f60191d988af2e9ce7ea5021304
Summary:
The NativeModules spec parser uses `moduleName` to refer to the name of the NativeModule spec. This is confusing, because the NativeModules spec also has a `moduleNames` array, which refers to names of the NativeModules that get required in the spec.

This diff renames `moduleName` to `hasteModuleName` within the NativeModule spec parser.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D24386279

fbshipit-source-id: 8e4eb8dfc647241bf2bdae54dc8d9ab0122f49f9
Summary: Changelog: [Internal]

Reviewed By: dsainati1

Differential Revision: D24364950

fbshipit-source-id: 42a81b155d803c3580cfac7d56c98f93a310d0fc
Summary:
#changelog: [internal]

When I built ThreadStorage I didn't know about existence of `thread_local` keyword. Because it achieves the same goal, using built in c++ features is preferred over building our own.

Reviewed By: JoshuaGross, shergin

Differential Revision: D24380680

fbshipit-source-id: e961fc34c6d3f085fc9b918b20bb4827de0d5624
Summary:
Fixed URL of ChainReactConf website on the ECOSYSTEM.md

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Internal] [Fixed] - Fix URL of ChainReactConf Website

Pull Request resolved: facebook#30199

Test Plan: URL leads to the ChainReactConf website

Reviewed By: makovkastar

Differential Revision: D24386708

Pulled By: cpojer

fbshipit-source-id: 27a48e84547ef3bc067845b3c302dd57decc34b2
shergin and others added 27 commits October 31, 2020 16:23
Summary:
Historically, `UIScrollView`s in React Native do not cancel touches started on `UIControl`-based views (as normal iOS `UIScrollView`s do).
This diff implements this behavior.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D24661106

fbshipit-source-id: 1fb98d62f9e1528f11e7699d460aaefcec534e97
Reviewed By: zertosh

Differential Revision: D24679750

fbshipit-source-id: 42d5a8aa40ec99be9a51a8e3eed54f2fc8e29e3a
Summary:
This PR makes it possible to build iOS applications with Hermes. Note that it doesn't work with `use_frameworks!` just yet.

Fixes facebook#27845 (by downgrading iOS deployment target for RCT-Folly to 9.0)
Fixes facebook#28810 (as above)

Checklist:
- [x] Adjust release scripts to create Hermes bytecode bundle
- [x] Release new Hermes npm package that includes iOS files (unreleased right now, if you want to try locally, you have to clone Hermes and `yarn link` its master to this project)
- [x] Test on a new React Native application in both Debug and Release (Device)
- [x] Test on an RNTester application in both Debug and Release (Device)
- [x] Add missing `i386` to Hermes framework and enable Bitcode
- [x] Inspect CI failures for possible regressions
- [x] Resolve Folly issue as reported facebook#27845 and facebook#28810
- [x] Release new Hermes and test against it that everything works

## Changelog

[IOS] [FEATURE] - Enable Hermes on iOS
[INTERNAL] - Upgrade to CocoaPods 1.10.0 to resolve Xcode 12.0 issues
[INTERNAL] - Upgrade to Xcode 12.0 on the CircleCI
[INTERNAL] - Fix building RNTester in Release mode
[INTERNAL] - Fix build-time errors of `libevent` with `use_frameworks!`
[INTERNAL] - Introduce `USE_HERMES` variable and test all RNTester configurations on the CI
[INTERNAL] - Do not fetch CocoaPods repository since we're using CDN anyway

Pull Request resolved: facebook#29914

Test Plan:
Turn on `hermes_enabled` to true in your `Podfile`, install pods, and run the iOS application. Your app should be running Hermes now.

Preview: (note "Engine: Hermes")

<img width="395" alt="Screenshot 2020-09-09 at 19 22 32" src="https://user-images.githubusercontent.com/2464966/92631584-d7c01d80-f2d1-11ea-9b40-33d73db96a53.png">

Reviewed By: hramos

Differential Revision: D24684845

Pulled By: cpojer

fbshipit-source-id: 900cbe3bf9398a6fd4a773d552899a001bf5146b
Summary:
Fix broken links in README by removing `.html` from any `reactnative.dev/docs`

## Changelog
General Fixed - Fixed broken links in README.md

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

Pull Request resolved: facebook#30286

Reviewed By: hramos

Differential Revision: D24673358

Pulled By: cpojer

fbshipit-source-id: 726a4742c3ae19dc51f2490619d04934f8aa861d
… animations without a final Mutation already queued up

Summary:
For some interrupted animations we will execute a "final" mutation associated with the animation, if it exists. For example, "UPDATE" animations always have a final Update animation associated with them.
Some, however, do not. For example: INSERT animations do not have a final mutation associated by default. In these cases (before this diff) if the animation from opacity 0 to 1 was interrupted, the View will
appear "stuck" at some intermediate opacity. To mitigate that, we generate a synthetic "final" mutation at 100% progress through the animation if it is interrupted.

Changelog: [Internal]

Reviewed By: fred2028

Differential Revision: D24691151

fbshipit-source-id: d9730b8a3493a5eeac4de325e7e0a7a64f73c8a0
Summary:
docker-android released v2 which reduced image size.

## Changelog

[Internal] [Changed] - bump docker-android to 2.1

Pull Request resolved: facebook#30296

Test Plan: test_android, test_docker is green

Reviewed By: fkgozali

Differential Revision: D24686168

Pulled By: hramos

fbshipit-source-id: c240848f10f473b38a0967dd681254c21f877277
We noticed that after applying d03c0f9,
`pod install` complains when we try to autogenerate FBReactNativeSpec.h
and FBReactNativeSpec-generated.mm because some of our TurboModule specs
aren't completely compatible with codegen. This commit fixes this issue,
updates FBReactNativeSpec files, and fixes any resulting compiler issues
in native macOS/iOS code.

Validated that ActionSheet, Alert, and Switch still work in RNTester
for both macOS and iOS.
* Remove deprecated/unused context param
* Update a few Mac deprecated APIs
* Ignore javadoc failure

* Bringing few more changes from 0.63-stable

* Fixing a patch in engine selection

* Fixing a patch in nuget spec

* Fixing the output directory of nuget pack

* Packaging dependencies in the nuget
* add pull yml

* match handleOpenURLNotification event payload with iOS (#755) (#2)

Co-authored-by: Ryan Linton <[email protected]>

* fix mouse evetns on pressable

* delete extra yml from this branch

* Add macOS tags

* reorder props to have onMouseEnter/onMouseLeave always be before onPress

Co-authored-by: pull[bot] <39814207+pull[bot]@users.noreply.github.com>
Co-authored-by: Ryan Linton <[email protected]>
Updates simple grammar issues.
Defensive changes to Mac RCTDisplayLink

Real-world data suggests crashes with this stack:
  CVDisplayLink::start()
  -[RCTDisplayLink updateJSDisplayLinkState] (RCTDisplayLink.m:157)
  -[RCTDisplayLink registerModuleForFrameUpdates:withModuleData:]_block_invoke (RCTDisplayLink.m:67)
  -[RCTTiming timerDidFire] (RCTTiming.mm:324)
  -[_RCTTimingProxy timerDidFire] (RCTTiming.mm:93)

Some symbols are missing in this stack, presumably due to compiler optimizations.
-updateJSDisplayLinkState is calling CVDisplayLinkStart as a result of a
call to "_jsDisplayLink.paused = NO".
-registerModuleForFrameUpdates block is presumably getting called via pauseCallback,
likely via [RCTTiming startTimers], presumably owned by RCTCxxBridge.

The most likely immediate explanation for the crash is that we are calling
CVDisplayLinkStart with a zombie _displayLink pointer.
However there is a lot of indirection here as well as thread-hopping, and
unfortunately no clearly incorrect code that would explain such a zombie pointer.

Some defensive changes:
-explicitly remove the association to pauseCallback when underlying display link object is invalidated.
-remove a prior attempt at additional check in updateJSDisplayLinkState itself as it is not relevant.
-make sure we explicitly set _displayLink to NULL when we release it, such that there is one less failure point.
This moves FBReactNativeSpec generation into Xcode's build process.
Although this made it in before 0.64.0, we're bringing it in now because
it keeps our CI for creating a new project from scratch intact.
…0449)

Summary:
Move the codegen invocation out of Podfiles and into the FBReactNativeSpec Pod itself. With this change, developers do not need to modify their existing project's Podfiles, and yet the codegen will be integrated into their projects automatically by way of the FBReactNativeSpec Pod.

This is accomplished in part by injecting a script build phase into the Pods Xcode project that is generated by CocoaPods. The build phase will save the output of the codegen script to a log in the derived files directory. The codegen will be executed if the codegen log file is not present, or if the contents of the Libraries directory has changed.

The codegen will thus be invoked in these situations:

**RNTester:**
* When `packages/rn-tester/RNTesterPods.xcworkspace` is built, if the codegen output logfile is not present or if the input files have changed.

**OSS React Native apps:**
* When `ios/AwesomeProject.xcworkspace` is built, if the codegen output file is not present or if the input files have changed. Normally, this should not happen, as we do not expect folks to update the contents of `node_modules/react-native/Libraries`.

Pull Request resolved: facebook#30449

Changelog: [Internal] - Moved codegen invocation out of Podfile and into FBReactNativeSpec Pod

Reviewed By: fkgozali

Differential Revision: D25138896

fbshipit-source-id: 4779f822459cea2c30fd544eee19a49e8d80153d
Summary:
The wrong value for the path to react-native-codegen was being used. The issue was introduced during the refactoring of this script for use in FBReactNativeSpec.podspec.

Changelog: [Internal]

Motivation:

Reviewed By: fkgozali

Differential Revision: D25290355

fbshipit-source-id: 5a46c680e7ea41157b03cf54a640a8816fb682b3
Summary:
Quick fix for Circle CI: Ensure FBReactNativeSpec dir exists before touching files.

Changelog:
[Internal]

Reviewed By: fkgozali

Differential Revision: D25285573

fbshipit-source-id: 8dec496856c90accc687648d7068aadfea24d72b
@pull pull bot added merge-conflict Resolve conflicts manually ⤵️ pull labels Oct 20, 2021
@Saadnajmi Saadnajmi merged commit 39bd488 into Saadnajmi:master Oct 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⤵️ pull merge-conflict Resolve conflicts manually
Projects
None yet
Development

Successfully merging this pull request may close these issues.