Commit Graph

2410 Commits

Author SHA1 Message Date
Roman Volosovskyi 52f9a432c9
fix ".. != Float.NaN" condition 2018-07-05 18:54:00 +03:00
Mike Grabowski 370bcffba7 [0.55.4] Bump version numbers 2018-04-27 18:34:36 +02:00
shockdesign 5bb2e83f65 Switch equality check in BlobModule.java
Summary:
Switch the equality check to avoid crash on the first item. The check can be on a null object and return the correct result.

Fixes #18709

Just a simple switch on equals, to make sure we're not bombing out by having a null scheme.

No related PRs and does not require a document change.

[ANDROID][BUGFIX][BlobModule] Switch equality check in BlobModule.java
Closes https://github.com/facebook/react-native/pull/18893

Differential Revision: D7658036

Pulled By: hramos

fbshipit-source-id: db61b98dae178dbbb645070f7b0d73ab43d30541
2018-04-27 18:33:33 +02:00
Mike Grabowski 2845a8661c [0.55.3] Bump version numbers 2018-04-17 13:43:40 -07:00
Mike Grabowski a05f85172e [0.55.2] Bump version numbers 2018-04-06 18:20:54 +02:00
Mike Grabowski 44f19f745b [0.55.1] Bump version numbers 2018-04-05 23:56:49 +02:00
Mike Grabowski 2e384184bc [0.55.0] Bump version numbers 2018-04-03 16:58:34 +02:00
Mike Grabowski c70578ab76 [0.55.0-rc.2] Bump version numbers 2018-03-28 19:12:20 +02:00
Eric Samelson 8a6ab14200 fix ReadableNativeMap.toHashMap() for nested maps and arrays
Summary:
<!--
  Required: Write your motivation here.
  If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
-->

Commit 7891805d22 broke the previous behavior of `ReadableNativeMap.toHashMap()` for nested maps and arrays. Previously, all nested `ReadableNativeMap`s and `ReadableNativeArray`s were recursively converted to `HashMap`s and `ArrayList`s, but this is lost when only `getLocalMap()` is returned.

<!--
  Required: Write your test plan here. If you changed any code, please provide us with
  clear instructions on how you verified your changes work. Bonus points for screenshots and videos!
-->

Call `ReadableNativeMap.toHashMap()` on a map with values of type `ReadableNativeMap` and `ReadableNativeArray`. Verify the returned hash map has these converted to `HashMap` and `ArrayList`, respectively.

<!--
  Does this PR require a documentation change?
  Create a PR at https://github.com/facebook/react-native-website and add a link to it here.
-->

<!--
  Required.
  Help reviewers and the release process by writing your own release notes. See below for an example.
-->

[ANDROID] [BUGFIX] [ReadableNativeMap] - Fix toHashMap() for nested maps and arrays

<!--
  **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 ] [ {Filename}  ]
  [ IOS      ] [ FEATURE     ] [ {Directory} ]   |-----------|
  [ ANDROID  ] [ MINOR       ] [ {Framework} ] - | {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/18455

Reviewed By: kathryngray

Differential Revision: D7347344

Pulled By: mdvacca

fbshipit-source-id: af2bca9dec6c0cb8a7da099b6757434fcc3ac785
2018-03-28 19:12:05 +02:00
Mike Grabowski b20827250e [0.55.0-rc.1] Bump version numbers 2018-03-20 21:50:22 +01:00
Mike Grabowski 9c29faf6a9 [0.55.0-rc.0] Bump version numbers 2018-03-12 23:53:13 +01:00
Alexander Tu 216c8ec04b AndroidInfoModule now also returns Android ID
Summary: Added Android ID as one of the constants returned by AndroidInfoModule

Reviewed By: fkgozali

Differential Revision: D7206029

fbshipit-source-id: 110b33235d3023b4a4607d37acc3440cfe735cef
2018-03-09 12:12:21 -08:00
Caleb Meredith a48b4d5df1 Add Sonar support to Oculus Twilight Android
Reviewed By: alex1kom

Differential Revision: D7177071

fbshipit-source-id: 685d40e564d391d18592cedfcc12d8ac743a5331
2018-03-09 11:42:40 -08:00
David Vacca c883d4e727 Add "newProps" map into ReactShadowNode
Reviewed By: achen1

Differential Revision: D7205127

fbshipit-source-id: 6c27070806de36cab7adf9c392a10c815aee90d4
2018-03-09 09:47:44 -08:00
David Vacca e31781be61 Add extra debug information to ReactShadowNodes objects
Reviewed By: achen1

Differential Revision: D7195373

fbshipit-source-id: 6611726c3e1f92f387e00e733b1b8909a3e9edc2
2018-03-09 09:47:44 -08:00
David Vacca a7558d58a0 Clone ReactShadowNode when Yoga clones a YogaNode during layout
Reviewed By: achen1

Differential Revision: D7195840

fbshipit-source-id: d596e3ada8fe48577b91295721d41c0afd33087f
2018-03-09 09:47:43 -08:00
Andrew Chen (Eng) 596bcb6d84 Initialize ReactChoreographer before creating the TimingModule
Reviewed By: mdvacca

Differential Revision: D7185838

fbshipit-source-id: f775f5668ccff3b311c95a0bdd37a420ec64b7d4
2018-03-07 18:57:42 -08:00
samsafay d52569c4a1 check for GET and Head in send request
Summary:
React Native had an underlying problem connecting to Firestore (Google's latest database) from Android devices. You can follow the issue [here](https://github.com/firebase/firebase-js-sdk/issues/283).
The main problem was in NetworkingModule.java. Please refer to section 3 of 4.5.6 in whatwg.org's guideline https://xhr.spec.whatwg.org/#dom-xmlhttprequest-send

In this [video](https://www.youtube.com/watch?v=tILagf46ys8), I am showing how the react native behaved before adding the new fix and how it worked after the new fix added.  The new fix starts at 50 seconds.

[ANDROID] [BUGFIX] [FIRESTORE][XMLHttpRequest][ReactAndroid/src/main/java/com/facebook/react/modules/network/NetworkingModule.java] - Fixes the connection to Firestore by following whatwg.org's XMLHttpRequest send() method
Closes https://github.com/facebook/react-native/pull/17940

Differential Revision: D7173468

Pulled By: hramos

fbshipit-source-id: 354d36f03d611889073553b93a7c43c6d4363ff3
2018-03-06 17:39:22 -08:00
Andrew Chen (Eng) 6fc416313c Clean up FabricUIManagerViewHierarchyTest
Reviewed By: mdvacca

Differential Revision: D7165823

fbshipit-source-id: e6d2a83bf9e089c67d69de6581d177bdf0d2ec4e
2018-03-06 16:19:04 -08:00
Andrew Chen (Eng) e7b8341024 Add Fabric test for text nodes
Reviewed By: mdvacca

Differential Revision: D7165356

fbshipit-source-id: ab5b019943d0d6f759bdb16ca646e34a2ef79e23
2018-03-06 16:19:04 -08:00
Krzysztof Ciombor b7bb2e5745 Add support for Android TV devices
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!

-->

* To be on par with Apple TV support, this makes it possible to run React Native apps on Android TV devices (See also: https://react-native.canny.io/feature-requests/p/android-tv-support)
* These changes also make it possible to navigate through the app using D-PAD buttons that are present on some mobile devices
* Since these changes affect, among others, `ReactRootView.java` and `Touchable.js` code and are closely related to Apple TV implementation, it makes sense for them to be included in the core

 - React native apps can be launched on Android TV devices and properly render their content
 - Navigation is possible using left, right, top, bottom arrows from the remote (or D-PAD)
 - Touchable components can handle D-PAD center button press events and correctly fire their `onPress` handlers
 - Touchable components will receive `onPressIn` and `onPressOut` events and can react to focus/blur changes appropriately (just like on Apple TV)
 - `Platform` constants allow to check if the react-native app is running on TV (`Platform.isTV`)
 - `ScrollView`s behave correctly (same as native implementation) when switching to view outside bounds – that is, the container would scroll such that the newly focused element is fully visible
 - Native "clicking" sounds are played when moving between focusable elements
 - Play/Pause click event is send to `TVEventHandler`
 - Rewind and FastForward events are send to `TVEventHandler`
 - Back button behaves as a normal Android back button
 - Diagonal buttons work correctly on Android TV, e.g. if there is no button directly to the right from the focused one, but there is one to the right but a bit higher/lower it will grab focus
 - Dev menu can be accessed by long pressing fast forward button

A demo showing RNTester app running on Android TV device (Amazon Fire TV Stick) can be found here:
[![RNAndroidTVDemo](http://img.youtube.com/vi/EzIQErHhY20/0.jpg)](http://www.youtube.com/watch?v=EzIQErHhY20)

- `TextInput` will not work on Android TV devices. There's an issue with native `ReactEditText` implementation that prevents it from receiving focus. This makes it impossible to navigate to `TextInput`.
This will be fixed next, but will be included in a separate Pull Request
- ~Overlay permissions cannot be granted on Android TV devices running Android version >= 6.0
This is because the overlay permission can only be granted by firing an Intent to open settings page (`ACTION_MANAGE_OVERLAY_PERMISSION`). Since this page does not exist on TV devices the permission cannot be requested. This will make the app crash when trying to open dev menu (⌘+M) or displaying a redbox error.
Note: This does not affect devices running Android version < 6.0 (for example Amazon Fire TV Stick)~
This is now fixed by: https://github.com/facebook/react-native/pull/16596

* Launch the RNTester app on Android TV device.
  * Ensure it launches without a crash
  * Ensure basic navigation is possible
  * Ensure Touchable components can receive select events
* Ensure the changes do not break current Android and iOS mobile devices functionality.
* Ensure the changes do not break current Apple TV functionality.

[RNAndroidTVDemo video](http://img.youtube.com/vi/EzIQErHhY20/0.jpg)

* Added `ReactAndroidTVViewManager` that handles TV `KeyEvent`s and dispatches events to JS - This is the core that enables basic navigation functionality on Android TV devices
* Following the above change we copy `TVEventHandler.ios.js` into `TVEventHandler.android.js` to enable JS to pick up those native navigation events and dispatch them further to subscribed views. (Note: We do not have a native `TVNavigationEventEmitter` implementation on Android, thus this file is slightly modified, e.g. it does pass `null` to `NativeEventEmitter` constructor)
* Added `uiMode` to `AndroidInfoModule`. (**Note**: This required changing `extends BaseJavaModule` to `extends ReactContextBaseJavaModule` to be able to use `getSystemService` which requires `Context` instance!
* Added `isTV` constants to both `Platform.ios.js` (keeping the deprecated `isTVOS` as well) and `Platform.android.js`
* Changed condition check on `Touchable.js` to use the newly added `isTV` flag to properly handle TV navigation events on Android as well
* Added `LEANBACK_LAUNCHER` to `RNTester` `intent-filter` so that it is possible to launch it on Android TV devices.
* See also a PR to `react-native-website` repo with updated docs for Android TV: https://github.com/facebook/react-native-website/pull/59

 - [ ] Fix `TextInput` components handling by allowing them to be focused and making a proper navigation between them (and/or other components) possible. One thing to note here that the default behavior to immediately open software keyboard when focused on `TextInput` field will need to be adjusted on Android TV as well)
 - [x] Fix overlay permissions issue by changing the way redbox/dev menu are displayed (see: https://github.com/facebook/react-native/pull/16596)
 - [ ] Adjust placement of TV-related files (e.g. the `TVEventHandler.js` file is placed inside `AppleTV` directory which is not accurate, since it does handle Android TV events as well)

Previous discussion: https://github.com/SoftwareMansion/react-native/pull/1
<!--
Help reviewers and the release process by writing your own release notes

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

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

[CATEGORY] [TYPE] [LOCATION] - MESSAGE

 EXAMPLES:

 [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things
 [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput
 [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with
 [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word
 [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position
 [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see
-->

[ANDROID] [FEATURE] [TV] - Added support for Android TV devices
Closes https://github.com/facebook/react-native/pull/16500

Differential Revision: D6536847

Pulled By: hramos

fbshipit-source-id: 17bbb11e8583b97f195ced5fd9762f8902fb8a3d
2018-03-06 10:47:02 -08:00
David Vacca d2f05740a8 Add support to FabricUIManger to handle Throwable
Reviewed By: achen1

Differential Revision: D7168684

fbshipit-source-id: c655730b5bf5e181974096c2b940f6457be8a40d
2018-03-06 10:47:01 -08:00
Andrew Chen (Eng) e839c91946 Generalize JavaOnlyMap's getMap
Reviewed By: mdvacca

Differential Revision: D7165678

fbshipit-source-id: 3dd88b24c89af369c9d5f3cc57c96f29c4f10d47
2018-03-05 22:52:09 -08:00
David Vacca ac929ef4f6 Fix subtle bugs in cloning and FabricUIManager
Reviewed By: achen1

Differential Revision: D7164980

fbshipit-source-id: 86e9f3f11b67c8947b177aac23f99808083c3121
2018-03-05 21:26:19 -08:00
David Vacca 4466b6fa7c Refactor BridgeListener into JSIModulesProvider
Reviewed By: achen1

Differential Revision: D7140944

fbshipit-source-id: 092ea8569af5b5f90e005d6dc2c1819c1c9cf58f
2018-03-05 11:03:44 -08:00
Rui Araújo a1295e1707 Fix Viewpager on Android when using native navigation.
Summary:
See the "broken" video attached to really understand the problem easily.

On Android after navigating to any other screen using wix navigation library, the native viewpager would lose the settling page behaviour which is quite annoying for the users.

This is caused by the onAttachedToWindow that resets mFirstLayout to true inside ViewPager. By request another layout pass, everything works as expected.

Working video is the application with patched RN.

[broken.mp4](https://github.com/facebook/react-native/files/1128028/broken.mp4.zip)
[working.mp4](https://github.com/facebook/react-native/files/1128032/working.mp4.zip)
Closes https://github.com/facebook/react-native/pull/14867

Differential Revision: D7154981

Pulled By: hramos

fbshipit-source-id: 2b3570800a5320ed2c12c488748d9e1358936c84
2018-03-05 10:55:49 -08:00
David Vacca 0d148ad67a Refactor FabricUIManagerModule -> FabricUIManager
Reviewed By: fkgozali

Differential Revision: D7125829

fbshipit-source-id: 46f9722a20e0bbf7f99a0cc36067035b009d73d8
2018-03-02 17:22:35 -08:00
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