Commit Graph

2433 Commits

Author SHA1 Message Date
Michael Lee 5d3efa7d6f Mark targets as explicitly Android
Reviewed By: mmmulani

Differential Revision: D7141568

fbshipit-source-id: 6c8679790309e72ca220443ecf693087f82ece85
2018-03-02 17:22:35 -08:00
Andrew Chen (Eng) 78b30659bc Fix appendChild
Reviewed By: mdvacca

Differential Revision: D7128443

fbshipit-source-id: 4eedea4df2b636eb9589cbe5e84c5c6a8aa33539
2018-03-01 16:57:25 -08:00
Andrew Chen (Eng) 6404529b76 Added an Assertion that addRoot is called before completeRoot
Reviewed By: mdvacca

Differential Revision: D7127321

fbshipit-source-id: a8215fda0d854471bed9aa5476141dfffc4dc11c
2018-03-01 16:57:25 -08:00
David Vacca 22990c3ce7 Add extra information to error message reported when a ReactRawText is included as a child of a non Text component
Reviewed By: achen1

Differential Revision: D7120188

fbshipit-source-id: 553a26d04a62dceb86d791bcdcb3a5e16a12f64b
2018-03-01 16:57:25 -08:00
Andrew Chen (Eng) 3f85dc5337 Log java error messages from FabricUIManagerModule
Reviewed By: mdvacca

Differential Revision: D7126177

fbshipit-source-id: bafa6e2b3dabf39d2ca0d9a8830b877fc5ae97ec
2018-03-01 12:17:44 -08:00
David Vacca 9b3861c109 Fix unmount of ReactRootView for Fabric surfaces
Reviewed By: fkgozali

Differential Revision: D7114865

fbshipit-source-id: f0a1c47c983e610fe0dba3051ed8aa350ac052cc
2018-03-01 10:33:21 -08:00
David Vacca c0c388c8aa Adding simple View rendering support using FabricUIManager.
Reviewed By: achen1

Differential Revision: D7102725

fbshipit-source-id: d2878d036843ba01201c4df617680269b5f59039
2018-03-01 10:33:21 -08:00
David Vacca b5b0ee853e Adding configuration of Fabric inside ReactRootView.
Reviewed By: achen1

Differential Revision: D7102701

fbshipit-source-id: f655327372c42ad86042011a3af3ee693d14014a
2018-03-01 10:33:21 -08:00
David Vacca 6b45fb2cb1 Create UIManager interface and extract common classes in uimanager/common
Reviewed By: achen1

Differential Revision: D7102674

fbshipit-source-id: e14b6782ad102ec1c3d37988df4bbd4190511f09
2018-03-01 10:33:21 -08:00
Héctor Ramos b181b7797f Check PATENTS does not creep into files
Summary:
Some files have crept into the repo with the old license header. These are usually from PRs that were opened prior to the re-licensing of the project.

Let the script run, prior to fixing the errant files. The script outputs the following:

```
PATENTS crept into some new files?
 --- /dev/fd/63	2018-03-01 01:42:48.250153746 +0000
+++ /dev/fd/62	2018-03-01 01:42:48.250153746 +0000
@@ -1 +1,9 @@
+Libraries/NativeAnimation/Nodes/RCTTrackingAnimatedNode.h
+Libraries/NativeAnimation/Nodes/RCTTrackingAnimatedNode.m
+ReactAndroid/src/main/java/com/facebook/react/animated/TrackingAnimatedNode.java
+ReactAndroid/src/main/java/com/facebook/react/views/text/CustomLetterSpacingSpan.java
+ReactCommon/yoga/yoga/YGLayout.cpp
+ReactCommon/yoga/yoga/YGLayout.h
+ReactCommon/yoga/yoga/YGStyle.cpp
+ReactCommon/yoga/yoga/YGStyle.h
 scripts/circleci/check_license.sh
Exited with code 1
```

Fix the headers in these files and run the script again. No output, exit code 0.
Closes https://github.com/facebook/react-native/pull/18143

Reviewed By: sophiebits

Differential Revision: D7119356

Pulled By: hramos

fbshipit-source-id: d238e4d4a3ae320a2c8e625c2fa29690057a4814
2018-03-01 08:22:05 -08:00
Pritesh Nandgaonkar d174ab8a7a Change NaN with large number
Reviewed By: emilsjolander

Differential Revision: D6969537

fbshipit-source-id: bdc09eaf703e0d313ca65c25a4fb44c99203d9bf
2018-03-01 04:02:01 -08:00
Pritesh Nandgaonkar af9d6479e5 Make two separate yoga targets for QE
Reviewed By: emilsjolander

Differential Revision: D7059278

fbshipit-source-id: dd11b018edc8ea930d5eba09c6c01e349bb8b63c
2018-03-01 04:02:01 -08:00
Michael Lee 35583e52f4 Add header_namespace to handle cross-platform uses
Differential Revision: D7101683

fbshipit-source-id: 2a95cd1447d4cc5d796556e3281d08136cd130ff
2018-02-28 12:01:50 -08:00
David Vacca ddcd609a86 Refactor cloneWithNewChildren method
Reviewed By: achen1

Differential Revision: D7064266

fbshipit-source-id: 71ef5651893359a257c39a5943812853f8d0dbcd
2018-02-27 18:47:50 -08:00
Alex Hinson 2dd2529b3a Add option to hide context menu for TextInput #17335
Summary:
<!--
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!

-->

There is currently no way to disable to context menu that automatically appears over a TextInput. This is especially troublesome if you would like to disable the user from pasting text into certain fields. This PR adds a `contextMenuHidden` property to TextInput that will hide it.

I'm not sure if testing is necessary here. I would be happy to investigate further on how this would be tested, if deemed necessary!

https://github.com/facebook/react-native-website/pull/95

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

[FEATURE][TextInput] - Added `contextMenuHidden` property
Closes https://github.com/facebook/react-native/pull/18125

Differential Revision: D7101888

Pulled By: hramos

fbshipit-source-id: fe36603a3fbdcefbd644251a7ea894ac7e23e5b8
2018-02-27 17:32:24 -08:00
Moti Zilberman 5898817fc1 Implement letterSpacing on Android >= 5.0
Summary:
`letterSpacing` is completely missing from RN Android at the moment.

I've reviewed the `letterSpacing` implementations in #13199, #13877 and #16801 (that all seem to have stalled) and managed to put together an improved one based on #13199, updated to merge cleanly post 6114f863c3, that resolves the [issues](https://github.com/facebook/react-native/pull/13199#issuecomment-354568863) I've identified with that code.

I believe this is the closest PR yet to a correct implementation of this feature, with a few caveats:

- As with the other PRs, this only works on Android >= 5.0 (silently falling back to no letter spacing on older versions). Is this acceptable for a RN feature, in general? Would a dev mode warning be desirable?
- The other PRs seem to have explored the space of potential solutions to the layout issue ([Android renders space _around_ glyphs](https://issuetracker.google.com/issues/37079859), iOS to the _right_ of each one) and come up empty, so I've opted to merely document the difference.
- I have neither updated nor tested the "Flat" UI implementation - everything compiles but I've taken [this comment](https://github.com/facebook/react-native/issues/12770#issuecomment-294052694) to mean there's no point in trying to wade through it on my own right now; I'm happy to tackle it if given some pointers.
- The implementation in `ReactEditText` is only there to handle the placeholder text, as `ReactBaseTextShadowNode` already affects the input control's contents correctly.
  - I'm not sure whether `<TextInput>` is meant to respect `allowFontScaling`; I've taken my cue here from `ReactTextInputManager.setFontSize()`, and used the same units (SP) to interpret the value in `ReactEditText.setLetterSpacingPt()`.
  - I'm not sure whether `<TextInput>` is even meant to support `letterSpacing` - it doesn't actually work on iOS. I'm not going to be able to handle the Objective-C side of this, not as part of this PR at least.
- I have not added unit tests to `ReactTextTest` - is this desirable? I see that some other props such as `lineHeight` aren't covered there (unless I'm not looking in the right place).
- Overall, I'm new to this codebase, so it's likely I've missed something not mentioned here.

Note comment re: unit tests above; RNTester screenshots follow.

| iOS (existing functionality, amended test) | Android (new functionality & test) |
| - | - |
| <img src=https://user-images.githubusercontent.com/2246565/34458459-c8d59498-edcb-11e7-8c8f-e7426f723886.png width=300> | <img src=https://user-images.githubusercontent.com/2246565/34458473-2a1ca368-edcc-11e7-9ce6-30c6d3a48660.png width=300> |

| iOS _(not implemented, test not in this branch)_ | Android (new functionality & test) |
| - | - |
| <img src=https://user-images.githubusercontent.com/2246565/34458481-6c60a36e-edcc-11e7-9af5-9734dd722ced.png width=300> | <img src=https://user-images.githubusercontent.com/2246565/34458486-8b3cdcf8-edcc-11e7-974b-25c6085fa674.png width=300> |

| iOS _(not implemented, test not in this branch)_ | Android (new functionality & test) |
| - | - |
| <img src=https://user-images.githubusercontent.com/2246565/34458492-d69a77be-edcc-11e7-896f-21212621dbee.png width=300> | <img src=https://user-images.githubusercontent.com/2246565/34458490-b3a1139e-edcc-11e7-88c8-79d4430d1514.png width=300> |

https://github.com/facebook/react-native-website/pull/105 - this docs PR is edited slightly from what's in `TextStylePropTypes` here; happy to align either one to the other after a review.

[ANDROID] [FEATURE] [Text] - Implemented letterSpacing
Closes https://github.com/facebook/react-native/pull/17398

Reviewed By: mdvacca

Differential Revision: D6837718

Pulled By: hramos

fbshipit-source-id: 5c9d49e9cf4af6457b636416ce5fe15315aab72c
2018-02-27 14:53:58 -08:00
Josh Hargreaves b60a727adb Fix crashes onKeyPress Android
Summary:
There appear to be two different types of crashes related to the recent addition of `onKeyPress` on Android introduce in `0.53`. This PR addresses the cause of both of them.

Firstly, it seems possible to get an `indexOutOfBoundsException` with some 3rd-party keyboards as observed in https://github.com/facebook/react-native/issues/17974 & https://github.com/facebook/react-native/issues/17922. I have simplified the backspace determining logic slightly, and also put in an explicit check for zero case so it is not possible to get an indexOutOfBoundsException & it should make sense in the context of the onKeyPress logic.

Secondly, it appears that `EditText#onCreateInputConnection` can return null. In this case, if we set `null` to be the target of our subclass of `ReactEditTextInputConnectionWrapper`, we will see the crashes as seen [here](https://github.com/facebook/react-native/issues/17974#issuecomment-368471737), whereby any of methods executed in the `InputConnection` interface can result in a crash. It's hard to reason about the state when `null` is returned from `onCreateInputConnection`, however I would might reason that any soft keyboard input cannot update the `EditText` with a `null` `input connection`, as there is no way of interfacing with the `EditText`. I'm am not sure, if there is a later point where we might return/set this input connection at a later point? As without the `InputConnection` onKeyPress will not work. But for now, this will fix this crash at least.

I have not managed to reproduce these crashes myself yet, but users have confirmed that the `indexOutOfBounds` exception is fixed with the 'zero' case and has been confirmed on the respective issues https://github.com/facebook/react-native/issues/17974#issuecomment-368471737.

For the `null` inputConnection target case, I have verified that explicitly setting the target as null in the constructor of `onCreateInputConnection` results in the same stack trace as the one linked. Here is also a [reference](https://github.com/stripe/stripe-android/pull/392/files#diff-6cc1685c98457d07fd4e2dd83f54d5bb) to the same issue closed with the same fix for another project on github.

It is also important to verify that the behavior of `onKeyPress` still functions the same after this change, which can be verified by running the RNTesterProject and the `KeyboardEvents` section in `InputText`.
The cases to check that I think are important to check are:
- Cursor at beginning of input & backspace
- Return key & return key at beginning of input
- Select text then press delete
- Selection then press a key
- Space key
- Different keyboard types

This should not be a breaking change.

 [ANDROID] [BUGFIX] [TextInput] - Fixes crashes with TextInput introduced in 0.53.
Closes https://github.com/facebook/react-native/pull/18114

Differential Revision: D7099570

Pulled By: hramos

fbshipit-source-id: 75b2dc468c1ed398a33eb00487c6aa14ae04e5c2
2018-02-27 10:01:40 -08:00
Jamie Curtis da84eba318 Catch exception and report it when making a network request with invalid URL on Android
Summary:
Currently if you invoke `fetch()` with an invalid URL ("aaa" for
example) you cannot catch the error in javascript since it's not
reported. Instead the entire app crashes.

Fixes #7436 and #18087

Hopefully.

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

-->

Fix using fetch on Android with user generated input.

Added relevant unit test

`./scripts/run-android-local-unit-tests.sh` all pass

[ANDROID] [BUGFIX] [fetch] - Allow "unexpected url" exception to be caught on Android when using fetch
<!--
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
-->
Closes https://github.com/facebook/react-native/pull/18103

Differential Revision: D7097110

Pulled By: hramos

fbshipit-source-id: 69144e8a0f7404d9bcc7c71a94650de36a48c84a
2018-02-27 04:39:01 -08:00
David Vacca 62efff8ab8 Implement cloning for all ReactShadowNodes
Reviewed By: achen1

Differential Revision: D7063509

fbshipit-source-id: 90df8a3d2e6f2a4efa13f5eb0337b191b690bf8f
2018-02-26 09:04:48 -08:00
Sasha Nikiforov d8bb990abc Update ReactAndroid build script to support gradle 2.3.0
Summary:
We updated to Gradle 2.3.0 and our app's build failed. Our app doesn't provide "repositoryUrl" which is intended to be an optional gradle property. However, Gradle 2.3.0 blows up on findProperty('repositoryUrl') when "repositoryUrl" isn't provided:

````
* What went wrong:
A problem occurred configuring project ':ContextMenuAndroid'.
> Could not resolve all dependencies for configuration ':ContextMenuAndroid:_debugPublish'.
   > A problem occurred configuring project ':ReactAndroid'.
      > Could not get unknown property 'repositoryUrl' for project ':ReactAndroid' of type org.gradle.api.Project.
````

To fix this, we now use "project.hasProperty('repositoryUrl')" to safely detect the presence of the optional "repositoryUrl" property.

Since I cannot check it with your build environment, I've created a small demo to show that "project.hasProperty" properly detects the presence of the gradle property "repositoryUrl". I edited "getRepositoryUrl" to throw an exception if "repositoryUrl" is set:

````
def getRepositoryUrl() {
    if (project.hasProperty('repositoryUrl')) throw new GradleException(property('repositoryUrl'))

    return project.hasProperty('repositoryUrl') ? property('repositoryUrl') : 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
}
````
Then I ran gradle with "repositoryUrl" set like this (passing the property):
````
./gradlew -PrepositoryUrl=blah assembleDebug
````

As expected, it detected that "repositoryUrl" was set and threw an exception:
````
* What went wrong:
A problem occurred configuring project ':ContextMenuAndroid'.
> Could not resolve all dependencies for configuration ':ContextMenuAndroid:_debugPublish'.
   > A problem occurred configuring project ':ReactAndroid'.
      > blah
````

The same issue has been reported before - #14811, #14810

Minor changes in the Android build script
Closes https://github.com/facebook/react-native/pull/18075

Differential Revision: D7077788

Pulled By: hramos

fbshipit-source-id: ecfbab29d0632e7eecb3c6a247df39bc7616653e
2018-02-23 19:16:02 -08:00
David Vacca 1b63da753f Implement Cloning for ART Views
Reviewed By: achen1

Differential Revision: D7058410

fbshipit-source-id: 394330654be1ab70853f78580c2543e04a3efb7c
2018-02-23 17:52:20 -08:00
Sebastian Markbage 25b0c374b3 JSC bindings for FabricUIManager - Android
Reviewed By: fkgozali

Differential Revision: D7054214

fbshipit-source-id: 6275a8a3e2a87dfd851a09392f09658538083483
2018-02-23 16:24:24 -08:00
David Aurelio 87f98bcd7c BundleDownloader/DevServerHelper: Close http responses
Reviewed By: amnn

Differential Revision: D7067204

fbshipit-source-id: 9b3dde374280b8d7bdc028a14e9218f37cfc87f2
2018-02-23 09:50:45 -08:00
David Aurelio e214bb3971 `DevSupportManager`: tag `RELOAD` marker with metro host
Summary: Adds the configured metro host to `ReactMarker.logMarker(ReactMarkerConstants.RELOAD)`. This may be used for diagnostics in marker listeners

Reviewed By: bnham

Differential Revision: D7041086

fbshipit-source-id: 0b0777b1cd4c74b29b9245e925cf7851b24985fa
2018-02-23 03:37:59 -08:00
David Vacca d352c93487 Register ReactRootView into FabricUIManagerModule
Reviewed By: achen1

Differential Revision: D7043902

fbshipit-source-id: fecef5a019dadd3d2802baa20dd8a3711e566ed3
2018-02-22 23:06:19 -08:00
Krzysztof Magiera ef9d1fba23 Fix IllegalStateException in looped timing native animation
Summary:
This PR fixes regression introduced in #17896 with IllegalStateException being thrown in FrameBasedAnimationDriver.

After investigating it seemed that the root cause was the code responsible for looping animations that was setting next frame time by adding the frame interval to the current time. In some circumstances the next frame would run earlier than that and as a result the calculated frame index was negative.

Here is the stacktrace as reported by axemclion https://github.com/facebook/react-native/pull/17896/files#r170007224
```
Caused by: java.lang.IllegalStateException: Calculated frame index should never be lower than 0
	at com.facebook.react.animated.FrameBasedAnimationDriver.runAnimationStep(FrameBasedAnimationDriver.java:60)
	at com.facebook.react.animated.NativeAnimatedNodesManager.runUpdates(NativeAnimatedNodesManager.java:444)
	at com.facebook.react.animated.NativeAnimatedModule$1.doFrameGuarded(NativeAnimatedModule.java:100)
	at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:29)
```

Run native animated tests suite. Run RNTester and scroll to the loop animation and see it working correctly

[ANDROID][BUGFIX][Animated] - Fix exception thrown by timing animation when looping
Closes https://github.com/facebook/react-native/pull/18061

Differential Revision: D7059335

Pulled By: hramos

fbshipit-source-id: b08dfd1398d028eeeabeb11863743666379da374
2018-02-22 13:37:26 -08:00
Andrew Chen (Eng) cf0193f9e0 More tests for FabricUIManagerModule
Reviewed By: mdvacca

Differential Revision: D7045459

fbshipit-source-id: f96758cf04b41836f73b29e62d43a122d955c67a
2018-02-22 12:24:32 -08:00
Andrew Chen (Eng) 190e6bef2e FabricUIManagerModuleTest setup and testCloneNode
Reviewed By: mdvacca

Differential Revision: D7037558

fbshipit-source-id: a62617c7e16102cf7d12ecde48a95feec264fa51
2018-02-21 12:47:51 -08:00
David Vacca 4371d1e1d0 Implement FabricUIManagerModule in Android
Reviewed By: achen1

Differential Revision: D7031902

fbshipit-source-id: a8d9d505f981ac4268760efa32f4cbc7955aec32
2018-02-21 09:33:22 -08:00
David Vacca ad06403c3e Introduce cloning mechanism for React Shadow Node
Reviewed By: achen1

Differential Revision: D7018869

fbshipit-source-id: beca45b1df9602ebbc9172091b24a2bf44e103f4
2018-02-20 19:09:52 -08:00
Sophie Alpert 26684cf3ad Update to MIT license
Summary: Manual changes.

Reviewed By: TheSavior, yungsters

Differential Revision: D7012152

fbshipit-source-id: de7459be3db13c687868b45059856f125c4f2eb1
2018-02-16 18:31:53 -08:00
Sophie Alpert 1490ab12ef Update license headers for MIT license
Summary:
Includes React Native and its dependencies Fresco, Metro, and Yoga. Excludes samples/examples/docs.

find: ^(?:( *)|( *(?:[\*~#]|::))( )? *)?Copyright (?:\(c\) )?(\d{4})\b.+Facebook[\s\S]+?BSD[\s\S]+?(?:this source tree|the same directory)\.$
replace: $1$2$3Copyright (c) $4-present, Facebook, Inc.\n$2\n$1$2$3This source code is licensed under the MIT license found in the\n$1$2$3LICENSE file in the root directory of this source tree.

Reviewed By: TheSavior, yungsters

Differential Revision: D7007050

fbshipit-source-id: 37dd6bf0ffec0923bfc99c260bb330683f35553e
2018-02-16 18:31:53 -08:00
Toby Cox 67c3ad4e6a Fix pinch crash in touch-responsive views.
Summary:
Fork and rebase of gillessed's PR https://github.com/facebook/react-native/pull/13166 which has gotten stale.

From original PR:

Motivation (required)

Multiple react native developer (including myself) have run into a crash with the react-native-photo-view library (and possibly others). The common solution to this problem lies in the underlying java code, and thus requires a change in the react native source.

The stack trace I am getting is the same as listed here alwx/react-native-photo-view#15.

There was a PR to fix this (#12085) but it was closed. In response to the comments there, in my PR, I do log the exceptions. I don't think we can get any closer to the exception because in the next level of the stack trace, we are in the android sdk code.

Looking at some stack overflow pages and the android bug tracker, it seems that this is the common solution to this bug, and does not cause any impact any functionality.

https://code.google.com/p/android/issues/list?can=1&q=pointerindex+out+of+range&colspec=ID+Status+Priority+Owner+Summary+Stars+Reporter+Opened&cells=tiles

Test Plan (required)

I have manually tested this by compiling react native android from source and have confirmed the exception still gets hit and logged, but does not cause the app to terminate.
Closes https://github.com/facebook/react-native/pull/17167

Differential Revision: D7014296

Pulled By: hramos

fbshipit-source-id: 06b4a31062a591b726d2021e877d16f49881dcfd
2018-02-16 17:33:11 -08:00
David Vacca 1f7a48f214 Extend the FabricUIManagerModule class to integrate with JSI/JSC in Android
Reviewed By: sebmarkbage

Differential Revision: D7005419

fbshipit-source-id: 6e65be5a922ddb29fde965f5df779cc92a996ecf
2018-02-16 13:09:30 -08:00
Krzysztof Magiera b48f7e5605 Support for animated tracking in native driver
Summary:
This PR adds support for Animated tracking to Animated Native Driver implementation on Android and iOS.

Animated tracking allows for animation to be started with a "dynamic" end value. Instead of passing a fixed number as end value we can pass a reference to another Animated.Value. Then when that value changes, the animation will be reconfigured to drive the animation to the new destination point. What is important is that animation will keep its state in the process of updating "toValue". That is if it is a spring animation and the end value changes while the previous animation still hasn't settled the new animation will start from the current position and will inherit current velocity. This makes end value transitions very smooth.

Animated tracking is available in JS implementation of Animated library but not in the native implementation. Therefore until now, it wasn't possible to utilize native driver when using animated tracking. Offloading animation from JS thread turns out to be crucial for gesture driven animations. This PR is a step forward towards feature parity between JS and native implementations of Animated.

Here is a link to example video that shows how tracking can be used to implement chat heads effect: https://twitter.com/kzzzf/status/958362032650244101

In addition this PR fixes an issue with frames animation driver on Android that because of rounding issues was taking one extra frame to start. Because of that change I had to update a number of Android unit tests that were relying on that behavior and running that one additional animation step prior to performing checks.

As a part of this PR I'm adding three unit tests for each of the platforms that verifies most important aspects of this implementation. Please refer to the code and look at the test cases top level comments to learn what they do.

I'm also adding a section to "Native Animated Example" screen in RNTester app that provides a test case for tracking. In the example we have blue square that fallows the red line drawn on screen. Line uses Animated.Value for it's position while square is connected via tracking spring animation to that value. So it is ought to follow the line. When user taps in the area surrounding the button new position for the red line is selected at random and the value updates. Then we can watch blue screen animate to that position.

You can also refer to this video that I use to demonstrate how tracking can be linked with native gesture events using react-native-gesture-handler lib: https://twitter.com/kzzzf/status/958362032650244101

[GENERAL][FEATURE][Native Animated] - Added support for animated tracking to native driver. Now you can use `useNativeDriver` flag with animations that track other Animated.Values
Closes https://github.com/facebook/react-native/pull/17896

Differential Revision: D6974170

Pulled By: hramos

fbshipit-source-id: 50e918b36ee10f80c1deb866c955661d4cc2619b
2018-02-16 12:10:01 -08:00
David Vacca ad4f54ff6c Extend installFabric method to access UIFabricModule from C++
Reviewed By: sebmarkbage

Differential Revision: D7001974

fbshipit-source-id: a49c6e634ac710805fb37a50a61c2cf2e248b8a7
2018-02-15 13:41:01 -08:00
David Vacca c82b9f72de Create JNI wrapper for Fabric
Reviewed By: fkgozali

Differential Revision: D6989838

fbshipit-source-id: f092901cacc0c3eb89b08c6ac0384c4d5f6e6cfe
2018-02-15 12:17:54 -08:00
David Vacca 51def5ef7f Make Java YogaNode cloneable
Reviewed By: priteshrnandgaonkar

Differential Revision: D6935971

fbshipit-source-id: a2008f1eb849b5074585b48699b7de56d5ac90d4
2018-02-14 18:19:03 -08:00
David Vacca db391a500c Allow installing JS binding via the RN Android bridge
Reviewed By: fkgozali

Differential Revision: D6979072

fbshipit-source-id: 8b4ac3769496a6a6fe3dd9ee2aac64b66604c413
2018-02-14 11:51:58 -08:00
David Vacca ecc08adf49 Expose methods of persistent yoga for Java
Reviewed By: priteshrnandgaonkar

Differential Revision: D6918605

fbshipit-source-id: e424c78680c04e21154ebe21405671c4e90f6529
2018-02-14 09:32:57 -08:00
Andrew Chen (Eng) c281f7a3ae Support resumes without overriding the back handler
Differential Revision: D6982515

fbshipit-source-id: 5483f6c677c6653e51f6311386f31f5be6ed0e00
2018-02-14 09:32:57 -08:00
Janic Duplessis d06e143420 Bundle download progress on Android
Summary:
Android equivalent of #15066

Tested that download progress shows up properly when reloading the app.

[ANDROID] [FEATURE] [DevSupport] - Show bundle download progress on Android
Closes https://github.com/facebook/react-native/pull/17809

Differential Revision: D6982823

Pulled By: hramos

fbshipit-source-id: da01e42b8ebb1c603f4407f6bafd68e0b6b3ecba
2018-02-13 20:31:22 -08:00
Stein Strindhaug 74e54cbcc4 Fix: incorrect line-height calculation
Summary:
There seems to be a rounding error in the android code for line height, so that for some fonts and at some combinations of line height and font size the actual height of the elements seems to be slightly too short.

I've identified one issue that I mentioned here https://github.com/facebook/react-native/issues/10712#issuecomment-359382137 that could at least explain some of the problem. That when the line-height minus the original sum of the absolute value of top  and bottom from the metrics, happens to be an odd number, the division by two causes a rounding error of 1, so that the actual line height is 1pt less than it should.

The fix uses floating point division instead of integer division, and rounds (arbitrarily) the negative values up and the positive values down so that the total is still the correct for odd numbers.

It turns out that only ascent and descent is used to give the actual line-height between lines in the same text-element. The top and bottom values are only used for padding the top and bottom of the text. So when the line-height is greater than the font size and the extra padding this PR sets the ascent and descent to the same value as the top and bottom respectively.

I've renamed the shouldIncreaseAllMetricsProportionally test to evenLineHeightShouldIncreaseAllMetricsProportionally and added an extra assertion to check that bottom-top still equals the line height.

Added another test oddLineHeightShouldAlsoWork that is similar but uses an odd number for the line height to test that it still works with odd numbers. This test only uses the sum of the values so that it's indifferent to what value the implementation chooses to round up or down.

Improvement on https://github.com/facebook/react-native/pull/16448

Fix line-height calculation on Android.

| Before        | After           |
| ------------- |-------------|
| ![without fix](https://user-images.githubusercontent.com/2144849/36150230-4404a0cc-10c3-11e8-8880-4ab84339c741.png)      | ![actual fix](https://user-images.githubusercontent.com/2144849/36156620-eb496d0e-10d7-11e8-8bd1-1cb536a38fbf.png) |

(All three columns have font size 16 and lineHeight: 32. The first one is has fixed height 9*32, the second is 9 Text elements, the last is one text element with lots of text limited to 9 lines, so they should be the same height. )
Closes https://github.com/facebook/react-native/pull/17952

Differential Revision: D6980333

Pulled By: hramos

fbshipit-source-id: 0a501358cfbf7f139fca46056d0d972b1daf6ae3
2018-02-13 13:50:22 -08:00
David Vacca 331cc791ec Extend Navigation to support "is_fabric" param from native
Reviewed By: fkgozali

Differential Revision: D6955828

fbshipit-source-id: 1a77b652a7e372acf961a0b0772ae93a999b90b1
2018-02-13 13:50:22 -08:00
Paco Estevez Garcia ad2d9e7fab Forward VM version to inspector
Reviewed By: bnham

Differential Revision: D6938018

fbshipit-source-id: c79853ddf835acab86a16ebd539874d29d3aa60a
2018-02-13 08:16:50 -08:00
Andrew Chen (Eng) 427e464bb9 Fix localization crash in DevSettingsActivity
Differential Revision: D6970534

fbshipit-source-id: da1df549b6157e5ec684cf4eed5f411740a73ed0
2018-02-12 16:33:07 -08:00
Jonathan Kim e233646d09 Clean up unused macros after consolidation
Reviewed By: mzlee

Differential Revision: D6954781

fbshipit-source-id: 0ec78e6f7f2780951ac008e9b12f41cfd5441ed5
2018-02-09 16:05:29 -08:00
Wei Sun 1a790f8703 Use ConcurrentHashMap for handling concurrent Android websockets, and…
Summary:
… prevent unknown websocket IDs from crashing on Android (show warning on development builds instead)

This PR addresses #3346; an unknown websocket ID should produce a warning during development, but not cause crashes in production RN apps. This PR was created by satya164's request, and was inspired by tanthanh289's suggestion on #3346's thread.

On Android, create a websocket using a service like Pusher (`pusher-js` npm package) or manually, and then induce removal of its websocket ID. Result should be a red warning screen during development, and no crash in the app's release variant.

 [ANDROID] [BUGFIX] [WebSocket] - Prevent unknown websocket IDs from crashing on Android
Closes https://github.com/facebook/react-native/pull/17884

Differential Revision: D6954038

Pulled By: hramos

fbshipit-source-id: b346d80d7568996b8819c0de54552abb534cbfae
2018-02-09 14:47:56 -08:00
Héctor Ramos 27b6348f86 Added progress updates for all XMLHttpRequest upload types / fix crash on closed connection
Reviewed By: mdvacca

Differential Revision: D6937754

fbshipit-source-id: 89b963e16adf1bd3200806fd7374d28aa618b62f
2018-02-09 10:34:56 -08:00
David Vacca 2d35bde101 Introduce new Fabric API in RNAndroid
Summary: Introduce new Fabric FabricUIManagerModule RNAndroid

Reviewed By: achen1

Differential Revision: D6833154

fbshipit-source-id: 9ab7ff8bf0c407d833c512eb3455969573f138da
2018-02-08 18:14:54 -08:00
Brian Vaughn 6f007e8957 Ran rename-unsafe-lifecycles codemod on xplat/js
Reviewed By: trueadm

Differential Revision: D6889214

fbshipit-source-id: e815cda4b09f3650ae3b0b9a44ae6f5fcb48fe25
2018-02-08 10:58:31 -08:00
Taras Tsugrii 79a63d040f Skylarkify RN defs.
Reviewed By: adamjernst

Differential Revision: D6934209

fbshipit-source-id: 59f50b739482a53473c157f9e0183024dc88dc67
2018-02-08 09:47:28 -08:00
Héctor Ramos a5e135aed6 Add CountingOutputStream
Reviewed By: mdvacca

Differential Revision: D6932872

fbshipit-source-id: 226f30833a786d0c03564f25ec8c4f43d94c48f4
2018-02-08 09:32:14 -08:00
Héctor Ramos 2f02dd4c8c Revert PR #17312 due to buck failures in continuous integration tests
Summary:
Circle is currently failing on the `android` step due to a dependency issue introduced by the aforementioned PR. I am currently waiting for an internal diff to be reviewed which will restore this PR alongside the necessary dependency.
Closes https://github.com/facebook/react-native/pull/17902

Differential Revision: D6937173

Pulled By: hramos

fbshipit-source-id: f732a397521cc5df36f503e618318ef6d69aeaa6
2018-02-08 07:38:37 -08:00
Pritesh Nandgaonkar 528bbacf6b Expose a function which marks all descendants dirty
Reviewed By: emilsjolander

Differential Revision: D6911869

fbshipit-source-id: e0a3abcf5653f921297edfdca473d83b947cc627
2018-02-08 05:04:02 -08:00
Vishwesh Jainkuniya 09b43e479e textinput: Maintain cursor position when secureTextEntry toggles.
Summary:
<!--
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!

-->

On current [master](8235a49a33), text input cursor resets to start when `secureTextEntry` prop toggles on Android. This motivate me to maintain position when `secureTextEntry ` prop toggles for better user experience.

On current [master](8235a49a33)
![ezgif com-video-to-gif-3](https://user-images.githubusercontent.com/18511177/35776882-bdc3b182-09ca-11e8-8f4e-218fae0a24a1.gif)

On this PR
![ezgif com-video-to-gif-4](https://user-images.githubusercontent.com/18511177/35776883-be082d94-09ca-11e8-9424-6164110bdf03.gif)

[ANDROID] [BUGFIX] [TextInput] - Fix: cursor positions resets to start on toggling `secureTextEntry` prop.

<!--
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
-->
Closes https://github.com/facebook/react-native/pull/17851

Differential Revision: D6925711

Pulled By: hramos

fbshipit-source-id: 6d53ad2dbed2dca20cd21e5b1b0578be13a91aad
2018-02-07 11:03:31 -08:00
Dmitry Zakharov 0c49c1f332 Native Modules -> Native Extensions
Reviewed By: danzimm

Differential Revision: D6887988

fbshipit-source-id: 475c05f60a2e1ddcfaa9263ab363bff8a528236a
2018-02-07 08:07:13 -08:00
David Aurelio 06d8f96a64 Inline format strings in `DevServerHelper`
Summary: Having format strings and values to interpolate separated makes reading the respective calls difficult. It has also led to situations where format strings were reused with slightly different values, instead of creating a parameterized method.

Reviewed By: pakoito

Differential Revision: D6900905

fbshipit-source-id: 68b56af6a86c0b46bc8cf9c44fbe0fb93ee151ac
2018-02-07 06:31:16 -08:00
Moti Zilberman 6c38972327 Support non-integer modulus in ModulusAnimatedNode on Android
Summary:
`Animated.modulo(value, modulus)` supports a non-integer modulus in the iOS and JS implementations but crashes on Android when `useNativeDriver` is set to `true`.

Unfortunately, I'm not fluent enough with this codebase to add a Java test for this fix - especially as I couldn't find any analogous tests to extrapolate from. However, the fix itself seems straightforward enough.

None needed

[ANDROID] [BUGFIX] [Animated] - Support non-integer modulus in .modulo()
Closes https://github.com/facebook/react-native/pull/17860

Differential Revision: D6918799

Pulled By: hramos

fbshipit-source-id: 8d15e4bc881ed41a4123c6f811c0c72119f67be0
2018-02-06 16:59:30 -08:00
David Aurelio f88c9d6382 Remove unused method
Summary: Removes `BundleDownloader#cancelDownloadBundleFromURL`

Reviewed By: pakoito

Differential Revision: D6900903

fbshipit-source-id: d9297344d6296d79a984aeecb3e014c9ed23a165
2018-02-06 15:12:08 -08:00
David Aurelio 1019bda930 Extract delta client
Summary: Extracts the delta client from the bundle downloader. This will allow us to extract an interface, and provide a different implementation for C++ delta bundling (where we will pass deltas directly to native code).

Reviewed By: pakoito

Differential Revision: D6900904

fbshipit-source-id: 358705615eecc15afa0de3e50478468ad840d250
2018-02-06 15:12:08 -08:00
David Aurelio 6e44356c9b Clean up `DevServerHelper`
Summary:
- Makes methods private that are not used elsewhere
- Moves a method to `DevSupportManagerImpl`
- Removes unused methods

Reviewed By: pakoito

Differential Revision: D6900907

fbshipit-source-id: c8d9f748effd396fe610f0d4d87e0bc388e155d6
2018-02-06 15:12:08 -08:00
David Aurelio 644123aa6f Consolidate bundle URL creation
Summary:
`DevServerHelper` had multiple places that created bundle URLs.
This consolidates that logic into a single place, and uses an enum for different "bundle types" (bundle, bundle deltas, source maps).

Reviewed By: pakoito

Differential Revision: D6900906

fbshipit-source-id: 64ed9360ea85dc5755308d822d5fc55fe8cb5a55
2018-02-06 15:12:08 -08:00
David Aurelio 108f9664bf Do not expose `BundleDownloader` from `DevServerHelper`
Summary:
Adds `downloadBundleFromURL` as a delegating method to `DevServerHelper` rather than exposing the underlying `BundleDownloader`.

The additional encapsulation will allow futher factoring of `BundleDownloader` to make logic for different delta bundler clients easier to implement and maintain.

Reviewed By: pakoito

Differential Revision: D6871225

fbshipit-source-id: 6adcab5e69869a234baf38f1f1e60abd34d6b555
2018-02-05 11:47:03 -08:00
allengleyzer 9e436d1439 Added progress updates for all XMLHttpRequest upload types / fix crash on closed connection
Summary:
This PR includes the same changes made in #16541, for addressing issues #11853/#15724. It adds upload progress updates for uploads with any request body type, and not just form-data.

Additionally, this PR also includes a commit for fixing an `IllegalStateException` when a user's connection gets closed or times out (issues #10423/#11016). Since this exception was occurring within the progress updates logic, it started being thrown more frequently as a result of adding progress updates to all uploads, which was why the original PR was reverted.

To test the upload progress updates, run the following JS to ensure events are now being dispatched:
```
const fileUri = 'file:///my_file.dat';
const url = 'http://my_post_url.com/';
const xhr = new XMLHttpRequest();

xhr.upload.onprogress = (event) => {
    console.log('progress: ' + event.loaded + ' / ' + event.total);
}

xhr.onreadystatechange = () => {if (xhr.readyState === 4) console.log('done');}

console.log('start');

xhr.open('POST', url);

// sending a file (wasn't sending progress)
xhr.setRequestHeader('Content-Type', 'image/jpeg');
xhr.send({ uri: fileUri });

// sending a string (wasn't sending progress)
xhr.setRequestHeader('Content-Type', 'text/plain');
xhr.send("some big string");

// sending form data (was already working)
xhr.setRequestHeader('Content-Type', 'multipart/form-data');
const formData = new FormData(); formData.append('test', 'data');
xhr.send(formData);
```

To test the crash fix:
In the RN Android project, before this change, set a breakpoint at `mRequestBody.writeTo(mBufferedSink);` of `ProgressRequestBody`, and wait a short while for a POST request with a non-null body to time out before resuming the app. Once resumed, if the connection was closed (the `closed` variable will be set to true in `RealBufferedSink`), an `IllegalStateException` will be thrown, which crashes the app. After the changes, an `IOException` will get thrown instead, which is already being properly handled.

As mentioned above, includes the same changes as #16541, with an additional commit.

[ANDROID] [BUGFIX] [XMLHttpRequest] - Added progress updates for all XMLHttpRequest upload types / fix crash on closed connection

Previously, only form-data request bodies emitted upload progress updates. Now, other request body types will also emit updates. Also, Android will no longer crash on certain requests when user has a poor connection.

Addresses issues: 11853/15724/10423/11016
Closes https://github.com/facebook/react-native/pull/17312

Differential Revision: D6712377

Pulled By: mdvacca

fbshipit-source-id: bf5adc774703e7e66f7f16707600116f67201425
2018-02-02 18:16:24 -08:00
Kathy Gray 28be33ac34 Remove release from ReadableNativeArray and Map
Reviewed By: mhorowitz

Differential Revision: D6846268

fbshipit-source-id: 2f750a05ee63a744e7f64b3fe67736df3614ef3d
2018-02-01 07:30:07 -08:00
Ray Shih 88980f2ef7 Implement bundle sync status
Reviewed By: pakoito

Differential Revision: D6807480

fbshipit-source-id: d71f2cecd882c47e79bb71dfb9d03d3597fa4068
2018-02-01 06:18:13 -08:00
Agastya Darma b1cdb7d553 Implementing space-evenly
Summary:
So in v0.52.0 space-evenly is introduced but not yet implemented (1050e0b by woehrl01). This pull request implements the space-evenly.

Manual Testing.
![notes marker](https://i.imgur.com/IXmezVY.png)

[IOS] [FEATURE] [Yoga] Adding space-evenly on justify-content in iOS
[ANDROID] [FEATURE] [Yoga] - Adding space-evenly on justify-content in Android
Closes https://github.com/facebook/react-native/pull/17805

Differential Revision: D6858294

Pulled By: shergin

fbshipit-source-id: 7a705ca05f58603ef4588e1bfd16c16a78f8a390
2018-01-31 10:17:22 -08:00
Dan Caspi 3fbf7856d9 Better handling exception in loadScript()
Differential Revision: D6856807

fbshipit-source-id: 36c527ee00eef56a5912ad6e4233d6cd61cb5170
2018-01-31 05:31:12 -08:00
David Aurelio e756251413 Synchronize map access
Summary:
We want applying deltas to be an atomic operation, from incrementing the delta message ID to updating the relevant maps.
This is a simple approach to synchronize the corrsponding method.

We will probably need to go with a more sophisticated approach, that makes sure that deltas are applied in order. That would also allow us to lock only on writes.

Reviewed By: kathryngray

Differential Revision: D6846560

fbshipit-source-id: 175a80b4e39223883e397d75e20109fc12a2a878
2018-01-31 03:04:13 -08:00
Chris Lewis 22efd95be1 Add back ability to customise OkHttp client
Summary:
Prior to 0a71f48b13, users could customise the OkHttp client used by React Native on Android by calling replaceOkHttpClient in OkHttpClientProvider.

This functionality has a variety of legitimate applications from changing connection timeouts or pool size to Stetho integration. The challenge is to add back support for replacing the client without causing a breaking change or reintroducing the problems olegbl sought to address in his original commit.

Introducing a client factory archives these aims, it adds a new, backwards compatible interface and is called each time a client is requested rather than re-using the same instance (unless you explicitly want this behaviour, in which case you could replicate it using a static class property inside your custom factory).

A number of PRs have been opened to add this functionality: https://github.com/facebook/react-native/pull/14675, https://github.com/facebook/react-native/pull/14068.

I don't have a lot of Java experience so I'm open to better/more idiomatic ways to achieve this :)

Create React Native application and set a custom factory in the constructor, e.g.  `OkHttpClientProvider.setOkHttpClientFactory(new CustomNetworkModule());`

Where a custom factory would look like:

```
class CustomNetworkModule implements OkHttpClientFactory {
    public OkHttpClient createNewNetworkModuleClient() {
        return new OkHttpClient.Builder().build();
    }
}
```

Remove the existing replace client method to prevent accident use and alert existing users that its functionality has changed: https://github.com/facebook/react-native/pull/16972

[Android] [Minor] [Networking] - | Provide interface for customising the OkHttp client used by React Native |
Closes https://github.com/facebook/react-native/pull/17237

Differential Revision: D6837734

Pulled By: hramos

fbshipit-source-id: 81e63df7716e6f9039ea12e99233f6336c6dd7ef
2018-01-30 11:58:45 -08:00
Héctor Ramos 964320447d Add support annotations dependency
Summary:
Should fix current test-android error in Circle CI.
Closes https://github.com/facebook/react-native/pull/17774

Differential Revision: D6837326

Pulled By: hramos

fbshipit-source-id: a53464d3abb52248c6565dee68e7e7f9be9a313f
2018-01-30 11:03:52 -08:00
Semen Zhydenko 8ffc16c6e7 Typos in code
Summary:
To fix typos

No testing required, changed only internal things names

No

addtionalStyles -> additionalStyles
occured -> occurred
recomendedType -> recommendedType
markDirtyAndPropogate -> markDirtyAndPropagate
targetting -> targeting
RCTApplyTranformationAccordingLayoutDirection -> RCTApplyTransformationAccordingLayoutDirection (tranform -> transform)
Closes https://github.com/facebook/react-native/pull/17587

Differential Revision: D6832696

Pulled By: shergin

fbshipit-source-id: 452287e5ce82df5c6b87126cb21889b7bd9d73c1
2018-01-29 19:17:33 -08:00
Alexey Lang 6224ef5301 Measure time to create ReactInstanceManager
Reviewed By: fkgozali

Differential Revision: D6591797

fbshipit-source-id: 7345b7c772eb4ae35ad570082090fbdf704102d3
2018-01-29 11:07:39 -08:00
Satyajit Sahoo be56a3efee Implement Blob support for XMLHttpRequest
Summary:
This PR is a followup to https://github.com/facebook/react-native/pull/11417 and should be merged after that one is merged.

  1. Add support for creating blobs from strings, not just other blobs
  1. Add the `File` constructor which is a superset of `Blob`
  1. Add the `FileReader` API which can be used to read blobs as strings or data url (base64)
  1. Add support for uploading and downloading blobs via `XMLHttpRequest` and `fetch`
  1. Add ability to download local files on Android so you can do `fetch(uri).then(res => res.blob())` to get a blob for a local file (iOS already supported this)

  1. Clone the repo https://github.com/expo/react-native-blob-test
  1. Change the `package.json` and update `react-native` dependency to point to this branch, then run `npm install`
  1. Run the `server.js` file with `node server.js`
  1. Open the `index.common.js` file and replace `localhost` with your computer's IP address
  1. Start the packager with `yarn start` and run the app on your device

If everything went well, all tests should pass, and you should see a screen like this:

![screen shot 2017-06-08 at 7 53 08 pm](https://user-images.githubusercontent.com/1174278/26936407-435bbce2-4c8c-11e7-9ae3-eb104e46961e.png)!

Pull to rerun all tests or tap on specific test to re-run it

  [GENERAL] [FEATURE] [Blob] - Implement blob support for XMLHttpRequest
Closes https://github.com/facebook/react-native/pull/11573

Reviewed By: shergin

Differential Revision: D6082054

Pulled By: hramos

fbshipit-source-id: cc9c174fdefdfaf6e5d9fd7b300120a01a50e8c1
2018-01-26 09:17:11 -08:00
4ndroidev 7b1915e74d Fix NPE in Android Switch during measure
Summary:
<!--
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!

-->

Fixes #16000

see [Issue #16000](https://github.com/facebook/react-native/issues/16000)
fix a null pointer exception while using higher version 'com.android.support:appcompat-v7'

N/A

[ANDROID][BUGFIX][Switch] - Fix NPE in Android Switch during measure
Closes https://github.com/facebook/react-native/pull/16064

Differential Revision: D6816122

Pulled By: hramos

fbshipit-source-id: ba9a6febad4884b8ab142d8c7142085367006904
2018-01-25 18:00:09 -08:00
Michael Lee 869866cc5c Continue wrapping functions as we prepare for skylark
Differential Revision: D6808010

fbshipit-source-id: f24e71558baed2c2da319e20e0faf66858eb27d5
2018-01-25 09:30:00 -08:00
Sergei Dryganets 0c18ec5b9c Popups calling error callback instead of crashing if view with passed tagId not found
Summary:
The showPopup method has an error callback. For some reason, it is asserting in case the wrong tagId is passed instead of calling the error callback on Android.

Pass not existing tagId to showPopup method and make sure it is receiving an error in js instead of crashing in native on Android.

[ANDROID] [MINOR] showPopup method calls error callback instead of crashing on errors.
Closes https://github.com/facebook/react-native/pull/17550

Differential Revision: D6776014

Pulled By: hramos

fbshipit-source-id: 1d97b762818d1591018fd43556eb41c3fb491eb9
2018-01-23 14:07:25 -08:00
Jonathan Kim 4f6c157250 Fix open source build load error
Reviewed By: hramos

Differential Revision: D6785610

fbshipit-source-id: d50aab72aa51f8aa063f23fc1e328caf9c02de0c
2018-01-23 09:51:40 -08:00
Pritesh Nandgaonkar be8e7c6e65 Made logging logic dynamic to log string length
Reviewed By: emilsjolander

Differential Revision: D6784491

fbshipit-source-id: 26e4520a84be355ff992b808297ce7a95b3d09e3
2018-01-23 06:46:08 -08:00
Sergei Dryganets 46cc4907e3 ClassCastException fix: getText() returns CharSequence not Spanned.
Summary:
ClassCastException fix: getText() returns CharSequence not Spanned.
From the other hand, EditTexts getText method returns Editable which extends Spanned.
This commit fixes two similar bugs one in flat TextView and another in standard TextView.
Also, it removes redundant checks in the ReactEditText.

Application without this change sporadically crashes with the following stack trace:
```
java.lang.ClassCastException: java.lang.String cannot be cast to android.text.Spanned
	at com.facebook.react.views.text.ReactTextView.reactTagForTouch(ReactTextView.java:195)
	at com.facebook.react.uimanager.TouchTargetHelper.getTouchTargetForView(TouchTargetHelper.java:269)
	at com.facebook.react.uimanager.TouchTargetHelper.findTargetTagAndCoordinatesForTouch$58866680(TouchTargetHelper.java:101)
	at com.facebook.react.uimanager.JSTouchDispatcher.handleTouchEvent(JSTouchDispatcher.java:77)
	at com.facebook.react.ReactRootView.dispatchJSTouchEvent(ReactRootView.java:151)
	at com.facebook.react.ReactRootView.onInterceptTouchEvent(ReactRootView.java:127)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2110)

```
Closes https://github.com/facebook/react-native/pull/15452

Differential Revision: D6775986

Pulled By: hramos

fbshipit-source-id: 6de929937cbbb3e7bd98a708a40700f883cbaef0
2018-01-22 15:15:23 -08:00
Pascal Hartig ff2658c3de Mark model fields final
Reviewed By: emilsjolander

Differential Revision: D6759564

fbshipit-source-id: 810dc8a9730fb330760d2aedecafcea81cf25cb1
2018-01-22 03:05:17 -08:00
Build Service f49f7932d5 @allow-large-files @ignore-conflict-markers[i18n] translation auto-update for i18n/instagram-directapp.config.json on master
fbshipit-source-id: ec880908d30772bf2047963013d184e01405de03
2018-01-22 02:16:31 -08:00
Build Service faa9519021 @allow-large-files @ignore-conflict-markers[i18n] translation auto-update for i18n/fb4a.config.json on master
fbshipit-source-id: c7382ae9de4fb1697190bbc9fe385bd552973fdd
2018-01-22 02:16:31 -08:00
Build Service 8bd00a2361 @allow-large-files @ignore-conflict-markers[i18n] translation auto-update for i18n/expresswifi.config.json on master
fbshipit-source-id: 42904e404f11a205af8af486e9535a8dc52da81e
2018-01-22 02:16:31 -08:00
Build Service bb6fceac27 @allow-large-files @ignore-conflict-markers[i18n] translation auto-update for i18n/creatorapp.config.json on master
fbshipit-source-id: 9ae5884ac23492feed039da32433cd8c08e2cc0e
2018-01-22 02:16:31 -08:00
Build Service c7846c4bfb @allow-large-files @ignore-conflict-markers[i18n] translation auto-update for i18n/adsmanager.config.json on master
fbshipit-source-id: a0ba2333de9b635234aa56ccd080252fa400d534
2018-01-22 02:16:31 -08:00
Jonathan Kim 4f2cc42a2d Make xplat react native files buildable
Reviewed By: mzlee

Differential Revision: D6605611

fbshipit-source-id: baa33947319a27b95020924d177a9398a276dabe
2018-01-21 22:05:05 -08:00
David Vacca 4d3519cc6a Adding JS hierarchy information when a StackOverflowException is thrown in Dev mode
Reviewed By: achen1

Differential Revision: D6716309

fbshipit-source-id: 23458cd126d13fec3aa9c09420f7cdd230ec8dd0
2018-01-19 13:02:41 -08:00
David Vacca 1aac962378 Capture StackOverflowExceptions triggered when drawing a ReactViewGroup or ReactRootView
Reviewed By: achen1

Differential Revision: D6653395

fbshipit-source-id: 849b1a2ed6ab9bc057414d451e97a673178c30dd
2018-01-18 18:48:59 -08:00
David Vacca 877f1cde2e Fix and re-enable "view flattening" optimizations for Marketplace
Reviewed By: achen1

Differential Revision: D6751078

fbshipit-source-id: 32bfb9ac64f183fabbba85755be372016722afc6
2018-01-18 17:55:08 -08:00
Ram N f5efc460ad Add support for finding multiple views with NativeIds using a single listener
Reviewed By: mdvacca

Differential Revision: D6735460

fbshipit-source-id: e038a68637a00fda7058fc82e253ae68cdf67c6e
2018-01-18 11:33:34 -08:00
David Vacca 71ec85f24c Cleanup ReactHorizontalScrollView
Reviewed By: achen1

Differential Revision: D6693605

fbshipit-source-id: e58425b2a5b0bf75ffb41ef3ab6fa7ad46222531
2018-01-18 10:46:47 -08:00
Tim Yung df2f33537a RN: Revert D6701597
Reviewed By: mdvacca

Differential Revision: D6735812

fbshipit-source-id: 8144b72883150f9d7e2614ee0f238c1b8e44c6ab
2018-01-17 15:11:14 -08:00
Kathy Gray 7891805d22 move native accesses of map into two accesses instead of per-element
Differential Revision: D6650192

fbshipit-source-id: 0eb0719fd3b7813add33a3d4fe3fb70e6f375fd7
2018-01-17 10:51:49 -08:00
Kathy Gray 5649aed6d3 Move native accesses of array into one access instead of per-element
Differential Revision: D6578349

fbshipit-source-id: 84ebd66ed791a845e9cc0fbc7e12a377534aa903
2018-01-17 10:51:49 -08:00
Felix Oghina fc6dd78935 Remove SoLoaderShim, use SoLoader
Summary:
SoLoader is more stable on older versions of Android. Switching to it should fix recurring issues that we get such as `UnsatisfiedLinkError` and so on.

CI + run showcase app.
Closes https://github.com/facebook/fresco/pull/1989

Reviewed By: erikandre

Differential Revision: D6556420

Pulled By: foghina

fbshipit-source-id: ffc3faef6452294b4d781258c64ef57e08d107b5
2018-01-16 09:16:01 -08:00
David Vacca 1f5bb374cd Revert D6704701: Refactor ReactViewGroup to reuse ReactViewBackgroundManager
Differential Revision: D6704701

fbshipit-source-id: 01feb61a9c2c263f88cca4fea5978957c5e4767f
2018-01-16 08:15:47 -08:00
Semen Zhydenko d2c569795c Typos in comments and log messages
Summary:
No code changes, no testing required.

alligned -> aligned
allignment -> alignment
completly -> completely
conseptually -> conceptually
decendents -> descendants
indefinetly -> indefinitely
dimention -> dimension
doesnt -> doesn't
safegaurd -> safeguard
intialization -> initialization
hierachy -> hierarchy
happend -> happened
gaurd -> guard
programatically -> programmatically
initalized -> initialized
immidiately -> immediately
occured -> occurred
unkown -> unknown
neccessary -> necessary
neccesarily -> necessarily
occuring -> occurring
comoponent -> component
propogate -> propagate
recieved -> received
referece -> reference
perfomance -> performance
recieving -> receiving
subsquently -> subsequently
scoll -> scroll
suprisingly -> surprisingly
targetting -> targeting
tranform -> transform
symetrical -> symmetrical
wtih -> with
Closes https://github.com/facebook/react-native/pull/17578

Differential Revision: D6718791

Pulled By: shergin

fbshipit-source-id: 4ab79c1131ec5971d35a0c7199eba7ec0a0918ad
2018-01-12 22:18:45 -08:00
David Vacca e8aa60430c Refactor ReactViewGroup to reuse ReactViewBackgroundManager
Reviewed By: achen1

Differential Revision: D6704701

fbshipit-source-id: 14bb155f2eb0951307674e257e729a1c72b08d8b
2018-01-12 17:08:00 -08:00