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

23233 Коммитов

Автор SHA1 Сообщение Дата
Nicola Corti 05b449baf2 Use Locale.ROOT for capitalization of variant names
Summary:
The IDE is complainign as we're using capitalization functions that
are not locale-independent. I'm changing this to use `Locale.ROOT`.
Once we move to Kotlin 1.5 we're going to replace those functions with newer ones.

Changelog:
[Internal] [Changed] - Use Locale.ROOT for capitalization of variant names

Reviewed By: ShikaSD

Differential Revision: D30958992

fbshipit-source-id: 225af4e7e323f143ab75bad106f3bca3db510b22
2021-09-15 09:32:55 -07:00
Nicola Corti 022f188750 Merge CodegenPluginExtension inside ReactAppExtension
Summary:
This Diff is merging over all the properties from `CodegenPluginExtension` to
`ReactAppExtension`. Some of the properties were duplicate and generally having two
extensions is creating a lot of confusion for the users (e.g. don't know where to place a
specific property).

Therefore I'm merging the two to have only one. I've also updated the property to use the
Gradle Lazy Configuration API.

Changelog:
[Android] [Changed] - Gradle: Merge CodegenPluginExtension inside ReactAppExtension

Reviewed By: ShikaSD

Differential Revision: D30961343

fbshipit-source-id: 66be3157efef356392c0701aaef2283d058d3161
2021-09-15 09:23:23 -07:00
Samuel Susla 1ecd98adc7 Do not flatten view if prop accessibilityViewIsModal is true
Summary:
changelog: [internal]

As per title, prevent view from flattening if `accessibilityViewIsModal` is true.

Reviewed By: jimmy623

Differential Revision: D30696223

fbshipit-source-id: 0c6bfc116458d1808f152cb13ba6c941c58f052e
2021-09-15 08:31:58 -07:00
Nicola Corti 862a5fe147 Splits test_docker into smaller steps (#32215)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/32215

Currently `test_docker` is the biggest offender in terms of time consumed
on CI (~70 minutes). I'm splitting it in smaller steps to let us investigate better
what is going on.

Changelog:
[General] [Changed] - Splits test_docker into smaller steps

Reviewed By: ShikaSD

Differential Revision: D30958906

fbshipit-source-id: 2a80535afe77f98427dd0d38e66c6de3fdf80188
2021-09-15 08:07:12 -07:00
Nicola Corti 578cba2338 Use Gradle Lazy API (#32214)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/32214

This Diff updates part of the Gradle plugin to use the Gradle Lazy Api (mostly `Property` classes).
This will defer the time when those value are accessed from configuration to execution phase.

So far I've converted the `Extension` class that should be our primary entry point to the public API.
I haven't converted the tasks as well, therefore we have several `.get()` calls around now.
I'll take care of them once I go over the Tasks file as well.

Moreover, I added some documentation to the Extention properties, as those will show up in the `build.gradle`
autocompletion for our users.

On the API point of view, this is going to be a breaking change for users that are testing the Gradle plugin AND
are on Gradle Kotlin DSL (which I believe are really limited so I don't think is a problem at the moment). Users
relying on `react.gradle` are unaffected.

Changelog:
[Internal] [Changed] - Use Gradle Lazy API

Reviewed By: ShikaSD

Differential Revision: D30902517

fbshipit-source-id: 5af4625e901b82f4b1c65bd631aa4bb9b505b2d0
2021-09-15 05:29:38 -07:00
Nicola Corti c8873fc43a Fixing a minor typo in the verify-android-sdk script.
Summary:
Just fixing a minor typo

Changelog:
[Internal] - Fixing a minor typo in the verify-android-sdk script

Reviewed By: sshic

Differential Revision: D30933339

fbshipit-source-id: b9191089b67dc05813609702dababc3e36a5e6f8
2021-09-15 03:26:06 -07:00
Nicola Corti c3ff336326 Merge the two Gradle Plugins (#32177)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/32177

This diff merges the `react-native-gradle-plugin` and the `react-codegen/android` into a single plugin.
This will allow us to iterate faster on a single plugin, will create less confusion for our users (`react` vs `reactApp`)
and will help us avoid race conditions when the two plugins are applied together (as we will control the whole lifecycle of it).

Changelog:
[Internal] [Changed] - Merged the two Gradle Plugins

allow-large-files

Reviewed By: ShikaSD

Differential Revision: D30765147

fbshipit-source-id: fcb02a181c7d900daa514107c637d0ee0225976c
2021-09-15 03:21:23 -07:00
Facebook Community Bot 671068f28d
Re-sync with internal repository (#32212)
Co-authored-by: Facebook Community Bot <6422482+facebook-github-bot@users.noreply.github.com>
2021-09-15 10:45:06 +01:00
Nicola Corti cad3effa92 Simplify the Circle CI setup steps (#32207)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/32207

This diff is removing some of the unnecessary steps on our CircleCI setup.
Specifically all the `setup_` steps are just checking out the code on different runners and nothing more
therefore I'm cleaning that up. A simple `checkout` should do the job.

I'll do a couple of runs to understand if that is also impacting performances or not.

Changelog:
[Internal] [Changed] - Simplify the CircleCI setup steps

Reviewed By: mdvacca

Differential Revision: D30932949

fbshipit-source-id: 2dec1aaa829416fdf10f4f13089f024a81c14082
2021-09-15 01:34:34 -07:00
CodemodService Bot 18b866da53 xplat/
Reviewed By: scottrice

Differential Revision: D30749716

fbshipit-source-id: d96a943a720fb6a2c8af80deab69e8990f53bb94
2021-09-14 19:13:25 -07:00
Sota Ogo 286df9000e Throw when extendsProps is empty
Summary:
If I understand the code correctly, component.extendsProps is expected to have more than 1 entry. I encounter a bug where it was an empty and produced an broken Props.h file while testing out in OSS.

```
// Example of the broken file.
class RNTMyNativeViewProps final :  {
 public:
```
In this diff, it makes it clear that the function has failed so that the codegen fails when the input is wrong.

There is probably an upstream problem that we should warn about, but this diff is just to make sure this method fails loudly.

Changelog: [Internal]

Reviewed By: hramos

Differential Revision: D30847173

fbshipit-source-id: 34c894f0a7bb81e132b6ed44f51d0f92ed9a5a20
2021-09-14 11:47:38 -07:00
Nicola Corti 99bad7015a Fix Broken RN-Tester due to wrong `cliPath` (#32206)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/32206

After we backported the cliPath fix, I forgot to update the `cliPath` specified for RN-Tester.
See D30899057 (8d4fe826c3). This Diff is fixing it.

Changelog:
[Internal] [Fixed] - Fix Broken RN-Tester due to wrong `cliPath`

Reviewed By: ShikaSD

Differential Revision: D30929640

fbshipit-source-id: 9fd1eaa5985c21e2d04319c4111db5e0a1b4b4ba
2021-09-14 07:20:45 -07:00
Nicola Corti 16a6f9f9d0 Do not wipe extraArgs for `BundleJsAndAssetsTask`
Summary:
Seems like we discard the `extraArgs` for `BundleJsAndAssetsTask` and it doesn't look right.
I'm fixing it here.

Changelog:
[Internal] [Changed] - Do not wipe extraArgs for `BundleJsAndAssetsTask`

Reviewed By: ShikaSD

Differential Revision: D30902743

fbshipit-source-id: 787a7fafab1d3f62d9fdc84d4f55a0cc381bcef8
2021-09-14 06:44:59 -07:00
Samuel Susla ce6047d816 Pull function calculateAnimationProgress to a separate file
Summary:
changelog: [internal]

Pulling a function from class since it doesn't use any of the ivars.

Reviewed By: RSNara

Differential Revision: D30766917

fbshipit-source-id: 219d9b7d3bc0b110b659d7188f5e3877c7b480ff
2021-09-14 06:21:05 -07:00
Ramanpreet Nara f617e022c8 Fix methodQueue attachment error message
Summary:
When we fail to assign the methodQueue to a NativeModule in the TurboModule system, we say "You must either synthesize the bridge property", when we should say "You must either synthesize the methodQueue property".

Changelog: [Internal]

Created from CodeHub with https://fburl.com/edit-in-codehub

Reviewed By: philIip

Differential Revision: D30909907

fbshipit-source-id: 07dc1060497be3fdd16bdfcf6e80cfed182bc5c7
2021-09-13 14:20:39 -07:00
Krzysztof Borowy 04fe3ed80d Fix: Set "new task flag" for intent method (#29000)
Summary:
Addresses https://github.com/facebook/react-native/issues/28934

## 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] - When sending OS intents, always set "FLAG_ACTIVITY_NEW_TASK" flag (required by OS).

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

Test Plan:
1. Open RNTester on Android
2. Go to Linking section
3. Try opening "POWER_USAGE_SUMMARY" intent
4. App should open settings, instead of crashing

Reviewed By: cortinico

Differential Revision: D30876645

Pulled By: lunaleaps

fbshipit-source-id: e427bfeadf9fb1ae38bf05bfeafd88e6776d71de
2021-09-13 12:56:19 -07:00
Jimmy Zhang a8cd8f7696 Setup a new macro to gate the core packager functionality
Summary:
Changelog:
* Rename `ENABLE_PACKAGER_CONNECTION` macro to a more appropriate name `RCT_DEV_SETTINGS_ENABLE_PACKAGER_CONNECTION` to reflect this is only used in RCT_DEV_SETTINGS

* Introduce `RCT_PACKAGER_LOADING_FUNCTIONALITY` that can be separate from `RCT_DEV_MENU`, by default, it equals to `RCT_DEV_MENU`

Reviewed By: fkgozali

Differential Revision: D30546025

fbshipit-source-id: f409c02dc1486041d7db5abdbf7eb482520fa171
2021-09-13 12:09:12 -07:00
Nicola Corti 8d4fe826c3 Backport the cliPath fix to the Gradle Plugin (#32193)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/32193

This Diff is backporting the change in https://github.com/facebook/react-native/pull/31839/
applied to `react.gradle` also to the React Gradle Plugin. Ideally we would like to two
logic to be in sync as much as possible.

Changelog:
[Internal] [Changed] - Backport the cliPath fix to the Gradle Plugin

Reviewed By: ShikaSD

Differential Revision: D30899057

fbshipit-source-id: a28628b36b3dfe565dbdc8d6416c5d25ddf1fe03
2021-09-13 10:13:10 -07:00
Nicola Corti 24bf1c5e8b Fix broken Android CI due to broken `BundleJsAndAssetsTask` override (#32194)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/32194

This Diff fixes the `test_android` CircleCI that is currently broken due to a faulty `BundleJsAndAssetsTask`
(that's my fault sorry for this).

The CI is failing with a `execCommand == null!` error message. The message is happening as the aformentioned
task is not correctly overriding `exec()` but just declaring a `TaskAction`. I'm fixing it.

Changelog:
[Internal] [Changed] - Fix broken Android CI due to broken `BundleJsAndAssetsTask` override

Reviewed By: GijsWeterings

Differential Revision: D30899742

fbshipit-source-id: a39b01b7d429bd7e87411282e1c22a7606ea22e0
2021-09-13 07:37:51 -07:00
Nicola Corti d246946fb8 Export and test `detectedHermesCommand` function from `ReactAppExtension`
Summary:
Another diff to remove code from `ReactAppExtension` to a Util file and test it.

Changelog:
[Internal] [Changed] - Export and test `detectedHermesCommand` function from `ReactAppExtension`

Reviewed By: feedthejim

Differential Revision: D30866510

fbshipit-source-id: 0023a063793d669ee4b2190679ca7fbd01e9a3fc
2021-09-13 03:19:53 -07:00
Ramanpreet Nara 801909be5b Disable TurboModulManagerDelegate locking by default
Summary:
This diff disables the TurboModuleManager delegate locking by default in the TurboModule system.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D30862260

fbshipit-source-id: 917c1e5862c69a753e33813705eead0e97cf5e9a
2021-09-13 02:32:20 -07:00
Samuel Susla cc3064d394 Use designated initialisers for ShadowViewMutation
Summary:
changelog: [internal]

In this diff, we delete default initialised for ShadowViewMutation to prevent accidentally creating empty ShadowViewMutation.
The other initialiser is made private and all of its uses are migrated to designated initialisers. This makes for safer API.

Reviewed By: RSNara

Differential Revision: D30774900

fbshipit-source-id: d2064bf08409850e75e13ad06558b7980a7f5d8d
2021-09-12 08:56:32 -07:00
Samuel Susla d2cc91bcc3 Add a way to simulate memory access to ImageProps in LayoutAnimations
Summary:
changelog: [internal]

I'm chasing down a crash in LayoutAnimations, it would help me to simulate the memory access which causes the crash to learn where the bad memory is coming from.

Reviewed By: RSNara

Differential Revision: D30776840

fbshipit-source-id: 1e97fac28ba2df37ba3e47ec2c110043c3823e70
2021-09-12 08:56:32 -07:00
Samuel Susla c6e203bdb0 Prevent implicit conversion to boolean
Summary:
changelog: [internal]

This looks like a bug where the author did not intend the conversion to boolean. This means that `onlyMutationIsUpdate` was evaluated to true even if more than 1 animation was in the vector.

Reviewed By: RSNara

Differential Revision: D30767172

fbshipit-source-id: 0ef47b65a5d8ef07d774d9e0b358e5642dc0a9ea
2021-09-12 08:56:32 -07:00
Samuel Susla 1e4f364f87 Remove movesToAnimate var which was never read
Summary:
changelog: [intenal]

The variable is never read, removing it.

Reviewed By: RSNara

Differential Revision: D30767134

fbshipit-source-id: de72740f9dc7ad10d651129404fe4df093e6206d
2021-09-12 08:56:32 -07:00
Samuel Susla 273f631535 Annotate arguments in AnimationKeyFrame ctor
Summary:
changelog: [internal]

Just improvement to readability.

Reviewed By: philIip

Differential Revision: D30767100

fbshipit-source-id: eb5d36712f8096e6becd8db1e9d47128d5754624
2021-09-12 08:56:32 -07:00
Samuel Susla 10ab64888f Annotate arguments when constructing ShadowViewMutation
Summary: changelog: [internal]

Reviewed By: philIip

Differential Revision: D30766786

fbshipit-source-id: f7fac3371d9f018c15c366b0e8a5be1de021a0e7
2021-09-11 01:42:32 -07:00
Samuel Susla 24b961b6f7 Add option to crash the app if component descriptor is missing in LayoutAnimations
Summary:
changelog: [internal]

Add a log behind feature flag to learn more about missing component descriptor.

Component descriptor should never be missing, that's a state of program that is impossible as far as I can tell. This logic was introduced in D22216030 (6342e6e3f1) and I think it is just cover the real cause of crashes in LA on iOS.

Reviewed By: RSNara

Differential Revision: D30765947

fbshipit-source-id: 6843384e02529de2f024c59c61ae21b8682ac371
2021-09-11 00:26:27 -07:00
Héctor Ramos ef6ad1f2d6 Codegen: Remove generate-specs.sh
Summary:
First part of the codegen script cleanup effort. Everything that was done in generate-specs.sh is now part of the CocoaPods recipe (e.g. codegen method in `react_native_pods.rb`).

Now that `generate-specs.sh` has been removed, the codegen may still be invoked manually for test purposes like so:

```
cd react-native

# Generate Schema - do this whenever your JS specs change
node packages/react-native-codegen/lib/cli/combine/combine-js-to-schema-cli.js <output_file_schema_json> <javascript_sources_dir>

# Generate native interfaces for iOS (use schema.json generated by previous step)
node scripts/generate-specs-cli.js ios <output_file_schema_json> <output_dir> <library_name>
```

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D30648067

fbshipit-source-id: 29688e0aac5496886657db82becb05bc8da076c9
2021-09-10 17:28:55 -07:00
Luna Wei 14ecf84a9c Add testID to movingBox example
Summary:
Changelog:
[Internal] - Add testID to moving box example for testing

Reviewed By: yungsters

Differential Revision: D30824961

fbshipit-source-id: 1e25f25a49d064eee6e17aebc2d981648a0559bc
2021-09-10 17:28:55 -07:00
Rick Hanlon 7f7f8188f2 React Native sync for revisions bd5bf55...95d762e
Summary:
This sync includes the following changes:
- **[95d762e40](https://github.com/facebook/react/commit/95d762e40 )**: Remove duplicate test //<Andrew Clark>//
- **[d4d1dc085](https://github.com/facebook/react/commit/d4d1dc085 )**: Reorder VARIANT feature flags ([#22266](https://github.com/facebook/react/pull/22266)) //<Dan Abramov>//
- **[2f156eafb](https://github.com/facebook/react/commit/2f156eafb )**: Adjust consoleManagedByDevToolsDuringStrictMode feature flag ([#22253](https://github.com/facebook/react/pull/22253)) //<Dan Abramov>//
- **[cfd819332](https://github.com/facebook/react/commit/cfd819332 )**: Add useSyncExternalStore to react-debug-tools ([#22240](https://github.com/facebook/react/pull/22240)) //<Andrew Clark>//
- **[8e80592a3](https://github.com/facebook/react/commit/8e80592a3 )**: Remove state queue from useSyncExternalStore ([#22265](https://github.com/facebook/react/pull/22265)) //<Andrew Clark>//
- **[06f98c168](https://github.com/facebook/react/commit/06f98c168 )**: Implement useSyncExternalStore in Fiber ([#22239](https://github.com/facebook/react/pull/22239)) //<Andrew Clark>//
- **[77912d9a0](https://github.com/facebook/react/commit/77912d9a0 )**: Wire up the native API for useSyncExternalStore ([#22237](https://github.com/facebook/react/pull/22237)) //<Andrew Clark>//
- **[031abd24b](https://github.com/facebook/react/commit/031abd24b )**: Add warning and test for useSyncExternalStore when getSnapshot isn't cached ([#22262](https://github.com/facebook/react/pull/22262)) //<salazarm>//
- **[b8884de24](https://github.com/facebook/react/commit/b8884de24 )**: break up import keyword to avoid being accidentally parsed as dynamic import statement in external code ([#21918](https://github.com/facebook/react/pull/21918)) //<Jianhua Zheng>//
- **[6d6bba5bf](https://github.com/facebook/react/commit/6d6bba5bf )**: Fix typo in ReactUpdatePriority-test.js ([#21958](https://github.com/facebook/react/pull/21958)) //<Ikko Ashimine>//
- **[0c0d1ddae](https://github.com/facebook/react/commit/0c0d1ddae )**: feat(eslint-plugin-react-hooks): support ESLint 8.x ([#22248](https://github.com/facebook/react/pull/22248)) //<Michaël De Boey>//
- **[1314299c7](https://github.com/facebook/react/commit/1314299c7 )**: Initial shim of useSyncExternalStore ([#22211](https://github.com/facebook/react/pull/22211)) //<Andrew Clark>//
- **[fc40f02ad](https://github.com/facebook/react/commit/fc40f02ad )**: Add consoleManagedByDevToolsDuringStrictMode feature flag in React Reconciler ([#22196](https://github.com/facebook/react/pull/22196)) //<Luna Ruan>//
- **[46a0f050a](https://github.com/facebook/react/commit/46a0f050a )**: Set up use-sync-external-store package ([#22202](https://github.com/facebook/react/pull/22202)) //<Andrew Clark>//
- **[8723e772b](https://github.com/facebook/react/commit/8723e772b )**: Fix a string interpolation typo in ReactHooks test ([#22174](https://github.com/facebook/react/pull/22174)) //<Matt Hargett>//
- **[60a30cf32](https://github.com/facebook/react/commit/60a30cf32 )**: Console Logging for StrictMode Double Rendering ([#22030](https://github.com/facebook/react/pull/22030)) //<Luna Ruan>//
- **[76bbad3e3](https://github.com/facebook/react/commit/76bbad3e3 )**: Add maxYieldMs feature flag in Scheduler ([#22165](https://github.com/facebook/react/pull/22165)) //<Ricky>//
- **[b0b53ae2c](https://github.com/facebook/react/commit/b0b53ae2c )**: Add feature flags for scheduler experiments ([#22105](https://github.com/facebook/react/pull/22105)) //<Ricky>//

Changelog:
[General][Changed] - React Native sync for revisions bd5bf55...95d762e

jest_e2e[run_all_tests]

Reviewed By: mdvacca

Differential Revision: D30809906

fbshipit-source-id: 131cfdf91e15f67fa59a5d925467e538ee89fe10
2021-09-10 17:28:55 -07:00
Luna Wei 0b3d28f8f1 Move multicolumn out to separate example
Summary: Changelog: [Internal] Refactor FlatList examples, move multi-column under FlatList index

Reviewed By: charlesbdudley

Differential Revision: D30816719

fbshipit-source-id: 3fb9a30ddb58ca302a1b1b5a23ea964f3793b836
2021-09-10 17:28:55 -07:00
Luna Wei 30630472fd Move FlatList separators example under FlatList index
Summary: Changelog: [Internal] Refactor FlatList examples, move separators example under FlatList index

Reviewed By: charlesbdudley

Differential Revision: D30816723

fbshipit-source-id: 741e4d97b18458fcedd9175309ff68c987d211b1
2021-09-10 17:28:54 -07:00
Luna Wei 5fd19835fe Move onViewableItemsChanged under FLatListExampleIndex
Summary: Changelog: [Internal] Refactor FlatList examples, move onViewableItemsChanged under FlatList index

Reviewed By: charlesbdudley

Differential Revision: D30816718

fbshipit-source-id: 87c0500f0852fa6608a133cca008347f62b7010b
2021-09-10 17:28:54 -07:00
Luna Wei 4603e76777 Fix styling
Summary: Changelog: [Internal] Fix styling for FlatList test output

Reviewed By: charlesbdudley

Differential Revision: D30816724

fbshipit-source-id: 3e756311c31a38dd4beb27ed16f8aaa206ddb7e8
2021-09-10 17:28:54 -07:00
Luna Wei a7b0943aa9 Move out inverted example
Summary: Changelog: [Internal] Refactor FlatList examples, move invert example under FlatList index

Reviewed By: charlesbdudley

Differential Revision: D30816725

fbshipit-source-id: 6eb4d3133206117646e4738cefdfdbf8f51127fe
2021-09-10 17:28:54 -07:00
Luna Wei 062cd4b2e7 Move Flatlist-contentInset
Summary: Changelog: [Internal] Refactor FlatList examples, move contentInset under FlatList index

Reviewed By: yungsters

Differential Revision: D30816720

fbshipit-source-id: 9b35c575be6819e31ff9ef768f9acfd721a876e8
2021-09-10 17:28:54 -07:00
Luna Wei bde0be26d9 Move out FlatList-onEndReached
Summary: Changelog: [Internal] Refactor FlatList examples, move onEndReached under FlatList index

Reviewed By: charlesbdudley

Differential Revision: D30816722

fbshipit-source-id: 4ee233c7674ed0f5707d9d98388b8c36af900641
2021-09-10 17:28:54 -07:00
Luna Wei 3c3ff30774 Create FlatListExampleIndex
Summary: Changelog: [Internal] Create FlatList example index for 3 levels of navigation

Reviewed By: charlesbdudley

Differential Revision: D30816721

fbshipit-source-id: a3bdae7f385bab3695a9c2dc6fe3148ebdbd12b4
2021-09-10 17:28:54 -07:00
Nicola Corti d8d9c28b48 Make the `BundleJsAndAssetsTask` Task more Gradle friendly
Summary:
This Diff is adapting the `BundleJsAndAssetsTask` to be a bit more idiomatic. Here the summary of changes.
- Make the task `abstract` to let Gradle properly implement it.
- Make all the annotated filed `public` instead of `internal` as they will be easier to access for Gradle + will show up
correctly in logs/scans
- Update the Task to subclass a `Exec` that is a specificed Task
- Do not reference `project.` inside the Task body as that is breaking the Configuration Caching of Gradle

Changelog:
[Internal] [Changed] - Make the `BundleJsAndAssetsTask` Task more Gradle friendly

Reviewed By: mdvacca

Differential Revision: D30865159

fbshipit-source-id: 74d4c77f6a2b3fac944e7e0b123726e6a423ba1d
2021-09-10 08:39:21 -07:00
Nicola Corti d4c347c052 Export `detected*` functions fron `ReactAppExtension` to its own file
Summary:
Ideally a Gradle `Extension` should contain only properties as it's the public facing API of our
Gradle surface. Here I'm movign a couple of functions away from it. Now they're located inside their
own Util file. Moreover I've added tests and documentation to those.

Changelog:
[Internal] [Changed] - Export `detected*` functions fron `ReactAppExtension` to its own file

Reviewed By: mdvacca

Differential Revision: D30865494

fbshipit-source-id: 59925414c0eb427161691950f5b9b6495121da00
2021-09-10 08:31:43 -07:00
Nicola Corti c40b177f61 Export file utils to a separate file and test them
Summary:
Another small diff to setup some testing for our Gradle Plugin.
Here I exported a couple of extension functions on `File` to a separate
Utils file + I've added some tests for them.

Changelog:
[Internal] [Added] - Add tests for AndroidConfiguration

Reviewed By: mdvacca

Differential Revision: D30841339

fbshipit-source-id: fcb00d7397d1f3e2b4500e9920508c71f20c76f3
2021-09-10 02:40:32 -07:00
Ramanpreet Nara 657c48c21d Rename JavaScriptTimerManager to JavaScriptTimerExecutor
Summary:
This JavaScriptTimerManager interface calls into JavaScript to execute timers. For that reason, I think JavaScriptTimerExecutor is a better name for the interface.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D30851912

fbshipit-source-id: de282068d18693fd67331586e66847105ea16531
2021-09-10 01:20:59 -07:00
Nick Gerleman ffcaef64e4 Fix BorderExample Crash on Out of Tree Platforms (#32120)
Summary:
9b4f8e0144 (diff-ee44452e2deeb3a607e863852bb720518875b88c4e78ea7dc76805488bfb1818) added examples to the border test page using PlatformColor. An iOS specific instance was later conditioned to only iOS in f6d0f9deac (diff-ee44452e2deeb3a607e863852bb720518875b88c4e78ea7dc76805488bfb1818) but one example remains that has values for Android, and iOS only. This causes a crash on at least RNW, since none of the PlatformColors are valid.

This change addsa a fallback to black for unsupported platforms, and also adds a Windows PlatformColor for kicks (and marginal extra usefuleness).

## Changelog

[Internal] [Fixed] - Fix BorderExample Crash on Out of Tree Platforms

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

Test Plan: Validated on RNTester on Windows.

Reviewed By: yungsters

Differential Revision: D30822765

Pulled By: lunaleaps

fbshipit-source-id: 6b3e65204259205bb2f3c9153a2361d1decebe98
2021-09-10 00:58:03 -07:00
Frieder Bluemle fc553ed8e6 Revert removal of CRLF from Windows bat files (#31398)
Summary:
This reverts https://github.com/facebook/react-native/issues/31128 - For the reasons stated in the thread. Files should have the correct endings in the repo (i.e. Windows .bat CRLF). There is no reason to perform additional conversion with attributes and/or an editorconfig. It was originally fixed in https://github.com/facebook/react-native/issues/29792 in August 2020.

⚠️ **EDIT 2021-08-31**

Commits 85249cafe8 and 13107fa3d0 accidentally converted the gradlew.bat files to LF again, resulting in modified files to appear in the working directory:

```
$ git status -s
 M gradlew.bat
 M packages/react-native-codegen/android/gradlew.bat
 M template/android/gradlew.bat
```

The reasons why this is happening are explained in detail in the two PRs linked above.

I've added an additional (new) commit to the PR head branch to fix the line endings in all three `gradlew.bat` files of the repo and rebased it. It should be ready for merge.

CC cortinico

EDIT 2021-09-02

The additional commit was removed again, but the original one remains.

To test the scenario locally run the following commands on a clean `main` branch (currently 455433f481):

```
$ rm gradlew.bat
$ git status -s
 D gradlew.bat               # Git shows the file as (D)eleted, as expected
$ git checkout gradlew.bat   # This should restore the file
$ git status -s
 M gradlew.bat               # The file still shows up, now as (M)odified with all line endings changed
```

The modified file will remain in the working directory until they are committed, or a different branch is _force_ checked out. `gradlew.bat` files are generated automatically by Gradle (with the correct line endings in the first place). There is no need to special case them and perform line ending conversion using Git and/or editorconfig.

## Changelog

[General] [Fixed] - Line endings in Windows files, Git/EditorConfig related conversions

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

Test Plan: Verify files are stored correctly in the repository (e.g. using the `file` command).

Reviewed By: yungsters

Differential Revision: D30839864

Pulled By: cortinico

fbshipit-source-id: dfc53e8c5d9276d2f9bfd4d4a4e6b44c3143a164
2021-09-09 22:44:32 -07:00
Sota Ogo 2a0293906f Add an error message when there is no modules to process in codegen
Summary:
Adding an error message when codegen doesn't recognize any modules to help users understand what's going on.

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D30624535

fbshipit-source-id: 781f1f874a5b0c16a05191186b81c2d3892da95b
2021-09-09 17:26:19 -07:00
Rodolfo d40cb0e1b0 Fix missing webview provider crash on Android (#32165)
Summary:
I applied the changes requested in this PR: https://github.com/facebook/react-native/pull/29089

We upgraded to RN 0.62.2 on our latest release and started to see again the "Failed to load WebView provider: No WebView installed" (see below for Crashlytics screenshot)

![image](https://user-images.githubusercontent.com/870365/131935283-033fbd44-5a3b-49b0-bd25-3d6733f22040.png)

This crash had been fixed by https://github.com/facebook/react-native/pull/24533 but https://github.com/facebook/react-native/pull/26189 (added in 0.62) reverted the fix

Indeed the exception raised in Crashlytics is actually a `AndroidRuntimeException` and `MissingWebViewPackageException` is only part of the message.

For instance, in the screenshot above, the exception message is `android.webkit.WebViewFactory$MissingWebViewPackageException: Failed to load WebView provider: No WebView installed`

Now these crashes are quite tricky to reproduce, so to be on the safe side, I'm filtering out all exceptions containing `WebView` as suggested by thorbenprimke on the original fix.

If my reasoning is correct, it should fix siddhantsoni 's issue as well, since `WebView` is included in `MissingWebViewPackageException`
But following that reasoning, I am not sure https://github.com/facebook/react-native/pull/26189 fixed siddhantsoni 's issue, so siddhantsoni if you could check that this PR also fixes your issue, that would be great!

## Changelog

[Android] [Fixed] - Fix missing WebView provider crash in ForwardingCookieHandler

<!-- 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: https://github.com/facebook/react-native/pull/32165

Test Plan:
I created a version of react native with this patch applied

```
"react-native": "almouro/react-native#release/062-2-fix-missing-webview-provider"
```

Before the fix ~0.1% of our users were impacted on Android, no new crashes have occurred after the update.

This is putting back what was already in place and working for us, but making the check wider to catch more errors.

Reviewed By: lunaleaps

Differential Revision: D30847404

Pulled By: sota000

fbshipit-source-id: fe3b5fa2c9ebde5bedd17a9d6394a52ccdbdf0d0
2021-09-09 15:24:03 -07:00
Timothy Yung ab2bdee735
Fix encoding for gradlew.bat files (#32178) 2021-09-09 14:33:50 -07:00
Tim Yung 504cbf1282 RN: Check `ReactSafeMobileConfig` Dependents for MobileConfig References
Summary:
Modifies `js1 build buckfiles` to also parse files that depend on `ReactSafeMobileConfig` for MobileConfig references.

That module was introduced in {D30470489}.

This fixes a bug where the MobileConfig reference in `ReactNativeInternalFeatureFlags` is not being correctly defined via Metro Buck.

Changelog:
[Internal]

Reviewed By: rickhanlonii

Differential Revision: D30815779

fbshipit-source-id: 156b0838fe47e7ab42c62258a1401875690813a6
2021-09-09 13:29:02 -07:00
Samuel Susla 4fe72bdc22 Move comparision functions to separate file
Summary:
changelog: [internal]

Just moving two functions to separate file.

Reviewed By: RSNara

Differential Revision: D30765732

fbshipit-source-id: e85e749c2910f6f38f07e56b23a21fb9f1cbc9b5
2021-09-09 11:57:25 -07:00