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

3039 Коммитов

Автор SHA1 Сообщение Дата
Valentin Shergin 9842e39019 Fabric: folly::dynamic was replaced with RawValue in prop-parsing infra
Summary:
Our long-term plan is to completely illuminate `jsi::Value`-to-`folly::dynamic` serialization step in prop parsing process improving performance and memory pressure. At the same time, we don't want to introduce a hard dependency in application code to JSI because it exposes direct access to VM and prevents parsing some data that come *NOT* from JSVM.
RawValue is an extremely light-weight (hopefully fully optimized-out) abstraction that provides limited JSON-like and C++-idiomatic interface.

The current particular implementation is still using `folly::dynamic` inside, but I have fully JSI-powered one which will replace the current one right after we figure out how to deal with folly::dynamic-specific callsites. Or we can implement RawValue in a hybrid manner if a code-size implication of that will be minimal.

Reviewed By: JoshuaGross, mdvacca

Differential Revision: D13962466

fbshipit-source-id: e848522fd242f21e9e771773f2103f1c1d9d7f21
2019-02-06 16:34:46 -08:00
Dulmandakh adc1410572 ReactPicker extends AppCompatSpinner (#23303)
Summary:
Google recommends to extend AppCompat widget, and this PR changes ReactPicker to extend AppCompatSpinner.

[Android] [Changed] - ReactPicker extends AppCompatSpinner
Pull Request resolved: https://github.com/facebook/react-native/pull/23303

Differential Revision: D13973918

Pulled By: cpojer

fbshipit-source-id: f925994eb631815c7461ed519701cd77e7068f38
2019-02-06 12:00:09 -08:00
Dulmandakh 833429dd63 ReactSlider extends AppCompatSeekBar (#23304)
Summary:
Google recommends to use AppCompat widgets, and this PR changes ReactSlider to extend AppCompatSeekBar.

[Android] [Changed] - ReactSlider extends AppCompatSeekBar
Pull Request resolved: https://github.com/facebook/react-native/pull/23304

Differential Revision: D13973636

Pulled By: cpojer

fbshipit-source-id: 9aa160b186fcea593224c5760a2de0fc3a2b6f85
2019-02-06 10:34:02 -08:00
David Vacca 185320db23 Initialize internals of ReadableNativeMap with the correct initial capacity
Summary: This diff initializes internals maps of ReadableNativeMap with the correct initial capacity

Reviewed By: kathryngray

Differential Revision: D13970989

fbshipit-source-id: d104fcbaf938f377a0138b839375c4bc146f1732
2019-02-06 09:24:19 -08:00
Ram N aa3fc0910a Move CoreModulesPackage to use TurboReactPackage
Summary:
In the path to TurboModules, this was the only package that was using LazyReactPackage. Moving this to use TurboReactPackage now ensures that all the packages now have a similar interface, and more importantly, implement `NativeModule getModule(String name)` method.

Note that in OSS, we still do not run the annotation processor. As a result, we manually create the ReactModuleInfoProvider map, so that this works in OSS also.

Reviewed By: fkgozali

Differential Revision: D9419573

fbshipit-source-id: f5b15713aff0c1a221767f1c23d9b76b04434570
2019-02-06 08:54:05 -08:00
Dulmandakh a4840e7ae3 remove redundant targetApi and version checks (#23302)
Summary:
RN supports API 16 and above, but we have redundant historical artifacts where we check and target APIs 16 and below. This PR removes redundant artifacts.

[Android] [Changed] - remove redundant targetApi and version checks
Pull Request resolved: https://github.com/facebook/react-native/pull/23302

Differential Revision: D13970434

Pulled By: mdvacca

fbshipit-source-id: 096b5ee6c8f076b0365e7dda0e77940290077ea2
2019-02-05 23:12:53 -08:00
Dulmandakh 3b9604feda ReactActivity extends AppCompatActivity (#23278)
Summary:
Google recommends to extend AppCompatActivity. and This PR changes ReactActivity to extend AppCompatActivity

[Android] [Changed] - ReactActivity extends AppCompatActivity
Pull Request resolved: https://github.com/facebook/react-native/pull/23278

Reviewed By: fkgozali

Differential Revision: D13937917

Pulled By: mdvacca

fbshipit-source-id: 4216482b30349b24e3cbf2bdc24d9a890744132f
2019-02-05 12:20:38 -08:00
Dulmandakh d53dbb0dfb SuppressLint("MissingPermission") in Location, NetInfo, Vibration mod… (#23294)
Summary:
Location, NetInfo and Vibration modules require its own permissions to work properly, and Android Studio and lint shows warning in the modules because permissions are not found in AndroidManifest.xml of ReactAndroid, due to that not all apps require these functionalities/permissions. Therefore, developers have to add required permissions if they want to use before mentioned functionalities.

This PR suppresses missing permission warnings.

[Android] [Changed] - Suppress missing permission warnings
Pull Request resolved: https://github.com/facebook/react-native/pull/23294

Differential Revision: D13959120

Pulled By: cpojer

fbshipit-source-id: 10526f1218989b805528a5415e03371d5865be63
2019-02-05 10:34:46 -08:00
Dulmandakh 38eb2a70af Enable Java8 (#23295)
Summary:
Running *lint* on RN found that there are some Java 8 features used without specifying Java 8 compatibility in projects. This PR adds Java 8 compatibility and fixes errors caused by Java 8 feature use. I suspend that it may be cause of many failures on older Androids, but also found that many modules/packages switched to and require Java 8.

```java
../../src/main/java/com/facebook/react/devsupport/BundleDownloader.java:167: Try-with-resources requires API level 19 (current min is 16)
../../src/main/java/com/facebook/react/devsupport/DevServerHelper.java:658: Try-with-resources requires API level 19 (current min is 16)
```

For more information https://developer.android.com/studio/write/java8-support

[Android] [Changed] - Enable Java 8
Pull Request resolved: https://github.com/facebook/react-native/pull/23295

Differential Revision: D13959096

Pulled By: cpojer

fbshipit-source-id: 0bfd0565b61a132906cf35ee55b4afcf5450f7cb
2019-02-05 10:18:27 -08:00
Dulmandakh 4d95e85f64 remove unnecessary Android version checks (#23277)
Summary:
React Native's minSdkVersion is 16, or we support Android versions 16 (Jelly Bean) and above. But in the code we have many checks if Android is Jelly Bean or newer, which are unnecessary. This PR removes unnecessary Android version checks, also uses Android version names instead of numbers.

[Android] [Changes] - remove unnecessary Android version checks
Pull Request resolved: https://github.com/facebook/react-native/pull/23277

Differential Revision: D13955909

Pulled By: cpojer

fbshipit-source-id: 6b1caa5ef4fe42273d3c69a6617fff140a697b5c
2019-02-05 03:08:16 -08:00
Angel Kjoseski 52bdf34059 Add support for intent:// URIs
Summary:
Adding support for `intent://` URIs.
More details about this type of URIs: https://developer.chrome.com/multidevice/android/intents

Reviewed By: mdvacca

Differential Revision: D13817496

fbshipit-source-id: e1eeb8bd4e293e2c24ce0910286724108b3e10de
2019-02-05 02:18:43 -08:00
David Vacca 7f27888878 Add performance counters for Fabric
Summary:
This diff adds performance loggers for Fabric in Android to be able to compare current version or RN with Fabric

This is the summary of Points and Annotations:

- **UIManager_CommitStart**: time that React starts the commit (react tree is ready to start rendering in native)
- **UIManager_LayoutTime**: this is the time it takes to calculate layout in yoga
- **UIManager_FabricFinishTransactionTime**: Time it takes transform "C++ mutationInstructions" into "Java MountItems" and cross boundaries from C++ to Java (including serialization of data) (THIS IS ONLY FABRIC)
- **UIManager_DispatchViewUpdates**: time right before RN moves the mount operations to the Queue that is going to be processed in the next tick UI thread
- **UIManager_BatchRunStart**: time right before the mountItems are going to be process in the UI Thread
- **UIManager_BatchedExecutionTime**: time it took to run batched mountItems (usually layout and prop updates on views)
- **UIManager_NonBatchedExecutionTime**: time it took to run non-batched mountItems (usually creation of views)

Reviewed By: fkgozali

Differential Revision: D13838337

fbshipit-source-id: 0a707619829e7d95ce94d9305ff434d1224afc46
2019-02-04 17:27:30 -08:00
Dulmandakh c493cfe708 remove ViewHelper, use ViewCompat instead (#23280)
Summary:
ViewHelper has only setBackground method which works identical to ViewCompat.setBackground from Android Support Library. This PR removes ViewHelper, and uses ViewCompat instead.

[Android] [Changed] - remove ViewHelper, use ViewCompat instead
Pull Request resolved: https://github.com/facebook/react-native/pull/23280

Differential Revision: D13950510

Pulled By: mdvacca

fbshipit-source-id: 10b5122affac17d4b66fb995339c6715c0871ed0
2019-02-04 16:16:39 -08:00
Vojtech Novak 58437cd10a fix checkbox casting crash in old android versions (#23281)
Summary:
fixes casting on older android versions reported in #22885

[Android] [Fixed] - fix casting crash in android checkbox
Pull Request resolved: https://github.com/facebook/react-native/pull/23281

Differential Revision: D13941776

Pulled By: cpojer

fbshipit-source-id: ff3695f64d3399790a03b02d5b1363cacc655336
2019-02-04 08:07:44 -08:00
David Vacca 8110909526 Add QPL marker to track time it takes to load .so file from RN
Summary: Simple diff that adds QPL marker to track time it takes to load .so file used by RN Fabric

Reviewed By: fkgozali

Differential Revision: D13934149

fbshipit-source-id: a5cb0fc255394cf6c936b9018c753dcc774c347f
2019-02-02 11:58:43 -08:00
Dulmandakh dda2b82a0a ReactActivity extends FragmentActivity (#22662)
Summary:
In https://github.com/facebook/react-native/pull/20602, I tried to make ReactActivity to extend AppCompatActivity per Google recommendation. But import failed, now ReactActivity extends FragmentActivity which is a parent class of AppCompatActivity and step forward to extend AppCompatActivity.
Pull Request resolved: https://github.com/facebook/react-native/pull/22662

Reviewed By: mdvacca

Differential Revision: D13505140

Pulled By: hramos

fbshipit-source-id: d4edc8dc5c606c45811c1deddf5727a47ad484d8
2019-02-01 12:34:13 -08:00
Salakar 84572c4051 apply Network Security Config file (fixes #22375) (part 2 of #23105) (#23135)
Summary:
This is a follow-up PR for https://github.com/facebook/react-native/pull/23105 - as mentioned on discord.

 ---

This PR applies the network security config for the RN template project only. New RN projects started with the updated template will be able to connect to the packager on builds built with Android API 28 & above.

See https://developer.android.com/training/articles/security-config#CleartextTrafficPermitted for more information about this newly required config, specifically:

![image](https://user-images.githubusercontent.com/5347038/52124287-b3de2580-2620-11e9-958d-bc2da15c6f01.png)

Changelog:
----------
[ANDROID] [Template] add Network Security Config file to allow access to packager via cleartext requests in Android API 28 and above. (fixes #22375)
Pull Request resolved: https://github.com/facebook/react-native/pull/23135

Differential Revision: D13917058

Pulled By: cpojer

fbshipit-source-id: 0e66f2cde712c1285d217e3625b73028c3770b65
2019-02-01 06:36:18 -08:00
Davide Mainas 32cb9ec49c Fix Inverted Horizontal ScrollView on Android (#23233)
Summary:
ScrollView (as well as FlatList) used with horizontal={true} and inverted={true} do not scroll as expected due to a known Android P bug.

Fixes #22710. This is pretty much a clone of PR #21117, applied to a horizontal ScrollView.

[Android] [Fixed] - Fix Inverted Horizontal ScrollView on Android

1. Create a test application with a FlatList with horizontal={true} inverted={true}.
2. Fill it with data
3. Scroll and release your finger
Pull Request resolved: https://github.com/facebook/react-native/pull/23233

Differential Revision: D13915911

Pulled By: cpojer

fbshipit-source-id: d32c82e6d9076f5ffdf342fcd71bd921e9c8a97b
2019-02-01 04:02:26 -08:00
Dulmandakh 07d1075f37 bump soloader to 0.6.0 (#23239)
Summary:
Bump soloader to 0.6.0, which added support for App Bundling and help reduce app size.

[Android] [Changed] - Bump Soloader to 0.6.0

CI is green and everything works just fine.
Pull Request resolved: https://github.com/facebook/react-native/pull/23239

Differential Revision: D13915901

Pulled By: cpojer

fbshipit-source-id: 917705326b76fc3356828e5d00e6148e292bd12a
2019-02-01 03:40:37 -08:00
Matt Hargett 36916ee99d Fix portability issues to Linux, FreeBSD, and older libc++
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/21764

Differential Revision: D13902907

Pulled By: hramos

fbshipit-source-id: 640cde865b1bcc5ca43c17d00574b8e2f78ceaf4
2019-01-31 17:45:20 -08:00
scisci e405e84fc3 Fix Native Rotation Android (#18872)
Summary:
Fixes #14161
Android crashes in some cases if an animated transform config contains a string value, like a rotation.
This PR fixes that by ensuring all values sent to the native side are doubles. It adds `__transformDataType` to AnimatedTransform.js.

Added integration test `ReactAndroid/src/androidText/js/AnimatedTransformTestModule.js` This test fails with the following error `INSTRUMENTATION_RESULT: longMsg=java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Double`, if the changes to AnimatedTransform.js are reverted.

[Android] [Fixed] - Fixes Android crash on animated style with string rotation
Pull Request resolved: https://github.com/facebook/react-native/pull/18872

Differential Revision: D13894676

Pulled By: cpojer

fbshipit-source-id: 297e8132563460802e53f3ac551c3ba9ed943736
2019-01-31 01:36:21 -08:00
Ranjan Shrestha 4c10f9321c Make perspective transformation look exactly same on iOS and Android (#18302)
Summary:
There is a variation in iOS and Android output while performing perspective transformation. The variation exists even when used in Android devices with different screen density.
Pull Request resolved: https://github.com/facebook/react-native/pull/18302

Differential Revision: D13877483

Pulled By: cpojer

fbshipit-source-id: e48be047a8047c7562722923a67666cb098243d8
2019-01-30 09:56:58 -08:00
David Vacca 6feb3dc837 Include PreAllocateViewMountItem into the eager initialization of Fabric classes
Summary: simple diff to eager initialize the PreAllocateViewMountItem class with the rest of the Fabric classes

Reviewed By: sahrens

Differential Revision: D13860612

fbshipit-source-id: d1fbc653420c1c1546bbf605c682ad5bb611d76b
2019-01-30 00:15:25 -08:00
David Vacca 16a6e51045 Optimize pre-allocation of views
Summary: This diff changes the way pre-allocation of views are executed in Fabric. Before this diff the execution of view preallocation was schedulled at the end of the UIThread queue, now the views are pre-allocated in the next "tick"

Reviewed By: sahrens

Differential Revision: D13857614

fbshipit-source-id: 386bf966d3c8a0d5c0bd626119a92810465aecb7
2019-01-30 00:15:25 -08:00
Kevin Gozali 4c69ccd0fb Revert D13860038: [react-native][PR] Add ability to control scroll animation duration for Android
Differential Revision:
D13860038

Original commit changeset: f06751d063a3

fbshipit-source-id: 5d89137aed0d549004e790068c1e4998ebccdaf1
2019-01-29 18:00:54 -08:00
Michał Osadnik 7e8b810499 Add ability to control scroll animation duration for Android (#22884)
Summary:
Motivation:
----------
This is one of the more sought after feature requests for RN:
react-native.canny.io/feature-requests/p/add-speed-attribute-to-scrollto

This PR adds the support to add a "duration" whenever using "scrollTo" or "scrollToEnd" with
a scrollView. Currently this only exists for Android as the iOS implementation will be somewhat more involved.

This PR is also backwards compatible and does not yet deprecate the "animated" boolean. It may not make sense to ever deprecate "animated", as it could be the flag that is used when devs want the system default duration (which is 250ms for Android). I'm not sure what it is for iOS. It would simplify things to remove "animated", though.
Pull Request resolved: https://github.com/facebook/react-native/pull/22884

Differential Revision: D13860038

Pulled By: cpojer

fbshipit-source-id: f06751d063a33d7046241c95348b6abbb327d36f
2019-01-29 07:18:09 -08:00
rogerkerse 8afa0378cd SystemUiVisibility overwritten bug (#17370)
Summary:
Make StatusBar style respect previously set systemUiVisibility

<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

I tried to set `SystemUiVisibility` flag to `SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR` to enable Android's light soft navigation bar, but when I had `<StatusBar />` component in my view, then it was always overwritten. This is how I found the bug and fixed it.

1. In MainActivity you can set systemUiFlags like this in onCreate method
```
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            Window window = getWindow();
            View rootView = window.getDecorView().getRootView();
            rootView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
        }
```
2. Add <StatusBar /> to a view
3. In `android/app/build.gradle` file set `targetSdkVersion` to **27** instead of 22 or something like that
4. In `android/app/src/main/res/values/styles.xml` add 2 lines to `AppTheme`
```
        <item name="android:windowDrawsSystemBarBackgrounds">true</item>
        <item name="android:navigationBarColor">#ffffff</item>
```
5. Run the app.
6. Test. Previously bottom soft navigation bar was set to white and buttons also to white (so they weren't visible anymore), because StatusBar was overwriting previously set systemUiVisibility Flags. Now the bar should be white and buttons dark as expected.

Previous buggy android bottom navbar
<img width="379" alt="screen shot 2017-12-27 at 17 11 57" src="https://user-images.githubusercontent.com/571171/34385126-2a3edc44-eb29-11e7-812e-846cfd2fb88b.png">

New fixed android bottom navbar
<img width="379" alt="screen shot 2017-12-27 at 17 12 07" src="https://user-images.githubusercontent.com/571171/34385137-3e82517c-eb29-11e7-8af9-a3b7a41ae8e2.png">

This pull request does not change any existing feature. It only makes StatusBar coloring work more properly without affecting bottom navigation bar on android or any other system ui visibility feature.

<!--
Help reviewers and the release process by writing your own release notes

**INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.**

  CATEGORY
[----------]        TYPE
[ CLI      ]   [-------------]      LOCATION
[ DOCS     ]   [ BREAKING    ]   [-------------]
[ GENERAL  ]   [ BUGFIX      ]   [-{Component}-]
[ INTERNAL ]   [ ENHANCEMENT ]   [ {File}      ]
[ IOS      ]   [ FEATURE     ]   [ {Directory} ]   |-----------|
[ ANDROID  ]   [ MINOR       ]   [ {Framework} ] - | {Message} |
[----------]   [-------------]   [-------------]   |-----------|

[CATEGORY] [TYPE] [LOCATION] - MESSAGE

 EXAMPLES:

 [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things
 [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput
 [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with
 [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word
 [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position
 [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see
-->
[ANDROID] [BUGFIX] [StatusBar] - Fixed StatusBar overwriting previously set SystemUiVisibility flags
Pull Request resolved: https://github.com/facebook/react-native/pull/17370

Differential Revision: D13860079

Pulled By: cpojer

fbshipit-source-id: a0bca7acb7601eb78f0842239ea4dee76a63d1fd
2019-01-29 07:12:41 -08:00
David Vacca 0bf6a8e914 Remove ReactInstanceManager out of FabricJSIModuleProvider
Summary: easy cleanup in FabricJSIModuleProvider

Reviewed By: shergin

Differential Revision: D13838336

fbshipit-source-id: 12738572394e9c091e559817f9886fa3aaf23570
2019-01-28 19:44:29 -08:00
David Vacca 2b356590f8 Remove components out of Bindings
Summary: This diff removes the components dependencies out of the Fabric/jsi/jni project

Reviewed By: shergin

Differential Revision: D13734001

fbshipit-source-id: 65182bfa5ee9fcd526a9afc40bd9fd6f0b86c5a5
2019-01-28 19:44:29 -08:00
Riley Dulin cf0c37b08b Remove UIProp class from redex and proguard rules, it doesn't exist
Summary:
`com.facebook.react.uimanager.UIProp` doesn't exist anymore in React Native.
Remove all the old references to it in various redex and proguard configurations.

Reviewed By: int3, minjang, justinjhendrick

Differential Revision: D13847084

fbshipit-source-id: 366fb0b25f446903cc2885686850810778779e5e
2019-01-28 14:42:03 -08:00
David Vacca 10b521815c Add QPL marker to track time it takes to load .so file from RN
Summary: Simple diff that adds QPL marker to track time it takes to load .so file from RN

Reviewed By: fkgozali

Differential Revision: D13845379

fbshipit-source-id: 6c2272605ba3fb08ab8ebce867f84c6a488438d0
2019-01-28 13:00:05 -08:00
Sunny Luo 46aaa02274 Make the load-script-error less misleading (#17055)
Summary:
For most cases, people saw this error when they are running a debug version. So they should check metro server first. However, they were misled to search for "bundle" keywords and finally they executed "react-native bundle" command and got an app that can never reload.
Pull Request resolved: https://github.com/facebook/react-native/pull/17055

Differential Revision: D13421737

Pulled By: cpojer

fbshipit-source-id: 8e108df06b7d416a74c33581457f3213b28306c1
2019-01-28 08:21:38 -08:00
Kesha Antonov 54534e79d7 CameraRoll support for Videos and Photos showed in same time (#16429)
Summary:
Right now you can choose to show Videos OR Photos.
This PR allows to show both in the same time.

[ANDROID][ENHANCEMENT] - Can show videos and photos from CameraRoll in the same time
Pull Request resolved: https://github.com/facebook/react-native/pull/16429

Differential Revision: D13839638

Pulled By: cpojer

fbshipit-source-id: 5edc039552888c3ba8a40f39e262919fa7c00b39
2019-01-28 07:39:59 -08:00
Chris Lewis 7cbdd7b6ac Remove replaceOkHttpClient method (#16972)
Summary:
This method was originally intended to replace the OkHttp client used by React Native's networking library. However it has effectively been a noop since 0a71f48b13 (diff-177100ae5a977e4060b54cc2b34c79a7), when the Networking library was modified to create a new client rather than use the reference provided by OkHttpClientProvider.

Leaving this code in place is dangerous. There is no indication to users upgrading React Native that the method is no longer replacing the OkHttpClient used by the Networking library. Any functionality reliant on overriding the client will silently break. This caused us some problems internally.

There's been a PR out for some time that seeks to reintroduce this functionality: https://github.com/facebook/react-native/pull/14068

I've also put up a new PR that adds an interface for replacing the client without introducing breaking changes: https://github.com/facebook/react-native/pull/17237

Do our unit tests continue to pass? Should be safe as this method is not used anywhere inside React Native.

[ANDROID] [BREAKING] [Networking] - removed replaceOkHttpClient method in OkHttpClientProvider.
Pull Request resolved: https://github.com/facebook/react-native/pull/16972

Differential Revision: D13838805

Pulled By: cpojer

fbshipit-source-id: 43606d1d141afb9b5dda4dd64e5ac5448771b45c
2019-01-28 05:20:58 -08:00
Janic Duplessis 3a33e75183 Fix textTransform when used with other text styles on Android (#22670)
Summary:
On Android `textTransform` breaks other styles applied to the text. It seems related to the usage of `ReplacementSpan` which allows drawing the text manually but seems to throw away some changes made by other span applied to the text.

To fix it I removed the usage of `ReplacementSpan` and simply transform the text before appending it to the `Spannable` string. To make sure textTransform is inherited correctly I added it to TextAttributes which handles this.
Pull Request resolved: https://github.com/facebook/react-native/pull/22670

Differential Revision: D13494819

Pulled By: cpojer

fbshipit-source-id: 1c69591084aa906c2d3b10153b354d39c0936340
2019-01-25 06:27:21 -08:00
Michel dos Santos Kuguio 5be50d4820 - update to gradle 4.10.1 or high (#23103)
Summary:
Add suport to gradle 4.10.1 or high!
The new version of android studio 3.3 recommendete to update gradle project to 4.10.1

> To take advantage of the latest features, improvements, and security fixes, we strongly recommend that you update the Android Gradle plugin to version 3.3.0 and Gradle to version 4.10.1. [Release notes ](https://developer.android.com/studio/releases/gradle-plugin)

>Android plugin 3.2.0 and higher now support building the Android App Bundle—a new upload format that defers APK generation and signing to compatible app stores, such as Google Play. With app bundles, you no longer have to build, sign, and manage multiple APKs, and users get smaller, more optimized downloads. [Learn more](https://developer.android.com/guide/app-bundle/?utm_source=android-studio)

but if the upgrade to the new Android gradle many warnings come up, becouse meny things was obsoleted

> WARNING: API 'variant.getMergeResources()' is obsolete and has been replaced with 'variant.getMergeResourcesProvider()'.

> WARNING: API 'variant.getPackageApplication()' is obsolete and has been replaced with 'variant.getPackageApplicationProvider()'.

> WARNING: API 'variant.getMergeAssets()' is obsolete and has been replaced with 'variant.getMergeAssetsProvider()'.

> It will be removed at the end of 2019.
> For more information, [see ](https://d.android.com/r/tools/task-configuration-avoidance.)
> To determine what is calling variant.getMergeAssets(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.

Changelog:
----------
[Android] [Deprecated] - fix warinings obsolete to update to gradle 4.10.1 or high
Pull Request resolved: https://github.com/facebook/react-native/pull/23103

Differential Revision: D13817123

Pulled By: cpojer

fbshipit-source-id: 9816e20145a5fded2702cf9317cfb6862f3ebd8b
2019-01-25 03:26:32 -08:00
Jyrno Ader 7795a672d3 Android: Add error description to Image onError callback (#22737)
Summary:
fixes #19073

Changelog:
----------

[Android] [Fixed] - Add error description to Image onError callback
Pull Request resolved: https://github.com/facebook/react-native/pull/22737

Differential Revision: D13676224

Pulled By: hramos

fbshipit-source-id: 0dea7e97ae6517b8980ad02827f19d22cd3ef933
2019-01-24 16:04:29 -08:00
Oleg Bogdanov 5c0dcddc0f Expose initialAppState constant from Android native AppState module (#19935)
Summary:
This PR addresses TODO left in _AppState.js_

The goal is to align AppState module implementation between iOS and Android. iOS native module exposes _initialAppState_ constant that AppState.js relies on, while Android doesn't expose that constant and js implementation uses a fallback. This PR aims to remove a need for a fallback
Pull Request resolved: https://github.com/facebook/react-native/pull/19935

Reviewed By: hramos

Differential Revision: D13774044

Pulled By: ejanzer

fbshipit-source-id: 05d27e702cb9aeedf14293158bfd50004df4726b
2019-01-24 11:30:49 -08:00
David Aurelio f4def0062c Delete functionality for shared childen
Summary:
@public

Removes `YGNodeInsertSharedChild` / `addSharedChildAt`.

This functionality is unused, and can cause memory leaks.

Reviewed By: SidharthGuglani

Differential Revision: D13711105

fbshipit-source-id: 86206c05393b3f1a497e6b046006f94ead88c6ce
2019-01-24 06:31:00 -08:00
Adam Comella 4936d284df Android: Add a maxFontSizeMultiplier prop to <Text> and <TextInput> (#23069)
Summary:
Equivalent of this iOS PR: https://github.com/facebook/react-native/pull/20915

Motivation:
----------

Whenever a user changes the system font size to its maximum allowable setting, React Native apps that allow font scaling can become unusable because the text gets too big. Experimenting with a native app like iMessage on iOS, the font size used for non-body text (e.g. header, navigational elements) is capped while the body text (e.g. text in the message bubbles) is allowed to grow.

This PR introduces a new prop on `<Text>` and `<TextInput>` called `maxFontSizeMultiplier`. This enables devs to set the maximum allowed text scale factor on a Text/TextInput. The default is 0 which means no limit.
Pull Request resolved: https://github.com/facebook/react-native/pull/23069

Differential Revision: D13748513

Pulled By: mdvacca

fbshipit-source-id: 8dd5d6d97bf79387d9a2236fa2e586ccb01afde9
2019-01-23 11:40:00 -08:00
Khaled Tantawy 9968d0c203 Rename dev settings menu preferences file as it conflicts with fennec's (#23123)
Summary:
On Android, resources with the same name from different libraries conflict, so it's encouraged to have prefixes for resource names.

This is one case where the settings menu preferences file in firefox for android is called `preferences.xml` so it conflicts with the dev support settings menu for react native.

when integrating react-native to the firefox project, react native dev settings menu never shows, and the one from firefox shows up instead.

This a link to a file from a fork project that I'm working on:
https://github.com/ghostery/browser-android/blob/master/mozilla-release/mobile/android/app/src/main/res/xml/preferences.xml

Please, let me know, if anything more needs to be changed

Changelog:
-----------
[Android] [Fixed] Rename dev settings menu preferences file with a RN prefix.
Pull Request resolved: https://github.com/facebook/react-native/pull/23123

Differential Revision: D13781836

Pulled By: cpojer

fbshipit-source-id: f27483d4eca5aa4148759b94b601673985c5aa91
2019-01-23 04:22:25 -08:00
Michael Diarmid 3b0b7ce8c3 Add Network Security Config file (fixes #22375) (#23105)
Summary:
This fixes #22375. Android API level 28 and above now blocks all [clear text requests](https://developer.android.com/training/articles/security-config#CleartextTrafficPermitted) unless a network configuration rule is added to exclude it specifically.

The packager falls into this category and therefore gets blocked; resulting in the app being unable to connect to it.

Domains/IPs for the config have been taken from [here](https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/AndroidInfoHelpers.java#L20-L22).

This change only adds to DevSupport android resources - so won't affect builds without DevSupport, e.g. release builds.

Changelog:
----------

[ANDROID] [DevSupport] add Network Security Config file to allow access to packager via cleartext requests in Android API 28 and above. (fixes #22375)
Pull Request resolved: https://github.com/facebook/react-native/pull/23105

Differential Revision: D13781516

Pulled By: cpojer

fbshipit-source-id: f7574f3e1b0fe6984efe1d0598ef631385c245bc
2019-01-23 03:07:52 -08:00
Dulmandakh 5bbed43854 android support library 28.0.0 (#23109)
Summary:
Bump Android Support Library to 28.0.0. Therefore fix Android CI

Changelog:
----------
[Android] [Changed] - Bump Android Support Library to 28.0.0.
Pull Request resolved: https://github.com/facebook/react-native/pull/23109

Differential Revision: D13779835

Pulled By: mdvacca

fbshipit-source-id: 7645ffe2c04ca81424b2f9cfa43dc4ec30c50e25
2019-01-23 02:22:00 -08:00
David Vacca b718d33721 Eager load Fabric classes
Summary: Eager load classes used by Fabric. This is a temporary change that will be reverted in the near future

Reviewed By: shergin

Differential Revision: D13747454

fbshipit-source-id: 8ceb21f51982bcfcaa005dcc2ad9b457f7211795
2019-01-22 11:39:00 -08:00
David Vacca fe6f6cd46f Upgrade Android support library to version 28 in RN
Summary: This diff upgrades the Android Support Library to use version 28.0.0

Reviewed By: cpojer

Differential Revision: D13737512

fbshipit-source-id: 7b3d9c384df0b25e5ce48e769e1ff0ac9be9f104
2019-01-22 10:44:53 -08:00
David Vacca a746f3b6c4 Fix Android OSS CI
Summary: Replace a library to fix Android OSS CI

Reviewed By: fkgozali

Differential Revision: D13763871

fbshipit-source-id: 44e2b32883a03583a6dddcb656a848aa8b1f0bb8
2019-01-22 09:47:12 -08:00
Christoph Nakazawa a3620799ec Fix OSS CI
Summary: This diff fixes Android OSS CI

Reviewed By: rickhanlonii

Differential Revision: D13747492

fbshipit-source-id: 6f90df6d3a096e3bf8a710382e192c3f54f00268
2019-01-21 08:28:47 -08:00
Adam Comella 1f912b9f31 Android TextInput: Fix updating of style props (#22994)
Summary:
For certain style props, each time any style prop changed, the previous version of the style would remain. For example, if you passed `"underline"` for `textDecorationLine` on a `TextInput` and then later passed `undefined` for `textDecorationLine`, the underline would remain.

We solved this problem before in de586bfa18. The fix was to use `manageSpans` to remove the old spans we added before adding the new spans. However, that fix hardcoded the list of spans to remove. Every span type that was introduced since that commit is affected by this bug:
  - CustomLetterSpacingSpan
  - CustomLineHeightSpan
  - CustomTextTransformSpan
  - ShadowStyleSpan
  - StrikethroughSpan
  - UnderlineSpan
  - TextInlineImageSpan

The reason this bug was reintroduced is `ReactBaseTextShadowNode` is responsible for adding spans and `ReactEditText` is responsible for removing spans. These classes fell out of sync.

This fix attempts a more robust solution. Every span that React Native adds to text now implements the `ReactSpan` interface. `manageSpans` deletes all spans that React Native adds by targeting the ones that implement `ReactSpan`. `ReactBaseTextShadowNode.SetSpanOperation` has been updated so that it's a compiler error to add a span that doesn't implement `ReactSpan`.
Pull Request resolved: https://github.com/facebook/react-native/pull/22994

Differential Revision: D13727580

Pulled By: mdvacca

fbshipit-source-id: 07b2eb08832efafb6c2806aa3329f0e9466b09fb
2019-01-18 11:34:51 -08:00
Kudo Chien 6a3d9c06ce Fix Picker.onValueChange on Android sometimes not fired due to race condition (#22821)
Summary:
Changelog:
----------

[Android] [Fixed] - Fix Picker.onValueChange sometimes not fired due to race condition. Fixes #15556

Root Cause:
------------

Please check my code snippet at https://snack.expo.io/kudochien/android-picker-issue
and try to select different items on Picker to see if console.log() hit.
If calling setState() with some latency, e.g. setTimeout() or changes from redux,
the second time changing picker item on UI, the onValueChange() will be not fired.

The root cause comes from the `forceUpdate` in PickerAndroid.android.js.
If user's setState() update comes after forceUpdate(), the flow will be:
1. First time select picker item
2. onValueChange + forceUpdate
3. user's setState() + componentDidUpdate + setNativeProps({ selected: ... })
4. mSuppressNextEvent = true
5. Second time select picker item
6. Since mSuppressNextEvent is true, the onValueChange will not be fired.

Solution:
---------

Like other controlled components, disable change listener during setup values from JS.
Android Spinner `setSelection(int position)` is asynchronous call, i.e. will fire onItemSelected in next run loop and is not suitable for us.
`setSelection(int position, boolean animate)`, however, is synchronous call which I used.

Some more references about setSelection:
https://stackoverflow.com/a/43512925/2590265
http://androidxref.com/8.1.0_r33/xref/frameworks/base/core/java/android/widget/AbsSpinner.java#276
The two arguments version will use `setSelectionInt()` which set mBlockLayoutRequests as true to prevent onItemSelected call from next layout().

I also moved the setOnItemSelectedListener() call after onLayout to prevent onValueChange() during intialization.
Pull Request resolved: https://github.com/facebook/react-native/pull/22821

Differential Revision: D13731979

Pulled By: cpojer

fbshipit-source-id: e06bd9aa62463b66c8f3fd7214485898d5375054
2019-01-18 08:12:12 -08:00
David Vacca 707622ac84 Refactor FabricBinding class
Summary: This diff removes the FabricBinding interface becuase it is not needed anymore.

Reviewed By: sahrens

Differential Revision: D13707494

fbshipit-source-id: 7b50dcd40559356464a860ba32d9a0130ab2da6e
2019-01-17 13:05:29 -08:00