Commit Graph

4295 Commits

Author SHA1 Message Date
Marcel Lasaj a71f37b951 Fix error message for DebugCorePackage.getModule IllegalArgumentExc… (#29304)
Summary:
…eption

This is a minor change in `DebugCorePackage.getModule()` method that corrects the `IllegalArgumentException`'s error message, which was probably copy-pasted from `CoreModulePackage`.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->
[Android] [Fixed] - Fixed error message in DebugCorePackage.getModule

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

Test Plan: No tests needed.

Reviewed By: RSNara

Differential Revision: D22521091

Pulled By: mdvacca

fbshipit-source-id: 19205f9beb0fc26249985ce2c865e284c4a4add1
2020-07-14 14:49:08 -07:00
Ramanpreet Nara ec18e35cd3 Instrument events emitted by TurboModuleManager
Summary:
TurboModuleManager can emit the following events:
- JS Require Beginning
- JS Require Ending
- Module Create (for C++-only TurboModules)

This diff instruments JS Require beginning, and JS Require ending. It also serves as a good stopgap to verify that TurboModule perf logging is set up correctly.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D22485529

fbshipit-source-id: a41b88b56627ad2bbcaadac87bf9d530bf07ae81
2020-07-11 09:38:45 -07:00
Ramanpreet Nara 41d948c8d6 Introduce TurboModulePerfLogger Java class
Summary:
We need to instrument the following markers for TurboModules in Java:
- **Java:** moduleDataCreate
- **Java:** moduleCreate

**Problem:** Perf-logging can be on or off in production. This means that we have to guard every perf-logger call, which can be a bit tedious. Therefore, this diff introduces a Java class called `TurboModulePerfLogger`, which:
1. Enables perf-logging by accepting a `NativeModulePerfLogger` `jni::HybridObject` in its `enableLogging` method.
2. Exposes static methods that call into the `NativeModulePerfLogger`'s Java part, when perf-logging is enabled.

We actually have C++ markers as well:
- **C++:** moduleJSRequireBeginning
- **C++:** moduleJSRequireEnding
- **C++:** syncMethodCall
- **C++:** asyncMethodCall
- **C++:** asyncMethodCallExecution

Therefore, `TurboModulePerfLogger.java` also calls its native method `jniEnableCppLogging` to setup C++ TurboModule perf-logging.

TurboModule C++ logging is done via a similar setup (to Java), using `TurboModulePerfLogger.cpp`. The `jniEnableCppLogging` native method calls into `TurboModulePerfLogger::enableLogging` with the C++ part of `NativeModulePerfLogger`. Then, the TurboModules C++ infra uses the static methods on `TurboModulePerfLogger.cpp` to start/end markers.

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D22444246

fbshipit-source-id: 66f191056cdcf5d7932ff1916a1de70b82e5f32b
2020-07-11 09:38:45 -07:00
Ramanpreet Nara c0dd11e532 Introduce JNativeModulePerfLogger
Summary:
## Description
This diff introduces `NativeModulePerfLogger.java`, the Android extension (a `jni::HybridClass`) to `NativeModulePerfLogger`.

### Why is this a Hybrid class?
Because we have C++ and Java markers, and the perf-logger has both a Java and a C++ interface that the application must implement. `jni::Hybrid` classes are a convenient solution for these constraints.

Changelog:
[Android][Added] - Introduce JNativeModulePerfLogger

Reviewed By: ejanzer

Differential Revision: D21318052

fbshipit-source-id: 2f43853b243fa2a629068bb4aced1e3f12f038ba
2020-07-11 09:38:45 -07:00
Joshua Gross 46d6e7f575 NativeAnimatedModule: animations should still run if there isn't a Fabric commit for multiple frames
Summary:
See videos. In some cases when an `Animated.timing` animation was triggered, there are not necessarily any corresponding Fabric commits. This causes the animations to be queued up but never execute... until there's some Fabric commit at a distant point in the future.

We can't immediately flush all animation operations (see inline comments) but we also shouldn't wait forever. Thus, we wait 2 frames and then flush.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D22490650

fbshipit-source-id: 1669bfed00f2a92b50f9558fc7ccaf71dc636980
2020-07-10 23:34:47 -07:00
Joshua Gross 7bf56e1902 NativeAnimatedModule: don't restore default values when disconnected nodes in Fabric
Summary:
See title.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D22488069

fbshipit-source-id: a0cb2dc65e5ea4befd7921acd194a67840b1498d
2020-07-10 23:34:47 -07:00
Joshua Gross 80f13412e5 Expose resolveCustomDirectEventName from UIManager interface
Summary:
Expose `resolveCustomDirectEventName` from UIManager interface for Bridgeless Mode+NativeAnimatedModule.

We cannot remove the interface from the Non-Fabric UIManagerModule yet, as it would break downstream open-source dependencies, so I just marked it deprecated.

Note that this still doesn't totally fix issues with Bridgeless mode: generally I have to navigate to a Bridgeless surface, exit it, and then navigate back, and only on the 2nd navigation does everything seem to work properly...

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D22483508

fbshipit-source-id: 685126e7e51aa5d0fd60ad5d4ecc44e8c6c3029d
2020-07-10 23:34:47 -07:00
Joshua Gross 95d05fc415 NativeAnimatedModule: subscribe to Fabric lifecycle events in more cases
Summary:
The previous assumption was that any animations would result in `addAnimatedEventToView` being called. That's not true in all cases, so sometimes we never subscribed to Fabric lifecycle events, preventing animations from working on some screens and for Venice.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D22483509

fbshipit-source-id: c97576675902b4b9e1d4e659c7c1e24c5fe92946
2020-07-10 23:34:47 -07:00
Joshua Gross 3503d722a1 Fix race between teardown and PreAllocateView/CreateView MountItem creation
Summary:
Commits can happen during navigation/teardown which creates mount items. If we throw an exception during
teardown because we expect the Context to still be around, we crash too often. Instead, I will rely on
logic in FabricUIManager to ignore queued MountItems if we try to execute them after the surface has been torn down;
and we move the IllegalStateException to actual execution of the mount item in case there's an edge-case we're missing.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D22470102

fbshipit-source-id: ad98c03994969a3c3f300d6551e90b6516ed2d8b
2020-07-09 20:50:00 -07:00
Santiago Alfonso Muñoz Rodriguez 1930039261 Move CameraRoll Android files to FB Internal
Summary: Changelog: [Lean Core][Android] Removed CameraRoll from RN Android

Reviewed By: RSNara

Differential Revision: D22410115

fbshipit-source-id: 5cdb5b87a7bf5b4a8a4c2953c14ba3751b125d07
2020-07-09 06:10:42 -07:00
Hein Rutjes cfa4260598 Add support for shadowColor on Android (API >= 28) (#28650)
Summary:
This PR adds support for the `shadowColor` style on Android.

This is possible as of Android P using the `setOutlineAmbientShadowColor` and `setOutlineSpotShadowColor` View methods. The actual rendered color is a multiplication of the color-alpha, shadow-effect and elevation-value.

## Changelog

`[Android] [Added] - Add support for shadowColor on API level >= 28`
Pull Request resolved: https://github.com/facebook/react-native/pull/28650

Test Plan:
- Only execute code on Android P
- Added Android `BoxShadow` tests to RNTester app

![image](https://user-images.githubusercontent.com/6184593/79457137-fe627c80-7fef-11ea-8e88-3d9423a4f264.png)

Reviewed By: mdvacca

Differential Revision: D21125479

Pulled By: shergin

fbshipit-source-id: 14dcc023977d7a9d304fabcd3c90bcf34482f137
2020-07-07 23:32:38 -07:00
Devon Deonarine 8c42c01977 Fix debugging on android for 0.63 (#29204)
Summary:
Currently on react native 0.63-rc.0 and 0.63-rc.1 enabling debugging throws an exception. It looks like something may have been missed in unregistering JSDevSupport in this commit c20963e

![crash](https://user-images.githubusercontent.com/14797029/85500252-2acae400-b5b1-11ea-938a-674b55e649b2.gif)

This should fix https://github.com/facebook/react-native/issues/28746 and https://github.com/facebook/react-native/issues/29136

## Changelog
[Android] [Fixed] - Fix crash when enabling debug

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

Test Plan:
To recreate the bug:

npx react-native init RN063 --version 0.63.0-rc.1
react-native start
react-native run-android
Enable debug mode from react native dev menu

After this commit, the crash no longer occurs

![non crash](https://user-images.githubusercontent.com/14797029/85500241-269ec680-b5b1-11ea-8cfe-85bfda4dd222.gif)

Reviewed By: TheSavior

Differential Revision: D22395406

Pulled By: RSNara

fbshipit-source-id: 046df77ae1c1de96870fb46f409d59e7d6a68c0d
2020-07-07 12:06:16 -07:00
Sean Wang 824d3a9770 Move iOS CameraRoll files into FB internal
Summary:
This moves ios CameraRoll files from React Native open source into FB internal as part of the Lean Core effort.

Changelog: [Breaking][ios] Remove CameraRoll from React Native

Reviewed By: cpojer

Differential Revision: D22208352

fbshipit-source-id: 894d6aff34ece94648dad68060c13b44974c93bb
2020-07-06 20:22:25 -07:00
Amir Shalem 8a14b98193 Don't call config->setLogger(nullptr) directly to avoid having no logger at all
Summary:
Changelog: [Internal][Yoga] Don't call config->setLogger(nullptr) directly to avoid having no logger at all

Broken in D14151037 (https://github.com/facebook/react-native/commit/dc7dce130beef647b3c3d5d25d067c3557b84214) when it started calling
```
config->setLogger(nullptr);
```
instead of going thru
```
YGConfigSetLogger(config, nullptr);
```
which does the right thing by setting the logger to its default value:
https://www.internalfb.com/intern/diffusion/FBS/browsefile/master/xplat/yoga/yoga/Yoga.cpp?commit=835911317e8b3cf7da1866e40e1c79cda0690136&lines=4320-4330

Also by default YogaConfig always have a logger:
https://www.internalfb.com/intern/diffusion/FBS/browsefile/master/xplat/yoga/yoga/Yoga.cpp?commit=835911317e8b3cf7da1866e40e1c79cda0690136&lines=335-343

Reviewed By: SidharthGuglani

Differential Revision: D22387459

fbshipit-source-id: 4da91da87a696d38cc9d8db2acb5845d29398adb
2020-07-06 03:43:26 -07:00
Christoph Nakazawa 6d6c68c2c6 "The Metro Server" -> Metro
Summary:
Pet Peeve: Metro is a brand name. You don't say "the Metro server" just like you don't say "the iPhone phone". This is a leftover from when it used to be called "the packager server".

Note: It makes sense to refer to "the Metro server" when talking about it in the context of Metro's features, like if you are discussing "Metro's bundling" and "Metro's server". However, when talking about the tool itself, just Metro is enough.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D22330966

fbshipit-source-id: 667618363c641884df543d88cac65d1e44956ad3
2020-07-02 14:51:18 -07:00
almouro f23feced42 Fix font variant crash on Android < 4.4 (#29176)
Summary:
In RN 0.62 support for `fontVariant` was added on Android.
Using that prop crashes the app on Android below KitKat (4.3 and below)

To reproduce just add any Text with the `fontVariant` styling prop in the app:
```js
<Text style={{fontVariant: ['tabular-nums']}}>This will crash</Text>
```
It will crash any device running Android below KitKat with the error:

![image](https://user-images.githubusercontent.com/4534323/85073452-18206b80-b1bb-11ea-8d7e-96f27fa1a320.png)

This is caused by `java.utils.Objects` only being available on Android 4.4+

## Changelog

[Android] [Fixed] - Fix font variant crash on Android < 4.4
Pull Request resolved: https://github.com/facebook/react-native/pull/29176

Test Plan:
[TextUtils.equals](https://developer.android.com/reference/android/text/TextUtils#equals) was added as soon as API level 1, so no compatibility issue here.
Tested on Emulator running Android 4.1, no crash anymore.

I've searched for other occurences of `java.utils.Objects` in the project, and this was the only one, so no need to remove other occurences 

Reviewed By: JoshuaGross

Differential Revision: D22337316

Pulled By: mdvacca

fbshipit-source-id: 5507b21b237a725d596d47b5c01e269895b16d4a
2020-07-01 19:12:22 -07:00
fabriziobertoglio1987 7d8aeb4955 do not call setHyphenationFrequency on AndroidSdk < 23 (#29258)
Summary:
JoshuaGross This issue fixes https://github.com/facebook/react-native/issues/28279 as discussed in https://github.com/facebook/react-native/pull/29157#issuecomment-649993571
Avoid calling [setHyphenationFrequency](https://developer.android.com/reference/android/widget/TextView#setHyphenationFrequency(int)) on Android Sdk < 23.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Android] [Fixed] - do not call setHyphenationFrequency on AndroidSdk < 23
Pull Request resolved: https://github.com/facebook/react-native/pull/29258

Test Plan:
| **BEFORE** | **AFTER** |
|:-------------------------:|:-------------------------:|
|  <img src="https://user-images.githubusercontent.com/24992535/86214122-05bf0e00-bb7b-11ea-93b5-2174812bfec9.png"  width="300" height="" />| <img src="https://user-images.githubusercontent.com/24992535/86214130-08216800-bb7b-11ea-9fc0-68b28638bf57.png" width="300" height="" /> |

The warning displayed with `adb logcat | grep -P "ReactTextAnchorViewManager"`

![image](https://user-images.githubusercontent.com/24992535/86214242-34d57f80-bb7b-11ea-9945-30ae25332bfb.png)

I remain available to do improvements. Thanks a lot. Fabrizio.

Reviewed By: JoshuaGross

Differential Revision: D22337095

Pulled By: mdvacca

fbshipit-source-id: d0943397af180929c48044ccbc7a9388549021b8
2020-07-01 17:45:34 -07:00
Joshua Gross c6b9cc36da Document early ViewCommand dispatch, since it is no longer gated
Summary:
In https://github.com/facebook/react-native/commit/0b63c9464872fed9ff3eb388e32850f2f8c69561, I shipped "Early ViewCommand Dispatch" everywhere but didn't provide a good summary in the commit message.

Here it is:

The "Early ViewCommand Dispatch" experiment was a success, leading to improved UI responsiveness and fewer overall crashes.

Ship to all Fabric and non-Fabric users, and clean up the code a bit.

# Context: what?

ViewCommands are now used in React Native to do things like scroll ScrollViews to a certain position; focus or blur a TextInput; control the value of controlled TextInputs; and much more. These used to be done using setNativeProps, but we're moving everything to ViewCommands, and most of that migration has already finished.

# Context: Why?

Because Fabric does not support setNativeProps, there has been an effort to move all setNativeProps callsites to ViewCommands. Since these callsites are in JS where we can't tell if we're running in Paper or Fabric, both Paper and Fabric callsites are being migrated (mostly already done) to ViewCommands. One such example is Android TextInput, which has been using ViewCommands instead of setNativeProps for several months.

This migration was largely without issues, except TheSavior and I noticed early on that certain things were just... slower with ViewCommands. It was definitely noticeable, but we determined it to be acceptable and moved on.

Recently, it became clear to me that the perf regression may not be acceptable, but there might be an "easy" solution.

# Why are ViewCommands slower than SetNativeProps?

So, a couple things. SetNativeProps on Paper would actually cause a layout pass; the same is not true for ViewCommands, so they should actually be much faster. But they're not! The reason is that ViewCommands are treated as regular mount items, and they are queued up /after/ all other mount items. That means if you're trying to interact with the UI while some part of it is updating, your ViewCommands must wait for portions of the screen to finish rendering before they execute.

In some cases, those views may even disappear before the ViewCommand executes, causing increased exceptions as well as speed degredations.

# Proposal

This experiment that ran with successful results was: to execute ViewCommands /before/ all other types of mount instructions (by maintaining a separate queue). That means if you tap on a TextInput to focus it while the screen is doing some heavy rendering, the next time the UIManager executes a batch of instructions, it will execute the focus operation out-of-order, at the very beginning. From a user perspective this is actually quite noticeable, and works much better than the older behavior.

# Why it's Not That Dangerous

* Is it possible that we'll execute instructions after the corresponding view has disappeared? This was already possible, and is actually less likely now, since it's more likely that the ViewCommand will execute before the Delete instructions executes.
* Is it possible we'll execute instructions BEFORE the view is created? Yes, this is possible and I actually found a repro for it. My solution: allow ViewCommands to be retried, exactly once. If they throw an exception the first time, we requeue which will cause the command to be executed after the current batch of mount items. Interestingly, this seems to be unnecessary in Fabric, so the logic there is a bit simpler (probably because on Android we do view preallocation under Fabric, so views are created way before they're inserted into the view hierarchy, and apparently before ViewCommands have a chance to execute).
* ViewCommands are already an imperative feature that exists outside of the normal React commit cycle. So they're already dangerous. This doesn't change that, but it does make dangerous code *faster*, so that's good.

Changelog: [Android][Changed] ViewCommands on Android now execute earlier, as a perf optimization.

Reviewed By: mdvacca

Differential Revision: D22343648

fbshipit-source-id: 310d94977ac8ca3140ee8aa272272f660efafa36
2020-07-01 17:25:32 -07:00
generatedunixname89002005287564 df6d2c50ff Daily arc lint --take GOOGLEJAVAFORMAT
Reviewed By: zertosh, bismarkito

Differential Revision: D22330388

fbshipit-source-id: 7a86a05da23728ad066702d868d805769389893f
2020-07-01 08:53:07 -07:00
Joshua Gross 0cef464fd2 StopSurface optimizations
Summary:
(1) As soon as we know we can StopSurface, stop executing all mountitems by clearing out the root tag.
(2) If a surface has been stopped and there's a batch of MountItems to execute against it, execute only the "delete" operations to clear views from memory.

Both of these should reduce memory usage and improve speed slightly around navigation pops.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D22321389

fbshipit-source-id: 96a8292a8442528f1bba50d35208885cc4168170
2020-06-30 22:06:15 -07:00
Joshua Gross 0aa8ed6361 Remove useless Mounting diagnostic error
Summary:
While in theory we should never delete views before removing them from the hierarchy, there are some exceptions:

(1) Some mysterious cases that don't seem like bugs, but where the child still seems to keep a reference to the parent:
(2) When deleting views as part of stopSurface.

On #1: in the past we had issues when we assumed that ViewManager.getChildCount() would return an accurate count. Sometimes it's just... wrong. Here, I've found at least one case where a View still has a parent after it's removed from the View hierarchy. I assume this is undocumented Android behavior or an Android bug, but either way, there's nothing I can do about it.

On #2: there are valid cases where we want to delete a View without explicitly removing it from the View hierarchy (it will eventually be removed from the hierarchy when the Root view is unmounted, but it may still be "in" a View hierarchy when it's deleted).

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D22321374

fbshipit-source-id: 9667bbe778c418f0216550638dc26ca48a58e5fa
2020-06-30 22:06:15 -07:00
Joshua Gross f493a316fd Remove flags around Catalyst teardown
Summary:
These flags haven't been used in months. They were useful to uncover some race conditions, but will not be iterated further. The Venice project will obviate the concerns that sparked these experiments in the first place.

These flags have been hardcoded to false for a while.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D22319204

fbshipit-source-id: 09415f3bb1ca56e15f357210e966d0483ff384f2
2020-06-30 16:12:05 -07:00
Joshua Gross 85f1e984bb Remove references to enableFabricStopAllSurfacesOnTeardown
Summary:
According to our experiments it's not better than "stop surface on unmount" in any way, and might regress some metrics. Unclear why, but if it's not necessary and doesn't seem to help, it doesn't make sense to continue this experiment.

We still have a mechanism on the C++ side to stop outstanding surfaces on teardown that does the same thing.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D22318864

fbshipit-source-id: 7e678c63e4884382e57d996a7f4c4b7b24c8193a
2020-06-30 16:12:05 -07:00
Vojtech Novak 9e85b7ad88 ScrollView, HorizontalScrollView: do not ignore null contentOffset prop (#28760)
Summary:
motivation: I was just checking out https://github.com/facebook/react-native/commit/30cc158a875a0414cf53d4d5155410eea5d5aeea
and noticed that the commit, I believe, is missing logic for when `contentOffset` is actually `null`.

That is, consider you render `ScrollView` with `contentOffset` { x: 0, y: 100 } and then change that to null / undefined. I'd expect the content offset to invalidate (set to 0 - hope that's the default).

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Android] [Fixed] - ScrollView, HorizontalScrollView: do not ignore `null` `contentOffset` prop
Pull Request resolved: https://github.com/facebook/react-native/pull/28760

Test Plan:
Tested locally within RNTester

<details><summary>code</summary>
<p>

```js
const Ex = () => {
  let _scrollView: ?React.ElementRef<typeof ScrollView> = React.useRef(null);
  const [offset, setOffset] = React.useState({x: 0, y: 20});
  setTimeout(() => {
    setOffset(undefined);
  }, 2000);

  return (
    <View>
      <ScrollView
        ref={_scrollView}
        automaticallyAdjustContentInsets={false}
        onScroll={() => {
          console.log('onScroll!');
        }}
        contentOffset={offset}
        scrollEventThrottle={200}
        style={styles.scrollView}>
        {ITEMS.map(createItemRow)}
      </ScrollView>
      <Button
        label="Scroll to top"
        onPress={() => {
          nullthrows(_scrollView.current).scrollTo({y: 0});
        }}
      />
      <Button
        label="Scroll to bottom"
        onPress={() => {
          nullthrows(_scrollView.current).scrollToEnd({animated: true});
        }}
      />
      <Button
        label="Flash scroll indicators"
        onPress={() => {
          nullthrows(_scrollView.current).flashScrollIndicators();
        }}
      />
    </View>
  );
};
```

</p>
</details>

Reviewed By: shergin

Differential Revision: D22298676

Pulled By: JoshuaGross

fbshipit-source-id: e411ba4c8a276908e354d59085d164a38ae253c0
2020-06-30 12:52:06 -07:00
TMaszko d92284216f Fix: Preserve native animated value after animated component unmount (#28841)
Summary:
After animation has been finished using Native driver there is no final value passed from the native to JS side. This causes a bug from https://github.com/facebook/react-native/issues/28114.

This PR solves this problem in the same way as `react-native-reanimated` library. When detaching it is calling native side to get the last value from Animated node and stores it on the JS side.

Preserving animated value even if animation was using `useNativeDriver: true`
Fixes https://github.com/facebook/react-native/issues/28114

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

[Internal] [Fixed] - Save native Animated node value on JS side in detach phase
Pull Request resolved: https://github.com/facebook/react-native/pull/28841

Test Plan: Unit tests for added getValue method passed. Green CI

Reviewed By: mdvacca

Differential Revision: D22211499

Pulled By: JoshuaGross

fbshipit-source-id: 9a3a98a9f9a8536fe2c8764f667cdabe1f6ba82a
2020-06-29 17:09:37 -07:00
fabriziobertoglio1987 0fda91ffff Adding Hyphenation Frequency prop for Text component (#29157)
Summary:
This issue fixes https://github.com/facebook/react-native/issues/28279
android_hyphenationFrequency prop for Android Text component which sets the frequency of automatic hyphenation to use when determining word breaks.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Android] [Fixed] - Adding Hyphenation Frequency prop for Text component
Pull Request resolved: https://github.com/facebook/react-native/pull/29157

Test Plan:
More info are available in the [android docs](https://developer.android.com/reference/android/widget/TextView#setHyphenationFrequency(int)). I will add the documentation to the docs later once the pull request is taken in consideration for merging.

| **AFTER** |
|:-------------------------:|
|  <img src="https://user-images.githubusercontent.com/24992535/84919245-f8f1e300-b0c1-11ea-8a33-f30d0c9a75b7.png"  width="300" height="" />|

I remain available to do improvements. Thanks a lot. Fabrizio.

Reviewed By: TheSavior

Differential Revision: D22219548

Pulled By: JoshuaGross

fbshipit-source-id: 7e2523c25adfcd75454f60184eb73dc49891bef7
2020-06-29 16:57:12 -07:00
Joshua Gross 0b63c94648 Ship early ViewCommand dispatch everywhere
Summary:
Early ViewCommand dispatch: ship the experiment everywhere on Android.

Since ViewCommands are totally divorced from the commit cycle currently, and since they are inherently unsafe, we can create a separate queue for them
and retry them if they fail with a specific category of exceptions.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D22173050

fbshipit-source-id: 494b7c6b5dfd2aec8ba77ae35d0d58d4d727b9b4
2020-06-29 15:45:11 -07:00
Joshua Gross 0a115d9c3f Ship MountItem Remove/Delete Collation
Summary:
Ship MountItem Remove/Delete Collation.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D22170891

fbshipit-source-id: a9a149783bdd69df54e429da6ed9870bfb405a36
2020-06-29 15:45:11 -07:00
David Vacca 7abcaafd66 Fix crash when updating dialog props after the Activity has disappeared
Summary:
This diff avoids accessing window and activities object that has dissapear

changelog: [Android][Fix] Fix crash when updating RN dialog props after the activity disappeared

Reviewed By: JoshuaGross

Differential Revision: D22264672

fbshipit-source-id: 89c9895c8c6b6fec383a0e160847e5059616e265
2020-06-29 15:29:21 -07:00
Omer Peleg 530d11c506 Fix RN OSS build (#29221)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/29221

Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D22234372

fbshipit-source-id: 9b83ec3aa57254826be44ac0f73aeb34fb859337
2020-06-25 11:09:42 -07:00
Lee Callender 0967e7b26d Move ImageEditor Android files to FB Internal.
Summary: Changelog: [Android] [Removed] - Migrated ImageEditingManager to FB internal.

Reviewed By: cpojer

Differential Revision: D22123807

fbshipit-source-id: 24c3b3554f5e6152b70750a6c8212b3d3b66678f
2020-06-22 19:20:24 -07:00
David Vacca 75e6f7961f Fix measure of ReactSlider for Android API < 21
Summary:
This diff avoids calling to the method setStateListAnimator for users running in Android API < 21 (This method did not exist in Android API < 21)

changelog: [Android][Fix] Fix crash while measuring ReactSlider in Android API < 21

Reviewed By: lunaleaps

Differential Revision: D22164574

fbshipit-source-id: 8163f99eeb78302fc75e2c4938330c699ca8d363
2020-06-22 12:42:41 -07:00
Joshua Gross e661a551cb Potential fix for, and more diagnostics for, NativeAnimatedModule crash
Summary:
Searching for details and maybe a fix for T68843308 crashing in disconnectFromView, "Attempting to disconnect view that has not been connected with the given animated node".

May be related to recent refactoring but it's not clear. Change logic slightly and add more diagnostic information.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D22153179

fbshipit-source-id: b95dbaf01ae8bca154c61442898b0f9d3aebb4de
2020-06-20 17:47:29 -07:00
Joshua Gross 9760a326c9 Fix MountingManager NPE
Summary:
Fix NullPointerException.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D22153157

fbshipit-source-id: 77be1456a2b7f6429d2dce6eac5d9d0bca362c27
2020-06-20 17:41:02 -07:00
David Vacca f8bcb1063e Cleanup updateState method on TextInputManager
Summary:
Quick refactor to cleanup the updateState method on TextInputManager

changelog:[internal]

Reviewed By: JoshuaGross

Differential Revision: D22149752

fbshipit-source-id: 0461b1769b9a7a3b25257bbf2039dc461a164c6f
2020-06-19 21:50:43 -07:00
David Vacca 85669d8c30 EZ fix typo
Summary:
Fix typo in TextInput classes

changelog:[internal]

Reviewed By: JoshuaGross

Differential Revision: D22149753

fbshipit-source-id: f5d1f5ee8bea82e049ead7ca2664e46cdcd961a0
2020-06-19 21:50:43 -07:00
David Vacca 8cbbd93c40 Refactor Text input state
Summary:
This diff refactors the theme management for text input in order to avoid extra state updates.

changelog:[Internal]

Reviewed By: JoshuaGross

Differential Revision: D22149754

fbshipit-source-id: 8a6dbe63c8d532986dbf785c7b16323e0a980669
2020-06-19 21:50:43 -07:00
Joshua Gross 304c5d54ec MountingManager debug tool: show view hierarchies before and after remove/insert operations
Summary:
This is a useful debugging tool that will not be compiled by default, and we have some protection to only compile it in Debug builds so it's less likely to accidentally slip into production.

This has been useful for debugging C++ LayoutAnimations, since Remove/Insert mutations are delayed and fiddled around with a little.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D22148853

fbshipit-source-id: 05609507cdf06b73fd3edf5cf7bc95e124ff1135
2020-06-19 20:28:05 -07:00
Joshua Gross e5a4d9550e Replace direct ViewManager calls to old UIManager with Fabric/Venice-compatible calls
Summary:
Replace direct ViewManager calls to old UIManager with Fabric/Venice-compatible calls.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D22111396

fbshipit-source-id: 2de9df5a4b494f82049dba62325ee3119c80d3c3
2020-06-19 11:15:57 -07:00
Joshua Gross d183fd327b Improve MountingManager diagnostics around View removal
Summary:
It is possible (most recently, if there are bugs in LayoutAnimations, but also in general) to issue a `removeViewAt` MountItem that removes the incorrect view if, for whatever reason, the View hierarchy has become "corrupt"
and Views are out of order. I added two heuristics to catch if that happens: check the tag of the View being removed if possible, and ensure that all deleted views do not have a parent. This will turn weird visual glitches into
hard crashes, which we want once the UI has become corrupt.

My only concern here is with perf; maybe we could put these behind a debug-only flag or something, but it's probably not a huge deal.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D22130186

fbshipit-source-id: 0942b019c3449d68edfb9db1fe8130ea351d1d8f
2020-06-19 11:13:35 -07:00
Tim Yung 64860972be RN: Adjust Image Blur on Android
Summary:
Adjusts the behavior of `blurRadius` for `Image` on Android so that it behaves more closely to other platforms (web and iOS).

Changelog:
[Android][Changed] - Effect of `blurRadius` now more closely matches other platforms.

Reviewed By: shergin

Differential Revision: D22118680

fbshipit-source-id: c6d14aef29b4a086e43badfa78407bfa07f9fee2
2020-06-18 14:46:49 -07:00
Lulu Wu e6fc20ee68 Keyframes is not implemented in Fabric Android
Summary:
Implement Keyframes in Fabric Android

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21952500

fbshipit-source-id: 6ba3af1afea227d58b6b12c1be629698d309a04d
2020-06-17 15:25:18 -07:00
Oleksandr Melnykov 6afc984e81 Update loading banner text and colors
Summary: This diff updates the loading banner text and color on Android to match its style on iOS.

Differential Revision: D22066823

fbshipit-source-id: 7f8d6cf1a6c4c48babe919995044978d7a81c674
2020-06-17 09:10:51 -07:00
Oleksandr Melnykov fca3a39da5 Add native module for loading split JS bundles in development
Reviewed By: mdvacca, cpojer

Differential Revision: D22001709

fbshipit-source-id: 4e378fd6ae90268e7db9092a71628205b9f7c37d
2020-06-17 09:10:51 -07:00
Joshua Gross 2e2c881147 NativeAnimatedModule should not crash if UIManager disappears
Summary:
If UIManager disappears, it's likely due to (1) teardown due to memory pressure, (2) teardown due to crash, (3) normal teardown.

In all of those cases, I would just want NativeAnimatedModule to stop executing and fail silently ASAP.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D22079209

fbshipit-source-id: 21650abdfdb119a6f4abccd6962d0c09f7c7c6cd
2020-06-16 17:04:22 -07:00
Tim Yung fa0e6f8051 RN: Image Progress Event on Android
Summary:
Adds support for the `onProgress` event on `Image`, for Android.

Since Fresco does not provide a progress listener on `ControllerListener`, this uses a forwarding progress indicator `Drawable` to pass along values from `onLevelChange`.

Caveat: The ratio between `loaded` and `total` can be used, but `total` is currently always 10000. It seems that Fresco does not currently expose the content length from the network response headers.

Changelog:
[Android][Added] - Adds support for the `onProgress` event on `Image`

Reviewed By: mdvacca

Differential Revision: D22029915

fbshipit-source-id: 66174b55ed01e1a059c080e2b14415e7d268bc5c
2020-06-16 15:01:05 -07:00
Tim Yung 74ab8f6e5a RN: Consistent API for Image Events
Summary:
Changes the `onLoad` and `onError` events on `Image` to be consistent with each other and with the `ImageSource` type.

Changelog:
[Android][Breaking] - On `Image`, `onLoad` and `onError` event objects will no longer have an extra `uri` property.
[Android][Breaking] - On `Image`, `onLoad` event objects' `source.url` is now renamed to `source.uri`.
[iOS][Breaking] - On `Image`, `onLoad` event objects' `source.url` is now renamed to `source.uri`.

Reviewed By: mdvacca

Differential Revision: D22023565

fbshipit-source-id: 5ea7904c697f87e01118bdb81ed50ab0a5aecdce
2020-06-16 15:01:05 -07:00
Tim Yung 90997c26e3 RN: Cleanup ImageLoadEvent Logic (Android)
Summary:
Cleans up `ImageLoadEvent` to minimize constructor confusion and to make the dispatching logic more predictable.

Changelog:
[Internal]

Reviewed By: mdvacca

Differential Revision: D22023141

fbshipit-source-id: 17e66de867f51121a3f9a6b782dbad700a54231a
2020-06-16 15:01:05 -07:00
Joshua Gross b69041f086 Feature-flag gate stopSurface on root view unmount
Summary:
Gate stopSurface behind a feature flag.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D22054480

fbshipit-source-id: 3ea48ab46aeb3532fc7a3dd83659d7c32891ec06
2020-06-15 18:43:30 -07:00
Joshua Gross 33ed358330 Bust surfaceActiveForExecution cache after executing a batch of items
Summary:
Since we were not busting the `surfaceActiveForExecution` cache, it is very possible (likely, even!) that a surfaceId is invalidated in between UI ticks but we keep executing items for that surface at the next tick.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D22055303

fbshipit-source-id: 351c13535e85b30e00684fe35fc4aa79ccb5961c
2020-06-15 18:05:19 -07:00