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

3091 Коммитов

Автор SHA1 Сообщение Дата
Vojtech Novak 976f4be457 support checkbox tinting (#18300)
Summary:
RN offers checkbox component on android: https://facebook.github.io/react-native/docs/checkbox.html

The Checkbox colors for checked and unchecked states cannot be controlled from JS at the moment; this PR adds support for that.

The essence of changing colors for the states is this:

```
ColorStateList cls = new ColorStateList(
        new int[][] {
                new int[] { -android.R.attr.state_checked }, // unchecked
                new int[] {  android.R.attr.state_checked }  // checked
        },
        new int[] {
                uncheckedColor,
                checkedColor
        }
);
checkBox.setSupportButtonTintList(cls);
```

Because of this, I did it so that both colors have to provided together in an object. This is similar to [switch](https://facebook.github.io/react-native/docs/switch#trackcolor)
Pull Request resolved: https://github.com/facebook/react-native/pull/18300

Differential Revision: D14180218

Pulled By: cpojer

fbshipit-source-id: 88a9d1faf061c0651e3e28950f697535b90fbfd4
2019-02-21 20:16:14 -08:00
Luna Wei e758435167 Refactor the way UIManagerModule uses measure specs
Summary:
Instead of using measure specs to set certain yoga properties on the root node (like max width, auto width, specific width), use yoga's calculateLayout(width, height) instead. The measure specs will be stored in the shadow node. This allows us to remove duplicated code that processes the measure specs and allows us to remove other logic like the enableLayoutCalculation() method.

This diff also removes MeasureSpecProvider. MeasureSpecProvider was originally introduced to pass previously measured view measure specs to the initial creation of the root shadow node, but it turns out that this is unnecessary. We can update the root layout specs from the root view instead.

Reviewed By: mdvacca

Differential Revision: D9729744

fbshipit-source-id: 79b0b27ca879758f5dc3fc7cc8a0d38856a6cc79
2019-02-21 20:04:23 -08:00
mannol b47191608b Fix issue with composing text not being cleared on some Android devices (#18859)
Summary:
Clearing the android TextInput text programmatically (i.e. calling: this.textInputRef.clear()) does not clear the previously composing text, if enabled, causing inconveniences when such behaviour is desired (i.e. chat input box, where you constantly have to clear the input after sending a message). Instead, the currently observed behaviour is that, after a new text is entered (usually as soon as the first letter), the previously composing text reappears making the input unusable.

The effect is only observable on some devices, for example, we observed it on Samsung S6 devices using both Android 6 and 7, and several LG devices running Android 6.

This issue is only present when clearing the text; setting text to some other value does not produce the same effect.

<!--
  Required: Write your motivation here.
  If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
-->
Pull Request resolved: https://github.com/facebook/react-native/pull/18859

Differential Revision: D14067144

Pulled By: hramos

fbshipit-source-id: 09f337edc026b83221f8a399749222cd75457ec7
2019-02-21 17:42:56 -08:00
Joshua Gross c933755c6a Remove unused import, followup to D14114388
Summary: Remove an unused import.

Reviewed By: mdvacca

Differential Revision: D14161154

fbshipit-source-id: f1156020e6e8e90fb9ea86b313decd524c883e2a
2019-02-21 17:27:53 -08:00
David Aurelio 25566ef28b `setBaseLine` -> `setBaseline`
Summary:
@public

`setBaseLine` was the only place where we used a capitalised *L.* Fixed here.

Reviewed By: SidharthGuglani

Differential Revision: D14152320

fbshipit-source-id: abf54fe7d6088e03775968baa8421c4bf43d6a6e
2019-02-21 05:38:51 -08:00
David Aurelio dc7dce130b Allow to use JNI without global refs
Summary:
@public

Adds the ability to opt into avoiding global weak JNI refs via `YogaConfig`.

Note that only homogeneous trees are supported, i.e. **mixing weak-ref and non-weak-ref nodes will break!**

Not using JNI refs hopefully will help with avoiding JNI reference table overflows, and will help creating trees on multiple threads, as no lock has to be acquired at any time.

Reviewed By: SidharthGuglani

Differential Revision: D14151037

fbshipit-source-id: 56d94713d39aee080d54be4cb4cdf5e3eccb473a
2019-02-21 05:38:51 -08:00
Mike Lambert f32dc63546 Fix two bugs with Location when not using ACCESS_FINE_LOCATION (#10291)
Summary:
Fix two bugs with Location when not using ACCESS_FINE_LOCATION:
- If we request highAccuracy=false, because we don't have ACCESS_FINE_LOCATION, but we don't have access to the NETWORK_PROVIDER...then the code should not trigger a SecurityException because it fell-back to using GPS_PROVIDER (which we don't have permission for)
- If the device is pre-lollipop, and doesn't have a provider, we should detect this properly instead of letting the pre-lollipop code raise a SecurityException.

Unfortunately, SecurityExceptions cannot be caught by the calling JS code. But I am not fixing that one here, instead choosing to fix/obviate the SecurityExceptions altogether.
Pull Request resolved: https://github.com/facebook/react-native/pull/10291

Differential Revision: D4163659

Pulled By: cpojer

fbshipit-source-id: 18bb4ee7401bc4eac4fcc97341fc2b3a2a0957c9
2019-02-21 02:25:18 -08:00
Grégoire Rit c416b40542 Add setNextFocus support (#22082)
Summary:
Add properties to be able to set the nextFocus. It can be very useful with Android TV.

New android View properties :

* nextFocusDown binded to [setNextFocusDownId](https://developer.android.com/reference/android/view/View.html#setNextFocusDownId(int))
* nextFocusForward binded to [setNextFocusForwardId](https://developer.android.com/reference/android/view/View.html#setNextFocusForwardId(int))
* nextFocusLeft binded to [setNextFocusLeftId](https://developer.android.com/reference/android/view/View.html#setNextFocusLeftId(int))
* nextFocusRight binded to [setNextFocusRightId](https://developer.android.com/reference/android/view/View.html#setNextFocusRightId(int))
* nextFocusUp binded to [setNextFocusUpId](https://developer.android.com/reference/android/view/View.html#setNextFocusUpId(int))

Can be used to fix :

* Fixes #20593
* Fixes #20100

Same PR as #22080 but accorded to changes on master
Pull Request resolved: https://github.com/facebook/react-native/pull/22082

Differential Revision: D14162740

Pulled By: cpojer

fbshipit-source-id: 9a13a185d4e8307ce67014fb076c62d135c487c3
2019-02-20 23:37:35 -08:00
Rizwaan Bhikha f8a4d281e2 Do not bring app out of immersive mode when a modal is presented (#21078)
Summary:
This does fix the issue, however, another, perhaps related issue persists, the dialog/modal occasionally uses what would be the height of the app in non-immersive mode, in immersive mode. Meaning that the background, what ever it is set as, does not use the full available height.

See https://stackoverflow.com/a/23207365 for more info.

Known Problems:
---------
* [Date/time picker](https://facebook.github.io/react-native/docs/datepickerandroid) still brings app out of immersive mode - The date/time picker dialog needs the same treatment (this MR) as `RN Modal` using a wrapper.
* Focusing on text input, which brings up keyboard, also brings app out of immersive mode. Sometimes temporarily, sometimes permanently - Needs investigating. I have tried [this](https://stackoverflow.com/a/25129542), unfortunately it doesn't work. **Workaround I'm using for this, is to call a native module method to re-apply immersive mode flags after `keyboardDidHide` on JS side.**

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

[Android] [Fixed] - Dialog (RN Modal) brings app permanently out of immersive mode
Pull Request resolved: https://github.com/facebook/react-native/pull/21078

Differential Revision: D14163127

Pulled By: cpojer

fbshipit-source-id: e0b67c91fa81880b19438a939bca26c128309799
2019-02-20 23:20:51 -08:00
Dulmandakh ba0c3ffd5b ReactTextView extends AppCompatTextView (#23321)
Summary:
Google recommends to use AppCompat widgets, and this PR changes ReactTextView to extend AppCompatTextView.

[Android] [Changed] - ReactTextView extends AppCompatTextView
Pull Request resolved: https://github.com/facebook/react-native/pull/23321

Differential Revision: D13986149

Pulled By: cpojer

fbshipit-source-id: 878849fff12dc5478bb0d0952b2c22695391e81a
2019-02-20 23:07:07 -08:00
Murilo Araujo 28f1648989 - Fixed line not breaking when multiline set to true and keyboard type set to numeric (or other numeric type) (#21884)
Summary:
Native Android sets the EditText widget to multiline only if the InputType flags are set to Text (or its variants like textEmailAddress) and Multiline, which causes the React Native TextInput to not break the line when set to multiline={true} and keyboardType={'numeric'} as it only have the flags Multiline and Number set.

This fix forces the widget to enable multiline, by calling setSingleLine(false) everytime a state change needs to be commited and the multiline prop is set to true.
Pull Request resolved: https://github.com/facebook/react-native/pull/21884

Differential Revision: D14162701

Pulled By: cpojer

fbshipit-source-id: b7d3fc8c5a4444dcfd29ad74d515a8ae486c7ede
2019-02-20 21:44:22 -08:00
David Aurelio d53bfed9bb Add config for avoiding JNI refs
Summary:
@public

Adds `YogaConfig#avoidGlobalJNIRefs` to control whether nodes created with a config will use weak global JNI refs. Used for experimentation.

Reviewed By: SidharthGuglani

Differential Revision: D14149982

fbshipit-source-id: c777c8b3af2167d96154db5aa6afec1476dac35b
2019-02-20 11:59:21 -08:00
Joshua Gross ab6ea9c938 Enable NativeAnimationDriver in Fabric
Summary:
Enables NativeAnimationDriver in Fabric.

Fabric animations:
{F151048224}

Pre-Fabric animations:

{F151048344}

Reviewed By: mdvacca

Differential Revision: D14114388

fbshipit-source-id: 1f64db168ae037535a31def7da28b9e0474b7198
2019-02-20 00:15:04 -08:00
David Vacca 22d776f5c2 Fix AssertionError in EventDispatcher
Summary: This task fixes an AssertionError in EventDispatcher class, this is produced by a race condition.

Reviewed By: JoshuaGross

Differential Revision: D14134907

fbshipit-source-id: 7b670ee35e47c0d8a9f7f7b68a3b8f7193b7de54
2019-02-19 12:11:39 -08:00
David Aurelio 49d91456fd Extract abstract class `YogaNode`
Summary:
@public

Here, we extract an abstract class from `YogaNode`, in order to allow for experimentation with different implementations.

The reason for not choosing an interface is to keep ABI compatibility for `YogaNode.create()`.

Reviewed By: pasqualeanatriello

Differential Revision: D14044990

fbshipit-source-id: f8eb246338b55f34f0401198c0655abfcb7c9f37
2019-02-19 11:19:31 -08:00
David Aurelio 043d0d0e2d Switch to `YogaNode.create()`
Summary:
@public

Switches instance creation from `new YogaNode()` to `YogaNode.create()`.

This allows for experimentation with different implementations, while maintaining API + ABI compatibility internally at FB, as well as for dependent projects in open source and elsewhere.

Reviewed By: amir-shalem

Differential Revision: D14122975

fbshipit-source-id: f194b146b7cd693dba1a7dafdf92d350e54cb179
2019-02-19 11:19:31 -08:00
Héctor Ramos 2c25e34060 Use new yearless copyright header format
Summary: Use the new copyright header format used elsewhere in the React Native repository.

Reviewed By: shergin

Differential Revision: D14091706

fbshipit-source-id: b27b8e6bcdf2f3d9402886dbc6b68c305150b7d5
2019-02-19 10:35:12 -08:00
David Aurelio dc55e2980e Add support for context-aware logging functions
Summary:
@public

Context-aware logging functions are an internal Yoga feature that will be used for Yoga’s JNI code.

It will be possible to specify a context when calculating layout, which will be passed on to baseline and measure functions. This will be a private feature.

Reviewed By: SidharthGuglani

Differential Revision: D14123482

fbshipit-source-id: 8ba3b6c493bf79fe09831f22d2b6da44f09e3d95
2019-02-19 09:58:26 -08:00
David Aurelio e8f95dc7a1 Make logging private
Summary:
@public

Makes logging implementation internal to Yoga.

Breaking changes: removed  `YGLog` and `YGLogWithConfig`.

The upcoming changes to the JNI layer (removal of weak global refs for each node) requires adding additional parameters to the logging functions that will only be available when calculating layout.

Reviewed By: SidharthGuglani

Differential Revision: D14123390

fbshipit-source-id: 468e4a240c190342868ffbb5f8beb92324cdfdd6
2019-02-19 09:58:26 -08:00
David Aurelio 7030399ec8 Add `YogaNode.create()`
Summary:
Adds a factory method to `YogaNode`.

While this is purely redundant at the moment, it will allow experimentation in follow-up diffs. We will have concrete implementations deriving from `YogaNode` (which will be abstract).

Going through `YogaNode.create()` means that we can maintain ABI compatibility.

Reviewed By: amir-shalem

Differential Revision: D14122974

fbshipit-source-id: 15d92f296d91cc8bbd79a196f370d2dbb69b3f92
2019-02-18 03:07:49 -08:00
Dulmandakh 84a2fb0a4a SYSTEM_ALERT_WINDOW only in debug builds (#23504)
Summary:
SYSTEM_ALERT_WINDOW permission is used only for debug builds to show draw overlay views or show warnings/errors. This permissions is unused in release builds, and there is an issue regarding removing unused permissions on Android build https://github.com/facebook/react-native/issues/5886#issuecomment-464495388. This PR removes SYSTEM_ALERT_WINDOW from all builds bug debug.

[Android] [Changed] - SYSTEM_ALERT_WINDOW permissions available only in debug builds
Pull Request resolved: https://github.com/facebook/react-native/pull/23504

Differential Revision: D14123045

Pulled By: cpojer

fbshipit-source-id: 68829a774ff23c7cb2721076a9d3870405f48fea
2019-02-18 02:39:55 -08:00
Vishwesh Jainkuniya 9126add6b9 Add prop to configure `importantForAutofill`. (#22763)
Summary:
In API 26, autofill framework was introduced in Android.
Read more about Autofill at https://developer.android.com/guide/topics/text/autofill.

Now, if in case for some text input if developer wants to disable
autofill then he can take help from this `importantForAutoFill` prop
and pass `no` to it.

Also important of auto fill can be configured with this prop, like:
* `auto`: Let the Android System use its heuristics to determine if the view is important for autofill.
* `no`: This view isn't important for autofill.
* `noExcludeDescendants`: This view and its children aren't important for autofill.
* `yes`: This view is important for autofill.
* `yesExcludeDescendants`: This view is important for autofill, but its children aren't important for autofill.

Default value if `auto`.

Read more at: https://developer.android.com/guide/topics/text/autofill-optimize

Changelog:
----------
[Android] [Added] - Add prop to configure `importantForAutofill` in `TextInput`.
Pull Request resolved: https://github.com/facebook/react-native/pull/22763

Differential Revision: D14121242

Pulled By: cpojer

fbshipit-source-id: aa4360480dd19f6dde66f0409d26a41a6a318c94
2019-02-17 14:33:37 -08:00
David Vacca 3102ea51b2 Use ReadableNativeMap equality on UpdateLocalData (#23408)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/23408

Use equals method in the updateLocalData method

Reviewed By: JoshuaGross

Differential Revision: D14026378

fbshipit-source-id: 762559276a1fe63035e0f5d055620f95b8f62fb0
2019-02-17 11:06:00 -08:00
David Vacca f4536422d6 Implement equality for ReadableNativeMap
Summary: This diff implements equality for ReadableNativeMap, the underlying implementation relies on the method HashMap.equals()

Reviewed By: kathryngray

Differential Revision: D14019065

fbshipit-source-id: aeaec22ce1066241ed85f0527f5cd804e3c763dd
2019-02-17 11:06:00 -08:00
David Vacca a8703fe10b Implement equality for RedableNativeArray
Summary: This diff implements equality on RedableNativeArray objects. This relies on the Arrays.deepEquals method

Reviewed By: kathryngray

Differential Revision: D14022108

fbshipit-source-id: 48b59529a9060a2bddba5fc8e3681c922ec31be4
2019-02-17 11:06:00 -08:00
Scott Rice c86f59cb82 Set UIManagerType as required for source_only_abi
Summary: This allows using this annotation when Buck has `java.abi_generation_mode = source_only` set.

Differential Revision: D14119311

fbshipit-source-id: 020e709924e70adb8a160069a1da9b209b99befa
2019-02-16 16:55:24 -08:00
Cassio Zen f15145639d Add autoComplete prop (#21575)
Summary:
TL;DR: Setting `autoComplete` will allow the system to suggest autofill options for the `<TextInput>` component.

Android Oreo introduced the AutoFill Framework, for secure communication between an app and autofill services (e.g. Password managers). When using `<TextInput>` on Android Oreo+, the system already tries to autofill (based on heuristics), but there is no way to set configuring options or disable.

The quick solution would be to just add the same Android attributes (`autofillHints` & `importantForAutofill`) in React Native TextInput, but that doesn't bond well with the cross-platform nature of the library.

Introduces an `autoComplete` prop based on HTML's `autocomplete` attribute, mapping to Android `autofillHints` & `importantForAutofill` and serving as a proper placeholder for autofill/autocomplete in other platforms:

Also gives you the ability to disable autofill by setting autocomplete="off".
Pull Request resolved: https://github.com/facebook/react-native/pull/21575

Differential Revision: D14102949

Pulled By: hramos

fbshipit-source-id: 7601aeaca0332a1f3ce8da8020dba037b700853a
2019-02-15 09:13:05 -08:00
Sébastien Lorber d4adf50e1e Android - decouple TextInput cursorColor from selectionColor (#20276)
Summary:
Basically I want my cursor to be the same color of the text. Which means obviously that selecting the text will make it invisibible (ie, red text on red selection rectangle)

Today, setting a selection color does set a cursor color, which may be a good default in some cases, but we don't always couple these 2 colors together.

See original commit of janicduplessis ae57b25134

I'd like to be able to set different colors for selection and cursor.
Pull Request resolved: https://github.com/facebook/react-native/pull/20276

Differential Revision: D14102952

Pulled By: cpojer

fbshipit-source-id: 652ff782044277a0c8a821dd628f0373659a7850
2019-02-15 08:20:59 -08:00
Jonathan Kim c02f278d8f xplat// -> fbsource//xplat/ for xplat/js
Reviewed By: scottrice

Differential Revision: D14076351

fbshipit-source-id: f803d2af438a5eb3f18c981793e17b6293d8ef1c
2019-02-14 23:53:32 -08:00
Joshua Gross 51b868728a Attempt to fix T40449334 by adding DoNotStrip to interface
Summary: Java symbols are likely being stripped at compile-time, preventing Reflection from working properly in C++. Should fix T40449334.

Reviewed By: mdvacca

Differential Revision: D14070629

fbshipit-source-id: f180fa3294b66f660ab1568250c47432cbf0c774
2019-02-14 15:38:43 -08:00
Quentin Valmori 8b59ef6818 Upgrade BouncyCastle [CVE] (#19074)
Summary:
This PR fixes no existing issue. BouncyCastle library is used inside React-Native but the current version is not updated anymore and this version is subject to `CVE-2013-0169`

Current maven link : http://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk16/1.46 . The descrption says that this jar is for SDK 1.6 but no updated since 2011.

Proposed maven link : http://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk15on The description says that that jar is for SDK 1.5 to SDK 1.8 and latest release was done in January 2018.

Nop.

But there was a discussion about bouncy castle few years ago https://github.com/facebook/react-native/issues/2793

[GENERAL] [Changes] robolectric - Upgrade bouncycastle lib to fix CSV vulnerabilities

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

Reviewed By: mmmulani

Differential Revision: D14068062

Pulled By: hramos

fbshipit-source-id: 24e63cab33c3e8b5a088b9a8843afdc23b43553d
2019-02-14 14:53:20 -08:00
David Vacca 27a0fc58f7 Apply clang format to Fabric C++ android code
Summary: run clang-format into Fabric C++ android code

Reviewed By: JoshuaGross

Differential Revision: D14078185

fbshipit-source-id: 07c77044dc7ca437c9dc4417a886f0d8f81ef788
2019-02-14 00:07:41 -08:00
David Vacca 959fdf6049 ReadableNativeMap -> ReadableMap
Summary:
This diff refactors JNI methods used by the Binding.cpp class in order to use ReadableMap instead of ReadableNativeMap
This will be helpful to provide a different implementation of ReadableMap from C++

Reviewed By: shergin

Differential Revision: D14077762

fbshipit-source-id: 595b0c2d3a2d6070112257b65c1141a8af36f0e1
2019-02-14 00:07:40 -08:00
Dulmandakh 57f444bd8a bump targetSdkVersion to 28 (#23431)
Summary:
Bump targetSdkVersion to 28

[Android] [Changed] - Bump targetSdkVersion to 28
Pull Request resolved: https://github.com/facebook/react-native/pull/23431

Differential Revision: D14065177

Pulled By: cpojer

fbshipit-source-id: a161d1d385b7b40ec93d70851e5a41baeb58f830
2019-02-13 07:13:19 -08:00
Dulmandakh 84f40da990 @Nonnull annotation for ReactPackage (#23415)
Summary:
Here are some leftovers from nullable annotations for native modules, discovered while developing native module in Kotlin. This will help improve Kotlin developer experience

[Android] [Changed] - Add Nonnull annotations to ReactPackage
Pull Request resolved: https://github.com/facebook/react-native/pull/23415

Differential Revision: D14064607

Pulled By: cpojer

fbshipit-source-id: af2ce1fc1911ee03c54b20a4fc3a6d1aba9267da
2019-02-13 05:29:18 -08:00
Luna Wei c974b5e966 Remove SizeMonitoringFrameLayout
Summary: SizeMonitoringFrameLayout was used to set layout contraints on the root shadow node when the native view's size changes. Since then, we introduced ways for the root node to use proper layout contraints using the root view's measure specs, which provides more accurate constraints for the root node, so SizeMonitoringFrameLayout is no longer needed. This ends up making a lot of UIManagerModule's method signatures cleaner

Reviewed By: mdvacca

Differential Revision: D9565720

fbshipit-source-id: c569cd15991a09987cc01e89612dc9193ad99b45
2019-02-12 18:23:09 -08:00
Sergei Dryganets 9df892cfcb DialogModule crash fixes. (#19332)
Summary:
I'm trying to fix DialogModule crashes we have in production: #6228

In this PR I'm fixing the following problem:

The fragment manager methods should be called only from the foreground. Now dismissExisting is protected by the mIsForeground variable as well as showNewAlert method.

[ANDROID] [Fixed] DialogModule - Race condition in dialog module fixed.

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

Reviewed By: mdvacca

Differential Revision: D13804542

Pulled By: hramos

fbshipit-source-id: 9d59c8eaad49e2d3f141e255467627d411ae8797
2019-02-12 12:59:28 -08:00
Dulmandakh 0a07161084 bump Fresco to 1.11 (#21935)
Summary:
This PR bumps Fresco to 1.11
Pull Request resolved: https://github.com/facebook/react-native/pull/21935

Reviewed By: mdvacca

Differential Revision: D12908390

Pulled By: hramos

fbshipit-source-id: 11059b30ab0f20dacb7e7def38c53012e9dfdf10
2019-02-12 12:20:36 -08:00
Emily Janzer 7652e31d8c Pass through track color values for true/false to native component
Summary:
There's a bug in the OSS Switch component where the track color value is reset to the default value when the switch is toggled. It looks like the Java class resets the track color value in `setOn` (which fires in a press event): https://fburl.com/vmugfzja but these values aren't actually initialized from JS - in Switch.js we only pass through the current track color: https://fburl.com/vytekd0o.

The React component already has an API for defining both true/false track colors. However, we should also make sure not to reset these values for people using the old API of `tintColor`/`onTintColor`, so I'm changing it to only reset the value when both of those props are null.

Reviewed By: mdvacca

Differential Revision: D14035007

fbshipit-source-id: 12d968076bd47d54deedbfc15b12ff3cd77e2fd0
2019-02-12 10:47:58 -08:00
Dulmandakh 7b33d6b0b9 fix WritableArray, WritableMap nullable annotations (#23397)
Summary:
Recently, I added nullable annotations to ReadableArray, ReadableMap, WritableArray, WritableMap and subclasses to improve Kotlin developer experience. But found that I made mistake with pushArray, pushMap, pushString method of WritableArray, and putArray, putMap, putString methods of WritableMap. This PR fixes previous mistake.

Excerpt from WritableNativeArray.cpp.
```cpp
void WritableNativeArray::pushString(jstring value) {
  if (value == NULL) {
    pushNull();
    return;
  }
  throwIfConsumed();
  array_.push_back(wrap_alias(value)->toStdString());
}

void WritableNativeArray::pushNativeArray(WritableNativeArray* otherArray) {
  if (otherArray == NULL) {
    pushNull();
    return;
  }
  throwIfConsumed();
  array_.push_back(otherArray->consume());
}

void WritableNativeArray::pushNativeMap(WritableNativeMap* map) {
  if (map == NULL) {
    pushNull();
    return;
  }
  throwIfConsumed();
  array_.push_back(map->consume());
}
```

Excerpt from WritableNativeMap.cpp
```cpp
void WritableNativeMap::putString(std::string key, alias_ref<jstring> val) {
  if (!val) {
    putNull(std::move(key));
    return;
  }
  throwIfConsumed();
  map_.insert(std::move(key), val->toString());
}

void WritableNativeMap::putNativeArray(std::string key, WritableNativeArray* otherArray) {
  if (!otherArray) {
    putNull(std::move(key));
    return;
  }
  throwIfConsumed();
  map_.insert(key, otherArray->consume());
}

void WritableNativeMap::putNativeMap(std::string key, WritableNativeMap *otherMap) {
  if (!otherMap) {
    putNull(std::move(key));
    return;
  }
  throwIfConsumed();
  map_.insert(std::move(key), otherMap->consume());
}
```

[Android] [Changed] - fix nullable annotations in WritableArray, WritableMap
Pull Request resolved: https://github.com/facebook/react-native/pull/23397

Differential Revision: D14044014

Pulled By: cpojer

fbshipit-source-id: c44ea2e097e7b1156223b516aa640a181f0d4a9b
2019-02-12 06:26:34 -08:00
Joshua Gross 2c09c06a4d Enable support for using new MobileConfigNativeModule in RN Core/Fabric C++
Summary: Enable support for using new MobileConfigNativeModule in RN Core/Fabric C++. Hack will be removed as part of T40273916 once MobileConfigNativeModule has rolled out to 100% of users and FbReactMobileConfigModule has been removed.

Reviewed By: mdvacca

Differential Revision: D14015962

fbshipit-source-id: 1b8ff0fb447040393a25fd03d9fb868877228ecc
2019-02-11 16:56:14 -08:00
Joshua Gross a15e723476 Support MobileConfig in Fabric Core C++ in FB4A and Catalyst
Summary:
MobileConfig should be wrapped and presented as a ReactNativeConfig object so that core Fabric C++ code can use it.

This is just a noop plumbing diff. Real support will be added in follow-on diff.

Reviewed By: fkgozali

Differential Revision: D13985466

fbshipit-source-id: a2ac2175688e855eda3b89aa69faf07749c6bd31
2019-02-11 16:56:14 -08:00
David Vacca 48ba44087f Remove unused code in ReactTextView
Summary: Trivial cleanup of variables and methods that were not being used in ReactTextView

Reviewed By: blairvanderhoof

Differential Revision: D14027630

fbshipit-source-id: e763d6d001d4a0c2970adebc9855190845cf5a1d
2019-02-11 16:01:05 -08:00
David Vacca 17e1694076 Stop preallocation views on the main thread
Summary:
There is no reason to allocate views ahead of time on the main thread.
There is a chance that this view will not be mounted and we are not saving any time because it's a sequential process anyway (because we are doing it on the main thread). Moreover, the switching context can only slowdown JS execution.

Reviewed By: JoshuaGross

Differential Revision: D14026379

fbshipit-source-id: 2dbe93ab32b611fae942468e7812b78afeaf34fc
2019-02-11 15:11:16 -08:00
Dulmandakh c6c5a173bc DatePickerDialogModule supports only FragmentActivity (#23371)
Summary:
Now RN has only ReactActivity which extends AppCompatActivity, subclass of FragmentActivity, therefore no need to check if activity is FragmentActivity or not. This PR changes DatePickerDialogModule to work only with FragmentActivity.

Also DialogFragment from Android is deprecated in API 28, and recommends to use DialogFragment from Support Library. Excerpt from DialogFragment documentation.

> **This class was deprecated in API level 28.**
> Use the Support Library DialogFragment for consistent behavior across all devices and access to Lifecycle.

**BREAKING CHANGE**: Brown field apps must extend FragmentActivity or its subclasses

[Android] [Changed] - DatePickerDialogModule supports only FragmentActivity
Pull Request resolved: https://github.com/facebook/react-native/pull/23371

Differential Revision: D14030765

Pulled By: cpojer

fbshipit-source-id: 3a1811102cf68b82c139f0e20b2fc8dab5d98b69
2019-02-11 15:03:36 -08:00
Dulmandakh be361d0fc1 TimePickerDialogModule supports only FragmentActivity (#23372)
Summary:
Now RN has only ReactActivity which extends AppCompatActivity, subclass of FragmentActivity, therefore no need to check if activity is FragmentActivity or not. This PR changes TimePickerDialogModule to work only with FragmentActivity.

Also DialogFragment from Android is deprecated in API 28, and recommends to use DialogFragment from Support Library. Excerpt from DialogFragment documentation.

> **This class was deprecated in API level 28.**
> Use the Support Library DialogFragment for consistent behavior across all devices and access to Lifecycle.

[Android] [Changed] - TimePickerDialogModule supports only FragmentActivity
Pull Request resolved: https://github.com/facebook/react-native/pull/23372

Differential Revision: D14030748

Pulled By: cpojer

fbshipit-source-id: 9b3778c90eb1c014260327513bc8709264b94431
2019-02-11 14:58:10 -08:00
Emily Janzer b8246ac89a Make REACT_CLASS public so we can use a provider
Summary: Make REACT_CLASS a public property on ReactSwitchManager (similar to our other UI managers) so we can more easily lazily load this class.

Reviewed By: mdvacca

Differential Revision: D14028452

fbshipit-source-id: 84aebd4e2e1e0039957d8c12490022386aab7847
2019-02-11 14:45:42 -08:00
David Vacca f83281e2ce Disable OverlappingRendering for ReactTextView
Summary:
This diff disables OverlappingRendering for ReactTextView to avoid the exception:

```
java.lang.IllegalStateException: Unable to create layer for com.facebook.react.views.text.ReactTextView
```
during fade animations

OverlappingRendering enables an optimization during rendering of animations per component, disabling this might affect performance of animations inside TextView.

We will add a ReactFlag to experiment on how this affect other surfaces.

Reviewed By: blairvanderhoof

Differential Revision: D14027631

fbshipit-source-id: c1a84e7488c44582f7b7c78965aeb7bd27f82368
2019-02-11 14:39:18 -08:00
Dulmandakh d2fc19f4aa fix lint error/warnings (#23333)
Summary:
Fix lint errors and warning, which might be a cause of various crashes on older Android OS, using Android Support Library.

```bash
./gradlew :ReactAndroid:lint
```

[Android] [Changed] - fix lint error/warnings
Pull Request resolved: https://github.com/facebook/react-native/pull/23333

Differential Revision: D14019322

Pulled By: mdvacca

fbshipit-source-id: 74c98da269c318cf3b114c8d9c876186369f2b8c
2019-02-09 22:30:55 -08:00
Dulmandakh 8ccc55fbd3 Prepare Groovy scripts for Kotlin DSL migration (#23355)
Summary:
Using Kotlin DSL in Gradle instead of Groovy will help detect problems early on using static typing, and it has advanced IDE support. This PR prepares Groovy script for Kotlin DSL migration per **Migrating build logic from Groovy to Kotlin** guide. Here is the excerpt:

>As a first migration step, it is recommended to prepare your Groovy build scripts by
> - unifying quotes using double quotes,
> - disambiguating function invocations and property assignments (using respectively parentheses and assignment operator).

See: https://guides.gradle.org/migrating-build-logic-from-groovy-to-kotlin/

[Android] [Changed] - Prepare Gradle scripts for Kotlin DSL migration
Pull Request resolved: https://github.com/facebook/react-native/pull/23355

Differential Revision: D14018504

Pulled By: mdvacca

fbshipit-source-id: 909982c715b640f102cbe723df578c9af7bae08e
2019-02-09 10:18:07 -08:00