Commit Graph

2410 Commits

Author SHA1 Message Date
Dmitry Zakharov fdf04953c0 Make RN Events registered disregarding ViewManager use pattern.
Reviewed By: bvaughn

Differential Revision: D6223864

fbshipit-source-id: 322626be193e5fa840d3e5477e86adaa90f2726d
2017-11-06 06:40:19 -08:00
Bartol Karuza 3f1b021506 Inverted descent/ascent Android prioritisation to match iOS lineHeight behaviour
Summary:
We noticed that on Android the lineHeight behaviour is different from iOS for built in fonts and custom fonts. The problem becomes visible when the lineHeight approaches the fontSize, showing a cut-off on the bottom of the TextView. This issue has been raised before in #10712. There is a mention of a PR with a fix in that issue, which has not been merged yet. This implementation is a less intrusive fix leaving the current lineHeight approach in place and fixing the discrepancy only.

This proposed change prioritises ascent over descent for reduction, making the lineHeight functionality behave identical to iOS.

There is no existing test covering the lineHeight property and its behaviour in the CustomLineHeightSpan. This PR contains new unit tests that covers the various scenario's for the lineHeight calculations.

The original behaviour, before the change can against these unit tests. The case that fails is `shouldReduceAscentThird`, which can be made to succeed on the old code by changing the asserts to:
```
    assertThat(fm.top).isEqualTo(-5);
    assertThat(fm.ascent).isEqualTo(-5);
    assertThat(fm.descent).isEqualTo(-4);
    assertThat(fm.bottom).isEqualTo(-4);
```
The unit test succeeds for the current implementation, which has the values for ascent and descent inverted.

Below screenshots show before, after and iOS:

BEFORE
![screen shot 2017-10-18 at 15 35 41](https://user-images.githubusercontent.com/1605731/31721688-58d7086a-b41a-11e7-8186-9a201e2acb01.png)

AFTER
![screen shot 2017-10-18 at 15 37 02](https://user-images.githubusercontent.com/1605731/31721665-473cf86c-b41a-11e7-94d5-7a70eaf99889.png)

iOS
![screen shot 2017-10-18 at 15 35 22](https://user-images.githubusercontent.com/1605731/31721712-707e30a6-b41a-11e7-9baa-f886a66837e6.png)

[ANDROID] [BUGFIX] [Text] - Fix the lineHeight behaviour on Android to match iOS
Closes https://github.com/facebook/react-native/pull/16448

Differential Revision: D6221854

Pulled By: andreicoman11

fbshipit-source-id: 7292f0f05f212d79678ac9d73e8a46bf93f1a7c6
2017-11-06 05:00:41 -08:00
Dan Caspi 19de7fcb22 Moving some RAM logic to Instance.
Reviewed By: michalgr

Differential Revision: D6208977

fbshipit-source-id: 28339d07c58f1acc816be02f2707ef75529fa069
2017-11-03 05:32:02 -07:00
Alex Dvornikov b5651d945c Add "setJsBundlesDirectory" method to CatalystInstanceImpl
Differential Revision: D6042493

fbshipit-source-id: 950c6d6bdc2e0b62b14c9bcfc86233159a002c67
2017-11-01 06:54:44 -07:00
Pritesh Nandgaonkar 0230672275 Reverting the dirty child optimization
Reviewed By: emilsjolander

Differential Revision: D6203290

fbshipit-source-id: 8e42abb70e55f0fac90faaa21ecdbe0fbb76ce6b
2017-10-31 23:15:43 -07:00
Pritesh Nandgaonkar 587225ab45 Used hasDirtyChildren tag for the optimization
Reviewed By: emilsjolander

Differential Revision: D6134754

fbshipit-source-id: bbcfee14058140b946401de756a3f130de0f51cd
2017-10-31 08:21:54 -07:00
Dmitry Zakharov 387a3557ae Remove FlatUI references from fb4a.
Reviewed By: AaaChiuuu

Differential Revision: D6189136

fbshipit-source-id: c92a4d46098ff36ddbf267d150c6fa559a60a1e8
2017-10-31 06:46:06 -07:00
Dmitry Zakharov a5550a56ea Introduce getConstants generation for Native Modules codegen.
Reviewed By: fkgozali

Differential Revision: D6125394

fbshipit-source-id: 13b48c75056868f45394f277d75fb05d167f1c9f
2017-10-30 08:16:48 -07:00
Alexey Lang 9742bcb4ba Remove quicklog
Reviewed By: AaaChiuuu

Differential Revision: D6172832

fbshipit-source-id: d239ce8bef0918d3e90662258b6eabe3502f4897
2017-10-30 08:12:34 -07:00
David Vacca c278020633 Fixing RTL HorizontalScrolling in Android
Reviewed By: astreet

Differential Revision: D6170631

fbshipit-source-id: 254e6ed9a4d6e42b6d1215de1ff63aedb2c07a0a
2017-10-27 12:34:10 -07:00
Jonathan Keljo dd016f334c Automated fixups for Instagram
Reviewed By: dreiss

Differential Revision: D6168048

fbshipit-source-id: 0e51319d93fd697db01ea3933f48cd06a6ffac12
2017-10-27 00:52:40 -07:00
Andrew Chen (Eng) 9b6f160c04 Revert D5638458: Fixing RTL HorizontalScrolling in Android
Differential Revision: D5638458

fbshipit-source-id: f4474a12821cd2c20f57ce3bac5996c327ceaa33
2017-10-26 15:33:10 -07:00
David Vacca 36c951d24f Fixing RTL HorizontalScrolling in Android
Reviewed By: astreet

Differential Revision: D5638458

fbshipit-source-id: 08a5070a362eb43e12140cc204172d0950a1b720
2017-10-26 11:25:22 -07:00
Charles Dick 1c104310fb RN catalyst instance destroy markers
Reviewed By: alexeylang

Differential Revision: D6109891

fbshipit-source-id: 2cd1491381220a80f71f9ab205a2c6a309ed35ae
2017-10-26 10:28:41 -07:00
Dmitry Zakharov f0fb720eaa Introduce mobile config flag to load classes for View Managers
Reviewed By: kathryngray

Differential Revision: D6148468

fbshipit-source-id: d0f919f63922dae4b0720f22fa70ab4a7f67b48a
2017-10-26 08:51:11 -07:00
Ramanpreet Nara efa4d3c222 Rename I18nManager Left/Right swap methods
Reviewed By: fkgozali

Differential Revision: D6140072

fbshipit-source-id: 282dc614c036de8f217a729f21a1bbe92b8afd7d
2017-10-24 20:45:59 -07:00
Andrew Chen (Eng) 90a42396b9 React native shadow tree sonar plugin
Reviewed By: emilsjolander

Differential Revision: D6050845

fbshipit-source-id: 8c041b26ed4eb701830f1aced73d996c71cb3326
2017-10-24 18:34:40 -07:00
Rafael Magalhães ce967c6fbe Requesting permission results into ArrayIndexOutOfBoundsException
Summary:
Reported in Issue #15928

Fixing bug when permission showing dialog and user go to home and re-open minimized app.

1. Ask for permission
2. Minimize app (Press HomeButton)
3. Open app again via shortcut

 [ANDROID] [BUGFIX] [PermissionsModule.java] - Fixed bug when asked for permission Cause: java.lang.ArrayIndexOutOfBoundsException · length=0; index=0
Closes https://github.com/facebook/react-native/pull/16507

Differential Revision: D6133708

Pulled By: shergin

fbshipit-source-id: 9c05d1d5d16fedf718ad5113df69a4df3af62013
2017-10-23 23:30:08 -07:00
Jonathan Keljo 18364e95b7 Export deps to be source-ABI friendly
Reviewed By: dreiss

Differential Revision: D6124559

fbshipit-source-id: f831196724f8e171b86c58af5d2ed7944ecf6b6b
2017-10-23 12:22:53 -07:00
Alexey Lang 95073f8589 Use ReactMarker for all perf logging in the bridge
Reviewed By: AaaChiuuu

Differential Revision: D6030270

fbshipit-source-id: c9fa04d4f2816e4e0a4a14caf41795d0f547a7a0
2017-10-22 04:04:42 -07:00
Tao Huang 7e0b7ef8d0 Fix wrong error code when location service is turned off on Android device
Reviewed By: achen1

Differential Revision: D6106890

fbshipit-source-id: ab6ccdc2625745e4bbcdb0d7fe284de504d09641
2017-10-19 19:52:57 -07:00
Ramanpreet Nara 99d294bf3d Consider negative border radii and widths invalid
Reviewed By: achen1

Differential Revision: D5998369

fbshipit-source-id: d54302777f4eeb13f4521800130c17ac07f1b354
2017-10-19 18:08:25 -07:00
Ramanpreet Nara 00c9c1ad74 Implement direction-aware border clipping
Reviewed By: achen1

Differential Revision: D6015812

fbshipit-source-id: 406ddb12884a1c490cee784c6ef42322bd497b24
2017-10-18 19:33:33 -07:00
Ramanpreet Nara 875f273dba Implement border(Start|End)Color for rounded borders
Reviewed By: achen1

Differential Revision: D6014637

fbshipit-source-id: 33c10ec1f84075e0bb1c1f529aa7231497028380
2017-10-18 19:33:33 -07:00
Ramanpreet Nara 38c2c26d90 Implement rounded border(Start|End)Width
Reviewed By: achen1

Differential Revision: D6013412

fbshipit-source-id: e7aa7a3cd9e3ed72b25664efee59e42792098fbd
2017-10-18 19:33:33 -07:00
Ramanpreet Nara 1a7abcf526 Android: Implement border(Top|Bottom)(Start|End)Radius for RN
Reviewed By: achen1

Differential Revision: D5924734

fbshipit-source-id: 24759326064c11d2cd8948c7a710376ca9f41c63
2017-10-18 19:33:32 -07:00
Ramanpreet Nara 0f467a25ed Android: Implement border(Start|End)Color for RN non-rounded borders
Reviewed By: achen1

Differential Revision: D5921865

fbshipit-source-id: ed964291cba0c701de677c24c54f885cda78e7cc
2017-10-18 19:33:32 -07:00
Ramanpreet Nara 7ed7593b2b Android: Implement border(Start|End)Width for non-rounded borders
Reviewed By: achen1

Differential Revision: D5917755

fbshipit-source-id: 3ec0ab1a1e191f5f6fd956691995e95937a513cc
2017-10-18 19:33:32 -07:00
Ramanpreet Nara 04a8c62313 Android: Implement margin(Start|End) styles for RN
Reviewed By: achen1

Differential Revision: D5907651

fbshipit-source-id: 4df7583483e6f10b5433b9fa9d9345e00ccedd20
2017-10-18 19:33:32 -07:00
Ramanpreet Nara 1ed08d3c01 Android: Implement padding(Start|End) styles for RN
Reviewed By: AaaChiuuu

Differential Revision: D5907207

fbshipit-source-id: c9bb322f94d701463be35fb1ca92aab80f47d8ab
2017-10-18 19:33:31 -07:00
Ramanpreet Nara dc92e69867 Android: Forward RN start/end styles to Yoga
Reviewed By: AaaChiuuu

Differential Revision: D5906097

fbshipit-source-id: 79bd43ea54572eb612e781628551bccf5a4f948d
2017-10-18 19:33:31 -07:00
Ramanpreet Nara 98547d4bcf Implement gating support for direction-aware API changes
Reviewed By: achen1

Differential Revision: D6045083

fbshipit-source-id: 857a43029ad88d2324ec77145a1e30d92b5e8fae
2017-10-18 19:33:31 -07:00
Ramanpreet Nara f7888310d4 Implement border(Left|Right|Top|Bottom)Color for rounded borders
Reviewed By: achen1

Differential Revision: D6009609

fbshipit-source-id: 6a247a14aa48ac2edc637bf064216407a3a9a81f
2017-10-18 19:33:30 -07:00
Ramanpreet Nara 4994d6a389 Implement partial rounded borders
Reviewed By: achen1

Differential Revision: D5982241

fbshipit-source-id: 2f694daca7e1b16b5ff65f07c7d15dd558a4b7e8
2017-10-18 19:33:30 -07:00
Ramanpreet Nara de313f6fdd Fix border clipping
Reviewed By: achen1

Differential Revision: D5992045

fbshipit-source-id: fccd864dbc24592c3cd4df7300aca5096537e1d8
2017-10-18 19:33:30 -07:00
Alexey Lang 52a67db629 Fix Systrace section for Lazy View Managers
Differential Revision: D6088310

fbshipit-source-id: cf14c9cc91068cfabf4e7c1bbae5df7f25e0ced3
2017-10-18 12:18:12 -07:00
Andrew Chen (Eng) 91372e8f9a Add callback for UIImplementation layout updates
Differential Revision: D6063839

fbshipit-source-id: ae08fd2fc6c6365813b8077efe14990a0355a5c7
2017-10-17 07:47:12 -07:00
Andrew Chen (Eng) dc16150bae Expose ReactInstanceManager from ReactRootView
Reviewed By: AaaChiuuu

Differential Revision: D6051991

fbshipit-source-id: f175fc273895d7e9fedec73428d61395ae00649f
2017-10-17 04:31:03 -07:00
Max Sherman f3b117abd0 Un-revert logMarker for hermes diff
Reviewed By: mhorowitz

Differential Revision: D6051880

fbshipit-source-id: 0ce4bbed9ba8579033ee5397ff6c0975b6886fb1
2017-10-13 14:01:43 -07:00
Max Sherman e60a2d0a53 Revert D5939688: [hermes][rn] Share logPerfMarker with hermes
Differential Revision: D5939688

fbshipit-source-id: 37daeeaa01144472c26383106c88dd49bb99a37b
2017-10-12 19:21:42 -07:00
Max Sherman fe62da34a6 Share logPerfMarker with hermes
Reviewed By: mhorowitz

Differential Revision: D5939688

fbshipit-source-id: ab6a86eb66a3d9501b9b5a55b562b277b5ab0620
2017-10-12 15:33:04 -07:00
Janic Duplessis 2b4ff6ea19 Native Animated - Restore default values when removing props on Android
Summary:
Rebased version of #12842 that was reverted because of failing fb internal tests.
Closes https://github.com/facebook/react-native/pull/15919

Differential Revision: D5823956

Pulled By: hramos

fbshipit-source-id: 4ece19a403f5ebbe4829c4c26696ea0575ab1d0e
2017-10-12 13:11:00 -07:00
Valentin Shergin f2c6877b91 Fixed crash on attempt to update local data of deallocated shadow node
Summary:
Trivial.
That's okay that sometimes shadowNodes and views hierarchies have lack of synchonization.

Reviewed By: sahrens

Differential Revision: D6040022

fbshipit-source-id: 6b49a82317b620b66a87441719fddcafb1f27934
2017-10-12 09:46:29 -07:00
Michael Lee 7997a2b749 Fix platform flags to also check for linux
Reviewed By: danzimm

Differential Revision: D6036995

fbshipit-source-id: 98d7f19eb80b72090b26252864a6bd41a3295462
2017-10-12 09:16:40 -07:00
Peter Ruibal 752b68857c Add `visible-password` for TextInput.keyboardType on Android
Summary:
`visible-password` represents a very basic keyboard, typically only
letters and numbers.  Backed by InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD,
it is useful for things like password and code entry fields. It can also be more
effective than autoCorrect={false} for disabling autocompletion on some keyboards
(like Gboard).

Note `secureTextEntry` also affects `TYPE_TEXT_VARIATION_*` flags internally, so there
may be some undefined behavior when combining `secureTextEntry` with
`keyboardType="visible-password"`

Also, while here, improve the documentation on TextInput to explicitly enumerate
which keyboardType applies to Android vs. iOS (since this is the first android-specific)

Reviewed By: shergin

Differential Revision: D6005353

fbshipit-source-id: 13af90c96353f714c0e106dd0fde90184a476533
2017-10-10 18:18:34 -07:00
Dmitry Zakharov ca834f96af Fix scrolling events for RN.
Reviewed By: bvaughn

Differential Revision: D6020664

fbshipit-source-id: c9fb9069e9dcde298901ba2c03bacc8b646844d0
2017-10-10 11:08:40 -07:00
Nivetha Singara Vadivelu 9424cd7e8f Handling exceptions in video player
Reviewed By: furdei

Differential Revision: D5958119

fbshipit-source-id: 79b431a8422d60134890d44e99c358a07a5adc5b
2017-10-09 22:45:48 -07:00
Janis Peisenieks 7a7bdeec3e Omit all line terminators for ImageStore.getBase64ForTag
Summary:
FIX #11142

This fixes #11142 and supersedes #11155 as I was unsure how to add/change commits in that PR.

Wrote up a bunch of unit tests for the ImageStore module. The added tests showed that there was indeed a problem with the flags used for the Base64OutputStream, and they also show that that has been fixed now.
Closes https://github.com/facebook/react-native/pull/13856

Differential Revision: D6017764

Pulled By: shergin

fbshipit-source-id: adf667dc722ddfe31449afd8cd20a0a192eacff6
2017-10-09 22:16:20 -07:00
Janic Duplessis 0cd69e8a02 Run eslint --fix
Summary:
CI is currently failing because of a lint issue, this fixes it and a bunch of other warnings that are auto-fixable.

**Test plan**
Quick manual test, cosmetic changes only.
Closes https://github.com/facebook/react-native/pull/16229

Differential Revision: D6009748

Pulled By: TheSavior

fbshipit-source-id: cabd44fed99dd90bd0b35626492719c139c89f34
2017-10-09 17:46:44 -07:00
Yann Pringault 1c24440644 Add TimePicker modes
Summary:
In the spirit of #10932, I added the `mode` option to the `TimePicker` Android API.
There is only one mode available for **Android < 5**, the `spinner` one.
If we are on **Android >= 5** we can choose between `spinner` or `clock`. If we specify `default` it will use the default of the current Android version.

On **Android < 5**, whatever we choose it will be this:
![screen shot 2017-02-14 at 17 05 44](https://cloud.githubusercontent.com/assets/5436545/22937805/024ec67e-f2da-11e6-8b32-a680d9bc2247.png)

On **Android >= 5**, with the `spinner` mode:
![screen shot 2017-02-14 at 16 51 17](https://cloud.githubusercontent.com/assets/5436545/22937803/024e0bbc-f2da-11e6-9f4b-26102ff2eeac.png)

And with the `clock` mode, the default:
![screen shot 2017-02-14 at 16 51 02](https://cloud.githubusercontent.com/assets/5436545/22937804/024e64e0-f2da-11e6-9911-4135049f4726.png)
Closes https://github.com/facebook/react-native/pull/12384

Differential Revision: D6006689

Pulled By: hramos

fbshipit-source-id: fcd37c867c4061b9982b1687f2c10211e54df7cf
2017-10-08 12:38:45 -07:00
Max Sherman 790eabcdff Replace getInt with asInt in native collections
Reviewed By: mhorowitz

Differential Revision: D5904751

fbshipit-source-id: 995412196fd76ea60a65253719e49852322be6e6
2017-10-05 10:07:24 -07:00
Alex Dvornikov 9e01d72103 Unify supplimentary bundle path creation logic between Android and iOS
Differential Revision: D5941546

fbshipit-source-id: c9b8fab887f480faa373c26a1d5ba310e8acde78
2017-10-04 15:16:27 -07:00
Alexey Lang adde2ed5e9 Fix the debug logging regression
Reviewed By: AaaChiuuu

Differential Revision: D5975880

fbshipit-source-id: 39c632ddf84e57c814b54fac465651120e4127da
2017-10-04 15:04:53 -07:00
Ram N 0c234c90a2 Add error customizer for React Native Android
Reviewed By: achen1

Differential Revision: D5954205

fbshipit-source-id: 8b92bf1484a037b333a6f0f4aeddd39ffee25361
2017-10-04 14:06:35 -07:00
Andrew Chen (Eng) 7677af1d10 Litho UIImplementation
Reviewed By: marco-cova

Differential Revision: D5880274

fbshipit-source-id: e6741579d3de6090dea8d26cd07241d57adba84d
2017-10-04 08:31:04 -07:00
Paco Estevez Garcia ef2e29f54c Move URL escaping to Inspector layer
Reviewed By: Hypuk

Differential Revision: D5967544

fbshipit-source-id: d741e6324aff7583778cb13c862505b61ca02a3d
2017-10-04 03:51:33 -07:00
Karl Tarvas 59d9f8ca5e Fix Android 4.1-4.3 WebView source baseUrl bug
Summary:
Resolves https://github.com/facebook/react-native/issues/11753 and https://github.com/facebook/react-native/issues/9835.

Android versions 4.1-4.3 don't understand the MIME type `text/html; charset=utf-8` and default to `text/plain` instead, rendering the content as an unparsed HTML string. Since the encoding is already set and passed separately, removing it from the MIME type has no negative effects.

The same fix has already been discussed, successfully tested and incorporated in https://github.com/NativeScript/NativeScript/issues/1038.
Closes https://github.com/facebook/react-native/pull/13789

Differential Revision: D5971910

Pulled By: shergin

fbshipit-source-id: 07795bdf0f13ddb1e8eec779d1cad59244f3687e
2017-10-03 18:51:57 -07:00
Valentin Shergin cdea3c574b Fixed crash in ReactTextInputLocalData
Summary:
Motivation:

(SUDDENLY) There is a thing on Android called SpanWather, and their purpose is to notify "the watcher" about span-related changes in SpannableString. The idea is: some special kind of span can have some logic to prevent or tweak interleaving with some another kind of spans. To do so, it has to implement SpanWather interface.
So, EditText uses this to control internal spannable object (!) and SUDDENLY (#><) calls internal "layout" method as a reaction to adding new spans. So, when we are cloning SpannableString, we are (re)applying same span objects to a new spannable instance, and it causes notifying other spans in the string, and they notify EditText, and the EditText does relayout and... BOOM!
So, the solution is, easy, we should use SpannableStringBuilder instead of SpannableString because it does not notify SpanWather during cloning.

See:
https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/text/SpannableStringBuilder.java#101
(the first argument is `false`).
https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/text/SpannableStringBuilder.java#678
Compare with:
https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/text/SpannableStringInternal.java#43

Why? I believe because SpannableStringBuilder objects are "unfinished" by design, and documentation said: "it is the caller's responsibility to restore invariants [among spans]". As we do an exact clone of the string, that's perfectly okay to assume that all invariants were already satisfied for original string.

Reviewed By: achen1

Differential Revision: D5970940

fbshipit-source-id: 590ca0e3aede4470b809c7db527c5d55ddf5edb4
2017-10-03 17:37:45 -07:00
Aaron Chiu bbcfcdb8ed bring back box-none as layout only prop
Differential Revision: D5965540

fbshipit-source-id: a4a7b32a563674cf5f94e88390483763cf49d6da
2017-10-03 11:30:57 -07:00
Aaron Chiu 13d8375323 fix spelling in ReactInstanceManager
Reviewed By: kathryngray

Differential Revision: D5959860

fbshipit-source-id: 3d5358349fd6c0f9b8e57261914c945488684a96
2017-10-03 10:31:47 -07:00
Paco Estevez Garcia e7765a32f7 Fix DeviceIdentity on RN for Android
Reviewed By: Hypuk

Differential Revision: D5963912

fbshipit-source-id: 3959e5ab6af66512f0035efea7919572554e10b4
2017-10-03 08:07:41 -07:00
Paco Estevez Garcia da14fad829 Add AppIdentity and DeviceIdentity to Inspector
Reviewed By: Hypuk

Differential Revision: D5924011

fbshipit-source-id: a81d420dbe1a5ede203d2fa313548e19664b9587
2017-10-03 06:03:23 -07:00
Dmitry Zakharov 346af557c3 Fix regression in Java->C++->JS ViewManagers interaction.
Reviewed By: bvaughn

Differential Revision: D5953937

fbshipit-source-id: 8bc5dd8a483054ab9830ab653f2a3b41cad6c791
2017-10-03 05:30:42 -07:00
Aaron Chiu 6ba9ad8ece redo D5917111
Reviewed By: fkgozali

Differential Revision: D5962566

fbshipit-source-id: 5f92890a08b6e900b8d54f35c48e783166ce5897
2017-10-03 00:22:53 -07:00
Wenting Hu f368287347 reverting D5917111
Reviewed By: zjj010104

Differential Revision: D5961716

fbshipit-source-id: 0efaf38380b0b2e9440375ce0a7623a543f3fbd0
2017-10-02 20:03:37 -07:00
Valentin Shergin c550f27a4e Intrinsic content size for ReactTextInput (aka autoexpandable <TextInput> on Android)
Summary:
After this diff the intrinsic content size of <TextInput> reflects the size of text inside EditText,
it means that if there is no additional style constraints, <TextInput> will grow with containing text.
If you want to constraint minimum or maximum height, just do it via Yoga styling.

Reviewed By: achen1

Differential Revision: D5828366

fbshipit-source-id: eccd0cb4ccf724c7096c947332a64a0a1e402673
2017-10-02 16:31:18 -07:00
Valentin Shergin d0790fea39 Introducting `UIManager.setLocalData()`, the way to provide environmental data to ShadowNode
Summary:
In some cases we need a way to provide some peice of data to shadow node
to improve layout (or do something similar), `setLocalData` allows to do this.

Reviewed By: AaaChiuuu

Differential Revision: D5828368

fbshipit-source-id: bf6a04f460dc7695a16269426d365b78909bc8eb
2017-10-02 16:31:18 -07:00
David Vacca a5d1d25f56 BREAKING: Add interface for ReactShadowNode
Reviewed By: AaaChiuuu

Differential Revision: D5943137

fbshipit-source-id: 00950190e0256303d423ae86c6c18facf173ad6a
2017-10-02 09:08:28 -07:00
Aaron Chiu 30044fd531 fix overflow hidden
Reviewed By: shergin

Differential Revision: D5917111

fbshipit-source-id: e3d97f26b6aada199f700ec6659ace0d7dffd4c5
2017-09-29 18:19:54 -07:00
Aaron Chiu e7af72b29a make view hierarchy optimizer smarter
Reviewed By: shergin

Differential Revision: D5744725

fbshipit-source-id: 4042310494a2bbd3d3472485ad8496d592eb28ac
2017-09-29 18:19:54 -07:00
Michael Lee ebb42ee1b6 Add include_defs("//ReactAndroid/DEFS") to all BUCK files in ReactAndroid
Reviewed By: mmmulani

Differential Revision: D5915945

fbshipit-source-id: 49bce07e4f5a2f4a8985b992e1e7d9ea4ef6c654
2017-09-29 16:16:06 -07:00
Alex Dvornikov 4162d73ec0 Added Android support for loading multiple RAM bundles
Differential Revision: D5901574

fbshipit-source-id: 395bae41e58505918d7ad20ac432eba3361361ea
2017-09-29 14:46:00 -07:00
Felix Oghina 7320ca5c7a Add GlobalImageLoadListener
Reviewed By: AaaChiuuu

Differential Revision: D5932865

fbshipit-source-id: 700983d7fc44c4ee5f77b58ef54cec62869009e0
2017-09-29 08:55:56 -07:00
Neo b64e6c722c fix arc drawing when sweep >= 360
Summary:
I hit this issue in my own component https://github.com/nihgwu/react-native-pie, and find this https://stackoverflow.com/questions/19383842/weird-behaviour-in-drawing-a-ring-using-path-arcto-in-android, after this change, it looks exactly the same on both Android and iOS
Closes https://github.com/facebook/react-native/pull/15042

Differential Revision: D5937957

Pulled By: shergin

fbshipit-source-id: 3c88565a1cc90d82edd819d048f40d4961f78b3c
2017-09-28 19:33:03 -07:00
Dmitry Zakharov da30b04703 Implement lazy discovery for ViewManagers.
Reviewed By: kathryngray

Differential Revision: D5865095

fbshipit-source-id: c94970e4cd7aafb20cf844c48feea053ac8b6b0f
2017-09-28 09:55:59 -07:00
Aaron Chiu 652dfd0b48 add Relay as a category
Reviewed By: achen1

Differential Revision: D5741372

fbshipit-source-id: 65d46decd26e563ab3cd9ea72c3a391ba32c67bb
2017-09-27 22:31:51 -07:00
Janic Duplessis 1af645b2fd Validate that JS and Native code versions match for RN releases
Summary:
Basic implementation of the proposal in #15271

Note that this should not affect facebook internally since they are not using OSS releases.

Points to consider:
- How strict should the version match be, right now I just match exact versions.
- Wasn't able to use haste for ReactNativeVersion because I was getting duplicate module provider caused by the template file in scripts/versiontemplates. I tried adding the scripts folder to modulePathIgnorePatterns in package.json but that didn't help.
- Redscreen vs. warning, I think warning is useless because if the app crashes you won't have time to see the warning.
- Should the check and native modules be __DEV__ only?

**Test plan**
Tested that it works when version match and that it redscreens when versions don't before getting other errors on Android and iOS.
Closes https://github.com/facebook/react-native/pull/15518

Differential Revision: D5813551

Pulled By: hramos

fbshipit-source-id: 901757e25724b0f22bf39de172b56309d0dd5a95
2017-09-27 18:31:15 -07:00
David Vacca 9b3cc30357 Backed out changeset 7c338fe3b747
Reviewed By: AaaChiuuu

Differential Revision: D5926999

fbshipit-source-id: 58595f74f1fab764b63b5d7d6c2f20d8edb2efda
2017-09-27 16:45:11 -07:00
Aaron Chiu 672db77eae add UI Manager operations
Reviewed By: achen1

Differential Revision: D5741087

fbshipit-source-id: f6b8f713cb3c4e48b417b47557a45ff9a4a5bf05
2017-09-27 16:16:20 -07:00
Kevin Doherty 6f6329d5e3 Only disallow changes if the value actually changed
Differential Revision: D5884661

fbshipit-source-id: 2d9fe28a0ecfc46afc9ca459975455e1fd13d19b
2017-09-26 08:18:24 -07:00
faifai21 64ffe4516e Use BitmapRegionDecoder to efficiently crop images on Android
Summary:
The Android ImageEditingManager is inefficient and slow when cropping images. It loads the full resolution image into memory and then crops it. This leads to slow performance and occasional OutOfMemory Exceptions.
[BitmapRegionDecoder](https://developer.android.com/reference/android/graphics/BitmapRegionDecoder.html) can be used to crop without needing to load the full resolution image into memory. Using it is much more efficient and much faster.

Relevant issue: https://github.com/facebook/react-native/issues/10470

Attempt to crop a very large image (2000x2000) on Android. With this change, the crop should happen almost instantly. On the master branch, it should take 2-3 seconds (and might run out of memory).

Please let me know if there's anything else I can provide.
Closes https://github.com/facebook/react-native/pull/15439

Differential Revision: D5628223

Pulled By: shergin

fbshipit-source-id: bf314e76134cd015380968ec4533225e724c4b26
2017-09-26 05:17:40 -07:00
Guizmo Martinez 31904d523d Fix slider colors in Android
Summary:
Hey !

I noticed that the `minimumTrackTintColor` and `maximumTrackTintColor` are exchanged in iOS and Android.
In iOS, `minimumTrackTintColor` is the left color and `maximumTrackTintColor` is the right color.
In Android, `minimumTrackTintColor` is the right color and `maximumTrackTintColor` is the left color.

With this code :
```jsx
<Slider
  style={{ width: 300 }}
  minimumTrackTintColor="red"
  maximumTrackTintColor="blue"
/>
```

|iOS|Android|
|----|----|
|![image](https://user-images.githubusercontent.com/17292331/30700555-2b8ae828-9ee8-11e7-94a3-f1d3adee7fd5.png)|![screenshot_2017-09-21-15-59-59](https://user-images.githubusercontent.com/17292331/30699855-246c1280-9ee6-11e7-9653-e61c4798a50f.png)|

|iOS|Android|
|----|----|
|![image](https://user-images.githubusercontent.com/17292331/30700563-2fc8c25c-9ee8-11e7-9c0d-955d9921660f.png) (same)|![screenshot_2017-09-21-16-12-04](https://user-images.githubusercontent.com/17292331/30700418-def3e136-9ee7-11e7-982b-48aeba23a5ea.png)|
Closes https://github.com/facebook/react-native/pull/16053

Differential Revision: D5910299

Pulled By: shergin

fbshipit-source-id: 74851e4cc6d54f72ea2755200e26b0d921890b48
2017-09-26 02:15:27 -07:00
Janic Duplessis 3cbc36138a Native Animated - Allow events that are dispatched from any thread
Summary:
Instead of preventing events from working when not on the UI Thread we can just dispatch to it instead.

**Test plan**
Tested manually that animated events still work in RNTester
Closes https://github.com/facebook/react-native/pull/15953

Differential Revision: D5909816

Pulled By: shergin

fbshipit-source-id: 48d02b6aa9f2bc3bcb638e8852fccaac3f205276
2017-09-25 23:15:15 -07:00
Paul van Staden 0818f3bdf5 Adding TLSv1 support for custom SSL socket factory
Summary:
This problem tries to solve issue #14244

Implemented a fetch request to a TLSv1 server. It now successfully resolves TLS handshake.
Tested same fetch to TLSv1.2 server and still successfully resolves TLS handshake.
Closes https://github.com/facebook/react-native/pull/14245

Differential Revision: D5898689

Pulled By: shergin

fbshipit-source-id: 8766ebe6909443367651ab868aa5ff62747cd906
2017-09-23 17:22:57 -07:00
Andrew Gallagher 49359e879b Deprecate older API uses of `prebuilt_cxx_library`
Reviewed By: ttsugriy

Differential Revision: D5878523

fbshipit-source-id: 2c8c1fd1d19597ff7459bbd527c89573520db74b
2017-09-22 13:20:17 -07:00
Alex Dvornikov 7d115730dc Configure JSExector with BundleRegistry instead of JSModulesUnbundle
Differential Revision: D5890458

fbshipit-source-id: 968be95786ffbf53aa98928d4d3e3bd52a84b3dc
2017-09-22 09:58:46 -07:00
Charles Dick e9aab0d452 Add locking around CatalystInstance.getJavaScriptContext()
Reviewed By: kathryngray

Differential Revision: D5861693

fbshipit-source-id: 226ff15622d5e1a8ae3ad4c63f1434bd95c1fa21
2017-09-22 08:37:22 -07:00
Jia Li 0aa12939fd Revert D5850968: Configure JSExector with BundleRegistry instead of JSModulesUnbundle.
Differential Revision: D5850968

fbshipit-source-id: f4c9dc8d5f14cdd32195463e8786242e708770e9
2017-09-21 21:22:39 -07:00
Hector Ramos 8fa9984b11 Migrate to Circle 2.0
Summary:
Following the migration guide. Let's see what happens here.
Closes https://github.com/facebook/react-native/pull/14955

Differential Revision: D5877682

Pulled By: hramos

fbshipit-source-id: 2a40560120b5d8d28bc6c52cc5e5916fd1bba336
2017-09-21 14:01:30 -07:00
Alex Dvornikov 79821917fa Configure JSExector with BundleRegistry instead of JSModulesUnbundle.
Differential Revision: D5850968

fbshipit-source-id: e5e7ad92c2347c2641551fcf820f061ffde5fed6
2017-09-21 08:51:00 -07:00
Alexey Lang b9be9a01a9 Break down PRE_REACT_CONTEXT
Reviewed By: cwdick

Differential Revision: D5874529

fbshipit-source-id: 0ee9d740b4445419e3143942514475751763520d
2017-09-21 08:04:08 -07:00
Adam Miskiewicz 26133beda9 Add closed-form damped harmonic oscillator algorithm to Animated.spring
Summary:
As I was working on mimicking iOS animations for my ongoing work with `react-navigation`, one task I had was to match the "push from right" animation that is common in UINavigationController.

I was able to grab the exact animation values for this animation with some LLDB magic, and found that the screen is animated using a `CASpringAnimation` with the parameters:

- stiffness: 1000
- damping: 500
- mass: 3

After spending a considerable amount of time attempting to replicate the spring created with these values by CASpringAnimation by specifying values for tension and friction in the current `Animated.spring` implementation, I was unable to come up with mathematically equivalent values that could replicate the spring _exactly_.

After doing some research, I ended up disassembling the QuartzCore framework, reading the assembly, and determined that Apple's implementation of `CASpringAnimation` does not use an integrated, numerical animation model as we do in Animated.spring, but instead solved for the closed form of the equations that govern damped harmonic oscillation (the differential equations themselves are [here](https://en.wikipedia.org/wiki/Harmonic_oscillator#Damped_harmonic_oscillator), and a paper describing the math to arrive at the closed-form solution to the second-order ODE that describes the DHO is [here](http://planetmath.org/sites/default/files/texpdf/39745.pdf)).

Though we can get the currently implemented RK4 integration close by tweaking some values, it is, the current model is at it's core, an approximation. It seemed that if I wanted to implement the `CASpringAnimation` behavior _exactly_, I needed to implement the analytical model (as is implemented in `CASpringAnimation`) in `Animated`.

We add three new optional parameters to `Animated.spring` (to both the JS and native implementations):

- `stiffness`, a value describing the spring's stiffness coefficient
- `damping`, a value defining how the spring's motion should be damped due to the forces of friction (technically called the _viscous damping coefficient_).
- `mass`, a value describing the mass of the object attached to the end of the simulated spring

Just like if a developer were to specify `bounciness`/`speed` and `tension`/`friction` in the same config, specifying any of these new parameters while also specifying the aforementioned config values will cause an error to be thrown.

~Defaults for `Animated.spring` across all three implementations (JS/iOS/Android) stay the same, so this is intended to be *a non-breaking change*.~

~If `stiffness`, `damping`, or `mass` are provided in the config, we switch to animating the spring with the new damped harmonic oscillator model (`DHO` as described in the code).~

We replace the old RK4 integration implementation with our new analytic implementation. Tension/friction nicely correspond directly to stiffness/damping with the mass of the spring locked at 1. This is intended to be *a non-breaking change*, but there may be very slight differences in people's springs (maybe not even noticeable to the naked eye), given the fact that this implementation is more accurate.

The DHO animation algorithm will calculate the _position_ of the spring at time _t_ explicitly and in an analytical fashion, and use this calculation to update the animation's value. It will also analytically calculate the velocity at time _t_, so as to allow animated value tracking to continue to work as expected.

Also, docs have been updated to cover the new configuration options (and also I added docs for Animated configuration options that were missing, such as `restDisplacementThreshold`, etc).

Run tests. Run "Animated Gratuitous App" and "NativeAnimation" example in RNTester.
Closes https://github.com/facebook/react-native/pull/15322

Differential Revision: D5794791

Pulled By: hramos

fbshipit-source-id: 58ed9e134a097e321c85c417a142576f6a8952f8
2017-09-20 23:38:16 -07:00
Adam King 4d54b48167 Fix onSubmitEditing dispatch behavior with blurOnSubmit/multiline combinations.
Summary:
Fixes https://github.com/facebook/react-native/issues/15863 on master. Behavior of `onSubmitEditing` is now consistent between iOS and Android. Tapping the submit button in a TextInput dispatches the event precisely when doing so does not make a newline (when blurOnSubmit is true or multiline is false).

1. Run this app on iOS and Android:
```
// flow

import React, { Component } from 'react';
import {
  StyleSheet,
  TextInput,
  View
} from 'react-native';

type State = {
  toggled: boolean
};

type Props = {
  blurOnSubmit: boolean,
  multiline: boolean
};

class ToggleColorInput extends Component<Props, State> {
  state: State = {
    toggled: false
  };

  props: Props;

  toggle = () => {
    this.setState({
      toggled: !this.state.toggled
    });
  }

  render() {
    return (
      <TextInput
        blurOnSubmit={this.props.blurOnSubmit}
        multiline={this.props.multiline}
        onSubmitEditing={this.toggle}
        style={[styles.textInput, {backgroundColor: this.state.toggled ? 'blue' : 'azure'}]}
        underlineColorAndroid='transparent'
      />
    )
  }
}

export default class App extends Component<{}> {
  render() {
    return (
      <View>
        <ToggleColorInput blurOnSubmit={true} multiline={true} />
        <ToggleColorInput blurOnSubmit={true} multiline={false} />
        <ToggleColorInput blurOnSubmit={false} multiline={true} />
        <ToggleColorInput blurOnSubmit={false} multiline={false} />
      </View>
    );
  }
}

const styles = StyleSheet.create({
  textInput: {
    height: 75,
    borderWidth: 1,
    borderColor: 'black'
  }
});
```
2. You see four TextInputs, with each combination of the `blurOnSubmit` and `multiline` properties. For each TextInput, type some text and tap the submit button.
3. The TextInputs in this test will toggle background color when they emit an `onSubmitEditing` event. Verify the following behavior on each platform:
 * blurOnSubmit && isMultiline => Submit event emitted, blurred, no newline inserted
 * blurOnSubmit && !isMultiline => Submit event emitted, blurred
 * !blurOnSubmit && isMultiline => Submit event emitted, newline inserted
 * !blurOnSubmit && !isMultiline => Submit event emitted
Closes https://github.com/facebook/react-native/pull/16040

Differential Revision: D5877401

Pulled By: shergin

fbshipit-source-id: 741bcc06d8b69d7025f2cb42dd0bee4fa01cd88e
2017-09-20 16:33:14 -07:00
Aaron Chiu 565a24140b add Native Module init
Reviewed By: achen1

Differential Revision: D5740540

fbshipit-source-id: 9989424812fdcfd0a54c2ccf1e973aa7cc2a1f67
2017-09-20 10:57:12 -07:00
Andrew Chen (Eng) 08befb730b Add interface for ReactShadowNode
Reviewed By: AaaChiuuu

Differential Revision: D5871546

fbshipit-source-id: 7c338fe3b747a79377a54867c789028d221b3dd5
2017-09-20 08:47:32 -07:00
Kathy Gray 6334ed2ff3 Detangle destroy and create accesses
Differential Revision: D5823786

fbshipit-source-id: d6a6e29b856361a6b1d5ab48397607a844b5ab53
2017-09-20 05:08:03 -07:00
Aaron Chiu 12f123d3e4 add JS->Java Bridge traffic
Reviewed By: achen1

Differential Revision: D5740501

fbshipit-source-id: 3a88cd95d3a58aac24968e577f4eb3096d47d4ec
2017-09-19 12:03:15 -07:00
Dmitry Zakharov 4fc9e20fce Untangle NativeAnimatedNodesManager from UIManager internals.
Reviewed By: AaaChiuuu

Differential Revision: D5861523

fbshipit-source-id: 39eb79b91d4d5e2295d03369f1be585ae7836c75
2017-09-19 10:00:52 -07:00
David Vacca 5180995666 Fix setBackground for Android sdk version 15 and below
Reviewed By: achen1

Differential Revision: D5854430

fbshipit-source-id: 1276f3d7e94b757f9a9dd412a2ef8b72e8427ffb
2017-09-19 09:39:45 -07:00
Kang Zhang 87a1dc4b76 rename catalyst animations
Reviewed By: achen1

Differential Revision: D5855613

fbshipit-source-id: 2eac7ba6a9d95f6cd3a58a1df4ec0b170f34d6ed
2017-09-19 07:33:42 -07:00
Tomas Reimers 9e373529f3 Backed out D5792012.
Reviewed By: AaaChiuuu

Differential Revision: D5855139

fbshipit-source-id: 3837769a4da90d9752de75669c6395fabcd3b18b
2017-09-18 21:37:54 -07:00
Max Sherman e764361f93 Add getter for JS Executor Factory
Reviewed By: mhorowitz

Differential Revision: D5857012

fbshipit-source-id: 8c9fc0095c512325968234f48d6728b63d61913d
2017-09-18 21:18:24 -07:00
Michał Gregorczyk d6c519bc96 Base class for all object private data passed to JSC
Reviewed By: amnn

Differential Revision: D5761937

fbshipit-source-id: de88cf8b959fc855c3c0786f817bb6032491c819
2017-09-18 18:45:27 -07:00
Ori Harel 795370789b re #15915 HeadlessJsTaskService is expected to run on UI thread
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!

-->

Headless tasks are required to run in the main thread, however due to the nature of the React context creation flow, the handler may be returned outside of the main thread, causing the HeadlessJsTaskContext to throw an exception.

Swipe out the app. send push notification from a server that starts a HeadlessJsTaskService
Closes https://github.com/facebook/react-native/pull/15940

Differential Revision: D5852448

Pulled By: foghina

fbshipit-source-id: 54c58a1eb7434dd5de5c39c28f6e068ed15ead9d
2017-09-18 05:30:50 -07:00
Valentin Shergin 7efd4fabfd Text to Spannable conversion is now using PRIORITY flag to enforce the order of spans
Summary:
When we convert nested <Text> components to Spannable object we must enforce the order of spans somehow,
otherwise we will have Spannable object with unpredictable order of spans, which will produce unpredictalbe text layout.
We can do it only using `Spannable.SPAN_PRIORITY` feature because Spannable objects do not maintain the order of spans internally.

We also have to fix this to implement autoexpandable <TextInput>.

Reviewed By: achen1

Differential Revision: D5811172

fbshipit-source-id: 5bc68b869e58aba27d6986581af9fe3343d116a7
2017-09-17 22:00:16 -07:00
Brian Vaughn d1372faeb5 Re-added global event-type Map to UIManager constants
Reviewed By: sophiebits

Differential Revision: D5846806

fbshipit-source-id: 7b0a54bd5a4b877f0c5915f11392ee0d34718dbe
2017-09-15 16:47:16 -07:00
Kathy Gray cf2ef84b16 Move destroy threads in catalystinstance off the UI thread
Reviewed By: cwdick

Differential Revision: D5842135

fbshipit-source-id: e9c44c4129d4d10da8781798df121f5c676766f8
2017-09-15 05:48:57 -07:00
Brian Vaughn 75c94a8907 Native view manager event types exposed to JS via view config
Differential Revision: D5814210

fbshipit-source-id: 41291f0d6b39af77f66173f6a699d88f9f4ccc74
2017-09-14 18:17:17 -07:00
Aaron Chiu 6c2c2ecd8c add some RN Core markers
Reviewed By: achen1

Differential Revision: D5740438

fbshipit-source-id: eca6160e0ff9089e1f70ead0f2269ce152258c19
2017-09-14 12:02:29 -07:00
Ramanpreet Nara adb6646016 Make <TextInput multiline> default blurOnSubmit to false.
Reviewed By: achen1

Differential Revision: D5830633

fbshipit-source-id: 3d0880656f14cfafa0f15c4341021799f20f40ed
2017-09-14 11:30:58 -07:00
Valentin Shergin a17797940d Fixed issue with remeasuring ReactTextShadowNode
Summary:
This fixes the regression recently introduced during refactoring of text-related classes.
So, added fragment of code was lost in D5715830.
See how it looked before:
9f5bdd7b49/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextShadowNode.java (L424-L431)

Reviewed By: TheSavior

Differential Revision: D5827424

fbshipit-source-id: 5df99620057ff6a27105dd05903c7f5def85c5d2
2017-09-13 14:33:59 -07:00
Tomas Reimers cbb0ccb185 mActivelyScrolling expected to be true so long as events are being fired.
Summary:
**Problem:**

It was observed that in [this code path](https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java#L292) (i.e. horizontal, paging-enabled scroll view) if you tried to programmatically call the scrollTo method within ~1s of the onMomentumScrollEnd event (which should only be called after all scrolling has ended), the scrollView would scroll to the new location, and then scroll BACK to the original location.

For example, assume you had released the scrollView at location B, and the nearest page boundary is A. Then, 1000ms later, you call scrollTo position C. The order of operations would be:

1. Begin scrolling to A from position B (as it is the nearest page boundary)
2. Reach position A
3. Fire onMomentumScrollEnd
4. 1000ms later call scrollTo C
5. scrollView scrolls to C
6. scrollView scrolls BACK to position A (for no apparent reason).

**Reason:**

I suspect this is because the [smoothlyScrollTo](https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java#L292) will continue to animate towards A, but the [scrollEvents will not fire](f954f3d9b6/ReactAndroid/src/main/java/com/facebook/react/views/scroll/OnScrollDispatchHelper.java (L45)) as they are too close to each other. So the true order of events is:

1. Begin scrolling to A from position B (as it is the nearest page boundary)

[begin smoothlyScrollTo]
[scroll towards position A]
[mActivelyScrolling is true]

2. Reach position A

[mActivelyScrolling is true]
[scroll towards position A]
[mActivelyScrolling is false, as there is another scrollEvent, but because it is close enough to the same location it is ignored]

3. Fire onMomentumScrollEnd
4. 1000ms later call scrollTo C

[scroll towards position C]

5. scrollView scrolls to C

[scroll towards position A as the original smoothlyScrollTo animation was never completed]

6. scrollView scrolls BACK to position A.

This is an untested hypothesis, but seems to explain the behavior, and the solution is more semantically correct anyway. If there is an easy way to rebuild the android binaries happy to test it myself! Just let me know!

**Solution:**

 Move the mActivelyAnimating outside the mOnScrollDispatchHelper.onScrollChanged helper, because the HorizontalScrollView event should be considered to be animating so long as onScrollChanged events are being fired.
Closes https://github.com/facebook/react-native/pull/15146

Reviewed By: AaaChiuuu

Differential Revision: D5792026

Pulled By: tomasreimers

fbshipit-source-id: 9654fda038d4a687cc32f4c32dc312baa34627ed
2017-09-12 18:30:39 -07:00
Tomas Reimers 718f4e60c2 Remove 'box-only' as a layoutOnlyProp
Summary:
Currently, having the property `pointerEvents={'box-only'}` marks a view as layoutOnly. For optimization reasons, layoutOnly nodes are [not added to the node hierarchy](b103903ec8/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyOptimizer.java (L99)) The problem is that should this box ever need to be [transitioned to not-layout-only](b103903ec8/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyOptimizer.java (L394)) (for example, because you add the a CSS transform property),  it must be added to the hierarchy. To add it to the hierarchy the [React Styles Diff Map](b103903ec8/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyOptimizer.java (L396)) is passed along with the backing shadowNode to create the node. The problem is that at no point were the original `pointerEvents` and so the new node will be created with `pointerEvents =  'auto'`.

A more correct fix to this problem might be to have shadowNodes carry around their pointerEvents, although this is likely a greater design decision which is why am I proposing the quick fix now.

Will also resolve: https://github.com/react-native-community/react-native-modal/issues/11
Closes https://github.com/facebook/react-native/pull/15529

Reviewed By: AaaChiuuu

Differential Revision: D5792012

Pulled By: tomasreimers

fbshipit-source-id: 625242c53e16cb293c64811a57f6c3905b3483e0
2017-09-12 14:21:11 -07:00
Valentin Shergin 6114f863c3 Restructured inheritance around ReactTextViewManager and co.
Summary:
Abstract class `ReactBaseTextShadowNode` was decoupled from `ReactTextShadowNode` to separate two goals/roles:
 * `ReactBaseTextShadowNode` represents spanned `<Text>` nodes, which can bear text attributes (both `RCTText` and `RCTVirtualText`);
 * `ReactTextShadowNode` represents anchor `<Text>` view in Yoga terms, which can bear layout attributes (`RCTText` and `RCTTextInput`).

`ReactVirtualTextShadowNode` now inherits `ReactBaseTextShadowNode`.
The same architectural changes was applited to view managers.

Why?
 * This is just a better architecture which represents the nature of this objects.
 * Bunch of "negative" logic which turn off excessive features for some suclasses was removed.
 * Memory efficiency.
 * Now we can improve `<TextInput>` component using right inheritance. Yay!

Reviewed By: achen1

Differential Revision: D5715830

fbshipit-source-id: ecc0764a03b5b7586fe77ad31f149cd840f4da41
2017-09-11 15:49:01 -07:00
Valentin Shergin 80027ce6db ReactRawTextShadowNode does not inherit ReactTextShadowNode anymore
Summary:
ReactRawTextShadowNode represents "raw" text node (aka textContent), so it cannot have layout or styling, it is just a line of text, a pure string.
So, we must not interit it from HUGE ReactTextShadowNode (which represents <Text> node with ReactRawTextShadowNode instance inside).
We need this change to make future fancy (and valuable from product perspective) refactoring possible. Stay tuned!

Reviewed By: achen1

Differential Revision: D5712961

fbshipit-source-id: 009e48046bdf34ddfd40b93175934969af64b98b
2017-09-11 15:49:01 -07:00
Spencer Ahrens 393bf88be6 Add all test routes as server snapshot tests
Reviewed By: raluca-elena, TheSavior

Differential Revision: D5638532

fbshipit-source-id: 8db8210d0d0d08b9423b0a77f6b8e4e290f2eef0
2017-09-11 15:18:11 -07:00
Andrew Jack 96de23abf1 Android Oreo (8.0) Support
Summary:
Apps targeting Android 8.0 (API level 26) cannot use `TYPE_SYSTEM_OVERLAY ` and `TYPE_SYSTEM_OVERLAY `. Targeting 26 will cause the app to crash when in `DEV_MODE`.

https://developer.android.com/about/versions/oreo/android-8.0-changes.html#cwt

This PR replaces uses of these overlay flags with the new `TYPE_APPLICATION_OVERLAY` when running on a device with Android 8.0 or later.

When using `TYPE_APPLICATION_OVERLAY` it still requires the `SYSTEM_ALERT_WINDOW` permission, just like previous android versions.
https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#TYPE_APPLICATION_OVERLAY

https://github.com/AndrewJack/react-native-android-oreo tested here
Closes https://github.com/facebook/react-native/pull/15601

Reviewed By: achen1

Differential Revision: D5801619

Pulled By: shergin

fbshipit-source-id: 27d1b9bb64018e7f12f9c3d3d222f1fda468b124
2017-09-11 12:48:46 -07:00
David Vacca 4ca617211b Add support for dynamically sized ReactRootView
Reviewed By: achen1, AaaChiuuu

Differential Revision: D5745093

fbshipit-source-id: 65d85252ab8a0ca38322f49a3d4812380d5228c4
2017-09-08 21:18:00 -07:00
Hongtan Du c893989d21 Add check for valid rootTag in ReactRootView
Reviewed By: AaaChiuuu

Differential Revision: D5796097

fbshipit-source-id: 1aed793dd77864f1b2cb20e64049483a084f0bc0
2017-09-08 14:17:38 -07:00
Michael Lee 1f2ca244d7 Move to fbsystrace to a new location
Reviewed By: dreiss

Differential Revision: D5760920

fbshipit-source-id: 9ff001dbd34660c14d061dec5428e82a815c719a
2017-09-07 09:17:02 -07:00
Valentin Shergin d2f3a7282b Bikeshedding in ReactTextInputShadowNode, part 2
Reviewed By: AaaChiuuu

Differential Revision: D5712962

fbshipit-source-id: b0cb5dbbd93b661252e5ddcf6c0a34e59cb7f2c6
2017-09-06 17:23:41 -07:00
Valentin Shergin 5f1f0b14f0 Bikeshedding in ReactTextInputShadowNode
Reviewed By: AaaChiuuu

Differential Revision: D5712963

fbshipit-source-id: 87c8394d82e0c206f908fb07eb8b7464b0ecabaf
2017-09-06 17:23:41 -07:00
Valentin Shergin 35cac3bf1b Introducing `ReactShadowNode.isYogaLeafNode()`
Summary:
We have to have a way to explicitly enforce the fact that some nodes cannot have Yoga child nodes.
Previously we relied on `isMeasureDefined()`, which is actually special case (so it does not cover all possible cases).

Reviewed By: AaaChiuuu

Differential Revision: D5647855

fbshipit-source-id: 59591be61ef62c61eb98748d44bb28b878f713fc
2017-09-06 17:23:41 -07:00
Michael Lee ed31f7a97d Reformat BUCK files
Reviewed By: zertosh

Differential Revision: D5756296

fbshipit-source-id: 69af6e9211648a81ba864be8d37165023cb5f9c2
2017-09-05 15:02:19 -07:00
Andrew Chen (Eng) 1ccc03c217 Fix Circle CI build missing appcompat dep
Differential Revision: D5769914

fbshipit-source-id: 51652e276165b4f61ae473bc25a19499da5bd1b4
2017-09-05 15:02:19 -07:00
Marc Horowitz d48f08cad6 Thread the JSI runtime descriptor up into the RCTDevMenu title
Reviewed By: javache

Differential Revision: D5643014

fbshipit-source-id: 977be5729c57c0d01ff67b268031ad6fdbf88a07
2017-09-05 15:02:19 -07:00
Andrew Chen (Eng) 5a3828d299 Dirty the shadow node when ReactLithoView requests layout
Reviewed By: shergin

Differential Revision: D5756680

fbshipit-source-id: 409095a2ee61db7ee7a85e12ab64c7806da3b3d9
2017-09-05 11:01:39 -07:00
Michał Gregorczyk efd728ab7e ReactInstanceManager tests with non-JSC JavaScriptExecutor
Reviewed By: johnislarry

Differential Revision: D5764234

fbshipit-source-id: ea088b025def7ed4f39e6b75b8111ac13da9b331
2017-09-05 09:45:02 -07:00
Janic Duplessis e964a7f4ef Fix scroll events getting skipped on Android
Summary:
This code related to velocity would cause some scroll events to be skipped and caused some jitter for sticky headers. Not sure if there is a better fix but removing this does fix missing events and the velocity calculation still seems to be working.

**Test plan**
Tested that sticky headers now work properly on Android, tested that velocity calculation still seem to work.
Closes https://github.com/facebook/react-native/pull/15761

Differential Revision: D5760820

Pulled By: sahrens

fbshipit-source-id: 562b5f606bdc5452ca3d85efb5e0e3e7db224891
2017-09-01 18:06:24 -07:00
Omer Strulovich b11587b19f Revert D5746286, D5717191, D5717111 to try and unblock stable
Reviewed By: mzlee

Differential Revision: D5758871

fbshipit-source-id: ea014e237246ae3b16ee2d1b5f5a7310e164d183
2017-09-01 15:18:40 -07:00
Michał Gregorczyk 9f76e9d374 Test for non-JSC JavaScriptExecutor
Reviewed By: mhorowitz

Differential Revision: D5746286

fbshipit-source-id: 5bc5d5fcbc9e3ab7de0153145b1276edd3f3aa13
2017-09-01 09:15:43 -07:00
Michał Gregorczyk 4cba3abf06 Fix NPE in ReactInstaceManager.setupReactContext
Reviewed By: AaaChiuuu, mhorowitz

Differential Revision: D5724464

fbshipit-source-id: 80d0b97f4294f6894e0d034dda6dd1a3db4b1341
2017-09-01 09:15:43 -07:00
Michael Lee bf80585eba Switch to xplat folly
Reviewed By: nlutsenko

Differential Revision: D5739990

fbshipit-source-id: a1b862faab1dbcdb3bcc11f1bf662241cf7252e5
2017-08-31 17:02:38 -07:00
Aaron Chiu 47c8b07310 add ability to print from JS and app navigation as a category
Reviewed By: achen1

Differential Revision: D5661567

fbshipit-source-id: 005323afbbb33ec5e36cbce7f395edc573dcc2ff
2017-08-31 14:46:12 -07:00
Adam Ernst 93993799eb Gracefully handle any unrecognized stack frame format
Reviewed By: javache

Differential Revision: D5736692

fbshipit-source-id: e90dc38fa203ae65ac839f37940e96f23b35c330
2017-08-31 07:52:50 -07:00
Ben Nham 6ceb4fa53f add files changed count to reload metrics
Reviewed By: AaaChiuuu

Differential Revision: D5694652

fbshipit-source-id: c7bfe4f222fd7b29baaec4102abe4f920ceaccc6
2017-08-31 04:37:36 -07:00
Zachary Liu 42713c917e Fix empty @ReactModuleList generated code
Reviewed By: AaaChiuuu

Differential Revision: D5737684

fbshipit-source-id: dc9312f595da23390cda14d5092c92d1e0319b83
2017-08-30 14:01:17 -07:00
Florian Schoellhammer fe0d081229 Remove v4 support library from RN deps
Reviewed By: achen1

Differential Revision: D5724107

fbshipit-source-id: 26548c0bc937b725d0cbe3c139ace09006f4fddb
2017-08-30 12:17:10 -07:00
Marc Horowitz de01f09b5d Remove the restriction on importing bridge:cxxreact
Reviewed By: javache

Differential Revision: D5724406

fbshipit-source-id: 24974601d161fd23805d8e925b2b20a1cf11850d
2017-08-30 11:52:28 -07:00
Ben Nham b7096c1136 fix logging of tagged markers
Reviewed By: alexeylang

Differential Revision: D5694590

fbshipit-source-id: 29e9cd7be88645e1c2c9f43d6e12261962c6ed09
2017-08-30 05:15:35 -07:00
Ben Nham ce4e41ac2e fix content appeared logging
Reviewed By: AaaChiuuu

Differential Revision: D5694558

fbshipit-source-id: 9d3ed839c301e700c715de1bbde7f6e44d12f605
2017-08-30 05:15:35 -07:00
Ben Nham d63cf13ce1 download bundle atomically
Reviewed By: javache

Differential Revision: D5697494

fbshipit-source-id: 9217194b609aabf3da23a092b3e5887925bb9bbc
2017-08-30 05:15:35 -07:00
Aaron Chiu e9d7711847 add debug overlay
Reviewed By: achen1

Differential Revision: D5659422

fbshipit-source-id: e95ed85884700b5e9bd084152e2cc89085fa66ad
2017-08-30 02:06:17 -07:00
Nurzhan Bakibayev 7d0c128174 Remove 'Debug JS on-device (experimental)' feature
Reviewed By: bnham

Differential Revision: D5706200

fbshipit-source-id: f389222a9266819c5730860a2e3e461eb1068d0e
2017-08-29 04:29:57 -07:00
Rene Weber 94a2ff93db Force original ime option when using multiline with blurOnSubmit in a…
Summary:
…ndroid

Android overrides the original set ime option when the EditText is a multiline one.
This change makes sure to set it back to the original one when blurOnSubmit is true,
which causes the button icon to be conforming to the set returnKeyType as well as
changing the behaviour of the button, such that it will blurOnSubmit correctly.

The reason not do it with blurOnSubmit being false is
because it then would not create new lines when pressing the submit button,
which would be inconsistent with IOS behaviour.

**Note** this change relies on this one #11006 because the app would crash if we don't expllicitly remove the focus (`editText.clearFocus();`)

Fixes #8778

**Test plan (required)**

1. Create view with TextInput with multiline and blurOnSubmit set to true
```javascript
<View>
           <TextInput
                returnKeyType='search'
                blurOnSubmit={true}
                multiline={true}
                onSubmitEditing={event => console.log('submit search')}></TextInput>
</View>
```

2. Input some text and click submit button in soft keyboard
3. See submit event fired and focus cleared / keyboard removed
Closes https://github.com/facebook/react-native/pull/11125

Differential Revision: D5718755

Pulled By: hramos

fbshipit-source-id: c403d61a8a879c04c3defb40ad0b6689a2329ce1
2017-08-28 12:15:30 -07:00
Alan Foster 2ceed95490 Support flash scroll indicators for android
Summary:
There is missing support for flash scroll indicators on Android. This PR adds this functionality.

Ensured that the functionality works now within iOS _and_ Android

![flashindicators-ios](https://user-images.githubusercontent.com/1271782/29491236-80ecc062-854c-11e7-9562-bdfe03d505f9.gif)

![flashindicators-android](https://user-images.githubusercontent.com/1271782/29491238-826f321c-854c-11e7-955c-cd425afd05f8.gif)
Closes https://github.com/facebook/react-native/pull/15566

Differential Revision: D5686942

Pulled By: shergin

fbshipit-source-id: 40c8bfec47d660fe8108253bb9ba9fd16ff0d19c
2017-08-27 22:29:42 -07:00
Andrew Goodale 1a262a7c7d Fix panResponder nativeEvent.locationX and locationY values on touch move
Summary:
Fixes #12591

The Android JSTouchDispatcher was using `mTargetCoordinates` when creating the TouchEvent for a move. However, these are final values which are set when the touch down is received. When the user's finger moves, it's important to be able to track the coordinates of the touch as it moves. Thus, we need to update the x,y coordinates by calling `TouchTargetHelper` on each move event.
Closes https://github.com/facebook/react-native/pull/15123

Reviewed By: achen1

Differential Revision: D5476663

Pulled By: shergin

fbshipit-source-id: ce79e96490f3657a13f9114fcc93e80d5fdbebaf
2017-08-27 22:15:22 -07:00
Spencer Ahrens dc22bd638f Add fb4a native modules to snapshot tests
Reviewed By: achen1

Differential Revision: D5599659

fbshipit-source-id: ca9f8806212e6b3551eaebb95903bc168110b4ec
2017-08-25 19:18:38 -07:00
Aaron Chiu 5d58831eac revert D5609280
Reviewed By: achen1

Differential Revision: D5711182

fbshipit-source-id: 5b4d813d144d92671090443990a3e2ea2abf3abe
2017-08-25 18:30:29 -07:00
Florian Schoellhammer db39d2387e Remove v4 dependency from Catalyst + RN libraries
Reviewed By: achen1

Differential Revision: D5676459

fbshipit-source-id: cd86c90580d9cdf686382c4d7169ce628403c06e
2017-08-25 14:30:20 -07:00
Becky Van Bussel 84b11dd518 Add Android React Native Checkbox
Reviewed By: achen1

Differential Revision: D5281736

fbshipit-source-id: 9a3c93eeace2d80be4ddbd4ffc3258c1d3637480
2017-08-25 10:30:54 -07:00
Kathy Gray f266ab9bac Move cleanup back to destructor
Reviewed By: javache

Differential Revision: D5697611

fbshipit-source-id: e8bce63aec02d08421eea52b20343576e914e5aa
2017-08-24 07:59:56 -07:00
Sreejith Krishnan R 9c2caaac3e Expose method to set custom baseline function
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!

-->

I was trying to typeset mathematical equations in react native. When typesetting fractions, baseline of the fraction must be aligned with the baseline of others. The baseline of fraction will vary based on size of numerator and denominator.

![image](https://user-images.githubusercontent.com/31202232/29577330-a22b45ee-8788-11e7-9cc5-04a72bcc1180.png)

 In yoga, we can set custom baseline function using `YogaNode.setBaselineFunction` method. If this method is exposed in `ReactShadowNode` class, it will be easy to create custom native UI modules which requires setting custom baseline.
Closes https://github.com/facebook/react-native/pull/15605

Differential Revision: D5686876

Pulled By: shergin

fbshipit-source-id: 34d797a7ea27d5c1b9f6b9c36e469cdca3883aec
2017-08-23 02:36:17 -07:00
Alexey Lang 4aae843ebb Report perf counters always when we call flushPendingBatches()
Reviewed By: AaaChiuuu

Differential Revision: D5678088

fbshipit-source-id: 35d909a432ece9539bd48e0bf4ddb14d5953a096
2017-08-22 08:44:45 -07:00
Kathy Gray f0d98104ae Reduce possible race condition on gc of catalyst instance
Reviewed By: cwdick

Differential Revision: D5669579

fbshipit-source-id: 165e19b68199e89bb99f7f93f2b1ec70729b2848
2017-08-22 03:30:22 -07:00
Andrew Y. Chen c3b47e5523 Remove appcompat dep from react/views/toolbar
Reviewed By: AaaChiuuu

Differential Revision: D5651764

fbshipit-source-id: c8cf730bf2086d205a43a535f3f12ae2af0caa5f
2017-08-21 15:15:10 -07:00
Michał Gregorczyk 73f17908e6 Make JavaScriptExecutor.Factory a configurable property of ReactInstanceManager
Reviewed By: mhorowitz

Differential Revision: D5662431

fbshipit-source-id: 17dca2744de645740cef252efbf83902acde5046
2017-08-21 13:42:34 -07:00
Michał Gregorczyk 606a876df7 Kill JSCConfig
Reviewed By: mhorowitz

Differential Revision: D5662181

fbshipit-source-id: 71a4d6cf4eb34030d4f86e96e8bc6f8e8efe5fdd
2017-08-21 13:42:34 -07:00
Alexey Lang 992777b765 Pass minTimeLeftInFrameForNonBatchedOperationMs from above
Reviewed By: AaaChiuuu

Differential Revision: D5658066

fbshipit-source-id: f89a8bcfc180210f7361b03f718f65b1d59cbf85
2017-08-20 17:30:38 -07:00
Adam Comella ffbd3db61b Android WebView: Only fire onLoadStart for toplevel page loads
Summary:
Currently, `onLoadStart` fires for a couple of cases:
  1. toplevel page loads (e.g. initial page load, clicking links)
  2. loading of pages within an iframe

The fact that `onLoadStart` fires for case (2) causes some problems. For example, it makes it difficult for the code that uses the WebView to know what URL the WebView is currently rendering. This is because the listener can't distinguish between the toplevel URL and the URL of an iframe. Additionally, this behavior is inconsistent with the behavior on iOS. On iOS, `onLoadStart` only fires for toplevel page loads.

To fix these issues, this change deletes the `doUpdateVisitedHistory` handler so that `onLoadStart` only fires for case (1).

**Test Plan**

Created a test page that has an iframe and loaded it in the WebView. Verified that `onLoadStart` only fires for toplevel page loads.

Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/15554

Differential Revision: D5665979

Pulled By: hramos

fbshipit-source-id: a52e473bc5691a6e180f45f0728e4ad89a7d354f
2017-08-19 00:59:51 -07:00
Misha Greenberg 9f5bdd7b49 Size height of Android Text component based on includeFontPadding style
Summary:
Overview -

This PR resolves the issue described in #14606. This PR makes Text components take into account the includeFontPadding property when calculating their size.

Background -

Currently, on Android, when includeFontPadding is set to false, the React Text component does not adjust its height. This makes it difficult to lay out other components at a precise spacing relative to a Text component.

iOS calculates the height of a UILabel based on the font's descent + ascent.

Android lets you choose whether to calculate the height of a TextView based on the font's top + bottom (includeFontPadding=true) or ascent + descent (includeFontPadding=false).

In order for a text component to be the same size on iOS and Android (relative to the rest of the layout in points and dips), one should set includeFontPadding=false on Android - but the React Text component needs to take this property into account when sizing itself for this to work.

Please see this stack overflow post for a visual explanation of the difference between a font's ascent/descent and top/bottom - https://stackoverflow.com/questions/27631736/meaning-of-top-ascent-baseline-descent-bottom-and-leading-in-androids-font

Testing -

Please see the attached screenshots to see the height difference of a Text component with this PR when includeFontPadding is true vs false.

The font I am using has an ascent + descent = em-size so that the height of the Text component will be equal to the font-size for a single line of text. This is to clearly show the additional height that includeFontPadding=true adds to the Text component.

For Text components that are styled in the same way,

When includeFontPadding=true, height = ~29.714 dips
When includeFontPadding=false, height= 24 dips

<img width="342" alt="includefontpaddingtrue" src="https://user-images.githubusercontent.com/1437344/27299391-3eec9de0-54fa-11e7-81d5-d0aeb40e8e27.png">

<img width="346" alt="includefontpaddingfalse" src="https://user-images.githubusercontent.com/1437344/27299401-45c95248-54fa-11e7-98d7-17dd152d3cb8.png">
Closes https://github.com/facebook/react-native/pull/14609

Reviewed By: AaaChiuuu

Differential Revision: D5587602

Pulled By: achen1

fbshipit-source-id: 6d2f12ba72ec7462676645519cd27820279278eb
2017-08-18 15:31:01 -07:00
Caleb Meredith 90eaeb019b Upgrade fbsource/xplat/js to Flow v0.53.0
Reviewed By: avikchaudhuri

Differential Revision:
D5648819
Ninja: T20988071

fbshipit-source-id: 66e5b6747c79ae66b6eb69d40ede5e982c26174f
2017-08-17 18:45:01 -07:00
Ben Nham 904e77a753 fix content appeared logging pt2
Reviewed By: AaaChiuuu

Differential Revision: D5639795

fbshipit-source-id: 8febaf7586df629f1a197896a2b8d0ebdf850444
2017-08-17 10:07:18 -07:00
Alexey Lang caaf7fd417 Add more perf counters
Reviewed By: AaaChiuuu

Differential Revision: D5624307

fbshipit-source-id: a7fd744b7a1989f35efe99d7471337a411870934
2017-08-17 08:00:28 -07:00
Kathy Gray 3c12faf01c Restore correct placement of PRE_RUN_JS_BUNDLE_START
Reviewed By: alexeylang

Differential Revision: D5640104

fbshipit-source-id: f0709f16874cca5147fdfc539727ec4225ca539b
2017-08-17 06:16:12 -07:00
Ben Nham c080fe54d6 add perf markers for reload and download
Reviewed By: alexeylang

Differential Revision: D5633613

fbshipit-source-id: 1fe39669cf4ba4e1475bb57de59c696771ebf8c7
2017-08-17 05:44:27 -07:00
Kevin Gozali 40a2885847 android: allow whitelisting urls to bypass default webview loading
Summary:
This is a workaround for missing PDF url support in Android WebView, which is a general known issue: when tapping a PDF url within WebView, instead of doing nothing, we just let android default intent handle it (e.g. it will open Chrome to load it).

This is basically to trick `shouldOverrideUrlLoading()` to return true for the specific url. The drawback is that product code needs to provide the whitelist.

The proper fix would be to use PdfRenderer in that method, but it seems like it's only for API >= 21...

Differential Revision: D5619383

fbshipit-source-id: f86b930f970dab9a5f57999df69ce94b9508edc9
2017-08-16 19:29:13 -07:00
Marc Horowitz 1cc7ae2ae1 FBASSERT -> FBJNI_ASSERT, ALOGE -> FBJNI_LOGE, ALOGF -> FBJNI_LOGF
Reviewed By: BurntBrunch

Differential Revision: D5609686

fbshipit-source-id: 3ac863abe8555e768df1625e414f09b35d49853d
2017-08-16 17:57:51 -07:00
Sriram Ramasubramanian dc61f10e8b Make ResourceDrawableIdHelper work with resource id
Reviewed By: fkgozali

Differential Revision: D5636657

fbshipit-source-id: 251b8b495655abf83618922b86f710fa38b08317
2017-08-16 15:46:06 -07:00
Eric Rozell fedc002c21 Use offset adjusted value in ModulusAnimatedNode
Summary:
Modulus animation computation should use the value adjusted for offset, not the raw value.

See the JS implementation here:
https://github.com/facebook/react-native/blob/master/Libraries/Animated/src/AnimatedImplementation.js#L1338

cc ryangomba
Closes https://github.com/facebook/react-native/pull/15502

Differential Revision: D5638901

Pulled By: shergin

fbshipit-source-id: cbf47bd4082897a969e2e561ec090366884a8349
2017-08-16 00:48:12 -07:00
Eric Rozell d0669fc922 `onAnimatedValueUpdate` should also include offset
Summary:
Native Android implementation of animation listeners reports value only, and does not include offset. For non-native animation, the JavaScript listeners receive the animated node value + the animated node offset. Here's where the JavaScript node calls the listeners:
046f600cc2/Libraries/Animated/src/AnimatedImplementation.js (L942)
 and here's how `__getValue()` is calculated:
 046f600cc2/Libraries/Animated/src/AnimatedImplementation.js (L741-L743)

cc janicduplessis kmagiera
Closes https://github.com/facebook/react-native/pull/15500

Differential Revision: D5638336

Pulled By: shergin

fbshipit-source-id: d2104fdb483d9db3b856d625d021cceaa9232787
2017-08-15 22:05:15 -07:00
Rafael Oleza c2b3ee789c Do not send 'hot' parameter when requesting a bundle from Android
Summary:
Since the `hot` parameter is not used anymore in metro-bundler (we are always applying the HMR transforms for bundlers requested through the HTTP server), we can remove it from the client request URL.

This allows us to reduce the metro-bundler memory by half when switching between HMR and not-HMR, since metro caches the bundles based on the requested URL path.

Reviewed By: davidaurelio

Differential Revision: D5630051

fbshipit-source-id: fb5dce4c31bbb38b1c0c93c97a525a992b2f6d8d
2017-08-15 18:50:29 -07:00
Valentin Shergin eb01f8fe59 Revert D4449255: [react-native][PR] Fixed ART Surface initialization: do not cancel updates to the surfce, make them pen…
Differential Revision: D4449255

fbshipit-source-id: e210cebfde25c6cd68a1fb7e1dceeefad890cf93
2017-08-15 17:11:46 -07:00
Adam Comella 7e11bad86f Android: Improve getCurrentPosition API
Summary:
We ran into a couple of problems with the implementation of `getCurrentPosition` on Android:
  - It sometimes returns an inaccurate location
  - It times out when `enableHighAccuracy` is `true` (#7495)

This change improves `getCurrentPosition` for both of the above problems. Instead of calling `requestSingleUpdate` it now calls `requestLocationUpdates` so it can receive multiple locations giving it an opportunity to pick a better one. Unlike `requestSingleUpdate`, this approach doesn't seem to timeout when `enableHighAccuracy` is `true`.

**Test plan (required)**

Verified in a test app that `getCurrentPosition` returns a good location and doesn't timeout when `enableHighAccuracy` is `true`. Also, my team has been using this change in our app in production.

Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/15094

Differential Revision: D5632100

Pulled By: hramos

fbshipit-source-id: 86e40b01d941a13820cb775bccad7e19dba3d692
2017-08-15 12:03:40 -07:00
Nivetha Singara Vadivelu 400020215f Fetching video length
Reviewed By: furdei

Differential Revision: D5596545

fbshipit-source-id: ae29bc27579f2d06b1281e677c1aa820d50d9ee2
2017-08-15 11:41:27 -07:00
Nivetha Singara Vadivelu 25f2938344 Getting correct video width and height metrics
Reviewed By: furdei

Differential Revision: D5594591

fbshipit-source-id: 73c3df227763bed3fc85f6aee60af5332cd09c55
2017-08-15 11:41:24 -07:00
David Vacca 6f60f2bf67 Expose StatusBar height and fix StatusBar example - T13591448
Reviewed By: achen1

Differential Revision: D5624514

fbshipit-source-id: edc1ebe9758bd6a67e79a60128553414fb1424d3
2017-08-15 11:11:39 -07:00
Ben Nham 091878a61a fix content appeared logging
Reviewed By: AaaChiuuu

Differential Revision: D5630723

fbshipit-source-id: 3791537afdb7ca4992c2562577466c2ef5baafce
2017-08-15 10:48:43 -07:00
Alexey Lang e16dd51a0e Fix systrace section name
Reviewed By: AaaChiuuu

Differential Revision: D5630025

fbshipit-source-id: 9fd6d177c65f1bf45ab56a4fc05b3a8e8fd72afb
2017-08-15 10:48:42 -07:00
Aaron Chiu 353cb61400 refactor out RootView tag number logic
Reviewed By: achen1

Differential Revision: D5609280

fbshipit-source-id: bc0c9f50b2938f05d5e43f50491ff6f0de154fb6
2017-08-15 10:48:41 -07:00
Paco Estevez Garcia 41504103ce Force the debugger to disconnect before a bundle reload
Reviewed By: bnham

Differential Revision: D5594238

fbshipit-source-id: feff9f179534c8e617f8fa7c8a7b1bc525c07cae
2017-08-14 08:16:52 -07:00
Kathy Gray 419652d4e9 Move native modules into different packages for fb4a shared bundle
Reviewed By: javache

Differential Revision: D5536155

fbshipit-source-id: 4d4bb0415d3012f09e98e185a92a0e1f3fdbc474
2017-08-14 07:02:08 -07:00
Kathy Gray 84e80eb781 Allow reactinstancemanager to set an initialization function
Reviewed By: javache

Differential Revision: D5227811

fbshipit-source-id: e7868481de2a8799af5d6a6bcad26369d054b35e
2017-08-14 07:02:07 -07:00
Charles Dick 37754c5c83 refactor MemoryPressureListener to use Android levels
Reviewed By: bnham

Differential Revision: D5603426

fbshipit-source-id: 6d09a56544c27e46f4b9ef491798720e37214e47
2017-08-12 06:31:02 -07:00
Andrew Y. Chen 64e9b24ef5 Expose the ReactApplicationContext to createShadowNodeInstance()
Reviewed By: AaaChiuuu

Differential Revision: D5581337

fbshipit-source-id: 5030e4f046ede1a99d22b2ffebbbfe79e7ce9c5d
2017-08-10 18:31:59 -07:00
Kathy Gray 5d4c6e5f23 Rename module name to module path
Reviewed By: javache

Differential Revision: D5592950

fbshipit-source-id: 7e32043ba6d1de129a4f8dc694bb5987393b0ebc
2017-08-10 09:19:20 -07:00
Rob Hogan cd9d6e34fd WebSocket API change to make room for other connection options (SSL pinning)
Summary:
This is a simple groundwork PR to allow options to be passed to the `WebSocket` constructor. It represents a minor change to an undocumented part of the API, moving `headers` to within `options`.

This will be a BC for anyone manually specifying headers other than `origin` but a) that's not a common use case with WebSockets and b) it's not documented even in code and wouldn't currently pass a flow check.

NB: The third argument to the WebSocket constructor isn't part of the W3C spec, so I think this is a good place for RN-specific named parameters, better than adding a fourth argument. `protocols` needs to stay where it is, in line with the spec.

If this goes through I'd like to build on it by adding an additional connection option for SSL certificate pinning, as already supported by the underlying `okhttp` and `RCTSRWebSocket`. It could later be expanded for various other uses.

Currently, there's no way for a `WebSocket` user to specify any connection options other than url, protocol and headers. The fact that `WebSocket` connects in its constructor means any options have to go in there.

Connect to a websocket server using iOS and Android, observe the connection headers:
1. Without specifying `origin`, the default header should be set
2. Specifying it in the old way `new WebSocket(url, protocols, { origin: 'customorigin.com' })`
3. Specifying it in the new way `new WebSocket(url, protocols, { headers: { origin: 'customorigin.com' }})`.

I've tested myself using the test app with iOS and Android.
Closes https://github.com/facebook/react-native/pull/15334

Differential Revision: D5601675

Pulled By: javache

fbshipit-source-id: 5959d03a3e1d269b2c6775f3e0cf071ff08617bf
2017-08-10 06:02:42 -07:00
Sergei Dryganets 7e515479b0 LocalString doesn't have a check for nullptr
Summary:
LocalString doesn't have a check for null ptr which causes a crash if the null string passed.
Closes https://github.com/facebook/react-native/pull/15372

Differential Revision: D5601469

Pulled By: javache

fbshipit-source-id: a1b20efbae90009f0d465c077e6401a701d7515f
2017-08-10 03:21:07 -07:00
Janic Duplessis b103903ec8 Fix updating a view z-index on Android
Summary:
If the z-index was updated after the initial mount, changes would not be reflected because we did not recalculate the z-index mapped child views and redraw the view. This adds code to do that and call it whenever we update z-index.

**Test plan**
Tested by reproducing the bug with 2 overlapping views that change z-index every second. Made sure it now works properly and z-index changes are reflected.
Closes https://github.com/facebook/react-native/pull/15203

Differential Revision: D5564832

Pulled By: achen1

fbshipit-source-id: 5b6c20147211ce0b7e8954d60f8614eafe128fb4
2017-08-09 20:52:11 -07:00
Ben Nham d013ba3915 add perf marker that fires first time content is added to root view
Reviewed By: javache

Differential Revision: D5582838

fbshipit-source-id: f90376ab11b4d44c002759829e4b2bbb4bbeeb56
2017-08-08 10:48:27 -07:00
Dmitry Petukhov be3f1be8df Fixed ART Surface initialization: do not cancel updates to the surfce, make them pen…
Summary:
My PR was pulled into RN 0.37 (d294e15c43). Since then an issue was discovered: ARTSurface skipped drawing the first render cycle if native TextureView takes too long. In case a static graphic is rendered in a single render cycle, it may be skipped resulting in an empty canvas being displayed.

A solution proposed in this PR: instead of skipping updates, make them pending and flush once the TextureView is ready.

This solution is released within our production app. It fixed ArtSurface initialisation issues cased by original PR to RN 0.37.
Closes https://github.com/facebook/react-native/pull/11539

Differential Revision: D4449255

Pulled By: shergin

fbshipit-source-id: a517909ca5c78c09a3ac8d9052664b92841b4e08
2017-08-07 18:19:17 -07:00
Pieter De Baets 5d79b26011 Limit calls to SoLoader
Reviewed By: kathryngray

Differential Revision: D5536048

fbshipit-source-id: 525d5a37f41671abd4b56e5a6f4b88e9af9927b8
2017-08-07 09:53:20 -07:00
Bartol Karuza b2fe048a0b always set camera distance on transforms, to default 1280 if 0
Summary:
This is the better fix for the same issue as mentioned in PR https://github.com/facebook/react-native/pull/14560

Certain rotateX, rotateY, scaleX and scaleY animations do not work correctly on some phones in Android 7.0.0, causing issues such as https://github.com/facebook/react-native/issues/14462 and https://github.com/facebook/react-native/issues/13522.

The issue can be fixed on JS side by setting an additional transform for perspective, eg. `{perspective: 1}` which triggers a `setCameraDistance` call in native code.

The fix in this PR always sets the camera distance on transforms, even when no perspective transform was specified. The default camera distance is set before the scale multiplication, to make sure that the value is appropriate for the phones density. The value calculates to an Android 'default' camera distance of 1280 * scale multiplier; https://developer.android.com/reference/android/view/View.html#setCameraDistance(float)

If a perspective transform is specified, this value will be used correctly still.

This fix was tested on the RNTester. Before the fix, on some devices, the FlatList example, with inverted turned on, will not display the list.

Devices that have been confirmed to have this issue:
FRD-AL10(honor 8) EMUI:5.0 android: 7.0
MHA-AL00(Mate9) EMUI:5.0 android:7.0
Huawei P10 VTR-L09, running Android 7.0

After the fix, the inverted FlatList displays correctly.
Closes https://github.com/facebook/react-native/pull/14646

Differential Revision: D5492009

Pulled By: shergin

fbshipit-source-id: d4da3b090a7e65df3b84e48ea32c964f4f8f7c88
2017-08-06 19:32:24 -07:00
Omer Strulovich 259eac8c30 Revert D5556439: [react-native][PR] Native Animated - Restore default values when removing props on Android
Differential Revision: D5556439

fbshipit-source-id: dc0e4c1db25ec7f3631e6f684f9497962f2adc7b
2017-08-04 16:04:11 -07:00
Janic Duplessis ac43548063 Native Animated - Restore default values when removing props on Android
Summary:
Same as #11819 but for Android. I didn't notice the bug initially in my app because I was using different animations on Android which did not trigger this issue.

**Test plan**
Created a simple repro example and tested that this fixes it. https://gist.github.com/janicduplessis/0f3eb362dae63fedf99a0d3ee041796a
Closes https://github.com/facebook/react-native/pull/12842

Differential Revision: D5556439

Pulled By: hramos

fbshipit-source-id: d13f4ad258d03cca46c793751ebc49d942b99152
2017-08-04 14:07:34 -07:00
Nivetha Singara Vadivelu b4f91be647 Allow to fetch files over the network
Reviewed By: furdei

Differential Revision: D5558385

fbshipit-source-id: 11f00acbbdf61bfa4b7e86675b0912d6edc39e9b
2017-08-04 13:04:30 -07:00
Maxime Goovaerts 546a43bda0 Expose offset parameters for ToastAndroid
Reviewed By: brosenfeld

Differential Revision: D5560628

fbshipit-source-id: b1457493e8429958fbd7bc9c490cffaa33b4a95a
2017-08-04 09:07:21 -07:00
Aaron Chiu 43ff9b4252 run onReactContextInitialized() on the UIThread
Reviewed By: furdei

Differential Revision: D5560722

fbshipit-source-id: 9871761dc5b314776c27128cfc51e0a414f9a736
2017-08-04 02:00:28 -07:00
Ats Jenk c9aeaf675d Separate window dimensions change from orientation
Summary:
**Summary:**
There was a bug with RN.Dimensions returning incorrect window dimensions. In certain cases when device was in portrait, window dimensions reported landscape dimensions and vice versa.

This happened because in certain scenarios, after device orientation changed, dimensions update event from ReactRootView had incorrect dimensions.
Was able to reproduce this when device was rotated during app launch. After rotation global layout listener callback gets invoked. Inside the callback current and previous orientations are compared. When a change is detected, orientation and dimension change events are sent to JS. It is assumed, when orientation changes, new dimensions are available immediately. This is not the case for window dimensions as they are retrieved from resources object which gets updated asynchronously after orientation change. In cases when app is doing a lot of work on the main thread, like app startup, it takes more time to update the resources object. And when orientation change is detected in global layout, resources object is not updated with new dimensions yet. This causes dimensions update to be sent to JS with old window dimensions.
Global layout listener callback does get invoked a second time when resources object is finally updated with new dimensions, but since orientation no longer changes, no event is sent to JS.

Fixed this by separating dimensions update from orientation update. Now RN keeps track of previous window and screen dimension values. When a change is detected, an event is sent to JS with updated dimensions. This ensures that whenever dimensions change, JS gets the updated values.

This has a side effect of sending dimension update twice in some cases.
One example is the case above where window dimensions take time to update, but screen dimensions are updated immediately. This will cause two events to be sent to JS. One for window dimensions and one for screen dimensions update.
Other change is that initial value for both window and screen fields is empty. Which results in first change to trigger an event. Previously initial orientation value was 0 which meant when app started in normal portrait orientation, first layout did not trigger a dimension update event. Now even first layout sends the event. This should not be an issue as it is to make sure dimensions in JS side are correct.

**Testing:**
Verified with a sample app that correct dimensions are available when app launches.
Verified that after orientation dimensions are updated.
Verified that in the scenario described above where window dimensions are updated later, we get correct dimension values in JS.
We have incorporated this fix into our app and have been testing it internally.

Ats Jenk
Microsoft Corp.

<!--
Thank you for sending the PR!

If you changed any code, please provide us with clear instructions on how you verified your changes work. In other words, a test plan is *required*. Bonus points for screenshots and videos!

Please read the Contribution Guidelines at https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md to learn more about contributing to React Native.

Happy contributing!
-->
Closes https://github.com/facebook/react-native/pull/15181

Differential Revision: D5552195

Pulled By: shergin

fbshipit-source-id: d1f190cb960090468886ff56cda58cac296745db
2017-08-02 21:07:35 -07:00
Nivetha Singara Vadivelu 1748922c15 Retrieve correct content uri for videos
Reviewed By: furdei

Differential Revision: D5547060

fbshipit-source-id: 6d3a6273ffbaa179081254e46204211b31faacf2
2017-08-02 20:07:26 -07:00
Paco Estevez Garcia 36c694364f Assure the Inspector socket runs through the lifecycle of ReactNative
Reviewed By: AaaChiuuu

Differential Revision: D5538894

fbshipit-source-id: f48d7a1df344bd3a16f5c170b0955b7d2ef35913
2017-08-02 17:43:39 -07:00
David Reiss 278cd5747f Mark React Native annotation processors as non-ABI-affecting
Reviewed By: AaaChiuuu

Differential Revision: D5518898

fbshipit-source-id: 652e5a70d27a0e598b2b6ae8f73d9d4fe19dfd36
2017-07-28 12:49:01 -07:00
Andrew Jack 7ac6fa7a10 Check if fresco is initialised before clearing memory caches
Summary:
Fixes the following crash:
```
Fatal Exception: java.lang.RuntimeException: Unable to destroy activity {com.example/com.example.MainActivity}: java.lang.NullPointerException: ImagePipelineFactory was not initialized!
       at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3831)
       at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3849)
       at android.app.ActivityThread.access$1500(ActivityThread.java:150)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1398)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:148)
       at android.app.ActivityThread.main(ActivityThread.java:5417)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:764)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
Caused by java.lang.NullPointerException: ImagePipelineFactory was not initialized!
       at com.facebook.common.internal.Preconditions.checkNotNull(Preconditions.java:226)
       at com.facebook.imagepipeline.core.ImagePipelineFactory.getInstance(ImagePipelineFactory.java:74)
       at com.facebook.drawee.backends.pipeline.Fresco.getImagePipelineFactory(Fresco.java:92)
       at com.facebook.drawee.backends.pipeline.Fresco.getImagePipeline(Fresco.java:97)
       at com.facebook.react.modules.fresco.FrescoModule.onHostDestroy(FrescoModule.java:186)
       at com.facebook.react.bridge.ReactContext.onHostDestroy(ReactContext.java:240)
       at com.facebook.react.ReactInstanceManager.moveToBeforeCreateLifecycleState(ReactInstanceManager.java:667)
       at com.facebook.react.ReactInstanceManager.onHostDestroy(ReactInstanceManager.java:586)
       at com.facebook.react.ReactInstanceManager.onHostDestroy(ReactInstanceManager.java:599)
       at com.facebook.react.ReactActivityDelegate.onDestroy(ReactActivityDelegate.java:142)
       at com.facebook.react.ReactActivity.onDestroy(ReactActivity.java:72)
       at android.app.Activity.performDestroy(Activity.java:6456)
       at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1143)
       at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3818)
       at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3849)
       at android.app.ActivityThread.access$1500(ActivityThread.java:150)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1398)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:148)
       at android.app.ActivityThread.main(ActivityThread.java:5417)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:764)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
```

This was introduced by d9ae27ba89

1. Create app with an image to be loaded
2. Background app before fresco has been initialised. (Very tight window to do this)
3. Should not crash

cc foghina
Closes https://github.com/facebook/react-native/pull/14359

Differential Revision: D5508505

Pulled By: hramos

fbshipit-source-id: 5a66d594625783f1c30180fe78c5baddb4f835aa
2017-07-28 07:51:09 -07:00
Philipp von Weitershausen ed903099b4 Add blob implementation with WebSocket integration
Summary:
This is the first PR from a series of PRs grabbou and me will make to add blob support to React Native. The next PR will include blob support for XMLHttpRequest.

I'd like to get this merged with minimal changes to preserve the attribution. My next PR can contain bigger changes.

Blobs are used to transfer binary data between server and client. Currently React Native lacks a way to deal with binary data. The only thing that comes close is uploading files through a URI.

Current workarounds to transfer binary data includes encoding and decoding them to base64 and and transferring them as string, which is not ideal, since it increases the payload size and the whole payload needs to be sent via the bridge every time changes are made.

The PR adds a way to deal with blobs via a new native module. The blob is constructed on the native side and the data never needs to pass through the bridge. Currently the only way to create a blob is to receive a blob from the server via websocket.

The PR is largely a direct port of https://github.com/silklabs/silk/tree/master/react-native-blobs by philikon into RN (with changes to integrate with RN), and attributed as such.

> **Note:** This is a breaking change for all people running iOS without CocoaPods. You will have to manually add `RCTBlob.xcodeproj` to your `Libraries` and then, add it to Build Phases. Just follow the process of manual linking. We'll also need to document this process in the release notes.

Related discussion - https://github.com/facebook/react-native/issues/11103

- `Image` can't show image when `URL.createObjectURL` is used with large images on Android

The websocket integration can be tested via a simple server,

```js
const fs = require('fs');
const http = require('http');

const WebSocketServer = require('ws').Server;

const wss = new WebSocketServer({
  server: http.createServer().listen(7232),
});

wss.on('connection', (ws) => {
  ws.on('message', (d) => {
    console.log(d);
  });

  ws.send(fs.readFileSync('./some-file'));
});
```

Then on the client,

```js
var ws = new WebSocket('ws://localhost:7232');

ws.binaryType = 'blob';

ws.onerror = (error) => {
  console.error(error);
};

ws.onmessage = (e) => {
  console.log(e.data);
  ws.send(e.data);
};
```

cc brentvatne ide
Closes https://github.com/facebook/react-native/pull/11417

Reviewed By: sahrens

Differential Revision: D5188484

Pulled By: javache

fbshipit-source-id: 6afcbc4d19aa7a27b0dc9d52701ba400e7d7e98f
2017-07-26 08:23:20 -07:00
Tomas Reimers 88a98455f6 Simplifying conditional logic.
Summary:
This should be functionally identical, but avoids unnecessary conditionals in the code.

<!--
Thank you for sending the PR!

If you changed any code, please provide us with clear instructions on how you verified your changes work. In other words, a test plan is *required*. Bonus points for screenshots and videos!

Please read the Contribution Guidelines at https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md to learn more about contributing to React Native.

Happy contributing!
-->
Closes https://github.com/facebook/react-native/pull/15147

Differential Revision: D5497883

Pulled By: javache

fbshipit-source-id: a4b182084ffce87adac56013a178fbc5a7a5d1bb
2017-07-26 07:08:51 -07:00
Aaron Chiu 042f254a12 make member variables private instead of protected
Reviewed By: sahrens

Differential Revision: D5425194

fbshipit-source-id: 69c06a8e38bf3c4d84c2c426325e92abf63b4cb7
2017-07-24 18:35:11 -07:00
Adam Comella fc38fe1736 DEPRECATION: Make NetInfo API cross platform and expose whether connection is 2g/3g/4g
Summary:
This change intends to fix 2 issues with the NetInfo API:
  - The NetInfo API is currently platform-specific. It returns completely different values on iOS and Android.
  - The NetInfo API currently doesn't expose a way to determine whether the connection is 2g, 3g, or 4g.

The NetInfo API currently just exposes a string-based enum representing the connectivity type. The string values are different between iOS and Andorid. Because of this design, it's not obvious how to achieve the goals of this change without making a breaking change. Consequently, this change deprecates the old NetInfo APIs and introduces new ones. Specifically, these are the API changes:
  - The `fetch` method is deprecated in favor of `getConnection`
  - The `change` event is deprecated in favor of the `connectionchange` event.
  - `getConnection`/`connectionchange` use a new set of enum values compared to `fetch`/`change`. See the documentation for the new values.
    - On iOS, `cell` is now known as `cellular`. It's worth pointing out this one in particular because the old and new names are so similar. The rest of the iOS values have remained the same.
    - Some of the Android enum values have been removed without a replacement (e.g. `DUMMY`, `MOBILE_DUN`, `MOBILE_HIPRI`, `MOBILE_MMS`, `MOBILE_SUPL`, `VPN`). If desirable, we could find a way to expose these in the new API. For example, we could have a `platformValue` key that exposes the platform's enum values directly (like the old `fetch` API did).

`getConnection` and `connectionchange` each expose an object which has 2 keys conveying a `ConnectionType` (e.g. wifi, cellular) and an `EffectiveConnectionType` (e.g. 2g, 3g). These enums and their values are taken directly from the W3C's Network Information API spec (https://wicg.github.io/netinfo/). Copying the W3C's API will make it easy to expose a `navigation.connection` polyfill, if we want, in the future. Additionally, because the new APIs expose an object instead of a string, it's easier to extend the APIs in the future by adding keys to the object without causing a breaking change.

Note that the W3C's spec doesn't have an "unknown" value for `EffectiveConnectionType`. I chose to introduce this non-standard value because it's possible for the current implementation to not have an `effectiveConnectionType` and I figured it was worth representing this possibility explicitly with "unknown" instead of implicitly with `null`.

**Test Plan (required)**

Verified that the methods (`fetch` and `getConnection`) and the events (`change` and `connectionchange`) return the correct data on iOS and Android when connected to a wifi network and a 4G cellular network. Verified that switching networks causes the event to fire with the correct information. Verified that the old APIs (`fetch' and 'change') emit a deprecation warning when used. My team is using a similar patch in our app.

Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/14618

Differential Revision: D5459593

Pulled By: shergin

fbshipit-source-id: f1e6c5d572bb3e2669fbd4ba7d0fbb106525280e
2017-07-24 15:50:53 -07:00
Benjamin Dobell 63c2ab3eb1 Request toolbar layout after drawable loads
Summary:
Fixes #11209

Updating action items in a `ToolbarAndroid`, or more specifically the native `ReactToolbar`, after the initial render presently will not always work as expected - typically manifesting itself as new action items not being displayed at all (under certain circumstances).

This seems to be happening because Fresco gets back to us asynchronously and updates the `MenuItem` in a listener. However when a keyboard is displayed the `Toolbar` is in a weird state where updating the `MenuItem` doesn't automatically trigger a layout.

The solution is to trigger one manually.

This is a bit wacky, so I created a sample project:

https://github.com/Benjamin-Dobell/DynamicToolbar

`master` demonstrates the problem. Run the project, the toolbar action item is scheduled to update every 2 seconds. It works fine _until_ you give the `TextInput` focus. Once you give it focus the action item disappears and it never recovers (despite on-going renders due to state changes).

You can then checkout the `fixed` branch, run `yarn` again, and see that problem is fixed. This branch is using a prebuilt version of React Native with this patch applied. Of course you could (and probably should) also modify `master` to use a version of RN built by the Facebook CI (assuming that's a thing you guys do).
Closes https://github.com/facebook/react-native/pull/13876

Differential Revision: D5476858

Pulled By: shergin

fbshipit-source-id: 6634d8cb3ee18fd99f7dc4e1eef348accc1c45ad
2017-07-24 11:47:18 -07:00
Tomas Reimers aa9a19ab8d Remove onScrollAnimationEnd
Summary:
<!--
Thank you for sending the PR!

If you changed any code, please provide us with clear instructions on how you verified your changes work. In other words, a test plan is *required*. Bonus points for screenshots and videos!

Please read the Contribution Guidelines at https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md to learn more about contributing to React Native.

Happy contributing!
-->
Closes https://github.com/facebook/react-native/pull/15156

Differential Revision: D5479265

Pulled By: shergin

fbshipit-source-id: a2dfa3a4357e126838a17dac4797d1d845cd56ae
2017-07-24 00:32:17 -07:00
Summer Kitahara 794dddc5bd Show RN Dev Menu after 2 rage shakes
Reviewed By: achen1

Differential Revision: D5427430

fbshipit-source-id: cac761c550ff2627f1bbbbde9e9b8d3f122bbb45
2017-07-21 00:02:23 -07:00
Sandro Machado bdd46aa283 Fix `HEAD` http requests in Android
Summary:
Closes https://github.com/facebook/react-native/issues/7463.

This PR fixes the `HEAD` http requests in Android.
In Android all the HEAD http requests will fail, even if the request succeeds in the native layer due to an issue in the communication with the `OkHttp`.
Closes https://github.com/facebook/react-native/pull/14289

Differential Revision: D5166130

Pulled By: hramos

fbshipit-source-id: a7a0deee0fcb5f6a645c07d4e6f4386b5f550e31
2017-07-20 16:34:38 -07:00
Krzysztof Magiera b8fafb46c1 Stop native driver animations when value is set.
Summary:
This diff changes the behaviour of natively driven animations in case the node that they are being run for has its value changed using `setValue` or as a result of an incoming event.

The reason for changing that is to match the JS implementation of `setValue` which behaves as described above (see relevant code here: 7cdd4d48c8/Libraries/Animated/src/AnimatedImplementation.js (L743))

**Test Plan:**
Use this sample app: https://snack.expo.io/B1V7RX9r-
Change: `USE_NATIVE_DRIVER` const between `true` and `false`.
See the animation stops regardless of the state of `USE_NATIVE_DRIVER` unlike before when it would stop only when `USE_NATIVE_DRIVER` was set to `false`
Closes https://github.com/facebook/react-native/pull/15054

Differential Revision: D5463750

Pulled By: hramos

fbshipit-source-id: e164c5299588ba8cac2937260c9ba9f6053b04e5
2017-07-20 14:20:30 -07:00
Rex Rao f32627f890 Fix cropImage crash with float displaySize
Summary:
On Android, using `ImageEditor.cropImage` with `displaySize` option may causes crash with exception below:

```
FATAL EXCEPTION: mqt_native_modules
                                                   Process: me.sohobloo.test, PID: 11308
                                                   com.facebook.react.bridge.UnexpectedNativeTypeException: TypeError: expected dynamic type `int64', but had type `double'
                                                       at com.facebook.react.bridge.ReadableNativeMap.getInt(Native Method)
                                                       at com.facebook.react.modules.camera.ImageEditingManager.cropImage(ImageEditingManager.java:196)
                                                       at java.lang.reflect.Method.invoke(Native Method)
                                                       at java.lang.reflect.Method.invoke(Method.java:372)
                                                       at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:345)
                                                       at com.facebook.react.cxxbridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:141)
                                                       at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
                                                       at android.os.Handler.handleCallback(Handler.java:815)
                                                       at android.os.Handler.dispatchMessage(Handler.java:104)
                                                       at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
                                                       at android.os.Looper.loop(Looper.java:194)
                                                       at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196)
                                                       at java.lang.Thread.run(Thread.java:818)
```

This is caused by getInt from `number` type of JS.

```javascript
      ImageEditor.cropImage(
        uri,
        {
          offset: {x: 0, y: 0},
          size: {width: 320, height: 240},
          displaySize: {width: 320.5, height: 240.5}
        }
      );
```
Closes https://github.com/facebook/react-native/pull/13312

Differential Revision: D5462709

Pulled By: shergin

fbshipit-source-id: 42cb853b533769b6969b8ac9ad50f3dd3c764055
2017-07-20 11:15:57 -07:00
Pieter De Baets ed3c018ee4 Remove legacy JSC profiler
Reviewed By: bnham

Differential Revision: D5433406

fbshipit-source-id: 8cbea8b9b46a0d9f29c57a5bcf605e6bb61ed8a7
2017-07-20 04:21:16 -07:00
Guichaguri bc0717c6cc Android: Added support to arrays in toBundle
Summary:
The support for `ReadableArray` in `toBundle` was never implemented, throwing an `UnsupportedOperationException` when trying to convert an array.

* Created `toList` -- A method that converts a `ReadableArray` to an `ArrayList`
* Modified `toBundle` to support arrays using `toList`
* Created `fromList` -- A method that converts a `List` to a `WritableArray`
* Modified `fromBundle` to also support lists using `fromList`

This PR allows `toBundle` and `fromBundle` (as well as `toList` and `fromList`) to work consistently without loosing information.

**Test Plan**

I've created three different arrays: one full of integers, one full of strings, and one mixed (with a integer, a boolean, a string, null, a map with a string and a boolean array), putting all of them inside a map.

After converting the map to a `Bundle` using `toBundle`, the integer array was retrieved through `Bundle.getIntegerArrayList`, the string array through `Bundle.getStringArrayList` and the mixed array through `Bundle.get` (casting it to an `ArrayList`)

After checking whether each value from the bundle was correct, I converted the bundle back to a map using `fromBundle`, and checked again every value.

The code and results from the test can be found in [this gist](https://gist.github.com/Guichaguri/5c7574b31f9584b6a9a0c182fd940a86).
Closes https://github.com/facebook/react-native/pull/15056

Differential Revision: D5460966

Pulled By: javache

fbshipit-source-id: a11b450eae4186e68bed7b8ce7dea8e5982e689a
2017-07-20 02:44:12 -07:00
Paco Estevez Garcia 0d16c7c982 Add app name to inspector device url
Reviewed By: bnham, Hypuk

Differential Revision: D5443705

fbshipit-source-id: 8c924948dd512be077e2f566da0cfc4110d5f843
2017-07-19 11:47:44 -07:00
Paco Estevez Garcia 90fad3c68b Add app name to PageInfo
Reviewed By: dcaspi

Differential Revision: D5436099

fbshipit-source-id: 73be706fbb36fe7c16b206de7ca3ba0cc3fa019b
2017-07-19 11:47:44 -07:00
sm2017 7e29b1fc77 Update WebSocketModule.java
Summary:
Convert to base64 not utf8

<!--
Thank you for sending the PR!

If you changed any code, please provide us with clear instructions on how you verified your changes work. In other words, a test plan is *required*. Bonus points for screenshots and videos!

Please read the Contribution Guidelines at https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md to learn more about contributing to React Native.

Happy contributing!
-->
Closes https://github.com/facebook/react-native/pull/15046

Differential Revision: D5451398

Pulled By: javache

fbshipit-source-id: b8c6c7b0fb50ca9558e92d3f63a088e343791b7f
2017-07-19 02:34:56 -07:00
Krzysztof Magiera b60a8dc6b9 Fix rotation matrix decomposition.
Summary:
This PR fixes an issue with rotation decomposition matrix on android.

The issue can be illustrated with this sample code https://snack.expo.io/r1SHEJpVb

It surfaces when we have non-zero rotation in Y or X axis and when rotation Z is greater than 90deg or less than -90deg. In that case the decomposition code doesn't give a valid output and as a result the view gets rotated by 180deg in Z axis.

You may want to run the code linked above on android and iOS to see the difference. Basically the example app renders first image rotated only by 89deg and the next one by 91deg. As a result you should see the second view being pivoted just slightly more than the first image. Apparently on android the second image is completely flipped:

iOS:
![screen shot 2017-07-07 at 12 40 30](https://user-images.githubusercontent.com/726445/27954719-7cf6d02c-6311-11e7-9104-5c3cc8e9b9c1.png)

Android:
![screen shot 2017-07-07 at 12 41 21](https://user-images.githubusercontent.com/726445/27954737-981f57e8-6311-11e7-8c72-af1824426c30.png)

The bug seemed to be caused by the code that decomposes the matrix into axis angles. It seems like that whole code has been overly complicated and we've been converting matrix first into quaternion just to extract angles. Whereas it is sufficient to extract angles directly from rotation matrix as described here: http://nghiaho.com/?page_id=846

This formula produces way simpler code and also gives correct result in the aforementioned case, so I decided not to debug quaternion code any further.

sidenote: New formula's y angle output range is now -90 to 90deg hence changes in tests.
Closes https://github.com/facebook/react-native/pull/14888

Reviewed By: astreet

Differential Revision: D5414006

Pulled By: shergin

fbshipit-source-id: 2e0a68cf4b2a9e32f10f6bfff2d484867a337fa3
2017-07-17 18:34:32 -07:00
Aaron Chiu a3142f50ed launch running setupReactContext in BG
Reviewed By: alexeylang

Differential Revision: D5185868

fbshipit-source-id: b7fcf289dca859d169eceb274f1fcd68e49a56d1
2017-07-14 17:39:36 -07:00
Paco Estevez Garcia a1e053cc50 Add Framework name to Attach selection
Reviewed By: Hypuk, javache

Differential Revision: D5389047

fbshipit-source-id: 90e2a5f805561e47e7705e7935ced7556a374616
2017-07-14 07:50:40 -07:00
Adam Comella 09401ed56f Android: Support setting background color on ARTSurfaceView
Summary:
This fixes support for the `backgroundColor` style prop on an `ART.Surface`.

`ARTSurfaceViewManager` inherits its `setBackgroundColor` implementation from `BaseViewManager`. This implementation broke in API 24 because API 24 removed support for `setBackgroundColor`on `TextureViews`. `ARTSurfaceView` inherits from `TextureView` so it also lost support for `setBackgroundColor`.

To fix this, the implementation of `ART.Surface's` `setBackgroundColor` was moved to the shadow node. The implementation now draws the background color on the canvas.

In a test app, verified that initializing and changing the background color on an `ART.Surface` works. Verified that the background renders as transparent when a background color isn't set. Also, this change is being used in my team's app.

Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/14117

Differential Revision: D5419574

Pulled By: hramos

fbshipit-source-id: 022bfed553e33e2d493f68b4bf5aa16dd304934d
2017-07-13 16:18:50 -07:00
Christian Brevik e2c87b59be Android: Set WebViewManager methods/fields as protected instead of private
Summary:
**Motivation**

See discussion in #10946. The motivation is to make `ReactWebViewManager` more extensible.

Re-using logic from the ReactWebViewManager when implementing your own custom WebView is a pain since so much of the logic is set as `private`.

This PR makes for easier extension/overriding of behavior, and less duplication of code, since most of the methods/fields are set as `protected` instead.

I've also made some "create" methods for the `WebView` and `WebViewBridge` so they can more easily be overridden.

**Test plan**
The test plan is the same as the other PR (#10946). I've made an simple test app which extends `RCTWebViewManager`: https://github.com/cbrevik/overrideWebview

See [CustomWebViewManager.java](https://github.com/cbrevik/overrideWebview/blob/master/android/app/src/main/java/com/overridewebview/CustomWebViewManager.java) for a simple implementation.

CC shergin (https://github.com/facebook/react-native/pull/10946#issuecomment-304763562)
Closes https://github.com/facebook/react-native/pull/14261

Differential Revision: D5413922

Pulled By: shergin

fbshipit-source-id: d2f6d478f2a147e2e7b5e05c195a8b28a0a3d576
2017-07-12 21:14:32 -07:00
Felix Oghina 999851a389 Update OSS Fresco dependency
Reviewed By: oprisnik

Differential Revision: D5406106

fbshipit-source-id: 3d928f431701b783fa0862d0dff818ec61d8b737
2017-07-12 07:54:09 -07:00
Alexander Komissarov 8f363b2c49 Converting more android support library dependencies in React Native. Now for v7
Reviewed By: achen1

Differential Revision: D5332443

fbshipit-source-id: 085be2d542feb29c3727958908648237c3ed0503
2017-07-10 17:18:11 -07:00
Nurzhan Bakibayev c00abe53c3 Move inspector proxy out of the packager
Reviewed By: pakoito

Differential Revision: D5369099

fbshipit-source-id: ff806d784b70804181c5c54837352f66e45d1b9e
2017-07-10 06:31:23 -07:00
Kevin Luvian e6941990ef Fixed new line and prioritise blurOnSubmit in multiline text input
Summary:
What existing problem does the pull request solve?
this fixes #13506 and #12717 where:
- there are some issues when pressing enter with some keyboard
- blurOnSubmit is not working with multiline

I think this should be in stable branch as this is pretty critical, isn't it?

- just create a TextInput with multiline and press enter with samsung keyboard
before, it won't create a new line, now it will.

- just create a TextInput with multiline and blurOnSubmit true and press enter
before, it won't blur, and wont create a new line (on some keyboard, it will create a new line), now it will blur only
Closes https://github.com/facebook/react-native/pull/13890

Reviewed By: achen1

Differential Revision: D5333464

Pulled By: shergin

fbshipit-source-id: a0597d1b1967d4de1486e728e03160e1bb15afeb
2017-07-09 15:34:10 -07:00
Seth Fitzsimmons 9afb71fde8 Replace React.createClass with create-react-class
Summary:
This replaces all uses of `React.createClass` with `createReactClass` from the `create-react-class` package, attempting to match use of `var` and `const` according to local style.

Fixes #14620
Refs #14712
Closes https://github.com/facebook/react-native/pull/14729

Differential Revision: D5321810

Pulled By: hramos

fbshipit-source-id: ae7b40640b2773fd89c3fb727ec87f688bebf585
2017-07-07 14:36:01 -07:00
Pieter De Baets 8548ca09f1 Remove unused RCTDebugComponentOwnership
Reviewed By: sahrens

Differential Revision: D5380887

fbshipit-source-id: ff81324718d64d7a04ef4bd293d30dd6f3aabb2a
2017-07-07 12:04:04 -07:00
Kathy Gray 6796abbe55 Using shared bridge path for RN
Reviewed By: javache

Differential Revision: D5002111

fbshipit-source-id: 86c2856145a6595823fd027145b050a6fba3d90d
2017-07-07 05:30:38 -07:00
Pieter De Baets a8a29a92a0 Simplify macro usage in MethodInvoker
Reviewed By: kathryngray

Differential Revision: D5363934

fbshipit-source-id: a9cffb10b4d6244d1d66267f6c1e07ba69663b9c
2017-07-07 03:06:21 -07:00
Pieter De Baets 465a68db1f Remove xcode_public_headers_symlinks from RN BUCK files
Reviewed By: dinhviethoa

Differential Revision: D5321259

fbshipit-source-id: b07ff4a01280251deb2113a62197d96d5c2e37a1
2017-07-06 12:16:20 -07:00
Alexander Komissarov 1ab96fd077 Converting android support library dependencies to be provided_deps in React Native.
Reviewed By: bestander

Differential Revision: D5326236

fbshipit-source-id: 3f2ca43a78c4c868ed6665b4d9f61630631f9502
2017-07-05 19:15:22 -07:00
Kathy Gray 3525998884 Setup experiment for split packages
Reviewed By: javache

Differential Revision: D5314224

fbshipit-source-id: b9bc28b8f4e058db1dcc0c17f7dc84bf15eb33f9
2017-07-04 04:01:14 -07:00
Kathy Gray e301a36606 Splitting packages into core bridge and core RN
Reviewed By: javache

Differential Revision: D4953811

fbshipit-source-id: 05ab9acc81e31bbb85005cd80eeebc550a6c452e
2017-07-04 04:01:14 -07:00
Kaibin Yin c42080eaaf add peeking feature in AndroidViewPage(RN)
Reviewed By: sahrens

Differential Revision: D5340198

fbshipit-source-id: b2986a320a39225882d4289b193e1d22e9e7547e
2017-06-30 22:21:06 -07:00
Joana Lopes 25d19e3830 Translating NativeArray into NativeMap on getConstants
Reviewed By: javache

Differential Revision: D5321741

fbshipit-source-id: 2465c69a5bd1d4f3cf20ba73e163372b12616312
2017-06-29 04:19:30 -07:00
Jean Lauliac 33057aacbf React Native: disable multipart bundle transmission for now
Reviewed By: davidaurelio

Differential Revision: D5329011

fbshipit-source-id: 5093bc5b1858314512313934fba04f4343fe0d5b
2017-06-29 04:19:30 -07:00
Janic Duplessis 960e5db0ed Add dev bundle download listener on Android
Summary:
This exposes a way to listen to JS bundle download events when creating a ReactInstanceManager. This can be used to display a custom native UI while the JS bundle is loading. It is a pretty specific use case but Expo will need this to display loading progress on the app loading splash screen.

**Test plan**
Tested by adding a listener to the ReactInstanceManager in the Expo app and checked that it gets called when the bundle is loading.
Closes https://github.com/facebook/react-native/pull/12984

Reviewed By: devknoll

Differential Revision: D4797638

Pulled By: hramos

fbshipit-source-id: 04d7cd4071535670c1bcb121566748e495197c80
2017-06-28 20:01:17 -07:00
Wenjia Ma f954f3d9b6 Add velocity to onScrollEndDrag event
Reviewed By: achen1

Differential Revision: D5330215

fbshipit-source-id: e45a302b325c38294324f4f384a5604355dc05aa
2017-06-27 15:57:00 -07:00
Alex Kring bb832e1238 Akring integration tests fix
Summary:
Fix a bug that allows us to run integration tests in our android project, where RN is specified as a module to our project.

sdkHandler does not exist. The android documentation suggests that we should be using android.ndkDirectory instead.

http://tools.android.com/tech-docs/new-build-system/migrating-to-1-0-0

An alternative solution would be to set the environment variable ANDROID_NDK, but we do not want to rely on setting this environemnt variable at a system wide level.

We ran two tests.
1.) perform a gradle sync from within our Android studio project, and verify there is no error output.
2.) build android using ./gradleW, from command land. Verify there are no build errors.
Closes https://github.com/facebook/react-native/pull/14136

Differential Revision: D5327421

Pulled By: shergin

fbshipit-source-id: d9e18519a8ca318f2026eb409b90cb09e2adbda1
2017-06-26 21:01:17 -07:00
Pieter De Baets 83faa4b608 Simplify Catalyst handleMemoryPressure
Reviewed By: cwdick

Differential Revision: D5200555

fbshipit-source-id: 86f12acca33ece265d3482ba52de9afcc83173cd
2017-06-26 06:01:14 -07:00
Andrew Y. Chen 076eaec805 Revert D5238126: Add velocity to onScrollEndDrag event
Differential Revision: D5238126

fbshipit-source-id: a8b5f9445fa15a0ef0851303961dbf63b5d46623
2017-06-23 19:02:27 -07:00
Pieter De Baets e2628f93b5 Rename Executor to JSExecutor
Summary:
* Cleanup some header files so we use more forward declarations
* Rename Executor to JSExecutor.h
* Move some typedefs to more appropriate locations

Reviewed By: mhorowitz

Differential Revision: D5301913

fbshipit-source-id: e75154797eb3f531d2f42a5e95409f4062b85f91
2017-06-23 17:01:25 -07:00
Wenjia Ma d4cda7168f Add velocity to onScrollEndDrag event
Summary:
1. Calculated the fling slow down velocity using OnScrollDispatchHelper
2. Calculated the END_DRAG velocity using velocity tracker in VelocityHelper.
3. Change the interface of ReactScrollViewHelper to pass velocity on x & y.

Pending future work:
Calculate the velocity of BEGIN_DRAG, MOMENTUM_BEGIN and MOMENTUM_END
Add threshold in ScrollResponder.js instead of checking x & y velocity equal zero

Reviewed By: achen1

Differential Revision: D5238126

fbshipit-source-id: 35fb70dda8ab66cd152413cb9c1c041354f1c061
2017-06-23 14:00:57 -07:00
Andrew Y. Chen ecccd06662 API check for removeOnGlobalLayoutListener in ReactRootView
Reviewed By: AaaChiuuu

Differential Revision: D5308604

fbshipit-source-id: adf4abbdd59e54c18fcae946f2f7e3af89e7190c
2017-06-23 10:37:59 -07:00
Nick Eddy a6607968c4 Fixing drawing bug in ReactArt on Android
Summary: This change fixes rendering issues with arcs having an inner radius.  The root cause was a bug that lost the negative sign for counter-clockwise angles.  The previous code also incorrectly set the start angle to the end angle.

Differential Revision: D5298320

fbshipit-source-id: 4d11edfed5bdab0cf68313d22f94ef0e3711a1a8
2017-06-23 09:30:37 -07:00
Kathy Gray 2b89416ac0 Only load core modules once
Reviewed By: javache, AaaChiuuu

Differential Revision: D5303176

fbshipit-source-id: f00ecacaa695ce7a4f8b57c66cee38bb70883cae
2017-06-22 11:55:19 -07:00
Pieter De Baets d795fa1b2c Update native references to JSTimers
Reviewed By: AaaChiuuu

Differential Revision: D5294997

fbshipit-source-id: 3003d56f744af0c35b1ffef7bdd71617d4f948c3
2017-06-22 09:52:33 -07:00
Kathy Gray 4566f01fbd Fix package order on reactinstancemanager
Reviewed By: alexeylang

Differential Revision: D5296348

fbshipit-source-id: bfd859085758f1f78a927b2ad4464ed9aff82c58
2017-06-21 16:30:38 -07:00