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

20203 Коммитов

Автор SHA1 Сообщение Дата
Samuel Susla 745ff1086a Prevent ABA problem during YogaLayoutableShadowNode cloning
Summary:
Changelog: [Internal]

# Problem
Yoga internally uses address of owner to determine whether a node should be cloned or it shouldn't.
During layout, it traverses the tree and looks whether current parent is equal to child's owner. If it isn't it means the yoga node is shared between 2+ trees and need to be cloned before mutated. Parent in yoga is stored as reference to the parent.

We can run into an issue where yoga node is shared between 2+ trees, but its current parent is equal to child's owner. This is because we reallocate new parent at address where its previous parent lived. This happens over few iterations, the old parent is first deallocated.

This is known as ABA problem.

# Solution

When we are cloning node, we loop over all children to see whether any of the is not using address of new `yogaNode_` as its owner. At this point we know this is accidental and set its owner to `0xBADC0FFEE0DDF00D`.

We chose `0xBADC0FFEE0DDF00D` because when someone is debugging this in LLDB and prints this address, it will hint them that it was artificially set and can string search for it in the codebase.

Reviewed By: shergin

Differential Revision: D21641096

fbshipit-source-id: c8b1b4487ea02b367f5831c1cdac055bce79c856
2020-05-21 07:20:20 -07:00
David Vacca 21afa62517 Serialize ART state into folly::dynamic
Summary:
This diff serializes ART state into folly::dynamic. this is necessary to send this data to Android

changelog: [Internal]

Reviewed By: shergin

Differential Revision: D21657608

fbshipit-source-id: 6c1b69af7d1dbe7de15e509f83c508a38294d89e
2020-05-21 00:11:51 -07:00
David Vacca 0305ff8ee0 Integrate ElementType Enum into state
Summary:
This diff replaces the usage of int to represent the type of elements for an Enum
changelog: [Internal] Internal change to support ART in fabric

Reviewed By: shergin

Differential Revision: D21657706

fbshipit-source-id: 7bda0210d50136477f0524695d5406e35074f09c
2020-05-21 00:11:51 -07:00
David Vacca b7ab3aaf61 Integrate State into ARTSurfaceViewShadowNode
Summary:
This diff integrates ART state into ARTSurfaceViewShadowNode

changelog: [Internal]

Reviewed By: shergin

Differential Revision: D21657611

fbshipit-source-id: 06bd4d610e2c52e0ef3bca423b93c9ad2318e8df
2020-05-21 00:11:51 -07:00
David Vacca 493d616521 Create internal State of ART based on Shadow Nodes
Summary:
This diff creates the internal state of ART based on its shadow nodes

changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D21657607

fbshipit-source-id: 0a15e90ee7465bf3a2b1001ff9d3198eb22fd708
2020-05-21 00:11:50 -07:00
David Vacca 192bea1613 Create classes to represent C++ state of ART
Summary:
This diff introduces a set of classes that are going to be used to represent the internal State of ART nodes

changeLog: [Internal][Android] Internal change to support ART in Fabric

Reviewed By: JoshuaGross, shergin

Differential Revision: D21657612

fbshipit-source-id: ea6d94b06807ff02d222dfa129a1cae384dceeaa
2020-05-21 00:11:50 -07:00
Ramanpreet Nara 4830085f40 Guard all NativeModulePerfLogger calls with a null check
Summary:
## Motivation
We got this crash T67304907, which shows a `EXC_BAD_ACCESS / KERN_INVALID_ADDRESS` when calling this line:
```
  NativeModulePerfLogger::getInstance().asyncMethodCallBatchPreprocessStart();
```
There are no arguments in that call, so I figured the only error could be when we try to invoke `getInstance()` or `asyncMethodCallBatchPreprocessStart()`.

This diff:
1. Removes the `NativeModulePerfLogger::getInstance()` bit. Now NativeModulePerfLogger is used via regular static C functions. So, there's no way that simply invoking one of the logging functions crashes the application: there's no vtable lookup.
2. Inside each logging function, when perf-logging is disabled, the global perflogger should be `nullptr`. This diff makes it so that in that case, we won't execute any code in the control group of the perf-logging experiment.

## Changes
**How do we enable NativeModule perf-logging?**
- Previously:
   - `NativeModulePerfLogger::setInstance(std::make_shared<FBReactNativeModulePerfLogger>(...))`
   - `TurboModulePerfLogger::setInstance(std::make_shared<FBReactNativeModulePerfLogger>(...))`.
- Now:
   - `BridgeNativeModulePerfLogger::enableLogging(std::make_unique<FBReactNativeModulePerfLogger>(...))`
   - `TurboModulePerfLogger::enableLogging(std::make_unique<FBReactNativeModulePerfLogger>(...))`

**How do we do NativeModule perf-logging now?**
- Previously:
   -  `NativeModulePerfLogger::getInstance().command(...args)`
   -  `TurboModulePerfLogger::getInstance().command(...args)`.
- Now:
   - `BridgeNativeModulePerfLogger::command(...args)`
   - `TurboModulePerfLogger::command(...args)`.

The benefit of this approach is that each method in `BridgeNativeModulePerfLogger` is guarded with an if check. Example:

```
void moduleCreateConstructStart(const char *moduleName, int32_t id) {
  NativeModulePerfLogger *logger = g_perfLogger.get();
  if (logger != nullptr) {
    logger->moduleCreateConstructStart(moduleName, id);
  }
}
```

Therefore, we don't actually execute any code when perf-logging is disabled.

Changelog:
[Internal]

Reviewed By: fkgozali

Differential Revision: D21669888

fbshipit-source-id: 80c73754c430ce787404b563878bad146295e01f
2020-05-20 20:19:30 -07:00
Joshua Gross c75e8ae4ff LayoutAnimations: allow Paragraph props to be interpolated
Summary:
1. Split out the prop interpolation function out of the View ComponentDescriptor, into an inline'd function that can be used elsewhere.
2. Call it from View and from Paragraph component descriptors.

This causes animations including Text to look normal on iOS.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21675804

fbshipit-source-id: c34a317749fd6c108aef072d47f3dcb14ce8aa5c
2020-05-20 19:45:51 -07:00
Joshua Gross 3f9fad1052 LayoutAnimations: Use Quaternions to interpolate rotation transforms
Summary:
Implement a real Transform interpolation. It uses quaternions/Slerp to interpolate rotations. This allows us to interpolate scale, rotation, and translation simultaneously.

See caveats in code. Because of the way transform matrices work, there isn't much (anything?) we can do about skew, and certain values will look nonsensical. This seems to be true for any variant of this algorithm.

This is a big step up from Classic RN which didn't support this in LayoutAnimations at all.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21675805

fbshipit-source-id: a33494cc02c73102ca67c1d562efc4b2a7308a4a
2020-05-20 19:45:50 -07:00
Joshua Gross 73995cf7e2 iOS-specific LayoutAnimation integration
Summary:
Turn on Fabric LayoutAnimations on iOS.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21675803

fbshipit-source-id: 1be5f516f8af9439134c1688deb63b35b964ae99
2020-05-20 19:45:50 -07:00
Joshua Gross 483f84e881 Android-specific LayoutAnimation integration
Summary:
Turn on Fabric LayoutAnimations on Android.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21675809

fbshipit-source-id: 49fbd3094532c5b486ea12a58898b986964ddd6e
2020-05-20 19:45:50 -07:00
Joshua Gross eb9b2cedb8 LayoutAnimations: implement LayoutAnimationStatusDelegate for platform-specific integrations
Summary:
The LayoutAnimationStatusDelegate exists so that platforms can get a signal when animations are starting or have all completed.

This signal is meant to be used ONLY for driving animations at 60fps, or stopping that process, on the platform side.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21675807

fbshipit-source-id: e89ba524ea43c266556199c8854e8228869755e3
2020-05-20 19:45:49 -07:00
Joshua Gross 8d2c1f6e7e LayoutImplementations: implement all existing animation curves besides Keyboard
Summary:
Implement EaseIn, EaseOut, EaseInOut, and Spring with SpringDamping.

Note this does not yet implement Keyboard-type animation for iOS (coming soon), and the spring interpolator is VERY naive. We likely want to replace it with a "real" spring animation ASAP. The spring animation is identical to what Android does today, but would likely be a downgrade for iOS. I will do both in a followup.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21675810

fbshipit-source-id: ac98554ebc81f0b81fdacefd6d848e3566e424c0
2020-05-20 19:45:49 -07:00
Joshua Gross 3331962279 C++ Fabric Core LayoutAnimations
Summary:
This is the V1 implementation of Fabric Core LayoutAnimations.

The intention is to structure this in such a way that it's easy for each platform to customize the "AnimationDriver" class (to do platform-specific optimizations) without changing the KeyFrameManager at all.

In the future, this structure and architecture should allow us to iterate faster on new animation APIs.

Changelog: [Internal] Support for LayoutAnimations in Fabric

Reviewed By: mdvacca

Differential Revision: D21675808

fbshipit-source-id: b3ef44729bb8b6217f90760aec9737276c9601d1
2020-05-20 19:45:49 -07:00
Héctor Ramos 2e756e024f Remove flow-node requirement from native modules codegen script
Summary:
Use transpiled `react-native-codegen` scripts. By avoiding use of flow-node, we no longer need to upgrade flow-remove-types in order to run the native modules codegen script.

The interface for the script remains the same:

```
./scripts/generate-native-modules-specs.sh [optionalOutputDir]
```

Changelog: [Internal]

Reviewed By: TheSavior

Differential Revision: D21629705

fbshipit-source-id: 7714a67e36c8151a3b0b49285b6a6c93a525d7bc
2020-05-20 18:48:49 -07:00
Ishan Khot eb504e613e Revert D17486030: C++ Fabric Core LayoutAnimations
Differential Revision:
D17486030

Original commit changeset: 95c72cf9fc2b

fbshipit-source-id: fa7ef058f5d0dea0154c62718a8a11d9330698d9
2020-05-20 16:34:29 -07:00
Ishan Khot 6a15d7487f Revert D21587648: LayoutImplementations: implement all existing animation curves besides Keyboard
Differential Revision:
D21587648

Original commit changeset: 246ab7fd4039

fbshipit-source-id: 427e13ff821776feb4952c3438c15ea815fce5f0
2020-05-20 16:34:29 -07:00
Ishan Khot 5ae7e4fee2 Revert D21583109: LayoutAnimations: implement LayoutAnimationStatusDelegate for platform-specific integrations
Differential Revision:
D21583109

Original commit changeset: 234496841bde

fbshipit-source-id: 2f74dcce23f4eebf987e2114ad1f23cf01e11a9d
2020-05-20 16:34:29 -07:00
Ishan Khot 70f732dc8a Revert D21583122: Android-specific LayoutAnimation integration
Differential Revision:
D21583122

Original commit changeset: 82eacb7192f7

fbshipit-source-id: 5bcc392cdb3b11c755395beba4032a21c1bf2668
2020-05-20 16:34:28 -07:00
Ishan Khot 08031477e7 Revert D21583932: iOS-specific LayoutAnimation integration
Differential Revision:
D21583932

Original commit changeset: 0e0f988b44af

fbshipit-source-id: 2e3986e9310a56880a36cfd72fdee53fd9177dca
2020-05-20 16:34:28 -07:00
Ishan Khot 953c39293e Revert D21615829: LayoutAnimations: Use Quaternions to interpolate rotation transforms
Differential Revision:
D21615829

Original commit changeset: da6cb931ce85

fbshipit-source-id: 4b5bc392a35aac627b89ccccb73e10a2b1c4aaa6
2020-05-20 16:34:27 -07:00
Ishan Khot adccef7f48 Revert D21635473: LayoutAnimations: allow Paragraph props to be interpolated
Differential Revision:
D21635473

Original commit changeset: 470f43fd24a6

fbshipit-source-id: 8507b0aaead2c0ebbdd09077db99e5e44da175ab
2020-05-20 16:34:27 -07:00
Joshua Gross a799367baf LayoutAnimations: allow Paragraph props to be interpolated
Summary:
1. Split out the prop interpolation function out of the View ComponentDescriptor, into an inline'd function that can be used elsewhere.
2. Call it from View and from Paragraph component descriptors.

This causes animations including Text to look normal on iOS.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D21635473

fbshipit-source-id: 470f43fd24a6e80d8696ee2f2a09d9e693b7f280
2020-05-20 14:16:48 -07:00
Joshua Gross 3cbafcccba LayoutAnimations: Use Quaternions to interpolate rotation transforms
Summary:
Implement a real Transform interpolation. It uses quaternions/Slerp to interpolate rotations. This allows us to interpolate scale, rotation, and translation simultaneously.

See caveats in code. Because of the way transform matrices work, there isn't much (anything?) we can do about skew, and certain values will look nonsensical. This seems to be true for any variant of this algorithm.

This is a big step up from Classic RN which didn't support this in LayoutAnimations at all.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21615829

fbshipit-source-id: da6cb931ce857107d4b3d20108fb9bbecbf4f898
2020-05-20 14:16:47 -07:00
Joshua Gross e781b31489 iOS-specific LayoutAnimation integration
Summary:
Turn on Fabric LayoutAnimations on iOS.

I will gate this change behind a QE before landing.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D21583932

fbshipit-source-id: 0e0f988b44af37eb6fb22cccb48b0c7aa5020ca7
2020-05-20 14:16:47 -07:00
Joshua Gross 076ba4c920 Android-specific LayoutAnimation integration
Summary:
Turn on Fabric LayoutAnimations on Android.

I will gate this change behind a QE before landing.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21583122

fbshipit-source-id: 82eacb7192f7c59d2809a67a619cb950293aaace
2020-05-20 14:16:47 -07:00
Joshua Gross f0c595b57c LayoutAnimations: implement LayoutAnimationStatusDelegate for platform-specific integrations
Summary:
The LayoutAnimationStatusDelegate exists so that platforms can get a signal when animations are starting or have all completed.

This signal is meant to be used ONLY for driving animations at 60fps, or stopping that process, on the platform side.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21583109

fbshipit-source-id: 234496841bde226fcd6623c74c1a500e5cd00d99
2020-05-20 14:16:46 -07:00
Joshua Gross 46310c1976 LayoutImplementations: implement all existing animation curves besides Keyboard
Summary:
Implement EaseIn, EaseOut, EaseInOut, and Spring with SpringDamping.

Note this does not yet implement Keyboard-type animation for iOS (coming soon), and the spring interpolator is VERY naive. We likely want to replace it with a "real" spring animation ASAP. The spring animation is identical to what Android does today, but would likely be a downgrade for iOS. I will do both in a followup.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21587648

fbshipit-source-id: 246ab7fd40397a4231bb6b18d2f29602788a1bd2
2020-05-20 14:16:46 -07:00
Joshua Gross e9d6fb2ec6 C++ Fabric Core LayoutAnimations
Summary:
This is the V1 implementation of Fabric Core LayoutAnimations.

The intention is to structure this in such a way that it's easy for each platform to customize the "AnimationDriver" class (to do platform-specific optimizations) without changing the KeyFrameManager at all.

In the future, this structure and architecture should allow us to iterate faster on new animation APIs.

TODOs:

- Use std::chrono for timekeeping

Changelog: [Internal] Support for LayoutAnimations in Fabric

Reviewed By: shergin

Differential Revision: D17486030

fbshipit-source-id: 95c72cf9fc2b4bf3fe652fbd249cf2ad113033c7
2020-05-20 14:16:45 -07:00
Samuel Susla 3265519920 Fix assignment of hitTestEdgeInsets in RCTViewComponentView
Summary:
Changelog: [Internal]

If you look at implementation of hit testing in `RCTViewComponentView`

```
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
{
  if (UIEdgeInsetsEqualToEdgeInsets(self.hitTestEdgeInsets, UIEdgeInsetsZero)) {
    return [super pointInside:point withEvent:event];
  }
  CGRect hitFrame = UIEdgeInsetsInsetRect(self.bounds, self.hitTestEdgeInsets);
  return CGRectContainsPoint(hitFrame, point);
}
```

you will notice that we use `UIEdgeInsetsInsetRect` to calculate hitFrame. The input for this function is bounds and `hitTestEdgeInsets`. `hitTestEdgeInsets` is our hitSlop.
Look at documentation of `UIEdgeInsetsInsetRect`, it says "Adjusts a rectangle by the given edge insets.".

So if you give it a positive edge insets, it will make the rect smaller.

That's why we need to reverse values of hitSlop to negative before assigning it to `hitTestEdgeInsets`.
Paper does the same thing here d0871d0a9a/React/Views/RCTViewManager.m (L304-L305)

Reviewed By: mdvacca

Differential Revision: D21661894

fbshipit-source-id: c3dd6c55b68e4fdef8589ca8f0484e2837b4136c
2020-05-20 11:51:08 -07:00
Jimmy Zhang 6acccae980 Add FBRotatablePhotoPlayerView to LegacyInterop whitelist
Summary: Changelog: [internal]

Reviewed By: sammy-SC

Differential Revision: D21661427

fbshipit-source-id: de692015f3c6f029d2ea3f927e30d6758c0b1102
2020-05-20 09:28:08 -07:00
generatedunixname89002005287564 6b64810f33 Daily `arc lint --take GOOGLEJAVAFORMAT`
Reviewed By: zertosh, colriot

Differential Revision: D21642196

fbshipit-source-id: 5ca93be472da2630374850e0937bbdcb92f86b31
2020-05-20 07:07:45 -07:00
Sakamoto, Kazunori 0a2bb714ae docs: mention prettier in eslint-config README (#28930)
Summary:
The combination of `eslint` (v7.0.0), `react-native-community/eslint-config` (v1.1.0), and `flow-typed` (v3.1.0) causes the following error (`ESLint couldn't find the plugin "eslint-plugin-prettier"`) because `flow-typed` (v3.1.0) depends on `prettier: ^1.19.1` (c.f. https://github.com/flow-typed/flow-typed/blob/master/cli/package.json#L38).
To deal with the error, developers should install `prettier` (v2.x) directly in `devDependencies`.

```
Oops! Something went wrong! :(

ESLint: 7.0.0

ESLint couldn't find the plugin "eslint-plugin-prettier".

(The package "eslint-plugin-prettier" was not found when loaded as a Node module from the directory "/Users/exkazuu/Projects/test".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

    npm install eslint-plugin-prettier@latest --save-dev

The plugin "eslint-plugin-prettier" was referenced from the config file in ".eslintrc.js » react-native-community/eslint-config".

If you still can't figure out the problem, please stop by https://gitter.im/eslint/eslint to chat with the team.
```

## Changelog

[Internal] [Changed] - `react-native-community/eslint-config` README recommends developers to install prettier directly
Pull Request resolved: https://github.com/facebook/react-native/pull/28930

Test Plan: This PR changes only README, so tests are not required.

Differential Revision: D21659672

Pulled By: cpojer

fbshipit-source-id: 67c775e664d539815fa78e12574d73eaa1942de1
2020-05-20 03:32:46 -07:00
Tim Yung 2c600b7c5a RN: Persist Asynchronously Consumed Events in Pressability
Summary:
There are a few places in `Pressability` where we asynchronously consume the `event` object.

Most places do not encounter any problems because the actual properties on `event` are seldom used.

Nonetheless, we should fix these gaps.

Changelog:
[General][Fixed] - Fix invalid `event` objects from `onPressOut` in certain cases

Reviewed By: rickhanlonii

Differential Revision: D21657126

fbshipit-source-id: e28d825b85d25602427beaf0bd603d22eaa5960a
2020-05-19 22:43:51 -07:00
Valentin Shergin c8d678abcf Revert D21396409: Add possibility to disable buttons in action sheet ios
Differential Revision:
D21396409

Original commit changeset: b3c3e4429651

fbshipit-source-id: 073bea94d96f0ebbb474c474c73e4e3f01f27b2e
2020-05-19 16:36:32 -07:00
Joshua Selbo 8ef0f1d90b Fix thrown GradleScriptExceptions
Summary:
Changelog:
[Android] [Fixed] Use actual constructor when throwing GradleScriptException

Reviewed By: PeteTheHeat

Differential Revision: D21644385

fbshipit-source-id: 09802682cb9eb788e508cff3fbebdbdacd5b1d69
2020-05-19 14:18:57 -07:00
Daniel Sainati afad239d72 remove suppress_comments from xplat flowconfigs
Summary:
Flow is deprecating this config option, so we are removing it in preparation.

Changelog:

[Internal]

Reviewed By: gkz

Differential Revision: D21642915

fbshipit-source-id: cb2abff067b8702b37d5fdbdd63556f464e2a4a5
2020-05-19 14:12:31 -07:00
Samuel Susla 351a9f1047 Copy alreadyAppliedPadding when cloning SafeAreaViewShadowNode
Summary:
Changelog: [Internal]

`SafeAreaViewShadowNode.alreadyAppliedPadding` was always {0, 0, 0, 0} because value of previous shadow node was never copied over to new shadow node during clone.

Reviewed By: shergin

Differential Revision: D21617361

fbshipit-source-id: 6d6c91b19ff60271bf7c48145d85faaee0321680
2020-05-19 03:20:42 -07:00
Samuel Susla f9e4e246ff Prevent SafeAreaView from reporting same size twice
Summary:
Changelog: [Internal]

# Problem

We call `_state->updateState` anytime safe area insets changes.
Once that is called, `_state` still holds old value, so when we check whether there is big enough of a difference, we are actually checking it against old value of state until `updateState` is called from MountingManager.

This causes `_state->updateState` to be called dozens of times (I measured 47, with this diff it fell to 22) when displaying a safe area view inside Modal.

# Solution

Create new ivar `_lastPaddingStateWasUpdatedWith` where we store last padding that was sent through `_state->updateState` and compare new inset with this value instead of last value stored in state.

Reviewed By: shergin

Differential Revision: D21596367

fbshipit-source-id: b9249b8ef444ea532ec8b86a15a32c733eb6f987
2020-05-19 03:20:42 -07:00
Mike Vitousek 37e7b41419 deploy Flow 0.125.1 to xplat
Summary:
Changelog: [Internal]
allow-large-files

Reviewed By: gkz

Differential Revision: D21597387

fbshipit-source-id: dddec43885daa5a9c5c4dfe8e338ecedc9abcd1e
2020-05-19 01:24:57 -07:00
lukewalczak f0bf4b0986 Add possibility to disable buttons in action sheet ios (#28792)
Summary:
I've noticed that currently there is no option to disable button within the `ActionSheetIOS`. It can be really useful and decided to extend the API to support that functionality.

I added a new option called `disabledButtonsIndices` to `ActionSheetIOS` which is an array of button indices which should be disabled.

`ActionSheetIOS` documentation - PR https://github.com/facebook/react-native-website/pull/1898

## Changelog

[iOS] [Added] - Add disableButtonsIndices option to ActionSheetIOS component
Pull Request resolved: https://github.com/facebook/react-native/pull/28792

Test Plan:
1. Run the `RNTester`
2. Choose `ActionSheetIOS`
3. Check the fourth example `Show Action Sheet with disabled buttons`
4. `Option 1` and `Option 2` should be disabled

screenshot | gif
 --- | ---
<img width="493" alt="Screenshot 2020-04-30 at 15 16 22" src="https://user-images.githubusercontent.com/22746080/80739025-1ec52780-8b16-11ea-8b1c-30bb40ad8c99.png"> | ![action_sheet_disabled](https://user-images.githubusercontent.com/22746080/80739043-24227200-8b16-11ea-8bcb-af25eb57baac.gif)

Differential Revision: D21396409

Pulled By: shergin

fbshipit-source-id: b3c3e442965160e0c5e52854352f0540575c4d4c
2020-05-19 00:19:56 -07:00
Tim Yung 4aaf629982 Pressable: Minimum Press Duration
Summary:
When a `Pressable` has a configured (or the default) `delayPressIn` and no (or the default) `delayPressOut`, tapping very quickly can lead to intantaneous invocation of `onPressIn` and `onPressOut`. The end result is that users may never experience any intended visual press feedback.

This changes `Pressable` to accept (and be preconfigured with a default) **minimum press duration**. The minimum press duration ensures that even if the press is released before `delayPressIn` has elapsed, `onPressOut` will still wait the remaining time up to `minPressDuration` before firing.

Note that setting a non-zero `delayPressOut` is insufficient because if a user holds down on a `Pressable` for longer than `delayPressIn`, we still want `onPressOut` to fire immediately when the press is released.

Changelog:
[General][Changed] - Added `minPressDuration` to `Pressable`.

Reviewed By: TheSavior

Differential Revision: D21614708

fbshipit-source-id: 502f3d8ad6a40e7762435b6df16809c8798dd92c
2020-05-18 21:28:10 -07:00
Vojtech Novak c8ed2dbbb2 get ripple drawables by id (#28600)
Summary:
While working on recent PRs regarding ripple radius in TouchableNativeFeedbaack and ripple support in Pressable I noticed `ReactDrawableHelper` uses a [discouraged](https://developer.android.com/reference/android/content/res/Resources#getIdentifier(java.lang.String,%20java.lang.String,%20java.lang.String)) way to obtain resources.

The attribute names (strings) `'selectableItemBackground'` and `'selectableItemBackgroundBorderless'` are used here

4a48b021d6/Libraries/Components/Touchable/TouchableNativeFeedback.js (L105)

And passed to `context.getResources().getIdentifier()` in `ReactDrawableHelper`. Since we know the attribute names beforehand I figured we can obtain the resources by id (fast) instead of by name (slow). I made it so that the slow code path is taken in case the attribute name does not match what is expected, as a fallback.

Note that I did not do any measurement of the effect of this, I'm just offering this as a PR. You'll notice that this PR relies on the fact that the string in JS is the same as the string in Java (it is duplicated). While I could export the strings from Java and use them in JS, I wasn't sure where to export them. But note that even before, the JS code depended on the `'selectableItemBackground'` and `'selectableItemBackgroundBorderless'` strings to exist on the native side, in the android SDK, I just made the dependency explicit.

## 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] [Changed] - get ripple drawables by id
Pull Request resolved: https://github.com/facebook/react-native/pull/28600

Test Plan: tested manually in RNTester

Differential Revision: D21241773

Pulled By: shergin

fbshipit-source-id: 1b8314f99616095cb6ed557c62095cf3200f53b6
2020-05-18 18:19:56 -07:00
David Vacca 04b8c9c925 Delete local data from Fabric android
Summary:
LocalData was fully replaced by State, this diff removes dead code thas was previously used to update local Data
changelog: [Internal] Internal cleanup on Fabric Android code

Reviewed By: shergin

Differential Revision: D21621481

fbshipit-source-id: a3e38300a54a85adff9145cdeea1e89dad09103f
2020-05-18 17:57:28 -07:00
Paige Sun 1f95c9b62e iOS: Fix logging lifecycle when image is scrolled out and immediately back in
Reviewed By: fkgozali

Differential Revision: D21619910

fbshipit-source-id: b94073afaacad45e12d22d593184cea97612fa26
2020-05-18 16:54:31 -07:00
David Vacca 7929f674cc Basic implementation of ARTText
Summary:
Basic implementation of ARTText (shadow node, props and component descriptor)
changelog: [Internal] Internal changes to support art in Fabric

Reviewed By: shergin

Differential Revision: D21621483

fbshipit-source-id: d0886dc149520af13faa1bb936dfcccab1798c37
2020-05-18 16:36:38 -07:00
David Vacca 54adda64ec Basic implementation of ARTGroupProps
Summary:
Basic implementation of ARTGroupProps (shadow node, props and component descriptor)
changelog: [Internal] Internal changes to support art in Fabric

Reviewed By: shergin

Differential Revision: D21621480

fbshipit-source-id: 367a479568b8c1a290f3e0f633cc4052a9c95b87
2020-05-18 16:36:38 -07:00
David Vacca 12fee9af62 Create basic implementation of Shape
Summary:
Create basic implementation of Shape (shadow node, props and component descriptor)
changelog: [Internal] Internal changes to support art in Fabric

Reviewed By: shergin

Differential Revision: D21621482

fbshipit-source-id: e5b9bb2812ee92bce625301b7521f0578eaca0ff
2020-05-18 16:36:37 -07:00
David Vacca a011eaf7e5 Basic implementation of ARTSurfaceView
Summary:
Basic implementation of ARTSurfaceView (shadow nodes, props and component descriptor)
changelog: [Internal]

Reviewed By: shergin

Differential Revision: D21621484

fbshipit-source-id: 5577989e966a8a97a043454bf9ae1e5602abc3b1
2020-05-18 16:36:37 -07:00
Valentin Shergin dafa975352 Fabric: Simplification of `UIManager::getRelativeLayoutMetrics`
Summary:
Using of the new API makes clear that we don't need to calculate the newest descendant node.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D21480202

fbshipit-source-id: c54998573baffe4a05726e3402da027f052b049a
2020-05-18 14:08:27 -07:00