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

20070 Коммитов

Автор SHA1 Сообщение Дата
Joshua Gross 03ef81bfa2 Fix taps not working after scrolling / scroll position not being updated in C++
Summary:
Problem: ScrollView offset was not being reported to the C++ ScrollView side of Fabric.
This results in taps not working correctly, for example if you tap a button inside scroll view after you scrolled, the tap might not trigger anything.
The root cause of this is our implementation of detecting whether scroll view has stopped scrolling.
To make this more robust, I now require that multiple "frames" have not scrolled because it's easy to trigger race conditions by scrolling very fast.
We also explicitly call `updateStateOnScroll` in a couple more places.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21496396

fbshipit-source-id: 2e565dd2fc4fc1ce582daa8a449c520e7cb19be0
2020-05-10 12:58:49 -07:00
Tim Yung a1ac2518a3 TextInput: Default `blurOnSubmit` in JS
Summary:
Consolidates the logic for the default value of `blurOnSubmit` on `TextInput` in the JavaScript component.

This only materially impacts Fabric.

Changelog:
[Internal]

Reviewed By: mdvacca

Differential Revision: D21491482

fbshipit-source-id: 16d8aba32e7d0321a4583e87e03405ea587e35d4
2020-05-09 17:24:19 -07:00
Valentin Shergin aece57be29 Fabric: Calling JSVM GC on memory pressure event on iOS
Summary:
This change is especially important for Fabric when a lot of objects (mostly `ShadowNode`s) have shared ownership. Without this change, JSVM could not know that bunch of natively allocated objects should be deallocated.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: dulinriley

Differential Revision: D21484773

fbshipit-source-id: 46e32de0f108082e60df346884c9287023156149
2020-05-08 17:34:15 -07:00
David Vacca f535c8b4bb Inject ImagePipeline into FrescoModule
Summary:
This diff refactors the FrescoModule in order to receive an ImagePipeline as a parameter. This is necessary to ensure the same ImagePipeline is used by every RN module

changelog: [Internal][Android]

Reviewed By: JoshuaGross

Differential Revision: D21428346

fbshipit-source-id: 70a6cc57c8585fe74b6d0b0d1fd86c539974ec23
2020-05-08 16:37:41 -07:00
Emily Janzer a4a47b9a1e Expose RuntimeExecutor on CatalystInstance (#28851)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/28851

This diff creates a RuntimeExecutor that uses the bridge and exposes it on CatalystInstanceImpl.

Changelog: [Internal]

Reviewed By: mdvacca, RSNara

Differential Revision: D21051949

fbshipit-source-id: b3977fc14fa19089f33e297d29cedba0d067526d
2020-05-08 16:13:42 -07:00
Peter Argany 13ee5c4c16 Enable animations in bridgeless mode on iOS
Reviewed By: ejanzer

Differential Revision: D21465166

fbshipit-source-id: b34e8e97330b897e20d9a4b05dba1826df569e16
2020-05-08 16:13:42 -07:00
Samuel Susla 77d1380f17 Remove RCTLogError from RCTScrollViewManager.calculateChildFrames
Summary: Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21483553

fbshipit-source-id: 0c681979a4988c36cfa6f05aa5bca896590f9e3d
2020-05-08 15:45:37 -07:00
empyrical c67e1fe42f Codegen: Add prepublish script to build Flow files (#28827)
Summary:
*This is a follow-up to https://github.com/facebook/react-native/issues/28645, redone using a build script based off of Metro's build script instead of using `flow-remove-types` and `flow-copy-source`.*

This pull request adds a build step to `react-native-codegen` that builds the Flow-annotated JS files so that users of the NPM module `react-native-codegen` do not need to use require hooks to be able to import it.

A new build script, `scripts/build.js` is added that builds every JS file in `src/` into a `lib/` folder, and also copies over the original Flow annotated files to `lib/` with a `.js.flow` extension, so users of `react-native-codegen` can still typecheck against it using Flow. The shell scripts in `src` are also copied over. It is based off of the [build script from Metro](00867816eb/scripts/build.js)

## Changelog

[General] [Added] - Codegen: Add prepublish script to build Flow files
Pull Request resolved: https://github.com/facebook/react-native/pull/28827

Test Plan:
I am able to make use of the Codegen scripts without needing to use the `flow-node` CLI or the `flow-remove-types/register`
require hook.

Reviewed By: cpojer

Differential Revision: D21412173

Pulled By: hramos

fbshipit-source-id: 26ae67cdd04652ca4700a069a234a25558773cb1
2020-05-08 15:41:35 -07:00
Enes 69ce9c21d4 Update .gitignore (#28789)
Summary:
When you profile your heap and memory allocations with Memory Profiler, files with *.hprof extension are created in /android folder that has big sizes (up to 600 MB for each). These files may be needed to add to gitignore.

## 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] - Add *.hprof files to gitignore
Pull Request resolved: https://github.com/facebook/react-native/pull/28789

Differential Revision: D21432927

Pulled By: hramos

fbshipit-source-id: a20f12645de5ca0874c9130094e2f97fe16b2203
2020-05-08 15:36:15 -07:00
Héctor Ramos 91a49d8827 Add script to generate native modules specs with react-native-codegen
Summary:
Adds a script that uses `react-native-codegen` to generate FBReactNativeSpec.
The generated output should not be considered ready for production use at this time.
The goal of adding this script at this time is to demonstrate the current status of native modules specs code generation in open source.

For example, the generated output may be used in RNTester, with some modifications due to some naming differences in react-native-codegen's output when compared to the FBReactNativeSpec files generated by the old codegen.

Usage:

```
./scripts/generate-native-modules-specs.sh ./codegen-out
```

Changelog: [Internal]

Reviewed By: TheSavior

Differential Revision: D21471004

fbshipit-source-id: 5ff3c57807d9ba2c91dc7fe32d227d218732b059
2020-05-08 12:23:35 -07:00
Kevin Gozali 164d47f30a label react-native-github targets
Summary:
For internal code attribution.

Changelog: [Internal]

Reviewed By: zlern2k

Differential Revision: D21468924

fbshipit-source-id: 59cd2a52e0ae46bedbf54816820a5f40b684da8b
2020-05-08 00:36:17 -07:00
Will Holen bf837d6373 Add support for Debugger.setInstrumentationBreakpoint
Summary:
This diff adds support for the "beforeScriptWithSourceMapExecution" instrumentation
breakpoint via "Debugger.setInstrumentationBreakpoint".

CDP describes it as a breakpoint, but we just set a flag in the inspector. A
fake breakpoint ID is synthesized for optional removal later.

Changelog: [Internal] Add Debugger.setInstrumentationBreakpoint to Hermes Inspector

Reviewed By: mhorowitz

Differential Revision: D21418218

fbshipit-source-id: 90fa49c0954980993815322d3a7effee416ed5db
2020-05-07 21:05:30 -07:00
Will Holen 938aa86013 Remove Hermes.setPauseOnLoad message
Summary:
This removes the Hermes.setPauseOnLoad. It will be replaced by the more standard
Debugger.setInstrumentationBreakpoint's "beforeScriptExecution" event.

ChangeLog: [Internal] Remove Hermes.setPauseOnLoad message (to be replaced)

Reviewed By: mhorowitz

Differential Revision: D21418219

fbshipit-source-id: 93c53801c23487f9336b322c2bd737663ec21b97
2020-05-07 21:05:30 -07:00
David Vacca 14a0f3fdea Eager initialize Fabric Android classes
Summary:
This diff eager initializes Fabric Android classes. This should help load all the Fabric classes at Bridge load time.

changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D21460507

fbshipit-source-id: 4b8d5c4e2d19e3a7eb3077027071e64ff16f1cbd
2020-05-07 18:04:54 -07:00
Héctor Ramos 6e88ab6bb2 Avoid redefining id when a property is named 'id'
Summary:
Handle properties named 'id' as a special case.

An example of a native module that ran afoul of this is `ExceptionsManager`.

Observe how the ExceptionsManager spec at `Libraries/Core/NativeExceptionsManager.js` defines the ExceptionData type as containing an `id` property:

```
export type ExceptionData = {
  message: string,
  originalMessage: ?string,
  name: ?string,
  componentStack: ?string,
  stack: Array<StackFrame>,
  id: number,
  isFatal: boolean,
  // flowlint-next-line unclear-type:off
  extraData?: Object,
  ...
};
```

Prior to this change, the generated code would redefine id in the SpecReportExceptionData struct...

```
 namespace JS {
   namespace NativeExceptionsManager {
     struct SpecReportExceptionData {
       // ...redacted...
       double id() const; <---
       // ...redacted...

       SpecReportExceptionData(NSDictionary *const v) : _v(v) {}
     private:
       NSDictionary *_v;
     };
   }
 }
```

...which would result in a build time error:

```
 inline double JS::NativeExceptionsManager::SpecReportExceptionData::id() const
 {
   id const p = _v[@"id"];
   ^--- build time error here
   return RCTBridgingToDouble(p);
 }
```

Comparing the above example  with the currently checked in `FBReactNativeSpec.h`, I see the expected output should be:

```
 namespace JS {
   namespace NativeExceptionsManager {
     struct SpecReportExceptionData {
       // ...redacted...
       double id_() const;
       // ...redacted...

       SpecReportExceptionData(NSDictionary *const v) : _v(v) {}
     private:
       NSDictionary *_v;
     };
   }
 }
```

...and...

```
inline double JS::NativeExceptionsManager::SpecReportExceptionData::id_() const
 {
   id const p = _v[@"id"];
   return RCTBridgingToDouble(p);
 }
```

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D21395463

fbshipit-source-id: e412648013ff9f70ebd294b6f5f81f1faccb4604
2020-05-07 17:58:00 -07:00
Héctor Ramos 853dc04d23 Handle optional return types/values
Summary:
Use folly to wrap optional return types and values as needed.

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D21395439

fbshipit-source-id: a0e84e20717887e79a8565332a11fef42ebd3487
2020-05-07 17:57:59 -07:00
David Vacca 11b9bad5b4 Small refactor on text measure method
Summary:
Quick refactor of TextLayoutManager class

changelog: [Internal]

Reviewed By: shergin

Differential Revision: D21446736

fbshipit-source-id: a32bdf534b167e128c8c0054cf6a126131fa740a
2020-05-07 17:11:49 -07:00
David Vacca 561a97f699 Extend Text measurement to support includeFontPadding prop
Summary:
This diff exposes the Text.includeFontPadding prop to java, then it uses the prop to calculate the height of Text components correctly.

changelog: [Internal][Fabric] Internal change in Fabric to support Text.includeFontPadding prop in fabric

Reviewed By: shergin

Differential Revision: D21446737

fbshipit-source-id: efe73fb6b0d402c3275ac8c012fa8fa06b743bdd
2020-05-07 17:11:48 -07:00
David Vacca 4e59508a8e Extend ParagraphAttribute to store the includeFontPadding prop
Summary:
This diff extends the ParagraphAttribute class to store the value of the includeFontPadding prop.
Note that this is an Android only prop, I'm not creating android blocks to improve "cleanliness" of the code.

changelog: [Internal][Fabric] Internal change in Fabric to support Text.includeFontPadding prop in fabric

Reviewed By: shergin

Differential Revision: D21446738

fbshipit-source-id: 0543e86aa18ce10f7a56bbaafe111cce0179ea86
2020-05-07 17:11:48 -07:00
João Vieira 16ea9ba813 Support excluding multiple platforms.
Summary:
Currently the schema only allows to exclude a single platform (iOS OR Android). There are cases where we need to exclude multiple. This change converts the previous `excludePlatform` string property into an `excludePlatforms` array.

Changelog:
[Internal][Changed] - Added support to exclude multiple platforms in Codegen.

Reviewed By: sammy-SC

Differential Revision: D21426950

fbshipit-source-id: eff36ffa207109274794b4b300bf6313f8286161
2020-05-07 09:43:52 -07:00
Eloy Durán 7bb1c4e1b8 Enable with CocoaPods `:configuration` (#28796)
Summary:
~~⚠️ Depends on https://github.com/facebook/flipper/pull/1086 and a new Flipper release.~~
Fixes 17f025bc26 (commitcomment-38831234)

Currently user’s are being told to add a definition of the `FB_SONARKIT_ENABLED` macro and examples, including those in stock React Native templates, set this for the user by making use of a `post_install` hook in the user’s `Podfile`. This leads to confusion, fragile code [when a user’s project dir structure deviates from vanilla], and is ultimately not necessary as CocoaPods already has dedicated mechanisms to:

* specify build settings (through the `xcconfig` property);
* and selectively include certain pods only in certain build configurations (e.g. debug).

## 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] - Entirely control Flipper being enabled through inclusion in Podfile and optionally limiting to certain build configurations using the `:configuration` directive.
Pull Request resolved: https://github.com/facebook/react-native/pull/28796

Test Plan: Tested using the changes of https://github.com/facebook/flipper/pull/1086 in a new app that uses RN `master`.

Reviewed By: priteshrnandgaonkar

Differential Revision: D21449754

Pulled By: passy

fbshipit-source-id: 9ff7c7f4ffc32b364b1edd82b94e0b80c3997625
2020-05-07 08:36:55 -07:00
Rubén Norte 26c120c632 Handle initialProps as optional in renderApplication
Summary:
Pass a default empty object to `AppContainer` if no `initialProps` were passed to `renderApplication`.

This prevents issues on Android, where we do not pass a default empty `initialProps` from native, as we do on iOS.

Changelog: [General] [Fixed] - Handle nullish `initialProps` correctly in `renderApplication`

Reviewed By: motiz88

Differential Revision: D21448692

fbshipit-source-id: 9630bdc2414532999abf3bf9da25047f0482fcab
2020-05-07 05:02:26 -07:00
Pieter De Baets e566c7ec7b Add virtual destructor to JSError
Summary:
We consume Hermes through multiple .so's, which means we have multiple (weak) typeinfo definitions of facebook::jsi::JSError. Previously we were using gnustl, which would strcmp typeinfo to decide whether a certain exception handler applies, which meant this didn't cause any major issues. However since this is deprecated, we recently switched to libc++, which does not have this by behaviour (or it does, but behind a flag I'm not sure how to enable). This causes any JS exceptions to fall through from our exception handlers and fatal the app.

This problem is actually documented in the common Android NDK problems page: https://android.googlesource.com/platform/ndk/+/master/docs/user/common_problems.md#rtti_exceptions-not-working-across-library-boundaries

The suggested solution is to ensure that any exception types have a key function defined (a non-pure, out-of-line virtual function). The simplest one to add is a virtual destructor. This makes the object file that holds the implementation of the destructor export a non-weak typeinfo definition which will at load time override the other weak versions.

I'm not sure why we're the first to hit this. RN's JSIExecutor doesn't explicitly reference JSError which probably helps (https://github.com/facebook/react-native/blob/master/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp#L256-L258) and they also don't use unguarded callbacks like we do.

Changelog: [Internal]

Reviewed By: mhorowitz

Differential Revision: D21426524

fbshipit-source-id: 474284ada1ca2810045dc4402c420879447f9308
2020-05-07 04:15:14 -07:00
Yuanzhe Bian 851644cfc2 Fix Animated type
Summary:
- Fixed typing of Animated and fixed the callsites

Changelog: [Internal]

Reviewed By: kacieb

Differential Revision: D21311870

fbshipit-source-id: 386fb496ab00ef7917273dc3eb65e1ed76a8dd33
2020-05-07 00:06:27 -07:00
Nikita Lutsenko f4815fbad3 third-party | Move glog from xplat/third-party to third-party and create temporary redirect.
Summary:
Move and create an empty rule that redirects as well, to handle //arvr rules
Need to do this way, since ovrsource sync rules are in different repo.

allow_many_files
allow-large-files

Steps:
- [X] Move glog from xplat/third-party to /third-party
- [ ] Update references in ovrsource to translate to //third-party instead of //xplat/third-party
- [ ] Get rid of temporary rule
- [ ] Update fbsource/third-party/glog to 0.3.5 (what we have in ovrsource)

Changelog: [Internal] Update reference for glog from xplat/third-party to /third-party.

Reviewed By: yfeldblum

Differential Revision: D21363584

fbshipit-source-id: c1ffe2dd615077170b03d98dcfb77121537793c9
2020-05-06 19:04:33 -07:00
Valentin Shergin 025b6a74c8 Fabric: Cross-platform implementation of `SynchronousEventBeat` and `AsynchronousEventBeat`
Summary:
`SynchronousEventBeat` and `AsynchronousEventBeat` are a cross-platform re-implementation of run loop related parts of `MainRunLoopEventBeat` and `RuntimeEventBeat` (iOS specific classes for now). In the future, they will replace iOS- and Android-specifc event beat classes.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D21341996

fbshipit-source-id: 8eda9a5df537cd666b7728e32212a8bb5ddb3ab7
2020-05-06 18:28:52 -07:00
Valentin Shergin d76e03f85a Fabric: Introducing `RunLoopObserver`
Summary:
`RunLoopObserver` is one of the core interfaces that bridge intrinsically platform-specific functionality to cross-platform React Native core. `RunLoopObserver` allows subscribing for notifications about changes in a run loop life cycle. Primarily it supposed to be used for observing UI (aka main) and JavaScript execution thread/run-loop.
Having a `RunLoopObserver` implemented in a platform-specific manner allows building these components in a cross-platform manner:
* Sync and async UI event delivery pipeline;
* Timing for some animation engine;
* Timers (probably additional features are required).

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D21341997

fbshipit-source-id: 7ef61fb51f550dd0f2e89c64af657e0f0de029aa
2020-05-06 18:28:52 -07:00
Emily Janzer ca105f8b06 Update cocoapods (#28833)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/28833

The checked-in RNTester podfile was generated using Cocoapods version 1.9.1. This doesn't match the version currently used in CircleCI, which is 1.8.4. In order to update the offline mirrors and land them without breaking CircleCI, it seems we need to switch back to 1.8.4. This diff updates the podfile back to 1.8.4 and updates the offline mirrors.

Reviewed By: fkgozali

Differential Revision: D21392989

fbshipit-source-id: b14aa6e2798175534e9416410ba9d6877fb718c0
2020-05-06 17:00:33 -07:00
David Vacca 5c48c94f8c Fix measureLayout function for Virtual Nodes
Summary:
This diff fixes a NullPointerException thrown when calling measureLayout function on a virtual node.

changelog: [Android] Fix measureLayout function for VirtualTexts

Reviewed By: JoshuaGross

Differential Revision: D21435030

fbshipit-source-id: aba6d81f333464e49d2d769b111842e7ae8ce769
2020-05-06 16:35:27 -07:00
David Vacca ff0c62504b Ez Extend logging of Fabric
Summary:
Quick diff to log of content of UpdateState mount item. This is useful for debugging. Note this will ONLY be logged when the constant FabricUIManager.IS_DEVELOPMENT_ENVIRONMENT is set to true

changelog: [Internal][Android] internal log for fabric android

Reviewed By: JoshuaGross

Differential Revision: D21428345

fbshipit-source-id: d000eb6dbdd39d15935fa2102072790e17372682
2020-05-06 16:35:27 -07:00
Christoph Nakazawa 21d7a357f6 Upgrade to Yargs 15
Summary:
Only breaking changes appear to be dropped Node 6 support: https://github.com/yargs/yargs/blob/master/CHANGELOG.md. Deduplicates quite a few copies of Yargs, yay!

Changelog: [Internal]

(Note: this ignores all push blocking failures!)

Reviewed By: motiz88

Differential Revision: D21426137

fbshipit-source-id: b091e29ac2d9464d6ce9a716a99f7ae156a91a01
2020-05-06 15:36:35 -07:00
Valentin Shergin fa5b4c9e0c Fabric: Backward-compatible behaviour of `measureInWindow` and `measure`
Summary:
Before this change, in case of incorrect measurements, Fabric's implementation of `measure` and `measureInWindow` incorrectly returned negative height and width. Now it returns zeros (as classic React Native does).

Fabric:
This does not fix `measureLayout` called for virtual nodes. This is not so trivially to fix and it will be done separately.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross, yungsters, mdvacca

Differential Revision: D21433239

fbshipit-source-id: fbaf5ee35c690506822c634daac4426542c2cdcf
2020-05-06 15:16:04 -07:00
Tim Yung d14b89bd8a RN: Workaround Fabric + Virtual Text Press Bug
Summary:
Workaround for a bug with Fabric when pressing on virtual text.

Changelog:
[Internal]

(Note: this ignores all push blocking failures!)

Reviewed By: JoshuaGross

Differential Revision: D21432793

fbshipit-source-id: fe20eeadd5365707fb71edae7a76d374e26b4c86
2020-05-06 14:23:05 -07:00
Nat Mote 0c2c4bf33c Deploy Flow v0.124.0 to xplat/js
Summary:
Changelog: [Internal]

allow-large-files

Reviewed By: samwgoldman, cpojer

Differential Revision: D21413059

fbshipit-source-id: f3d111b40bfb88c182eab022925f7ae2dc47bc6b
2020-05-06 12:32:21 -07:00
Kevin Gozali de667fffa4 Moved some NativeModule JS specs to OSS
Summary:
For some reason the specs were internal, but the native impl is still in github. So let's move these to github for consistency.

Changelog: [Internal]

Reviewed By: hramos

Differential Revision: D21419934

fbshipit-source-id: f2c4486edca43c4348f3a3c6ce98f76a322bab0b
2020-05-06 12:20:48 -07:00
Rick Hanlon 41f0d9ba8f Rename error titles
Summary:
Based on feedback we're updating these titles to be more clear for their source.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D21413486

fbshipit-source-id: c144e7f759a4ff263b7ec80fa643eeb8ffac741b
2020-05-06 11:40:22 -07:00
Rick Hanlon 5066b662f2 LogBox - Always display the first fatal error
Summary:
This diff fixes an off-by-one error probably caused by my font ligatures where when exactly two exceptions are thrown at the same time we would show the second exception instead of the first. If three or more were thrown, we would show the second.

I also fixed some tests that had the wrong descriptions and wrong behavior enforced.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D21413186

fbshipit-source-id: 8e2940c89251dc042b10c6a2a2186089b6e7b53d
2020-05-06 11:40:22 -07:00
Paige Sun b0d0e51a77 iOS: Animated image should animate at the same speed regardless of framerate
Summary:
In iOS 11, [CADisplayLink](https://developer.apple.com/documentation/quartzcore/cadisplaylink)'s frameInterval was deprecated in favor of preferredFramesPerSecond, but these two properties have different underlying assumptions.

- set frameInterval to 2 for 30fps
- set preferredFramesPerSecond to 30 for 30fps. When you use preferredFramesPerSecond, assume frameInterval is 1.

This fix ensures gifs in <Image> component will animate at same speed regardless of framerate.

Reviewed By: shergin

Differential Revision: D21414014

fbshipit-source-id: 40ab23bab1990cf65d2802830b6835f350999537
2020-05-06 10:38:14 -07:00
Christoph Nakazawa 530dffa342 Cleanup unused dependencies
Reviewed By: kassens

Differential Revision: D21281288

fbshipit-source-id: cf566ad0628dc179b3753f2f25a11637c33dee24
2020-05-06 04:35:01 -07:00
Joshua Gross 10314fe621 Smoother scrolling in ScrollView, HorizontalScrollView
Summary:
Android ScrollView/HorizontalScrollView `smoothScrollTo` contains some logic that, if called multiple times in a short amount of
time, will treat all calls as part of the same animation and will not lengthen the duration
of the animation. This means that, for example, if the user is scrolling rapidly, multiple
pages could be considered part of one animation, causing some page animations to be animated
very rapidly - looking like they're not animated at all.

We use a custom animation to perform `smoothScrollTo` to improve the UX.

This resolves a longstanding issue in non-Fabric RN, as well as Fabric, since this code is shared between the platforms.

Changelog: [Update] Android ScrollView/HorizontalScrollView scrolls using custom animations instead of default Android `smoothScrollTo` implementation, leading to smoother scrolls for paginated ScrollViews

Reviewed By: mdvacca

Differential Revision: D21416520

fbshipit-source-id: 6ebe63cb054a98336b6e81253d35623fe5522f89
2020-05-05 22:27:47 -07:00
Emily Janzer edfd965c46 Update native module specs
Summary: As titled.

Reviewed By: fkgozali

Differential Revision: D21417307

fbshipit-source-id: 7c6b0179f9f1a5108da241d181a24f707a083deb
2020-05-05 19:37:02 -07:00
Héctor Ramos e8060ae103 Import folly and adjust whitespace to match old codegen
Summary:
Import folly to handle optionals (`folly::Optional<__type__>`)

Sort modules and indent generated code to match output from the old codegen. While not strictly necessary as these are generated files that should not be edited by hand, I found that matching the old codegen in this regard made it less of a chore when it came to comparing the output of both codebases.

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D21395231

fbshipit-source-id: 289d617d7a2d93724456c80afea57a49c108cb9b
2020-05-05 16:01:55 -07:00
Mats Byrkjeland de7f69a58e Fix type of exported Touchables: ComponentType -> AbstractComponent (#28737)
Summary:
Fixes https://github.com/facebook/react-native/issues/28726

When importing TouchableOpacity, it is treated as any by Flow. Replacing ComponentType with AbstractComponent works.

The [Flow documentation](https://flow.org/en/docs/react/types/#toc-react-componenttype) says the following about ComponentType:
> Note: In 0.89.0+, React.ComponentType is an alias for React.AbstractComponent<Config, any>, which represents a component with config type Config and any instance type.

So I'm thinking that since the instance type is treated as any with ComponentType, Flow treats TouchableOpacity as any as well.

## 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] - Fix Touchable{Opacity,Bounce,Highlight} being exported as `any` (Flow)
Pull Request resolved: https://github.com/facebook/react-native/pull/28737

Test Plan: I have done the same changes to react-native in my project's node_modules and seen that the components TouchableOpacity went from any to AbstractComponent with some props. Now I have a bunch of errors because I'm sending in wrong props to some touchables, which is good!

Reviewed By: cpojer

Differential Revision: D21362601

Pulled By: TheSavior

fbshipit-source-id: 5b98cc79eaef034eccdb7f47242f9f44be2ef2b8
2020-05-05 12:44:50 -07:00
Will Holen 4459c08219 Make column match fuzzy
Summary:
We are currently very strict about breakpoint location matching. This
diff allows some fuzz in the column, but not in the line.

Changelog: [Internal] Setting Hermes breakpoints no longer requires exact column match

Reviewed By: avp

Differential Revision: D21343198

fbshipit-source-id: a59786a9d63f9fe1ed576835ed660ba3343affe1
2020-05-05 12:04:10 -07:00
Christoph Nakazawa 1740233f38 Upgrade to Jest 26
Summary:
* Brings performance improvements from 25.5.x
* Reduces node_modules by 3 MiB, see https://github.com/facebook/jest/pull/9950/files?short_path=63580dd#diff-63580dd1e7078ce037f10f2fee7553b9
* Breaking changes: https://github.com/facebook/jest/blob/master/CHANGELOG.md

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D21369069

fbshipit-source-id: 81a9d50f8e541293a85ce3957cb962930ca05b11
2020-05-05 08:33:16 -07:00
Rubén Norte 4f5a092bf6 Pass initial props to WrapperComponent
Summary:
`renderApplication` receives the root component that we need to render and an optional wrapper component. There are cases where we want to use the initial props passed to the root component in the wrapper component as well (e.g.: to provide a specific context to the root component), so this adds modifies `AppContainer` to accept the initial props and inject them into the wrapper component.

Changelog: [General] [Added] - Modified `renderApplication` to forward `initialProps` to `WrapperComponent`

Reviewed By: fkgozali

Differential Revision: D21347486

fbshipit-source-id: 1c4f702a3875077630de1a44d3ac9ef2c80bc10c
2020-05-05 04:54:56 -07:00
Janic Duplessis 0348953914 Allow passing partial contentOffset to ScrollView on Android (#28817)
Summary:
Since support for contentOffset was added to horizontal ScrollView on android (30cc158a87) I'm seeing a crash in my app because of a library. What happens is that it passes a partial object for contentOffset so something like `{x: 1}` which causes a crash on Android.

According to the flow types the object should always contain both x and y but I think we should preserve the runtime behaviour and just use 0 like iOS does.

## Changelog

[Android] [Fixed] - Allow passing partial contentOffset to ScrollView on Android
Pull Request resolved: https://github.com/facebook/react-native/pull/28817

Test Plan: Tested that passing partial object for contentOffset does not crash.

Reviewed By: JoshuaGross

Differential Revision: D21396319

Pulled By: shergin

fbshipit-source-id: 4b52c868e3bfe183ff7f68a76ac34d1abd5e1069
2020-05-04 21:54:35 -07:00
Joshua Gross bb5d04366a Differ: fix TinyMap to prevent possible crashes in `find()` and `begin()`, and prevent erased elements from being iterated over
Summary:
The core issue solved in D21389371 was that erased elements of a TinyMap were being iterated over, because TinyMap has somewhat-complicated logic around cleaning out the underlying vector. In some very marginal cases, vectors were not being cleaned and an iterator pointing at erased elements was being returned.

The diff prevents some possible crashes in `begin()` and `find()` while making it much less likely to iterate over erased elements.

We also add a unit test to catch the case fixed in D21389371, in particular.

We also are keeping the code added in D21389371 (for now) since it's a cheap check, and will be a safeguard until we have rigorous testing around TinyMap. To be clear that logic should noop currently, but will prevent crashes in case guarantees around TinyMap change in the future.

Currently there is only one line of code that actually uses the TinyMap iterator, so this should be safe.

Reviewed By: shergin

Differential Revision: D21392762

fbshipit-source-id: 36dc998958c230fad01af93338974f8889cbcf55
2020-05-04 21:28:35 -07:00
Joshua Gross aae38c3dfe Support calling LayoutAnimation APIs in Fabric from JS
Summary:
Call Fabric's LayoutAnimation APIs from JS.

Changelog: [Internal] A step towards supporting LayoutAnimations on Fabric

Reviewed By: shergin, mdvacca

Differential Revision: D21297975

fbshipit-source-id: 6d530b01d8152e7c803a7c0299b918a32fb39dc0
2020-05-04 21:28:35 -07:00
Joshua Gross ca144fca3f Fix unit test compilation on Android
Summary:
Before, compilation fails with P130281113. After fixing BUCK target, fails with P130281201.

After all changes, the tests succeed.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21390996

fbshipit-source-id: c85aa43b3ef7fc9642d226ae706c937b2a5a408d
2020-05-04 21:28:34 -07:00