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

16198 Коммитов

Автор SHA1 Сообщение Дата
Matt Hargett e67aa427a8 Eliminate eslint npm version mismatch warnings and bump some to latest (#23969)
Summary:
I was annoyed by warnings from yarn/npm about eslint peer dependencies not being met, so I dived in to try and get rid of some of them. Sometimes it meant bumping a plugin, but then that plugin needed a newer babel-eslint, so it was a dance.

Some we can't easily update to latest (eslint-plugin-prettier) because the rule format has changed a bit. Happy to do that in this PR if folks think its a good idea. eslint-config-fbjs itself needs to be updated and republished to eliminate the last few warnings.

There are a few new warnings (the repo wasn't linting cleanly for me from the start). I can fix those in this PR, or a separate one, based on people's preferences.

[internal] [chore] - Eliminate some peer dependency warnings and bump some eslint packages to latest.
Pull Request resolved: https://github.com/facebook/react-native/pull/23969

Differential Revision: D14519076

Pulled By: cpojer

fbshipit-source-id: aa44cfd05814d7b79069414aa78d089e448c2235
2019-03-19 11:14:30 -07:00
Alexey Lang c3475419a9 Add removeExtra()
Reviewed By: bestander

Differential Revision: D14386282

fbshipit-source-id: 045dd0f12cc462da694d20da52f3a591b538dc57
2019-03-19 10:24:52 -07:00
Orta Therox 1a635c6ade Update the license for RCTWrapperExample (#24037)
Summary:
The copyright headers in the Wrapper example referenced a license file that doesn't exist anymore. This PR updates the copyright header to match other example files in the repo

Fixes https://github.com/facebook/react-native/issues/23215

[General] [Changed] Updated the license of RCTWrapperExample to match the rest of the Examples
Pull Request resolved: https://github.com/facebook/react-native/pull/24037

Differential Revision: D14521327

Pulled By: cpojer

fbshipit-source-id: 983741d4d93178cd90b532ad5f8ff0717670aff4
2019-03-19 09:19:19 -07:00
cpojer 156e483491 Remove `-p` calls from `shasum`. (#24036)
Summary:
Fixes #22873. Given that this code is meant to only work on macOS, we should be fine not using a portable hash. In the packages for which this matters at the bottom of this file, it produces the same hashes so it should be fine.

[General] [Fixed] - Don't use `-p` when invoking shasum.
Pull Request resolved: https://github.com/facebook/react-native/pull/24036

Differential Revision: D14521134

Pulled By: cpojer

fbshipit-source-id: 882e762b7817d9d46bdd405c9e2e9e8b4d7cfaf4
2019-03-19 08:53:45 -07:00
ferrannp 7e37370ab5 add react_native_config to RNTester (#24033)
Summary:
It was not possible to run RNTester in Android P and connect to the packager.

[Android][RNTester] add react_native_config to RNTester for the packager to be able to connect with Android P devices
Pull Request resolved: https://github.com/facebook/react-native/pull/24033

Differential Revision: D14520803

Pulled By: cpojer

fbshipit-source-id: 567a0461d14d880cd78e9fa551ba25fe60af798d
2019-03-19 07:52:19 -07:00
Alexey Lang abe737fe74 Proxy statics for the wrapped component
Summary: Currently we can't access navigationOptions  from measureAppRequire and that breaks fetchRelayQuery logs.

Reviewed By: fkgozali

Differential Revision: D14505525

fbshipit-source-id: 97ae4461ebb0e703633f782323b13b4e4f7c5cb7
2019-03-19 07:32:20 -07:00
Danilo Bürger 8fa116cc0e Fixed regression in SectionList caused by #21577 not being able to scroll to top on android (#24034)
Summary:
```
let index = params.itemIndex + 1;
```
to
```
let index = Platform.OS === 'ios' ? params.itemIndex : params.itemIndex - 1;
```
to fix an issue on iOS. Note however, how the sign for non iOS changed from `+` to `-` causing a crash on Android when trying to scroll to index 0 as that will be evaluated to -1 instead of 1 and thus be out of bounds.

[Android] [Fixed] - Fixed regression in SectionList caused by #21577 not being able to scroll to top on android
Pull Request resolved: https://github.com/facebook/react-native/pull/24034

Differential Revision: D14520796

Pulled By: cpojer

fbshipit-source-id: bb49619f49752fd3f343ef3b7bf1b86ac48af7f8
2019-03-19 07:32:20 -07:00
Rick Hanlon 0827184c60 Add PointPrimitive
Summary: Adds support for the native type Point to the rn codegen

Reviewed By: TheSavior

Differential Revision: D14462164

fbshipit-source-id: 942b5697d616c6aa6289d01bb56382fd7adac203
2019-03-19 06:36:33 -07:00
Rick Hanlon 7723c31329 Add ArrayTypeAnnotation
Summary:
Adds support for `ArrayTypeAnnotation`, usage is as:

```
{
  type: 'ArrayTypeAnnotation',
  items: {
    type: 'BooleanTypeAnnotation',
}

{
  type: 'ArrayTypeAnnotation',
  items: {
    type: 'StringTypeAnnotation',
}

{
  type: 'ArrayTypeAnnotation',
  items: {
    type: 'FloatTypeAnnotation',
}

{
  type: 'ArrayTypeAnnotation',
  items: {
    type: 'Int32TypeAnnotation',
}

{
  type: 'ArrayTypeAnnotation',
  items: {
    type: 'NativePrimitiveTypeAnnotation',
    name: 'ImageSourcePrimitive'
}

{
  type: 'ArrayTypeAnnotation',
  items: {
    type: 'NativePrimitiveTypeAnnotation',
    name: 'ColorPrimitive'
}

{
  type: 'ArrayTypeAnnotation',
  items: {
    type: 'NativePrimitiveTypeAnnotation',
    name: 'PointPrimitive' // added in the next dfif
}
```

Reviewed By: TheSavior

Differential Revision: D14462086

fbshipit-source-id: f0c25f8fe969efc01e5838f3966d910fbbd9c86c
2019-03-19 06:36:33 -07:00
Valentin Shergin ae157883eb ShadowNode: Using state value for computing ShadowView hash
Summary: Trivial.

Reviewed By: JoshuaGross

Differential Revision: D14472906

fbshipit-source-id: 014a3115c24d155a93ff24404d4f748880d53b2b
2019-03-19 00:02:30 -07:00
Valentin Shergin f24fd6e9ee Fabric: Using new shiny ShadowNode::getAncestors in LayoutableShadowNode
Summary: Same algorithm using a new API.

Reviewed By: JoshuaGross

Differential Revision: D14423509

fbshipit-source-id: c40f61fdd001f68785512c304941f523585d641c
2019-03-18 23:56:13 -07:00
Valentin Shergin 4602bf5cc6 Fabric: Using ShadowNode::getAncestors in RootShadowNode::clone
Summary: The basic idea of the implementation is the same, but it uses the new method for finding parenting chain and it does not use `shared_from_this()` anymore.

Reviewed By: JoshuaGross

Differential Revision: D14416949

fbshipit-source-id: 13ef928505a60280e2a6c30c76ac87d91cee326e
2019-03-18 23:56:13 -07:00
Valentin Shergin be51d0564b Fabric: a new efficient implementation of ShadowNode::getAncestors()
Summary:
The algorithm is quite simply:
1. Get family objects of the two nodes (inner and outer).
2. Traverse the list of family objects starting from the inner one and form a reversed list of them.
3. tarting from the inner node, traverse the tree layer-by-layer choosing a next element of the path by comparing the family object of each node on the level and an object from the list.

Reviewed By: JoshuaGross

Differential Revision: D14416950

fbshipit-source-id: 23c659a9e01690f90174193650a2b0ef09eadb4d
2019-03-18 23:56:13 -07:00
Valentin Shergin 978e59aa92 Fabric: ShadowNodeFamily, maintaining a pointer to a parent family
Summary:
One of the core feature of ShadowNodeFamily is having a pointer to a parent family. This diff implements it.
I don't think there is a hard retain cycle there, but for more lean memory usage we use weak_ptr here.

Reviewed By: JoshuaGross

Differential Revision: D14416948

fbshipit-source-id: 05fd2c4833146f007228363b1d958776b4a2a9cf
2019-03-18 23:56:13 -07:00
Valentin Shergin 28e89e5081 Fabric: ShadowNodeFamily, the first steps
Summary:
ShadowNodeFamily is a new concept that allows us to implement an efficient way to solve the problem of finding a path to some ancestor node (practically reimplement ShadowNode::constructAncestorPath() in some efficient way).

This diff is the first one in the series. It introduces a new class and moves some data into it.

Reviewed By: JoshuaGross

Differential Revision: D14416947

fbshipit-source-id: c93865a8929a2128498e34d3589487696aac6283
2019-03-18 23:56:13 -07:00
Valentin Shergin e0bbdbc040 Fabric: Removed declaration of ShadowNode::clearSourceNode()
Summary: This is a leftover from the ealy days of Fabric. The mehtod does not have implementation counterpart and any usage.

Reviewed By: JoshuaGross

Differential Revision: D14402636

fbshipit-source-id: aa2e919084ae7382d3a62af761e1f6eac334fc75
2019-03-18 23:56:13 -07:00
Valentin Shergin b93221036a Fabric: Removed unnecessary call in `RootShadowNode::clone`
Summary: The removed code does nothing because we are replacing the oldChild with newChild several lines above.

Reviewed By: JoshuaGross

Differential Revision: D14402637

fbshipit-source-id: 731a950f373e20f7d5bae3cbf6470335d3694ccc
2019-03-18 23:56:13 -07:00
Valentin Shergin 50b40a41c0 Fabric: Tightening up some ShadowNode cloning semantics
Summary: In React, things like changing `tag`, `eventTarget` or reparenting are impossible by design. Which seems like a strange limitation actually allows us to do tremendous performance optimizations (stay tuned!).

Reviewed By: JoshuaGross

Differential Revision: D14402638

fbshipit-source-id: 3b7b7edaff0d55a3ca94e2ac4c753d630d07101d
2019-03-18 23:56:13 -07:00
zhongwuzw e40a76715a Remove explicitly add png file extension when load local image (#23864)
Summary:
We need to remove adding png file extension when path has not extension. Two reasons:
1. `imageWithContentsOfFile` or other `UIKit` methods can load png image correctly, even if path has not `png` file extension.
2. Sometimes, people may have file that actually not have file extension, it's the designated behavior for user. Like #23844 .

CC. sahrens cpojer .

[iOS] [Fixed] - Remove explicitly add png file extension when load local image
Pull Request resolved: https://github.com/facebook/react-native/pull/23864

Reviewed By: shergin

Differential Revision: D14425373

Pulled By: hramos

fbshipit-source-id: 3cc06c9a3d68cadf652c1de742f3cce26258c874
2019-03-18 23:03:32 -07:00
Héctor Ramos c2f5b676ff Refactor autofillHints API 26+ runtime check
Summary: Refactor the fix from d4aa1e7a52 into something that follows the same convention used in 36957dcedd

Reviewed By: mdvacca

Differential Revision: D14485427

fbshipit-source-id: e6118284fcffa4b43c8392c94991764a07094403
2019-03-18 22:55:42 -07:00
Valentin Shergin 9a0047f368 Fabric: Explicit dirtying Yoga nodes for Text component (and co.)
Summary:
With recent changes, simple cloning a component does not mean that underlying Yoga node will be dirtied. Autodirtying is only performed if the child nodes were dirtied and/or if the YGStyles were changed.
That's not the case for Text component which does not have direct layotable children, so we have to call `dirtyLayout` explicitly.

Reviewed By: JoshuaGross

Differential Revision: D14508277

fbshipit-source-id: 2c52d7d40da963a976c7d28a13781cc1755ef591
2019-03-18 19:21:26 -07:00
Valentin Shergin ab86085caf Fabric: Correct checking for `sealable` flag with move semantic methods
Summary: In methods which implement move semantic we have to check the source object because it's (also) being mutated.

Reviewed By: JoshuaGross

Differential Revision: D14496937

fbshipit-source-id: f3f2299d14e41c8b269f1647336dbd5b45c235f4
2019-03-18 19:21:26 -07:00
Valentin Shergin 587087c4e7 Fabric: More asserts/invariant-checking in YogaLayoutableShadowNode
Summary: More `assert`s and `ensureUnsealed` calls were added to YogaLayoutableShadowNode for simpler debugging and early failing.

Reviewed By: JoshuaGross

Differential Revision: D14496936

fbshipit-source-id: 898c6a0665aeac5d0b1995bd53046f58cec37007
2019-03-18 19:21:26 -07:00
Valentin Shergin 55eaf30740 Fabric: Checking for `HasNewLayout` before applying layout metrics to ShadowNode
Summary:
If the `HasNewLayout` flag is `false`, we should not copy the data from YGStyle/YGLayout to ShadowNode because the node can be already sealed and because it's unnecessary. Previously we workaround this case with a special check in `setLayoutMetrics` method, but that can be unreliable because of some side-effects related to pixel rounding and comparing floats.
The new approach is much more robust and explicit.

Reviewed By: JoshuaGross

Differential Revision: D14496939

fbshipit-source-id: deddb14d2206c5bd3f22154d0ea682e3c5888901
2019-03-18 19:21:26 -07:00
Valentin Shergin be6fa25d16 Fabric: Removing default implementation of some methods of LayoutableShadowNode
Summary: These default implementations are never being used. Removing them allowing to ensure that flags inside YGNode have same values as flags in YogaLayoutableShadowNode. That also saves a couple of bytes in size of ShadowNode.

Reviewed By: JoshuaGross

Differential Revision: D14496938

fbshipit-source-id: c43f9c8a2eec054f728ff54a6573668eccda55fb
2019-03-18 19:21:26 -07:00
Valentin Shergin 32d5c7e1f3 Fabric: Checking getHasNewLayout in RootShadowNode
Summary:
As a comment above changed lines states, RootShadowNode is a special one because it layouts itself. In normal case some parent node layouts its children, and it also checks getHasNewLayout flag. So, in the case of RootShadowNode it has to check its own flag by itself.
That fix should save some resources and generally correct.

After the change, changing a state of some node does not cause relayout process. If dirtying is required, the component should call `dirtyLayout()` explicitly in the constructor or in `adopt` method.

Reviewed By: JoshuaGross

Differential Revision: D14472751

fbshipit-source-id: 75bf62ac28991a39e5664aa71c08bd0e64fa275b
2019-03-18 19:21:25 -07:00
Valentin Shergin 72cd8716fd Fabric: Calling a base class copy constructor in YogaLayoutableShadowNode's copy constructor
Summary: That diff fixes an obvious bug that prevents internal data of LayoutableShadowNode being cloned during cloning of YogaLayoutableShadowNode.

Reviewed By: JoshuaGross

Differential Revision: D14472753

fbshipit-source-id: d07be3bf36708690dfe10de7898e2b48648aa0f4
2019-03-18 19:21:25 -07:00
Valentin Shergin 6bd67de4d3 Fabric: Being even smarter preserving dirty flag on Yoga nodes
Summary: In addition to the previous change, now we handle a situation where some node receives a new set of children and all those children have the same styles. (See the previous diff for more details.)

Reviewed By: JoshuaGross

Differential Revision: D14472754

fbshipit-source-id: 16411036e14f18e730e064e33948440b05ff51c8
2019-03-18 19:21:25 -07:00
Valentin Shergin d6d381180b Fabric: Being smarter preserving dirty flag on Yoga nodes
Summary:
After the change, YogaLayoutableShadowNode will preserve dirty flag (being false) in cases where:
* a node was cloned with same children;
* changes in props don't affect layout.

Motivation:
In Fabric we always were aggressive about dirting yoga nodes: when we clone the node, we always dirty underlying Yoga node. I think that was the case because we don't deeply understand how the system works and we always had more severe problems to fix. Now, we faced an issue that forces us to think about that problem carefully (more about that later).

(I don't expect that will improve TTI performance, but that's possible if we do a lot of changes in the hierarchy during initial load process.)

I see two main use cases where we have to be smart about dirtied yoga nodes:

Case 1. Native local commits which do *not* modify yoga styles.E.g. in a case where ScrollView updates the internal state (which has offset info) really really frequently. (It will be implemented later.) That `contentOffset` info does not or might not affect layout, so we should not pay for this.

Case 2. Legit React commits which do *not* modify yoga styles. E.g. in a case where only the background color of some view changes, we don't need to relayout anything. Unfortunately, we do this in Fabric because of two major reasons:
* We don't make a difference between any changes in Props.
* React constructs new children of cloned node iteratively, calling `appendChild`. That makes implementing optimization really challenging because we don't know when the process ends. And when it ends we have very few pieces of information about how the state looked before.

This diff stack will handle the problems of the first kind. The main motivation is: we want to have state updates to be as lean as possible.

Reviewed By: JoshuaGross

Differential Revision: D14472752

fbshipit-source-id: 68374f60cb07de9ab65bf1f6d94c828985359fa5
2019-03-18 19:21:25 -07:00
Sergei Dryganets 62d340910a There is a small gap in the SynchronizedWeakHashSet implementation. T… (#24015)
Summary:
There is a small gap in the SynchronizedWeakHashSet implementation - the containsKey method of the WeakHashMap is modifying hence calling it during the iteration might cause ConcurrentModificationException. Added a command DO_IF_CONTAINS to safely handle this case.

[Android] [Bugfix] - Should fix a ConcurrentModificationException in onResume.
Pull Request resolved: https://github.com/facebook/react-native/pull/24015

Reviewed By: mdvacca

Differential Revision: D14507342

Pulled By: fkgozali

fbshipit-source-id: 2998bffb06e2cbacd8df1780964355842b1cc4a0
2019-03-18 14:24:25 -07:00
Dulmandakh f49f1812ed land androidx in gradle (#24014)
Summary:
Use AndroidX in ReactAndroid/build.gradle, and remove androidx dependency from template and RNTester app because it's already exposed/exported from ReactAndroid.

[Android] [Changed] - Land AndroidX in gradle
Pull Request resolved: https://github.com/facebook/react-native/pull/24014

Differential Revision: D14508774

Pulled By: mdvacca

fbshipit-source-id: c96b97876571a5a7f2b400dd29188cfdf1f84a4c
2019-03-18 13:37:17 -07:00
Spencer Ahrens 5ebef7a214 Fix Fabric animation association
Summary:
Before I was looking at the animation nodeTag rather than the view reactTag to determine if it was Fabric, so sometimes we would do an early fabric flush on non-fabric views, or miss it on fabric ones.

This fixes it by associating animations with fabric based on the reactTag of the view that is associated with the animation nodeTag.

Reviewed By: shergin

Differential Revision: D14504446

fbshipit-source-id: 75a1394b34436556daf9c33dc63743df33c2fb19
2019-03-18 13:37:17 -07:00
Jan Kassens 8b206cab82 remove $FlowFixedInNextDeploy
Summary:
This gets completely rid of this flow ignore. The flow team is using the version
aware `$FlowFixMe` now and the only instance of this used was on www dating back
to 2016: D3235864

My intention here was to slightly simplify the flowconfigs.

Reviewed By: gabelevi

Differential Revision: D14494167

fbshipit-source-id: 0fab176ce326007ac45b47691378812c74a523e6
2019-03-18 13:32:28 -07:00
Alston Lin d6b2f78ad4 Added support for saving http and https URIs in the React Native CameraRoll module
Summary:
Currently, the behavior of saving in the `CameraRoll` module varies depending on the platform.

On iOS, remote URIs are supported and will save a remote image to the local storage. However, on Android it can only be used for local images, making this function much less useful.

This change allows the Android version of the `CameraRoll` module to have the same behavior, at least for http and https scheme URIs, which will probably cover the vast majority of the use cases.

Reviewed By: sahrens

Differential Revision: D14483943

fbshipit-source-id: e63ca786240e6657c8c8e0292be9fb08efa40ef1
2019-03-18 13:03:28 -07:00
Dulmandakh 75af15ede4 use Conscrypt as security provider if available (#23984)
Summary:
This PR adds support to use Conscrypt as Security Provider if available runtime. Consscrypt supports TLS 1.2 on Android 4.x and TLS 1.3 on all Android versions. Fixes issues (ex https://github.com/facebook/react-native/issues/23151) with HTTPS connections on Android 4.x.

Just add below to your project build.gradle and it'll use it.

```gradle
implementation('org.conscrypt:conscrypt-android:2.0.0')
```

[Android] [Changed] - Add TLS 1.3 support to all Android versions using Conscrypt.
Pull Request resolved: https://github.com/facebook/react-native/pull/23984

Differential Revision: D14506000

Pulled By: cpojer

fbshipit-source-id: 58bf18f7203d20519fb4451bae83f01e2f020a44
2019-03-18 12:01:35 -07:00
Ryan Elliott eec2495a96 Resolve issue #23816, updated with recent merges (#23961)
Summary:
This fixes #23816, which states that `getSize()` does not function correctly on Android. The original PR for this is now outdated as there have been merges into master that would create merge conflicts.

[Android] [Fixed] - Added correct handling for `getSize()` to avoid warnings being thrown.import
Pull Request resolved: https://github.com/facebook/react-native/pull/23961

Differential Revision: D14505183

Pulled By: cpojer

fbshipit-source-id: 3d8976fd518de0903d7736a8cbd8371987eb1b2d
2019-03-18 11:16:20 -07:00
Alec Larson 68825f9ca5 Fix prop overrides of TouchableWithoutFeedback (#23966)
Summary:
Child props were being overridden by `<Touchable>` props even when the `<Touchable>` props were undefined.

[General] [Fixed] - Prevent prop override by TouchableWithoutFeedback when undefined
Pull Request resolved: https://github.com/facebook/react-native/pull/23966

Differential Revision: D14502918

Pulled By: cpojer

fbshipit-source-id: 614ee43bbb6f062a98bd9318693807320979a016
2019-03-18 11:06:38 -07:00
zhongwuzw 8266f61935 Change invalid bridge log level from error to warn (#24005)
Summary:
I encountered invalid bridge error when I develop (reload high frequency) some times, and if it happened, I only can restart the app, because we would always show error invalid message if we trigger reload command. So I recommend Change invalid bridge log level from error to warn, I think it's enough.

cc. cpojer .

<img width="375" alt="892C97F4-E910-4E3B-935A-65C899916E6E" src="https://user-images.githubusercontent.com/5061845/54538344-0d32c600-49cf-11e9-818c-0e4cb5a0a518.png">

[iOS] [Fixed] - Change invalid bridge log level from error to warn
Pull Request resolved: https://github.com/facebook/react-native/pull/24005

Differential Revision: D14504820

Pulled By: cpojer

fbshipit-source-id: f24c4876fdb3e64183c09c5ddc598a8c87e405a7
2019-03-18 10:48:59 -07:00
zhongwuzw 17ca80a9c5 Fixed test_ios Switch test failed (#24009)
Summary:
In #23977 , it changed switch example, it leads snapshots test failed.

cc hramos .

[iOS] [Fixed] - Fixed test_ios Switch test failed
Pull Request resolved: https://github.com/facebook/react-native/pull/24009

Differential Revision: D14504806

Pulled By: cpojer

fbshipit-source-id: 0c47226a3da0cba2371c627f42f62835b3aac810
2019-03-18 10:24:25 -07:00
Michał Pierzchała 79be593f27 feat: validate config with jest-validate (#205)
Summary:
**Summary**

This PR introduces validation for the new `metro-config`. For now I'm keen on only validating new config, because I can see there's yet unused `convertConfig` which, I guess, defeats the purpose. Let me know otherwise.

This is still work in progress, as I need to fix some stuff upstream (e.g. recursive object validation and pretty-printing). Just letting you know I'm working on it :)

**Test plan**

Added a test.

cc CompuIves cpojer
Pull Request resolved: https://github.com/facebook/metro/pull/205

Differential Revision: D14501222

Pulled By: cpojer

fbshipit-source-id: 0ab8f3ad14d6f33690d5f57fd1e7487f3a4a8c71
2019-03-18 09:42:24 -07:00
Estevão Lucas fa426cf05f - Add openSettings method to Linking module (#23965)
Summary:
This will create a cross-platform and safe way to programmatically open the app's settings into the iOS /Android Settings app.

Right now it's possible to open the app's settings, but _**only for iOS**_ via `Linking.openURL("app-settings:")`

To do the same for Android, you need to either create NodeModule or install a dependency such as [react-native-open-settings](https://github.com/lunarmayor/react-native-open-settings).

Why this new method is useful: since Android 6, app permissions work similar to iOS. It's granular and it's requested in the app runtime.

https://developer.android.com/guide/topics/permissions/overview#runtime_requests_android_60_and_higher

> If the device is running Android 6.0 (API level 23) or higher, and the app's targetSdkVersion is 23 or higher, the user isn't notified of any app permissions at install time. Your app must ask the user to grant the dangerous permissions at runtime. When your app requests permission, the user sees a system dialog telling the user which permission group your app is trying to access. The dialog includes a Deny and Allow button.

Thus, if the user checks the **"Never ask again box"** and taps **"Deny"**, for some specific permission, the only way to change the permission is going to the Android Setting app.

And that's where this new method becomes useful. It'll allow our apps to programmatically send the the user to  settings app.

Also, `openSettings()` doesn't receive a parameter to redirect to specific subsections of the Settings app because there's no public API to do it on iOS ([there's a way to have, via private API, but it causes the app to get rejected.](https://github.com/mauron85/cordova-plugin-background-geolocation/issues/394))

Create `Linking.openSettings()` for iOS and Android;

[General] [add ] - Add openSetting method to Linking module
Pull Request resolved: https://github.com/facebook/react-native/pull/23965

Differential Revision: D14502910

Pulled By: cpojer

fbshipit-source-id: d27d62282b9df499845c78d983d3b6936c36ea39
2019-03-18 08:06:12 -07:00
Casper Boone bce1e6f536 Fix and update end to end tests for Android (#23958)
Summary:
This PRs makes an attempt at fixing the set up of the Android end to end tests, and the tests themselves. The end goal is to re-enable the tests on CircleCI (see #23561 for more details).

The goal of this PR is to the end to end tests to a working state. Better tests can be added at a later point.

I changed the tests using the menu button. These tests made something silently crash/hang, after which it was no longer possible to get an element or even get the source. A fix for this needs further investigation.

Also, I enabled the tests in the CircleCI config, however CircleCI is currently failing on them with the following error:
```
info Running /opt/android/platform-tools/adb -s emulator-5554 reverse tcp:8081 tcp:8081
error: closed
info Could not run adb reverse: Command failed: /opt/android/platform-tools/adb -s emulator-5554 reverse tcp:8081 tcp:8081
info Starting the app on emulator-5554 (/opt/android/platform-tools/adb -s emulator-5554 shell am start -n com.endtoendtest/com.endtoendtest.MainActivity)...
Starting: Intent { cmp=com.endtoendtest/.MainActivity }

Too long with no output (exceeded 10m0s)
```
Some help here would be appreciated. An alternative is to not enable the tests yet on CircleCI in this PR.

[Android] [fixed] - Fix and update end to end tests for Android
Pull Request resolved: https://github.com/facebook/react-native/pull/23958

Differential Revision: D14502884

Pulled By: hramos

fbshipit-source-id: 4316c3fd817451d332e64a10d88389b74a60d3dd
2019-03-18 07:51:01 -07:00
Ali Akbar Azizi 43d3313788 Fix bat file (#23967)
Summary:
Add reactNativePath to cli.js

Add reactNativePath to cli.js

[GENERAL] [FIXED] - Internal - Update packagers to the latest CLI
Pull Request resolved: https://github.com/facebook/react-native/pull/23967

Differential Revision: D14502855

Pulled By: hramos

fbshipit-source-id: b9804e4fb364c004215227d938fe7101641f5b3c
2019-03-18 07:51:01 -07:00
Georgios Andreadis 6047d42bc7 Add tests for Geolocation module (#23987)
Summary:
This PR adds a number of unit tests for the Geolocation module, as a follow-up of #23903. I also added two missing documentation strings to that module, with references to the online documentation, for consistency with the other methods in the same module.

Not applicable, since it only adds tests.
Pull Request resolved: https://github.com/facebook/react-native/pull/23987

Differential Revision: D14502848

Pulled By: cpojer

fbshipit-source-id: 8f7c1cee6be3fae081d9770e5e942fadda65e6c2
2019-03-18 07:40:56 -07:00
Max Komarychev cc3f9a7538 Fix native implementation of `Animated.modulo` (#23973)
Summary:
fixes #23875
[ios,android][fixes] incorrect behavior of `Animated.modulo`

Use the same formula as used in js: `mod(a,m)=>(a % m + m) % m` (https://github.com/facebook/react-native/blob/master/Libraries/Animated/src/nodes/AnimatedModulo.js#L35)

Native implementation of `Animated.modulo` was different from what was used in javascript, more details available here: https://github.com/facebook/react-native/issues/23875

[iOS] [Fixed] incorrect behavior of Animated.modulo
[Android] [Fixed] incorrect behavior of Animated.modulo
Pull Request resolved: https://github.com/facebook/react-native/pull/23973

Differential Revision: D14502697

Pulled By: cpojer

fbshipit-source-id: befef2b99ae758f98459caaadc8ebdbbd547e69a
2019-03-18 07:40:56 -07:00
Casper Boone f541c34067 Add tests for utilities (#23989)
Summary:
This PR add tests for several utilities in `Libraries/Utilities`, as a follow-up of #23903.

The following utilities are now tested:
* `clamp.js`
* `binareToBase64.js`
* `DeviceInfo.js`
* `mergeIntoFast.js`
* `PixelRatio.js`
* `infoLog.js`
* `logError.js`
* `warnOnce.js`
* `mapWithSeparator` (added a missing test)

Not applicable, since it only adds tests.
Pull Request resolved: https://github.com/facebook/react-native/pull/23989

Differential Revision: D14502806

Pulled By: cpojer

fbshipit-source-id: e2c3b3a35f4f765d5336b998ab92dba14eeac7bc
2019-03-18 07:40:55 -07:00
Estevão Lucas 65a8a51556 Add missing mock for AccessibilityInfo (#23982)
Summary:
I've realized after #23839 got merged, that `AccessibilityInfo` doesn't have a jest mock the same way as the other frameworks do.

This PR adds the testing mock for `AccessibilityInfo`.
Pull Request resolved: https://github.com/facebook/react-native/pull/23982

Differential Revision: D14502780

Pulled By: cpojer

fbshipit-source-id: ec11bd547b6f90858e7f51ed8230c8d02dc4904c
2019-03-18 07:28:46 -07:00
Mike Grabowski 5558333c60 Update React Native to use latest CLI (#23940)
Summary:
Landing D14472633 again which failed because of a metro-buck issue.

Latest CLI requires `reactNativePath` to be explicitly set when `react-native` is not present under `node_modules` (which is the case when running from source).

Fixes #23936

This PR also updates CLI to latest version and removes private calls to `findPlugins` (it's now exposed under public interface).

We also remove custom `rn-cli.config.js` options that are no longer needed that we have `--reactNativePath`. I added them a month ago as a temporary workaround.

[GENERAL] [FIXED] - Internal - Update to the latest CLI
Pull Request resolved: https://github.com/facebook/react-native/pull/23940

Reviewed By: rickhanlonii

Differential Revision: D14501686

Pulled By: cpojer

fbshipit-source-id: c8dac71b3806d81c9d18b6d4a7e92d82962791f9
2019-03-18 06:22:53 -07:00
David Vacca 8d5ac8de76 Migration of RN-Android OSS tests to Android X
Summary:
This diff migrates RN to AndroidX.
As part of this diff I disabled few tests in RNAndroid OSS that will be re-enabled this week. As part of the refactor of BUCK files in OSS

Reviewed By: shergin

Differential Revision: D14200097

fbshipit-source-id: 932fcae251d1553e672acd67ecd0e703dcb364aa
2019-03-17 08:13:30 -07:00
Marshall Roch 5613aa8948 flow v0.95
Summary: 0.95 has a more accurate definition of JSON.stringify which could return void.

Reviewed By: dsainati1

Differential Revision: D14494286

fbshipit-source-id: 6cf9cb5889b4078548665bc66fe899a266c689ce
2019-03-16 09:12:27 -07:00