Граф коммитов

23680 Коммитов

Автор SHA1 Сообщение Дата
Tommy Nguyen 86491749ee ci: ignore bundle size reporter failures (#32490)
Summary:
CircleCI stopped populating `CIRCLE_PULL_REQUEST` without providing an
alternative, so now it's impossible to get the PR number unless it comes
from a forked repo.

## Changelog

[Internal] [Fixed] - ignore bundle size reporter failures

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

Test Plan: CI should ignore bundle size reporter failures.

Reviewed By: fkgozali

Differential Revision: D32008694

Pulled By: lunaleaps

fbshipit-source-id: 68e25ac2fbb23c1d7a55e667c90aec3a61302b8a
2021-11-03 12:10:31 -07:00
Andrei Shikov 5c045861b9 Copy touch objects before consuming them in new touch path
Summary:
Ensures that copy of the native touch objects happens before consuming them.

The reverse order seems accidental after refactor, as copying objects doesn't consume them whereas adding to a native array does. This behavior didn't show up during testing in dev environment (only affects CANCEL events), and it seems to be the cause of high-firing crash on production.

Changelog: [Internal] Copy touch objects before consuming them in the new touch path.

Reviewed By: mdvacca

Differential Revision: D32112036

fbshipit-source-id: e9ec47689b7ceb0a40a23bab9f03367c4acb8632
2021-11-03 12:08:39 -07:00
Andrei Shikov deb6fbd929 Check for double dispose when sending touch event
Summary:
Makes new touch processing path check for double dispose on touch events.

Old event dispatcher has a race condition which makes it double-dispose some events, so we need to make sure it also processes touches correctly.

Changelog: [Internal] Check for double dispose when sending touch event

Reviewed By: cortinico

Differential Revision: D32110250

fbshipit-source-id: d6a12cbac60f9ff5e836cfaca5a47c467bea06c7
2021-11-03 12:08:39 -07:00
Lucas Bento aa515450fe Fix issues with `-rc` version not being labeled properly (#32522)
Summary:
This PR bumps https://github.com/lucasbento/core-workflow-apply-version-label which fixes the issue with versions having `-rc` not working.

## Changelog

N/A.

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

Reviewed By: yungsters

Differential Revision: D32115258

Pulled By: lunaleaps

fbshipit-source-id: ece8400f223640f8b75141f0e3286888a72c996b
2021-11-03 12:01:42 -07:00
Ken Tominaga 9b059b6709 Remove iOS 11 availability check (#32488)
Summary:
This pull request aims to remove iOS 11 availability check which is no longer needed.

The minimum iOS deployment target for React Native is iOS 11 but we still have iOS 11 version check like below.

```
if (available(iOS 11.0, *)) {
```

This is a continuation pull request of https://github.com/facebook/react-native/pull/32151

## 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
-->

[iOS] [Changed] - Remove iOS 11 availability check

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

Reviewed By: yungsters

Differential Revision: D32006312

Pulled By: ryancat

fbshipit-source-id: 0ee6579e433a15d3d220a52d2ccd6931b0513971
2021-11-03 09:06:06 -07:00
Tim Yung b25d9e4123 Back out "Fix build of glog & Flipper-Glog on Apple Silicon"
Summary:
Reverts https://github.com/facebook/react-native/pull/32486 because this commit is suspected of breaking some internal CI.

Changelog:
[iOS][Changed] - Reverts "Apple Silicon builds of glog & Flipper-Glog"

Reviewed By: mendoncakeegan

Differential Revision: D32129681

fbshipit-source-id: e195009f2ab202cd4e30b978a1ca89dc388c9ddf
2021-11-02 23:27:31 -07:00
Tim Yung fba1ae1643 RN: Temporarily Disable Prettier for Some Files
Summary:
We are in the middle of a Prettier upgrade and some of the files which disagree between Prettier v1.x and v2.x are now being flagged by `eslint-plugin-prettier` as lint errors.

The correct fix here is probably to update `eslint-config-prettier` and `eslint-plugin-prettier`, but I am landing this first to unbreak CI.

Reviewed By: mendoncakeegan

Differential Revision: D32129458

fbshipit-source-id: a5206a5ef58f1d7614f9459c99b9e39109be6de9
2021-11-02 23:09:38 -07:00
Tim Yung 77ecc7ede1 JS: Format with Prettier v2.4.1 [3/n]
Summary:
Changelog:
[General][Internal]

Reviewed By: zertosh

Differential Revision: D31883447

fbshipit-source-id: cbbf85e4bf935096d242336f41bf0cc5d6f92359
2021-11-02 22:14:16 -07:00
Tim Yung 4e587a1b7d JS: Upgrade to Prettier v2.4.1 [1/n]
Summary:
Changelog:
[General][Changed] - Upgraded to `prettier@^2.4.1`.

Reviewed By: zertosh

Differential Revision: D31854010

fbshipit-source-id: 6d7a2e758a3ddf7c758ceffb14d98eb93b0ce4b0
2021-11-02 22:14:16 -07:00
Ramanpreet Nara 27ddbd8137 Refactor: Simplify deprecated component code-gen logic in View Config generator
Summary:
**Motivation:** Readability. It was hard to tell how componentName, paperComponentName, and paperComponentNameDepreacted produced the NativeComponentRegistry.get call.

Changelog: [Internal]

Reviewed By: philIip

Differential Revision: D32108276

fbshipit-source-id: ea7c9fe4dc50cdd6fec94b5cd25f7bbcfb451ef6
2021-11-02 21:27:36 -07:00
rayzr522 25d4cb98b0 Fix build of glog & Flipper-Glog on Apple Silicon (#32486)
Summary:
This is a fixed version of the https://github.com/facebook/react-native/issues/32380 PR. It solves a typo, prevents variable substitution in the patch file, and moves it to a better place in the script so that CURRENT_ARCH is actually detected before checking whether to patch.

The `config.sub` included in glog is too old and does not recognize `arm64-*` as a valid arch when building. This, combined with an out of date Flipper-Glog version, results in persistent build failures on Apple Silicon machines.

p.s. i assume all the podfile lock changes were caused by me running this on an Apple Silicon Mac, and thus all the pod checksums were run against the arm64 versions of those pods rather than the normal x86_64 versions. if this is an issue I can revert the changes to that file, but it would seem to be an inevitable issue in future PR diffs...

## Changelog

- [iOS] [Fixed] - Apple Silicon builds of glog & Flipper-Glog

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

Test Plan:
- Clone this branch on both an Apple Silicon- & Intel-based Mac
- Run `pod install` in `packages/rn-tester`
- Confirm that build passes successfully

Reviewed By: cortinico

Differential Revision: D32080994

Pulled By: yungsters

fbshipit-source-id: 76a7c5bba20d91905455920609c890e92bb5b980
2021-11-02 17:35:33 -07:00
Paige Sun 6fd3bc2175 Fix Gemstone Profile Swiping Animations by fixing Animated.Value for Animated.event
Reviewed By: RSNara

Differential Revision: D32037021

fbshipit-source-id: 41da68706e6c752bf480d11112f70692f7234756
2021-11-02 17:32:03 -07:00
Nicola Corti 8fef52035b Bump codegen to 0.0.10
Summary:
For the sake of the playbook, I'm bumping the codegen to the latest stable.
This is needed as there was a change in the Android NDK Makefile that wasn't shipped yet.

Changelog:
[Internal] [Changed] - Bump codegen to 0.0.10

Reviewed By: hramos

Differential Revision: D32101355

fbshipit-source-id: c20268f1ea93ebad8f92f760874a43c8ceeaf9f9
2021-11-02 12:22:17 -07:00
Andrei Shikov e161598c40 React Native sync for revisions afcb9cd...3fcd81d
Summary:
This sync includes the following changes:
- **[5cccacd13](https://github.com/facebook/react/commit/5cccacd13 )**: Upgrade useId to alpha channel ([#22674](https://github.com/facebook/react/pull/22674)) //<Andrew Clark>//
- **[75f3ddebf](https://github.com/facebook/react/commit/75f3ddebf )**: Remove experimental useOpaqueIdentifier API ([#22672](https://github.com/facebook/react/pull/22672)) //<Andrew Clark>//
- **[8c4a05b8f](https://github.com/facebook/react/commit/8c4a05b8f )**: Remove flow pragma comment from module registration start/stop templates ([#22670](https://github.com/facebook/react/pull/22670)) //<Brian Vaughn>//
- **[ebf9ae857](https://github.com/facebook/react/commit/ebf9ae857 )**: useId ([#22644](https://github.com/facebook/react/pull/22644)) //<Andrew Clark>//
- **[a0d991fe6](https://github.com/facebook/react/commit/a0d991fe6 )**: Re-land #22292 (remove uMS from open source build) ([#22664](https://github.com/facebook/react/pull/22664)) //<Andrew Clark>//
- **[6bce0355c](https://github.com/facebook/react/commit/6bce0355c )**: Upgrade useSyncExternalStore to alpha channel ([#22662](https://github.com/facebook/react/pull/22662)) //<Andrew Clark>//
- **[7034408ff](https://github.com/facebook/react/commit/7034408ff )**: Follow-up improvements to error code extraction infra ([#22516](https://github.com/facebook/react/pull/22516)) //<Andrew Clark>//
- **[90e5d3638](https://github.com/facebook/react/commit/90e5d3638 )**: chore: fix comment typo ([#22615](https://github.com/facebook/react/pull/22615)) //<btea>//
- **[3c4c1c470](https://github.com/facebook/react/commit/3c4c1c470 )**: Remove warning for dangling passive effects ([#22609](https://github.com/facebook/react/pull/22609)) //<Andrew Clark>//
- **[d5b6b4b86](https://github.com/facebook/react/commit/d5b6b4b86 )**: Expand act warning to cover all APIs that might schedule React work ([#22607](https://github.com/facebook/react/pull/22607)) //<Andrew Clark>//
- **[fa9bea0c4](https://github.com/facebook/react/commit/fa9bea0c4 )**: Initial implementation of cache cleanup ([#22510](https://github.com/facebook/react/pull/22510)) //<Joseph Savona>//
- **[0e8a5aff3](https://github.com/facebook/react/commit/0e8a5aff3 )**: Scheduling Profiler: Add marks for component effects (mount and unmount) ([#22578](https://github.com/facebook/react/pull/22578)) //<Brian Vaughn>//
- **[4ba20579d](https://github.com/facebook/react/commit/4ba20579d )**: Scheduling Profiler: De-emphasize React internal frames ([#22588](https://github.com/facebook/react/pull/22588)) //<Brian Vaughn>//
- **[cdb8a1d19](https://github.com/facebook/react/commit/cdb8a1d19 )**: [Fizz] Add option to inject bootstrapping script tags after the shell is injected ([#22594](https://github.com/facebook/react/pull/22594)) //<Sebastian Markbåge>//
- **[34e4c9756](https://github.com/facebook/react/commit/34e4c9756 )**: Clear extra nodes if there's a hydration mismatch within a suspense boundary  ([#22592](https://github.com/facebook/react/pull/22592)) //<Sebastian Markbåge>//
- **[02f411578](https://github.com/facebook/react/commit/02f411578 )**: Upgrade useInsertionEffect to stable ([#22589](https://github.com/facebook/react/pull/22589)) //<Andrew Clark>//
- **[2af4a7933](https://github.com/facebook/react/commit/2af4a7933 )**: Hydrate using SuspenseComponent as the parent ([#22582](https://github.com/facebook/react/pull/22582)) //<Sebastian Markbåge>//
- **[b1acff0cc](https://github.com/facebook/react/commit/b1acff0cc )**: Enable cache in test renderer ([#22580](https://github.com/facebook/react/pull/22580)) //<Joseph Savona>//
- **[996da67b2](https://github.com/facebook/react/commit/996da67b2 )**: Replace global `jest` heuristic with `IS_REACT_ACT_ENVIRONMENT` ([#22562](https://github.com/facebook/react/pull/22562)) //<Andrew Clark>//
- **[163e81c1f](https://github.com/facebook/react/commit/163e81c1f )**: Support disabling spurious act warnings with a global environment flag ([#22561](https://github.com/facebook/react/pull/22561)) //<Andrew Clark>//
- **[23b7dfeff](https://github.com/facebook/react/commit/23b7dfeff )**: Enable scheduling profiler for RN FB profiling builds ([#22566](https://github.com/facebook/react/pull/22566)) //<Brian Vaughn>//
- **[61455a25b](https://github.com/facebook/react/commit/61455a25b )**: Enable experimental Cache API in www TestRenderer ([#22554](https://github.com/facebook/react/pull/22554)) //<Joseph Savona>//
- **[7142d110b](https://github.com/facebook/react/commit/7142d110b )**: Bugfix: Nested useOpaqueIdentifier references ([#22553](https://github.com/facebook/react/pull/22553)) //<Andrew Clark>//
- **[1e247ff89](https://github.com/facebook/react/commit/1e247ff89 )**: Enabled scheduling profiler marks for React Native FB target ([#22544](https://github.com/facebook/react/pull/22544)) //<Brian Vaughn>//
- **[c16b005f2](https://github.com/facebook/react/commit/c16b005f2 )**: Update test and stack frame code to support newer V8 stack formats ([#22477](https://github.com/facebook/react/pull/22477)) //<Brian Vaughn>//
- **[55d75005b](https://github.com/facebook/react/commit/55d75005b )**: duplicate value in variable ([#22390](https://github.com/facebook/react/pull/22390)) //<BIKI DAS>//

Changelog:
[General][Changed] - React Native sync for revisions afcb9cd...3fcd81d

jest_e2e[run_all_tests]

Reviewed By: yungsters

Differential Revision: D32065987

fbshipit-source-id: ef2d402835c981aab68ca40a894c66c1630864e9
2021-11-02 12:06:32 -07:00
Lorenzo Sciandra 38381c8a2e add release changelog back to core repo (#32520)
Summary:
As agreed, we are moving back the changelog from the RNC repo into the core one. This PR does just that.

It will be followed up by a new draft PR for the 0.67 release ([old one](https://github.com/react-native-community/releases/pull/255)).

Once this is merged, a few links will need to be fixed, such as:
* https://github.com/facebook/react-native/wiki/Changelog
* https://github.com/facebook/react-native/releases (for new releases)

Moreover, we should have a conversation about how changes are reported for the "monorepo" part of this repo: https://github.com/facebook/react-native/tree/main/packages as far as I can see, the changes to those packages are not documented anywhere.

## Changelog

[Internal] [Added] - Adding Changelog.md back into main repo

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

Test Plan: N/A

Reviewed By: lunaleaps

Differential Revision: D32102055

Pulled By: cortinico

fbshipit-source-id: 6d1f353bb6acdc952e40941510ca36200690bbf8
2021-11-02 10:57:32 -07:00
Ramanpreet Nara 857137dc21 Create E2E tests for Component Generators
Summary:
## Rationale
- We actually don't have E2E tests that test the parser + generator together, until now.
- **Documentation Value:** These tests show how the Component Spec files in [react-native-codegen/e2e/__test_fixtures__/](https://www.internalfb.com/code/fbsource/[e32a790dfa05]/xplat/js/react-native-github/packages/react-native-codegen/e2e/__test_fixtures__/components/) map to all the different types of codegen output.

Changelog: [Internal]

Reviewed By: sshic

Differential Revision: D32081445

fbshipit-source-id: 02cd17945ef63a42381d6d4adbd0a9b0eaa2a1ef
2021-11-02 10:54:11 -07:00
Nicola Corti cfacfe8b6c Bump gradle-plugin to 0.0.3
Summary:
For the sake of the playbook, I'm bumping the Gradle Plugin to the latest stable.
Specifically a change in how CLI args are parsed (D31908041 (70785e3d5a)) was not backward compatible,
therefore we need to migrate users to the new version.

Changelog:
[Internal] [Changed] - Bump gradle-plugin to 0.0.3

Reviewed By: hramos

Differential Revision: D32101577

fbshipit-source-id: 9a29b988a4b520a8ece10a90a9a4bedc02ec16ad
2021-11-02 10:39:25 -07:00
Lucas Bento 60352a9549 Add workflow to create version labels on new releases (#32508)
Summary:
This PR adds the following GitHub actions:

- https://github.com/lucasbento/core-workflow-create-version-label - Create version labels (such as `Version: 0.65.1`) whenever there's a new release;
- https://github.com/lucasbento/core-workflow-apply-version-label - Apply a version label to opened/edited issues based on the version mentioned on the issue body.

## Changelog

N/A.

## Few things to keep in mind

- A label named "Version: unspecified" must be created;
- The GitHub action to create labels will only run when there's a new release or if one is edited, it will then create all the other labels bases on the previous releases until it encounters one that already exists.

 ---

Example of issue with version label: https://github.com/lucasbento/test-issue-forms/issues/4

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

Reviewed By: cortinico

Differential Revision: D32055682

Pulled By: lunaleaps

fbshipit-source-id: 04d3e942eb1f71b3bc1d5a643b0156c35ef5f00b
2021-11-01 11:41:19 -07:00
Juan Tejada 18f62544c6 Update React Devtools v4.21.0
Summary:
Update `react-devtools-core` and `react-devtools` dependencies for RN, VSCode, Flippe, etc.

`js1 upgrade react-devtools -v 4.21.0`

# Changelog:

[General][Changed] - Upgraded react-devtools-core dependency to 4.21.0

Reviewed By: bvaughn

Differential Revision: D32065685

fbshipit-source-id: 30d0cca2bec6e9abe384da2afefab1d241e0523f
2021-11-01 10:46:06 -07:00
Ramanpreet Nara 3848f48943 Use JavaScript functions for Component templates
Summary:
## Rationale
**Disclaimer**: This is an incremental step towards more maintainable/readable react-native-codegen generators. In the future, we may want to replace these templates/string concat logic with *something better*. But until we decide what that *something better* is, let's at least get rid of all this gross string find/replace.

Benefits of using Function templates over String.prototype.replace.
- **Self-documenting**: Template Functions enumerate/describe their exact data dependencies in their signature. You no longer have to read the template implementation to see what data you need to pass into the template.
- **Improved Readability**: JavaScript syntax highlighting makes it really easy to see where/how the data is inserted into the templates. Also template variables used be prefixed/suffixed with ::, which made things really confusing in C++ code (e.g: wtf is `::_CLASSNAME_::EventEmitter::::_EVENT_NAME_::`?).
- **Simpler Interpolation**: Don't have to worry about .replaceAll vs .replace, or calling these replace functions with regexes or strings.
- **Template Type-safety**: Ensure that the correct data types are passed to the component templates (e.g: flow will complain if you accidentally pass null/undefined when a template expects a string).
- **Template Type-safety**: Ensure that we don't pass in extra data to templates (this diff catches/fixes instances of this error). Ensure that we don't forget to pass in data to the template.
- etc.

After this diff, both our Component and NativeModule generators will be using template functions. This string find/replace exists no more in react-native-codegen.

This is also a very surface-level change. I made no efforts to simplify these templates. Let's take a look at that later, as necessary.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D32021441

fbshipit-source-id: f8f27069bcbf9d66dcafb7d1411da1f938eb6dcd
2021-11-01 09:00:24 -07:00
Nicola Corti b0711f1d35 Update ReactAndroid to use the AGP NDK Apis (#32443)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/32443

This diff removes all the custom Gradle machinery to build the native code and delegates to AGP
the triggering of the `ndk-build` command. This means that the native build will be now invoked
with the `:ReactAndroid:externalNativeBuild<Variant>` task.

An important thing to notice is that that task will always run, and will delegate to Make the
compilation avoidance. If you invoke the task twice, the second time it will be significantly faster.
On my machine this takes ~6/7 mins the first time, and 30 seconds the second time.

There are some gotchas that are worth noting:
* The native build will run on every build now. Given the complexity of our native build graph,
even with an up-to-date build, Make will still take ~30 seconds on my machine to analyse all the
targets and mention that there is no work to be done. I believe this could be impactful for local
development experience. The mitigation I found was to apply an `abiFilter` to build only the ABI
of the target device (e.g. arm64 for a real device and so on).
This reduces the native build to ~10 seconds.
* All the change to the `react-native-gradle-plugin` source will cause the Gradle tasks to be
considered invalid. Therefore they will re-extract the header files inside the folders that are
used by Make to compile, triggering a near-full rebuild. This can be a bit painful when building
 locally, if you plan to edit react-native-gradle-plugin and relaunch
 rn-tester (seems to be like an edge case scenario but worth pointing out). The mitigation here
 would be to invoke the tasks like

```
gw :packages:rn-tester:android:app:installHermesDebug -x prepareBoost -x prepareLibevent -x prepareGlog \
   -x prepareJSC -x extractNativeDependencies -x generateCodegenArtifactsFromSchema \
   -x generateCodegenSchemaFromJavaScript
```

Changelog:
[Internal] [Changed] - Refactor Extract Headers and JNI from AARs to an internal task

Reviewed By: ShikaSD

Differential Revision: D31683721

fbshipit-source-id: fa85793c567796f4e04751e10503717a88cb0620
2021-11-01 05:59:15 -07:00
George Zahariev 6790cf137f Change usages of `exports.foo` and `module.exports.foo` to just `foo`
Summary:
Change usages of `exports.foo` and `module.exports.foo` to just `foo`.

This will fix future errors when Flow no longer allows reads from `exports`/`module.exports`.

Changelog: [Internal]

Reviewed By: bradzacher

Differential Revision: D32009490

fbshipit-source-id: bb609b37ba948b44c3877f8dbbfa9137b963586b
2021-10-29 20:09:13 -07:00
Marshall Roch d150529656 Deploy 0.163.0 to xplat
Summary: Changelog: [Internal]

Reviewed By: evanyeung

Differential Revision: D32025457

fbshipit-source-id: f2c08e4baa9a39731ab970b917d2c67c852e9603
2021-10-29 19:06:23 -07:00
grgr-dkrk c8b83d4e0b feat: add `isAccessibilityServiceEnabled` (#31396)
Summary:
fix https://github.com/facebook/react-native/issues/30863

This PR adds `isAccessibilityServiceEnabled` to get if accessibility services are enabled on Android.

## 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
-->

[Android] [Added] - Added `isAccessibilityServiceEnabled` to get if accessibility services are enabled

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

Test Plan: ![accessibilityService](https://user-images.githubusercontent.com/40130327/115560972-11d5b100-a2f0-11eb-8aa2-7c52dc71ca59.gif)

Reviewed By: yungsters

Differential Revision: D31911880

Pulled By: lunaleaps

fbshipit-source-id: 9ae294999a6d46bf051ab658507bf97764a945d2
2021-10-29 18:40:59 -07:00
Ken Tominaga bbb52aa276 Fix Fabric debug message when we set `fabric_enabled = false` in `rn-tester` (#32502)
Summary:
The debug message stays `Building RNTester with Fabric enabled.` even if we set `fabric_enabled = false`

This pull request changes the message like below when `fabric_enabled = false`

`Building RNTester with Fabric disabled.`

## 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
-->

[iOS] [Fixed] - Fix the debug message for Fabric in rn-tester

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

Reviewed By: sota000

Differential Revision: D32027858

Pulled By: lunaleaps

fbshipit-source-id: baf5301581e354f588830acd12a5e8171799b1ca
2021-10-29 15:13:09 -07:00
Héctor Ramos 70785e3d5a generate-specs-cli: Parse arguments using yargs
Summary:
Make `generate-specs-cli.js` use named arguments.

Updated all `generate-specs-cli.js` callsites to make use of named arguments.

Changelog: [Internal]

Reviewed By: sota000

Differential Revision: D31908041

fbshipit-source-id: f2cb5967db3c3b847e1095e35e8d5d21585be27b
2021-10-29 11:07:38 -07:00
Ramanpreet Nara 58c9d8eda7 Fix "Duplicate license header lint error" in Component generators
Summary:
See title.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D32019151

fbshipit-source-id: aea69a6c032cef1c99cd7641bdc10e730076e781
2021-10-29 10:43:39 -07:00
Luna Wei a6d8a9970d Add ios template build test
Summary: Changelog: [Internal] - Add iOS template app test

Reviewed By: sota000

Differential Revision: D31747179

fbshipit-source-id: d49c32c7652f91bdfd463509787096a41bbcc7b0
2021-10-28 15:48:29 -07:00
Xin Chen 61e1b6f86c Fix #flingAndSnap to check all the scroll item for offset range
Summary:
When calculating the offset range, we assume the first item is always at offset zero position and skipped that (as the smallerOffset is zero). However, this may not be the case in some situations. This diff changes the range measuring loop to always start from the first item.

Changelog:
[Android][Fixed] - Do NOT skip the first child view in the scroll view group when measuring the lower and upper bounds for snapping.

Reviewed By: mdvacca

Differential Revision: D31887086

fbshipit-source-id: af7221a621b2719d057afa6b64aa91c94ac01295
2021-10-27 13:59:12 -07:00
Nicola Corti 25605fb6c5 Bump version to 0.0.2
Summary:
Publishing a new version of the Gradle plugin as we need to distribute some
changes before releasing the playbook to the public.

Changelog:
[Internal] [Changed] - Bump react-native-gradle-plugin to 0.0.2

Reviewed By: ShikaSD

Differential Revision: D31957686

fbshipit-source-id: ef6742a205f2b568714c349dcb6481af33254b9b
2021-10-27 10:20:14 -07:00
Nicola Corti 3dff1fabdd Do not publish tests inside the npm package
Summary:
I'm removing the `src/test` folder from the npm bundle as it's not really
needed for the sake of distributing the gradle plugin.

Changelog:
[Internal] [Changed] - Do not publish tests inside the react-native-gradle-plugin npm package

Reviewed By: ShikaSD

Differential Revision: D31956449

fbshipit-source-id: b84138d24a7c51c44b92ebfc84f35afb3668dee5
2021-10-27 09:48:08 -07:00
Sota Ogo 9c4c12722a Fix a build issue where codegen order is incorrect (#32480)
Summary:
D31809012 (f7e4c07c84) introduced a condition where codegen files weren't generated in a correct order so the build fails in `yarn test-ios` if it was a first time to run the command. So it broke ci/circleci: test_ios_unit_hermes.

In this diff

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

Changelog: [intermal]

Reviewed By: cortinico

Differential Revision: D31953580

fbshipit-source-id: db854d6cfed8167dc4aae2667d379738bc261cfe
2021-10-27 09:45:25 -07:00
Nicola Corti a9fc0c5a9c Re-add libreact_debug to codegen makefile and add prebuilts for them
Summary:
While working updating the codeden Makefile template for Android, I've removed
the `libreact_debug` and `libreact_render_debug` dependencies as they were unused in a
simple turbomodule. Turns out that `:ReactAndroid` is depending on having those dependencies.

Moving the build file to use AGP APIs, triggers this scenario and is making `ReactAndroid`
failing to build (see the build status for https://github.com/facebook/react-native/pull/32443).

I'm updating the codegen Makefile template to reintrodce the two libraries + I've update the prebuilt
makefile (used in the playbook) to include `react_debug` prebuilts as they were missing.

Changelog:
[Internal] [Changed] - Re-add libreact_debug to codegen makefile and add prebuilts for them

Reviewed By: ShikaSD

Differential Revision: D31900675

fbshipit-source-id: ff188c0498a0dca4a951a548a580ca8dd0674782
2021-10-27 09:20:35 -07:00
Moshe Berman fdd744f013 Enable complete_nullability on //xplat/js/react-native-github:RCTTypeSafety (#32473)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/32473

Reviewed By: AdamCmiel

Differential Revision: D31775069

fbshipit-source-id: f3aaee36c1ca8a209610f8b66c7adc90bd2b8c7e
2021-10-26 17:14:24 -07:00
Stefanos Markidis 456cf3db14 Fix ReactSwitch for non RippleDrawable backgrounds (#32468)
Summary:
ReactSwitch component is crashing on Android when it is initialised with both a backgroundColor and thumbColor, `style={{ backgroundColor: "anyColor" }} thumbColor="anyColor"`, due to IllegalCastException.

When setting a background color, BaseViewManagerDelegate is calling `setBackgroundColor` which replaces the background drawable with a ColorDrawale, hence [this line](72ea0e111f/ReactAndroid/src/main/java/com/facebook/react/views/switchview/ReactSwitch.java (L68)) fails.

Instead, given the ripple effect needs to be preserved, one should initialise a RippleDrawable using the current background drawable and set it as the background of the switch.

Given the RippleDrawable should be preserved, overriding the `setBackgroundColor` seemed the sensible thing to do.

## Changelog

[Android] [Fixed] - Fix crash when a Switch is initialised with both backgroundColor and thumbColor.

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

Test Plan:
### Setup:
Initialise an empty React Native project. Add a switch component:
`<Switch
        style={{backgroundColor: 'red'}}
        thumbColor={'https://github.com/facebook/react-native/issues/356'}
      />`
Run the project `yarn android`

### Current state (RN 65+):
Red screen will show highlighting an IllegalCastException.

<img src="https://user-images.githubusercontent.com/4354327/138616661-3ba1370c-6a2b-48c2-ba70-b99415a4256f.png" width="200"/>

### With fix:
- The component is expected to have a red background.
- When pressed a ripple effect shows inside the backgrounds bounding box.
- Business as usual otherwise.

`backgroundColor` with `thumbColor`:
![backgroundColor + thumbColor](https://user-images.githubusercontent.com/4354327/138615603-141660d2-a5cd-49d7-aa5e-9c93ebc6d680.gif)

Just `thumbColor`:
![Screen Recording 2021-10-25 at 00 23 57](https://user-images.githubusercontent.com/4354327/138615658-baa380dd-2cbb-4d0f-a25e-a003ef67c977.gif)

Reviewed By: ShikaSD

Differential Revision: D31895690

Pulled By: cortinico

fbshipit-source-id: 60af16de7db61440ccfbf11d67a3d945dd90b562
2021-10-26 11:21:05 -07:00
Andrei Shikov f58c496e07 Use context from entry point for prerendering
Summary:
Some of the prerendered surfaces rely on Android context being present to have correct theming (e.g. for platform colors) and measurements of platform components. This change uses context provided to initialize the surface as themed context before view is attached.
This way it is possible to configure theming with `ContextThemeWrapper` the same way as Litho does it for prerendering. The assumption is that any kind of customization done through Android theme will be applied from prerendering entry point as well.

Changelog: [Internal] - Use context from surface for prerendering

Reviewed By: mdvacca

Differential Revision: D31906091

fbshipit-source-id: 344fc96eb2f85ba5b762bee64d1a29443b3fd1d3
2021-10-26 06:00:27 -07:00
Geraint White d2c10da5d5 Add bundleForVariant option (#32472)
Summary:
Ref https://github.com/facebook/react-native/pull/30606#issuecomment-948458552

## Changelog

[Android] [Added] - Add bundleForVariant option

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

Test Plan:
I added the following log into react.gradle and ran the Android build for my app:

```
println("bundleEnabled: ${targetName}, ${bundleForVariant(variant)}")
```

```
# build.gradle

project.ext.react = [
    entryFile: "index.android.js",
    enableHermes: true,  // clean and rebuild if changing
    bundleForVariant: {
         def variant -> variant.name.toLowerCase().contains('release') || variant.name.toLowerCase().contains('live')
    },
]

...

flavorDimensions 'branding'
productFlavors {
    cve {
        dimension 'branding'
    }
    whce {
        dimension 'branding'
    }
}
```

Console output:

```
Reading env from: env/cve/live
bundleEnabled: CveDebug, false
bundleEnabled: CveRelease, true
bundleEnabled: CveLive, true
bundleEnabled: WhceDebug, false
bundleEnabled: WhceRelease, true
bundleEnabled: WhceLive, true
```

Reviewed By: cortinico, ryancat

Differential Revision: D31910406

Pulled By: ShikaSD

fbshipit-source-id: baca5efaddedddad15d974cc7bb8f3c2a4c4f35b
2021-10-26 04:59:16 -07:00
Pieter De Baets d1439e8b85 Remove unused ensureComponentIsNative mock
Summary: Changelog: [Internal]

Reviewed By: philIip

Differential Revision: D31893181

fbshipit-source-id: 63204b818465f8ae06135f42c63e1340f6abb351
2021-10-26 03:24:01 -07:00
Sota Ogo 24d41845e8 Add fabric_enabled check in generate_temp_pod_spec_for_codegen
Summary:
I missed to push this change in the previous diff D31809012 (f7e4c07c84).

This diff adds a check so that only when fabric is enabled it include the React-graphic dependency.

Changelog: [internal]

Reviewed By: fkgozali

Differential Revision: D31919354

fbshipit-source-id: 0b4e7f489155f868cdf58bec3f61f309470ca0c6
2021-10-26 01:18:22 -07:00
Sota Ogo f7e4c07c84 Move codegen output out of node_modules
Summary:
In this diff, it moves the codegen output location out of node_modules and to build/generated/ios folder.

A temp pod spec will be created so that those files will be included in the Xcode project.

Changelog: [Internal]

Reviewed By: hramos, cortinico

Differential Revision: D31809012

fbshipit-source-id: ba1c884c8024306ba0fd2102837b7dbebc6e18ac
2021-10-25 20:48:24 -07:00
Saad Najmi 1b30dd074b Expose Pressability Hover config props in Pressable (#32405)
Summary:
Several desktop forks (`react-native-macos`, `react-native-windows`, `react-native-web`) support mouse events, and while the stock Pressable component has the ability to support mouse events, it seems we aren't forwarding some props properly from Pressable -> Pressability.

Pressability will calculate onMouseEnter / onMouseLeave event handlers based on the `onHoverIn/onHoverOut` callbacks passed into PressabilityConfig.
ad0d4534a7/Libraries/Pressability/Pressability.js (L552)
 However, Pressable does not pass take in onHoverIn/onHoverOut props to pass to PressabilityConfig, so we can't take advantage of this functionality. This change should simply address that by passing the props through.

## 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
-->

[General] [Fixed] - Pressabel not passing hover props and event handlers to PressabilityConfig

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

Test Plan: I fixed a similar issue in `react-native-macos` that I am now trying to contribute back upstream. https://github.com/microsoft/react-native-macos/pull/855

Reviewed By: yungsters

Differential Revision: D31667737

Pulled By: sota000

fbshipit-source-id: f0bbe48302703bb2c45280d2afeec8d7a4586b6a
2021-10-25 19:49:21 -07:00
Andrew Scherkus b2415c4866 Update XMLHttpRequest.getAllResponseHeaders() implementation (#32353) (#32363)
Summary:
As per the XMLHttpRequest specification [1], getAllResponseHeaders() should return a string of headers with lowercased names and sorted by their uppercase representation, with each header ending with '\r\n'.

[1] https://xhr.spec.whatwg.org/#the-getallresponseheaders()-method

## Changelog

[General] [Changed] XMLHttpRequest.getAllResponseHeaders() now returns headers with names lowercased and sorted in ascending order, as per specification

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

Test Plan:
Test derived from Web Platform Test repository:
https://github.com/web-platform-tests/wpt/tree/master/xhr

Reviewed By: yungsters

Differential Revision: D31626217

Pulled By: sota000

fbshipit-source-id: 299d005facbe1c15b8cda5eed6750db75addca80
2021-10-25 19:45:51 -07:00
Sota Ogo 65af5eba9c Add a check for library_type
Summary:
Adding an error check to make debugging easier when codegen fails  when invalid library_type option is passed.

Changelog: [internal]

Reviewed By: hramos

Differential Revision: D31907880

fbshipit-source-id: c1ffa6bbd7b3e4faede88da2ee8d3378fa086780
2021-10-25 14:52:38 -07:00
Juan Tejada 016aef612c Update React DevTools v4.20.2
Summary:
Update `react-devtools-core` and `react-devtools` dependencies for RN, VSCode, Flipper, etc.

`js1 upgrade react-devtools -v 4.20.2`

# Changelog:

[General][Changed] - Upgraded react-devtools-core dependency to 4.20.2

Reviewed By: lunaruan

Differential Revision: D31809278

fbshipit-source-id: 0360fe173cfc7ce09595e6db4e8e41c6f64becd7
2021-10-25 14:00:48 -07:00
Sota Ogo 8b56522013 Accept "Library Type" in generate-specs-cli.js
Summary:
Currently, some filtering of generated files are done in multiple places (e.g. generate-specs-cli.js, react_native_pods.rb, etc). I am introducing this arguments so that only needed files are generated for components and modules.

Changelog: [internal]

Reviewed By: hramos, cortinico

Differential Revision: D31878098

fbshipit-source-id: d2dc8f51ea14a5d0ba1548bd481814220c9ae3a2
2021-10-25 11:39:53 -07:00
Luna Wei 03a0907868 Add back Xcode_12_5_M1_post_install_workaround
Summary: Changelog: [Internal] Add back Xcode_12_5_M1_post_install_workaround workaround

Reviewed By: sota000

Differential Revision: D31902449

fbshipit-source-id: 5c9d962d0d1a55a9f14186bd7d6d8fe087101f0d
2021-10-25 11:34:05 -07:00
Luna Wei 0454626415 Remove link to outdated release docs
Summary: Changelog: [Internal] - Remove link to outdated release docs

Reviewed By: cortinico

Differential Revision: D31837194

fbshipit-source-id: 9afad47e6d94d185d360af36776cd02a9b155650
2021-10-25 10:48:22 -07:00
Luna Wei 0a73a6fd31 Fix issue form description
Summary: Changelog: [Internal] - Fix github issue form description

Reviewed By: cortinico

Differential Revision: D31837196

fbshipit-source-id: 9ccdd0d1773add7f63b9ae8818b2a9364eb965d8
2021-10-25 10:48:22 -07:00
Luna Wei 2dda1cfc8e Remove action to close upgrade-related issues
Summary: Changelog: [Internal] Remove github action to close upgrade-related issues. We will be moving these issue to react-native repo and using this tag

Reviewed By: cortinico

Differential Revision: D31837195

fbshipit-source-id: 51fdd6efd88c0ebd5c504730406b217c8dbb3a88
2021-10-25 10:48:22 -07:00
Geraint White 055ea9c7b7 Fix devDisabledInStaging not working with multiple productFlavors (#30606)
Summary:
Fixes https://github.com/facebook/react-native/issues/27052

Since react-native 0.62, the `devDisabledIn${buildType}` syntax has stopped working for apps with multiple `productFlavors`. This PR adds the `disableDevForVariant` lambda to allow dev mode to be disabled for different variants.

## 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
-->

[Android] [Fixed] - Fix devDisabledIn not working with multiple productFlavors

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

Test Plan:
I added the following log into `react.gradle` and ran the Android build for my app:

```
println("devEnabled: ${targetName}, ${devEnabled}")
```

```
# build.gradle

project.ext.react = [
    entryFile: "index.android.js",
    enableHermes: true,  // clean and rebuild if changing
    bundleInLive: true,
    disableDevForVariant: {
         def variant -> variant.name.toLowerCase().contains('release') || variant.name.toLowerCase().contains('live')
    },
]

...

flavorDimensions 'branding'
productFlavors {
    cve {
        dimension 'branding'
    }
    whce {
        dimension 'branding'
    }
}
```

Console output:

```
Reading env from: env/cve/live
devEnabled: CveDebug, true
devEnabled: CveRelease, false
devEnabled: CveLive, false
devEnabled: WhceDebug, true
devEnabled: WhceRelease, false
devEnabled: WhceLive, false
```

Reviewed By: cortinico

Differential Revision: D31649977

Pulled By: ShikaSD

fbshipit-source-id: 520734314f4bca7608b8dca67c7c5ce0be6d31a5
2021-10-25 08:11:40 -07:00