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

21447 Коммитов

Автор SHA1 Сообщение Дата
MD. Mizanur Rahman a26db2292f fix community link [404 not found] (#30313)
Summary:
The README file in this repo has a bad link - [404:NotFound]

Status code [404:NotFound] - Link: https://reactnative.dev/en/help

## Changelog

fixed link: https://reactnative.dev/help

[Link] [fixed] - fixed broken link.

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

Test Plan: ![image](https://user-images.githubusercontent.com/46071874/98048666-5fe91c00-1e58-11eb-804e-b90f6d77b15f.png)

Reviewed By: yungsters

Differential Revision: D24716546

Pulled By: cpojer

fbshipit-source-id: 684285e5cc0bb6fadc88c1f25d77b38d482084ce
2020-11-04 09:35:02 -08:00
Valentin Shergin 5c4979b2a5 Fabric: Using state auto-repeating in RCTSafeAreaViewComponentView
Summary:
This change introducing using `updateStateWithAutorepeat` for state updates in RCTSafeAreaViewComponentView. This way we can reduce the number of active commits and reduce jumps & relayout passes.
The approach with a callback is better than using `_lastPaddingStateWasUpdatedWith` because:
* When we compare the values, we can compare them with actual previous padding numbers stored in Shadow Tree.
* The value stored in a UIView instance can go away because of a view being remounted because of flattening.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D24719345

fbshipit-source-id: 9bf1ae284875b4c99cf23be2fcc9a829eb8a895e
2020-11-04 08:10:30 -08:00
Valentin Shergin bd7ab6c90b Fabric: Introducing `YogaLayoutableKindMutatesStylesAfterCloning` trait
Summary:
This implements a new ShadowNode trait that helps to propagate Yoga node `isDirty` flag down the root of the tree and clone siblings appropriately.

Several Fabric components mutate its Yoga styles after the node was cloned. In such cases, we need to mark the node as dirty after doing so. The problem with this is that the parent node and its siblings were already updated (cloned or not) based on the previous value of the `isDirty` flag. This happens because this logic is implemented in YogaLayoutableShadowNode which is a base constructor that must be called before any other logic from a subclass can run.

For now, this change enables that for SafeAreaView only (which seems to help with some junkiness issues), later we can extend the usage of this for other components if needed.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D24719347

fbshipit-source-id: b0d050afea5de9c470e05e1b4c9e7052e00ae949
2020-11-04 08:10:30 -08:00
Valentin Shergin 04de0e75a0 Back out "Use ConcreteStateTeller in RCTSafeAreaViewComponentView"
Summary:
We don't need StateTeller anymore because we already shipped state-autorepeat mechanism on Android.

Original commit changeset: 67596194b599

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D24719346

fbshipit-source-id: 798b6897c49c45ffbf481e6d1be17bc5e7810f27
2020-11-04 08:10:30 -08:00
Christoph Nakazawa bfb2c4be99 Rename `//xplat/js:experimental-packager` to `//xplat/js:metro-transform-worker`
Summary: Changelog: [Internal]

Reviewed By: MichaReiser

Differential Revision: D24678671

fbshipit-source-id: 7fc82f73b9f78411dd652f16260af61c18b539b2
2020-11-04 05:47:07 -08:00
Dulmandakh 9500eb8867 bump docker-android to 2.1 (#30296)
Summary:
docker-android released v2 which reduced image size.

## Changelog

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

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

Test Plan: test_android, test_docker is green

Reviewed By: fkgozali

Differential Revision: D24686168

Pulled By: hramos

fbshipit-source-id: c240848f10f473b38a0967dd681254c21f877277
2020-11-03 16:57:39 -08:00
Joshua Gross 61c1d60356 LayoutAnimations: generate final mutation instruction for interrupted 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
2020-11-03 09:08:19 -08:00
Helena Ford 21349d63f9 docs: fix broken links in README (#30286)
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: https://github.com/facebook/react-native/pull/30286

Reviewed By: hramos

Differential Revision: D24673358

Pulled By: cpojer

fbshipit-source-id: 726a4742c3ae19dc51f2490619d04934f8aa861d
2020-11-03 01:34:33 -08:00
Mike Grabowski c95ee5ac18 feat: Enable Hermes to work on iOS (#29914)
Summary:
This PR makes it possible to build iOS applications with Hermes. Note that it doesn't work with `use_frameworks!` just yet.

Fixes https://github.com/facebook/react-native/issues/27845 (by downgrading iOS deployment target for RCT-Folly to 9.0)
Fixes https://github.com/facebook/react-native/issues/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 https://github.com/facebook/react-native/issues/27845 and https://github.com/facebook/react-native/issues/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: https://github.com/facebook/react-native/pull/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
2020-11-03 01:14:38 -08:00
generatedunixname89002005325676 00456211e5 Daily `arc lint --take CLANGFORMAT`
Reviewed By: zertosh

Differential Revision: D24679750

fbshipit-source-id: 42d5a8aa40ec99be9a51a8e3eed54f2fc8e29e3a
2020-11-02 03:48:06 -08:00
Valentin Shergin 97d6f2e6a9 Fabric: `touchesShouldCancelInContentView` now always returns `YES`
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
2020-10-31 16:23:29 -07:00
Kevin Gozali 7dcecb2907 Android Test: target SDK 21 instead of 16 (#30280)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/30280

Now that React Native targets minimum SDK of 21, use that SDK level to run test. For some reason the default was previously 16 (I couldn't figure out where this was configured). This fixes the following test failure:

https://app.circleci.com/pipelines/github/facebook/react-native/6937/workflows/d2d365f8-3f5d-453d-af28-68a040fb4188/jobs/174719/parallel-runs/0

To test, using local Docker image:

```
root@d5618d33a37b:/app# buck test ReactAndroid/src/test/...
Not using buckd because watchman isn't installed.
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
Parsing buck files: finished in 2.4 sec
Creating action graph: finished in 0.6 sec
Building: finished in 36.8 sec (100%) 577/577 jobs, 241 updated
  Total time: 39.9 sec
Testing: finished in 02:19.7 min (167 PASS/0 FAIL)
RESULTS FOR //ReactAndroid/src/test/java/com/facebook/react/animated:animated //ReactAndroid/src/test/java/com/facebook/react/bridge:bridge //ReactAndroid/src/test/java/com/facebook/react/devsupport:devsupport //ReactAndroid/src/test/java/com/facebook/react/modules:modules //ReactAndroid/src/test/java/com/facebook/react/packagerconnection:packagerconnection //ReactAndroid/src/test/java/com/facebook/react/uimanager/layoutanimation:layoutanimation //ReactAndroid/src/test/java/com/facebook/react/uimanager:uimanager //ReactAndroid/src/test/java/com/facebook/react/util:util //ReactAndroid/src/test/java/com/facebook/react/views:views //ReactAndroid/src/test/java/com/facebook/react:react
PASS     18.3s  7 Passed   0 Skipped   0 Failed   com.facebook.react.animated.NativeAnimatedInterpolationTest
PASS     32.4s 24 Passed   0 Skipped   0 Failed   com.facebook.react.animated.NativeAnimatedNodeTraversalTest
PASS     25.2s  4 Passed   0 Skipped   0 Failed   com.facebook.react.bridge.BaseJavaModuleTest
PASS      1.8s  4 Passed   0 Skipped   0 Failed   com.facebook.react.bridge.FallbackJSBundleLoaderTest
PASS    <100ms  1 Passed   0 Skipped   0 Failed   com.facebook.react.bridge.JavaOnlyArrayTest
PASS    <100ms  2 Passed   0 Skipped   0 Failed   com.facebook.react.bridge.JavaScriptModuleRegistryTest
PASS     24.7s 10 Passed   0 Skipped   0 Failed   com.facebook.react.devsupport.JSDebuggerWebSocketClientTest
PASS     16.6s  4 Passed   0 Skipped   0 Failed   com.facebook.react.devsupport.MultipartStreamReaderTest
PASS     15.4s  5 Passed   0 Skipped   0 Failed   com.facebook.react.devsupport.StackTraceHelperTest
PASS     26.0s  6 Passed   0 Skipped   0 Failed   com.facebook.react.modules.blob.BlobModuleTest
PASS     21.6s  5 Passed   0 Skipped   0 Failed   com.facebook.react.modules.camera.ImageStoreManagerTest
PASS     15.1s  1 Passed   0 Skipped   0 Failed   com.facebook.react.modules.clipboard.ClipboardModuleTest
PASS     14.4s  5 Passed   0 Skipped   0 Failed   com.facebook.react.modules.dialog.DialogModuleTest
PASS    <100ms 10 Passed   0 Skipped   0 Failed   com.facebook.react.modules.network.HeaderUtilTest
PASS      7.9s 14 Passed   0 Skipped   0 Failed   com.facebook.react.modules.network.NetworkingModuleTest
PASS      4.3s  9 Passed   0 Skipped   0 Failed   com.facebook.react.modules.network.ProgressiveStringDecoderTest
PASS      5.2s  4 Passed   0 Skipped   0 Failed   com.facebook.react.modules.network.ReactCookieJarContainerTest
PASS      9.0s  2 Passed   0 Skipped   0 Failed   com.facebook.react.modules.share.ShareModuleTest
PASS      9.3s  6 Passed   0 Skipped   0 Failed   com.facebook.react.modules.storage.AsyncStorageModuleTest
PASS      6.7s 10 Passed   0 Skipped   0 Failed   com.facebook.react.modules.timing.TimingModuleTest
PASS     22.2s  9 Passed   0 Skipped   0 Failed   com.facebook.react.packagerconnection.JSPackagerClientTest
PASS     18.3s  4 Passed   0 Skipped   0 Failed   com.facebook.react.uimanager.layoutanimation.InterpolatorTypeTest
PASS     16.9s  2 Passed   0 Skipped   0 Failed   com.facebook.react.uimanager.BaseViewManagerTest
PASS     15.9s  4 Passed   0 Skipped   0 Failed   com.facebook.react.uimanager.MatrixMathHelperTest
PASS     16.8s  3 Passed   0 Skipped   0 Failed   com.facebook.react.uimanager.SimpleViewPropertyTest
PASS    <100ms  1 Passed   0 Skipped   0 Failed   com.facebook.react.util.JSStackTraceTest
PASS     19.9s  1 Passed   0 Skipped   0 Failed   com.facebook.react.views.image.ImageResizeModeTest
PASS     21.5s  4 Passed   0 Skipped   0 Failed   com.facebook.react.views.image.ReactImagePropertyTest
PASS     22.9s  4 Passed   0 Skipped   0 Failed   com.facebook.react.CompositeReactPackageTest
PASS     15.9s  2 Passed   0 Skipped   0 Failed   com.facebook.react.RootViewTest
Updated test logs: buck-out/log/test.log
TESTS PASSED
```

Changelog: [Android][Deprecated] Deprecate support of Android API levels 19 and 20.

Reviewed By: JoshuaGross

Differential Revision: D24643610

fbshipit-source-id: 0b9536076d08019ef154b338acd136a82cc5a166
2020-10-31 12:48:54 -07:00
Kevin Gozali 49d41c93ad Docker android: addressing AVD launch issue (#30279)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/30279

Take in the fix from https://github.com/facebook/react-native/pull/30273 + force starting adb server before launching AVD.

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D24638504

fbshipit-source-id: 7a379eb1db49ab418d9d91d20b49a02bbc0bc71c
2020-10-31 12:48:54 -07:00
Héctor Ramos 864cdf3383 Stop using S3 CocoaPods Specs mirror (#30265)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/30265

The CocoaPods Specs mirror provided by Circle CI is no longer supported, and is no longer necessary, as of CocoaPods v1.8. We are already using the CDN in the Podfile, so the step may be removed from the Circle CI config.

Reference: https://circleci.com/docs/2.0/testing-ios/#optimizing-cocoapods
Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D24601585

fbshipit-source-id: c794102cf573e0cf47ae936bf3c1eb386e089315
2020-10-30 23:03:26 -07:00
Héctor Ramos 538446e755 Bump Xcode to 12.1.0, bump CocoaPods 1.10.0 (#30250)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/30250

Upgrade the version of Xcode used in Circle CI to Xcode 12.1.0, and target iOS 14.1 in tests.

Reference:
* Circle CI Xcode 12.1 container manifest (new version):
https://circle-macos-docs.s3.amazonaws.com/image-manifest/v3985/index.html
* Circle CI Xcode 11.6.0 container manifest (previous version): https://circle-macos-docs.s3.amazonaws.com/image-manifest/v3299/index.html

> Source: https://circleci.com/docs/2.0/testing-ios/#supported-xcode-versions

The default version of CocoaPods used in the Xcode 12.1 container image has changed. Use `bundle exec` with `pod install` to ensure we use the same version of CocoaPods as prescribed in the Gemfile.

Changelog:
[iOS][Changed] - Update iOS project template for Xcode 12.1.0
[iOS][Changed] - Bump CocoaPods 1.10.0
[Internal] Bump Xcode version used for iOS tests.

Reviewed By: fkgozali

Differential Revision: D24545010

fbshipit-source-id: 4a39781352bc5a85dae55ed5cd4e1ed6043a4aeb
2020-10-30 23:03:26 -07:00
Joshua Gross dd9fd2acac Fix dispatchDraw crash
Summary:
For over a month I've been searching for a crash that occurs during Android's native `dispatchDraw` method on View. The stack traces didn't show anything useful - everything in the stack trace was native Android code,
not React Native code.

This also seems to only repro on certain vendors, and only on a very few React Native screens - I'm still not sure why either of those are the case, but from my repro, a *very* specific set of interactions needs to happen
to trigger this crash. See comments inline and an example stack trace.

Luckily, the fix is trivial. Since this code is used for animations, accessibility, and a number of other important interactions, I'm gating this change for now.

In general we must be careful to only mutate the View hierarchy only when we /know/ for certain it is safe to do so. Indirectly mutating the View hierarchy during measure, onMeasure, layout, dispatchDraw, etc, can all be
very dangerous. This is one of the last "escape hatches" that can cause view hierarchy modifications unexpectedly, so I think it's a very good idea to "secure" this further, and only update props synchronously here - and
ensure that other MountItems like `Delete` are definitely /not/ executed here.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D24639793

fbshipit-source-id: b6219ce882e8d2204b4d10bf99f6a1120a33cb5a
2020-10-30 20:40:24 -07:00
Joshua Gross 2cd89d040b Experiment: use int buffer to represent MountItems instead of concrete classes
Summary:
I've had my eyes on this optimization for a while: during TTRC especially, but really during any heavy render path, Fabric will create hundreds to thousands of MountItem class instances in order to construct a BatchMountItem.

This results in: hundreds/thousands of round-trip JNI calls, hundreds/thousands of Object allocations, etc. This will also result in increased memory and GC pressure.

Theoretically, by reducing the number of JNI calls and reducing allocations, we may be able to get some small wins in memory and CPU usage during very hot paths.

I am motivated to do this, in part, to indirectly measure the cost of JNI calls as well as allocating many objects vs an int buffer. I am unaware of such a measurement that we can use to make architectural decisions for React Native Android overall.

The other reason this could be a positive change: if it's successful and we can delete the old path, we'll be able to delete a bunch of Java classes entirely which is great for APK size wins.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D24631230

fbshipit-source-id: 86a46ffcaef4ecbec2e608ed226aed0b5c4b832e
2020-10-30 20:40:24 -07:00
Valentin Shergin d7b3daa643 Fabric: Removing `RCTExperimentSetSyncPerformanceFlag`
Summary:
Cleaning up an old experiment, it was `static true` for a couple of months already.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D24642808

fbshipit-source-id: 50ba955490d848a9c1698e1c6d0c296e833386f3
2020-10-30 15:45:21 -07:00
Peter Argany 192e821fbd Hook up logTaggedMarkerWithInstanceKey to performance logger [2/n]
Summary:
This re-uses the same logic as `logTaggedMarker` for `logTaggedMarkerWithInstanceKey`. When no instanceKey specified, use 0.

Changelog: [Internal]

Differential Revision: D24607919

fbshipit-source-id: 4a29e5ece9a5462eb1163185d26370ee873f1412
2020-10-30 14:05:11 -07:00
Peter Argany 4308f9f835 Add new ReactMarkers for bridgeless mode [1/n]
Summary:
These are new markers that will be placed around initializing an RCTInstance.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D24607905

fbshipit-source-id: 8e83a2476e2ae878c523217aeb5a3b4bfc5bf911
2020-10-30 14:05:11 -07:00
Samuel Susla 0217c14a11 Implement ScrollView.keyboardDismissMode
Summary: Changelog: [internal]

Reviewed By: shergin

Differential Revision: D24648120

fbshipit-source-id: 718be95dc87217fa6745535a3760ec23cc390444
2020-10-30 08:51:33 -07:00
Samuel Susla 96ecad4341 Trigger garbage collection when the app receive memory warning
Summary:
Changelog: [internal]

The condition inside `[RCTCxxBridge handleMemoryWarning]` was preventing JS VM from handling memory pressure if React Native was loading. This seems incorrect as loading only occurs once at the startup but memory pressure event occurs mostly after React Native was initialised. Therefore, JS VM wasn't handling memory pressure events.

Reviewed By: shergin

Differential Revision: D24646724

fbshipit-source-id: 7b4420fe675261e434c3427c8ad366ba0086a453
2020-10-30 08:18:58 -07:00
Hans Halverson be8fe21d06 Deploy Flow v0.137.0
Summary: Changelog: [Internal]

Reviewed By: mroch

Differential Revision: D24627713

fbshipit-source-id: 4a3760f504e13dc92bab52a182aa00e44d1f950d
2020-10-29 23:36:00 -07:00
Peter Argany ab21d7320e Fix crash in RCTEventEmitter
Summary:
According to the crash, RCTEventEmitter is being asked to emit events before RN is set up {emoji:1f928}. Neither the bridge, nor bridgeless mode is ready to send events.

In this scenario, drop the events on the floor instead of crashing.
Changelog: [Internal]

Reviewed By: naftaly

Differential Revision: D24634701

fbshipit-source-id: 933e5dfd15e5ee7c2215489305c71de46e78a9e5
2020-10-29 22:07:09 -07:00
Paige Sun e37708dfb6 Allow image loaders to enable/disable image telemetry
Summary:
When shouldEnableLoggingForRequestUrl is false, ImageTelemetry is not initialized, and no logging is done.

* Replace `- (NSString *)loaderModuleNameForRequestUrl:(NSURL *)url` with `- (BOOL)shouldEnableLoggingForRequestUrl:(NSURL *)url`
* Rename RCTImageLoaderInstrumentableProtocol.h -> RCTImageLoaderLoggableProtocol.h

Reviewed By: fkgozali

Differential Revision: D24523984

fbshipit-source-id: a5463eceea1c40f9452b0ad2ee6bf047f71a02c1
2020-10-29 21:59:59 -07:00
Alexey Litvinov 1b71ec4e81 update eslint-plugin-react to 7.21.5 version
Summary:
The current available version of eslint-plugin-react is 7.21.4.
Update it to 7.21.5 to be able to use function-component-definition rule https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/function-component-definition.md

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D24619420

fbshipit-source-id: 3097c4d920aa41b2dcced8d0ef5224b04a36effe
2020-10-29 09:31:00 -07:00
Pasquale Anatriello 2707c17b07 Fix clone issue in YogaNodeJNIBase
Summary:
Changelog:
Fix the cloneWithChildren implementation that was not copying the list of children on the java object.

We were missing on copying the list of children when cloning. This is pretty bad as it means that the clone operation was mutating the old node as well as the new. When multiple threads were involved this could cause crashes.

Reviewed By: SidharthGuglani

Differential Revision: D24565307

fbshipit-source-id: 4e2e111db389e25c315ce7603b4018ac695bb0f1
2020-10-29 09:26:41 -07:00
Jason Safaiyeh 4b92e2e53d Update Node version to >= 12 (#30252)
Summary:
Update engines to node >= 12

## 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] [Changed] - Update node engine to version 12

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

Reviewed By: yungsters

Differential Revision: D24558093

Pulled By: fkgozali

fbshipit-source-id: 7a10bb935f89ba3374b0909161db9974e1fc477a
2020-10-29 07:40:36 -07:00
Kevin Gozali 17a8737ecb Codegen Android: update Docker configuration to support codegen (#30268)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/30268

This addresses the following CI failure:
https://app.circleci.com/pipelines/github/facebook/react-native/6847/workflows/36d59aab-bc4a-4d21-9ce1-a8348e71aea3/jobs/173669

The problem was missing directories because we didn't copy the relevant ones for docker build.

In addition:
* The codegen depends on `invariant`, but didn't specify the dep in package.json. This fixes it.
* Also ask Metro to ignore buck-out

Note that this will depend on docker image v1.0.5 (to be released later) to fully build. v1.0.5 will need to install `rsync`, see this patch: https://gist.github.com/fkgozali/1d8cae92a5bc521e0f2e4f275008db93. With my test image (of 1.0.5 local build), I got the docker build to pass:

```
$ docker build -t reactnativeci/android -f .circleci/Dockerfiles/Dockerfile.android .
[+] Building 1624.2s (27/27) FINISHED
 => [internal] load build definition from Dockerfile.android                                                                                           0.0s
 => => transferring dockerfile: 52B                                                                                                                    0.0s
 => [internal] load .dockerignore                                                                                                                      0.0s
 => => transferring context: 2B                                                                                                                        0.0s
 => [internal] load metadata for docker.io/reactnativecommunity/react-native-android:1.0.5                                                             0.0s
 => [1/22] FROM docker.io/reactnativecommunity/react-native-android:1.0.5                                                                              0.0s
 => [internal] load build context                                                                                                                      5.6s
 => => transferring context: 7.11MB                                                                                                                    5.5s
 => CACHED [2/22] ADD .buckconfig /app/.buckconfig                                                                                                     0.0s
 => CACHED [3/22] ADD .buckjavaargs /app/.buckjavaargs                                                                                                 0.0s
 => CACHED [4/22] ADD Libraries /app/Libraries                                                                                                         0.0s
 => CACHED [5/22] ADD ReactAndroid /app/ReactAndroid                                                                                                   0.0s
 => CACHED [6/22] ADD ReactCommon /app/ReactCommon                                                                                                     0.0s
 => CACHED [7/22] ADD React /app/React                                                                                                                 0.0s
 => CACHED [8/22] ADD keystores /app/keystores                                                                                                         0.0s
 => CACHED [9/22] ADD packages/react-native-codegen /app/packages/react-native-codegen                                                                 0.0s
 => CACHED [10/22] ADD tools /app/tools                                                                                                                0.0s
 => CACHED [11/22] WORKDIR /app                                                                                                                        0.0s
 => CACHED [12/22] RUN buck fetch ReactAndroid/src/test/java/com/facebook/react/modules                                                                0.0s
 => CACHED [13/22] RUN buck fetch ReactAndroid/src/main/java/com/facebook/react                                                                        0.0s
 => CACHED [14/22] RUN buck fetch ReactAndroid/src/main/java/com/facebook/react/shell                                                                  0.0s
 => CACHED [15/22] RUN buck fetch ReactAndroid/src/test/...                                                                                            0.0s
 => CACHED [16/22] RUN buck fetch ReactAndroid/src/androidTest/...                                                                                     0.0s
 => CACHED [17/22] RUN buck build ReactAndroid/src/main/java/com/facebook/react                                                                        0.0s
 => CACHED [18/22] RUN buck build ReactAndroid/src/main/java/com/facebook/react/shell                                                                  0.0s
 => [19/22] ADD . /app                                                                                                                                28.1s
 => [20/22] RUN yarn                                                                                                                                  50.2s
 => [21/22] RUN ./gradlew :ReactAndroid:downloadBoost :ReactAndroid:downloadDoubleConversion :ReactAndroid:downloadFolly :ReactAndroid:downloadGlog  235.8s
 => [22/22] RUN ./gradlew :ReactAndroid:packageReactNdkLibsForBuck -Pjobs=1                                                                         1240.1s
 => exporting to image                                                                                                                                64.2s
 => => exporting layers                                                                                                                               64.2s
 => => writing image sha256:6449dc629ed12395c9c98d880fb421284193bc9b5d2a77578760a23b5c3c1acd                                                           0.0s
 => => naming to docker.io/reactnativeci/android
```

To test with a custom local docker image:
* https://docs.docker.com/get-started/ (install the Mac client)
* git clone https://github.com/react-native-community/docker-android
* Make the local change then create the fake v1.0.5 image:
  * `docker build --tag reactnativecommunity/react-native-android:1.0.5 .`
  * Run the image from Docker Mac client
* Then build RN docker test pasted above.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D24611539

fbshipit-source-id: 7435e720bbb2e8d6528ce2a7344f1def15803898
2020-10-28 21:48:20 -07:00
Valentin Shergin 306a8adade Fabric: Using shared pointer for event counter in ViewEventEmitter
Summary:
The callback `dispatchEvent` is called asynchronously on the JavaScript thread, so all data it uses must be copied to the lambda. To work around this constraint we use a shared pointer for the counter.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D24598840

fbshipit-source-id: fb5581858d54dc806863caf0c7c4f612ed6046e2
2020-10-28 19:48:10 -07:00
Valentin Shergin aead26dddd Fabric: Assert if `props` in `updateProps:oldProps:` is nullptr
Summary: Just an assert.

Reviewed By: JoshuaGross

Differential Revision: D24600634

fbshipit-source-id: 0be765d79bc71b232f559c6f821444f37462feef
2020-10-28 19:40:16 -07:00
Rubén Norte 697d7610ab Annotate usedReactFabric in TTRC
Summary:
Adds an annotation in the performance logger that indicates if the component was rendered using Fabric or not.

Changelog: [internal]

Reviewed By: JoshuaGross, ShikaSD

Differential Revision: D24596131

fbshipit-source-id: 489f3a03f09c5425c870678ed593ee8f16a2d98b
2020-10-28 18:45:44 -07:00
Andrei Shikov c2b75901cf Change the order of handling exception and clearing react instance manager
Summary:
Changelog: [Internal]
Added better explanation to help debugging ViewManager crashes

Reviewed By: makovkastar

Differential Revision: D24539229

fbshipit-source-id: 36a010324cbf29dfe63784682715b963394a87fb
2020-10-28 17:42:05 -07:00
Samuel Susla 07d090dbc6 Implement ScrollView.scrollToOverflowEnabled
Summary:
Changelog: [internal]

Add missing implementation of [scrollToOverflowEnabled](https://reactnative.dev/docs/scrollview#scrolltooverflowenabled).

Reviewed By: JoshuaGross

Differential Revision: D24536893

fbshipit-source-id: a540b9b5b302404cc0a431f666bba269da849c50
2020-10-28 06:44:38 -07:00
Christoph Nakazawa a6825e590a Clean up `symbolicateStackTrace`
Summary:
This diff cleans up a bunch of code in `symbolicateStackTrace`. According to motiz88 all of it is dead code and I can confirm symbolication does not break with the changes applied.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D24585849

fbshipit-source-id: 5b2c76f56dbbbf27449ce1472cdd0271ed230c35
2020-10-28 03:00:00 -07:00
Dulmandakh e9fd93f53f Bump Gradle Wrapper to 6.7 (#30200)
Summary:
Bump Gradle Wrapper to 6.7, to keep tooling on edge. Here are the highlights of this release:
- File system watching is ready for production use
- Declare the version of Java your build requires
- Java 15 support

## Changelog

[Android] [Changed] - Bump Gradle Wrapper to 6.7

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

Test Plan: RNTester builds and runs as expected. Also my apps.

Reviewed By: cpojer

Differential Revision: D24560233

Pulled By: fkgozali

fbshipit-source-id: 0d94b4527b2ee5b28b22478128c25761929fbdc7
2020-10-27 23:35:51 -07:00
Dulmandakh dfa9db49e3 bump Android Gradle Plugin to 4.1.0 (#30201)
Summary:
Android Studio 4.1 release with Android Gradle Plugin 4.1.0, thus I expect developers will update to newer version and expect React Native support. Thus release include many fixes and improvements, see[release notes](https://developer.android.com/studio/releases/gradle-plugin#4-1-0), but most importantly Google released it's API documentation at https://developer.android.com/reference/tools/gradle-api. We lacked the API documentation to develop proper React Gradle Plugin.

## Changelog

[Android] [Changed] - bump Android Gradle Plugin to 4.1.0

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

Test Plan: RNTester builds and runs as expected, also my apps.

Reviewed By: cpojer

Differential Revision: D24560213

Pulled By: fkgozali

fbshipit-source-id: 9cf1e2373f278885b35b4f9176c7ad736ec50f6b
2020-10-27 23:35:51 -07:00
Kevin Gozali 3a41125e80 Android CI: Fix up //packages/react-native-codegen:setup_cli src copy issue
Summary:
This fixed bad src copy for Buck-building: `//packages/react-native-codegen:setup_cli`. Using rsync -L will correctly copy file contents instead of preserving symlinks (which confused yarn).

Changelog: [Internal]

Reviewed By: hramos

Differential Revision: D24577333

fbshipit-source-id: 4f586ba95d2d95d6ce8e3389e355cfb1a9121745
2020-10-27 17:27:33 -07:00
generatedunixname89002005325674 1903f6680d Daily `arc lint --take GOOGLEJAVAFORMAT`
Reviewed By: zertosh

Differential Revision: D24561115

fbshipit-source-id: f9b1a529e4421be77c5baae5f3eab450602fb988
2020-10-27 15:01:48 -07:00
Emily Janzer bb8d0f5732 Set color filter so that the arrow matches the text color
Summary: We support setting the text color in the ReactPicker component, but we don't apply the text color to the little arrow icon that appears next to it. This diff applies the color tint from the picker's primary text color (set with a style prop on the main picker component, *not* the 'color' prop on the Picker.Item) to the background of the picker, which tints the arrow icon.

Reviewed By: makovkastar

Differential Revision: D24480642

fbshipit-source-id: 7ce84d616ae677da8975be9444428392020c57dc
2020-10-27 14:57:37 -07:00
Dulmandakh 1e78e0655d bump okio to 1.17.5 (#30204)
Summary:
Bump Okio to 1.17.5, which includes fixes for many bugs and crashes since current version. Also removed android.enableR8=false from gradle.properties because it's deprecated. And moved FEST_ASSERT_CORE_VERSION from gradle.properties to build.gradle because it's used in single line.

## Changelog

[Android] [Changed] - bump Okio to 1.17.5

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

Test Plan: RNTester builds and runs as expected.

Reviewed By: hramos

Differential Revision: D24560711

Pulled By: fkgozali

fbshipit-source-id: 433075293ca2dc41869dbb272d674625639c8b83
2020-10-27 12:13:34 -07:00
Janic Duplessis d50a425e92 Use $projectDir instead of $rootDir for ReactAndroid codegen (#30220)
Summary:
When working with RN installed from npm and a regular project structure `$rootDir` won't be at the react-native package root. Instead we can use `$projectRoot` which will always be the ReactAndroid folder.

## Changelog

[Android] [Internal] - Use $projectDir instead of $rootDir for ReactAndroid codegen

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

Test Plan: Test building an app with RN as a regular dep with codegen enabled

Reviewed By: hramos

Differential Revision: D24560634

Pulled By: fkgozali

fbshipit-source-id: 434d32f37e6f9d48a8c562655ceff7249bd056ce
2020-10-27 12:01:35 -07:00
Oleksandr Melnykov 3ea899f3fb Pass segment hash from JS to Java
Summary: Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D24333057

fbshipit-source-id: cb65ae0c21a4b425ea8fd462e8a42910cf3f8507
2020-10-27 10:13:02 -07:00
Janic Duplessis 1e9d7b70fc More reliable way to get ReactAndroid build dir in Android-prebuilt.mk (#30222)
Summary:
Pass the ReactAndroid project build directory as a variable to the ndk build so it can be used instead of assuming that the build directory is under ReactAndroid/build.

## Changelog

[Internal]

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

Test Plan: Tested in an app with a custom build directory

Reviewed By: yungsters

Differential Revision: D24560643

Pulled By: fkgozali

fbshipit-source-id: cc65a70582f546ca2e2ca9fb6a2ff03ea70ca9d8
2020-10-27 10:06:58 -07:00
Kevin Gozali 4630e57821 Codegen Android: fixed CI due to bad SRC->OUT dir copy
Summary:
The recursive copy statement fixed here behaved differently in MacOS vs Linus (CI), because of the missing dot (.)

The trailing slash on the source directory behaves differently on Mac (BSD) than Linux (GNU):

> If the source_file ends in a /, the contents of the directory are copied rather than the directory itself.

This should fix the CI failure: https://app.circleci.com/pipelines/github/facebook/react-native/6847/workflows/36d59aab-bc4a-4d21-9ce1-a8348e71aea3/jobs/173681

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D24560543

fbshipit-source-id: c3ab2c28616b717891bcf5d2ad762340cfb97e3d
2020-10-27 09:26:32 -07:00
Ramanpreet Nara 758b63313c Use custom require hook to strip Flow types from NativeModule spec parser
Summary:
## Context
We currently run ESLint using `flow-node`. This is a very recent change that was introduced in these two diffs:
- Switch VSCode ESLint plugin using flow-node: D24454702.
- Switch all ESLint scripts to use flow-node: D24379783 (ad5802cf91).

## Problem
Because `react-native/eslint-plugin-codegen` (written in vanilla JavaScript) requires two files from `react-native-codegen` (written with Flow typings), we force all requires executed while initializing ESLint to compile out Flow types. Issues:
- In the grand scheme of things, this is such a tiny and isolated problem. It shouldn't be the reason why we switch over to using flow node. That's a larger decision that should be discussed outside of this diff.
- On VSCode cold start, in D24454702, I measured that using flow-node adds approximately 320ms to JavaScript file lint time. So, this is just slow.

## Solution
- Switch ESLint back to using regular node:
   - Revert the changes to VSCode's ESLint plugin: D24454702
   - Revert the changes to the internal ESLint scripts: D24379783 (ad5802cf91).
- Inside the ESLint plugin, register a temporary require hook to remove Flow types from the NativeModule spec parser, before we require it. We de-register this hook after the requires finish.

## Implementation Notes:
- The `with-babel-register/` is a fork of `babel/register`, except I simplified the implementation based on the assumption that we're using it literally to only compile `react-native-codegen`.
- `with-babel-register/` uses a disk cache, so we only call transformSync when a the input file (1) hasn't been transformed before, or (2) the cache entry was created before the file was last modified.
- I ported over the source-map logic, so that when the NativeModule spec parser throws non-parsing errors, we get the correct stack trace. **Note:** I'm not sure if the source maps will work if there's a babel/register earlier during initialization. However, I don't think this will pose an actual problem, since we don't use a babel/register hook earlier. So, I think we should punt on this investigation.

## Alternative: Why aren't we using babel/register?
Every time you call babel/register, it replaces the last registered hook. We don't want the ESLint plugin to be changing any existing require hooks that people have set up. Abandoned diff with babel/register: D24519349.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D24551549

fbshipit-source-id: bbd7c5be44f74c0e9adbb20fe86e09802410b123
2020-10-27 00:41:47 -07:00
Kevin Gozali f023519e49 TurboModule Android: Enable TurboModule by default on RNTester
Summary:
This does a few things:
* Remove USE_CODEGEN flag so that TurboModule is enabled by default for RNTester
* Use the codegen output for Java/JNI spec files
* Remove the checked in com.facebook.fbreact.specs Java/JNI files

Changelog: [Changed][Android] RNTester now enables TurboModule by default using codegen.

Reviewed By: RSNara

Differential Revision: D24382083

fbshipit-source-id: 87e3e0581bac3287ef01c1a0deb070c1d7d40f2d
2020-10-26 23:47:54 -07:00
Kevin Gozali f2ba978cad Codegen Android: build react-native-codegen via yarn when building from source
Summary:
The Gradle codegen integration requires the JS CLI to be first built via `yarn run build`. This commit puts that logic in a `build.sh` script, then defines a Gradle task to build it.

Changelog: [Internal]

Reviewed By: hramos

Differential Revision: D24556992

fbshipit-source-id: 7092de7c1126edc157b122f4b2243e55f7188846
2020-10-26 23:47:54 -07:00
Joshua Gross 3ddba567a8 Animated module: don't use random IDs as waiting identifier for queueing
Summary:
In D24521951 (2ff1d4c041) I refactored the JS-side queueing for NativeAnimated API calls, and used randomized IDs for queueing. This could cause bugs or unexpected behavior, and potentially crashes, if there's ever a collision in random numbers generated or
a collision between random number and one of the deterministic numbers generated in createAnimatedComponent.

In this diff I make both of them namespaced with a string, and deterministic, to eliminate any potential collisions. This could also be slightly faster (but not meaningfully) since we're not relying on Math.random.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D24553557

fbshipit-source-id: 8b765e21597ad4f8e641453c1f9f90bdf1ee022f
2020-10-26 22:14:25 -07:00
Kevin Gozali e9116519c8 Codegen iOS: use the codegen target from Libraries just like for Android
Summary:
To unify with Android, this uses the target off the same BUCK file.

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D24522269

fbshipit-source-id: 5aa0c08962890b884081faeb1ec801aebec9c2dd
2020-10-26 22:02:05 -07:00