Commit Graph

11400 Commits

Author SHA1 Message Date
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
Sam Goldman 9d54a10cf8 @allow-large-files Deploy Flow v0.51.0 to xplat
Reviewed By: gabelevi

Differential Revision: D5481707

fbshipit-source-id: 66f7417e7ecf1dea609a3efbecfed45dcbc9527f
2017-07-24 14:35:09 -07:00
Eric Rozell 59105f6b1e Adds hook for platform-specific View props
Summary:
Platforms that plug in to react-native may require additional props that are specific to those platforms. For example, already in react-native there are props that are specific to Android (`accessibilityComponentType`, `needsOffscreenAlphaCompositing`, etc.), props that are specific to iOS (`accessibilityTraits`, `shouldRasterizeIOS`, etc.) and props that are specific to tvOS (`isTVSelectable`, `tvParallaxProperties`, etc.).

I need to add properties to `react-native-windows`, and I'd prefer not to override the entire `ViewPropTypes` file as it is a risk that things in react-native-windows fall out of sync with react-native.

Fixes #15173

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

Differential Revision: D5481444

Pulled By: hramos

fbshipit-source-id: 3da08716d03ccdf317ec447536eea3699dd7a760
2017-07-24 12:26:58 -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
Satyajit Sahoo 4de9d64e62 Improve Headless JS documentation
Summary: Closes https://github.com/facebook/react-native/pull/15174

Differential Revision: D5481462

Pulled By: hramos

fbshipit-source-id: 6bf293fabd30102f1eddf48f3afa4d3683fc577b
2017-07-24 11:31:01 -07:00
r_fujiwara f39f21660d Update Navigation.md
Summary:
NavigatorIOS push method arg is route object.
For working this image animation,
add passProps property to NavigationIOS,
changed _onForward function navigator.push method arg is route object

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

Differential Revision: D5481399

Pulled By: hramos

fbshipit-source-id: b131ef27b70fc0bbc4f519a924187c19dca73ed2
2017-07-24 11:31:01 -07:00
Jason Gaare f7043699b0 Use Apple's significant-change API (for iOS 11 UX)
Summary:
In the yet-to-be-released iOS 11, Apple has changed the way they notify the user of location services. (You can watch their session from WWDC about all the changes [here](https://developer.apple.com/videos/play/wwdc2017/713/).)

The current implementation of `RCTLocationObserver` uses the standard location services from Apple. When the user has granted `Always` location permission and the application uses the background location service, the user is presented with the *_Blue Bar of Shame_* (for more information check out [this blog post](https://blog.set.gl/ios-11-location-permissions-and-avoiding-the-blue-bar-of-shame-1cee6cd93bbe)):

![image](https://user-images.githubusercontent.com/15896334/28285133-281e425c-6af9-11e7-9177-61b879ab593c.png)

* Added `useSignificantChanges` boolean to the options passed.

* Added `_usingSignificantChanges` boolean based on user options. If `true`, then the CLLocationManager will use functions `startMonitoringSignificantLocationChanges`/ `stopMonitoringSignificantLocationChanges` rather than the standard location services.
* Changed method signature of `beginLocationUpdatesWithDesiredAccuracy` to include `useSignificantChanges` flag
* Added check for new `NSLocationAlwaysAndWhenInUseUsageDescription`

All unit tests passed.

Tested in simulator and on device, toggling `useSignificantChanges` option when calling `watchPosition`. Results were as expected. **When `TRUE`, the _Blue Bar of Shame_ was not present.**

Changes do not affect Android and location services still work as expected on Android.

* Change is for iOS only
* Using a different API will have different accuracy results. Adding `useSignificantChanges` as an option was by design so apps that want to have most accurate and most frequent update can still use standard location services.
Closes https://github.com/facebook/react-native/pull/15062

Differential Revision: D5443331

Pulled By: javache

fbshipit-source-id: 0cf5b6cd831c5a7c8c25a5ddc2e410a9aa989bf4
2017-07-24 11:23:10 -07:00
Taylor Kline 64899c08f3 Identify keyboardDismissMode platform-specific options
Summary:
Similar to `TextInput`'s `returnKeyType`, comments allow to see at a glance which options are cross-platform and which are not.

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

Differential Revision: D5480895

Pulled By: hramos

fbshipit-source-id: c38337def920678d29c8322e52b54f57e80cb95b
2017-07-24 11:23:10 -07:00
Touko Vainio-Kaila 879d2e3cc5 Retry for #14830 - Fix "Handling Text Input" tutorial's "next" within text
Summary:
Retry for https://github.com/facebook/react-native/pull/14830.

There was some problem with the import and hramos instructed to open a new PR with the same changes. See https://github.com/facebook/react-native/pull/14830#issuecomment-315146320 for more details.

-----

The tutorial pages tend to have a "follow to the next topic" section at the end of the text.

HandlingTextInput.md has handling-touches in the "next" in metadata, but the "follow to the next topic" section linked to ScrollView tutorial page. Thus, the "follow to the next topic" section in the text is updated also to point to handling-touches.
Closes https://github.com/facebook/react-native/pull/15176

Differential Revision: D5480608

Pulled By: hramos

fbshipit-source-id: 5161d1acad6a3f0401fd5d15d5ff29a0701a1211
2017-07-24 10:15:47 -07:00
Valentin Shergin 324eba14d5 BREAKING: Removed couple unused notifications from RCTUIManager
Reviewed By: javache

Differential Revision: D5477733

fbshipit-source-id: 85f90c534fffd6ea9f8f7ad1c0e0fddc1ebdec62
2017-07-24 09:42:06 -07:00
Valentin Shergin 1b9b366cef Removed unused ivar (`_launchOptions`) from `RCTRootView`
Reviewed By: javache

Differential Revision: D5477683

fbshipit-source-id: 05191c98573fe74105d6af2a098f2a8c4479e09c
2017-07-24 09:42:06 -07:00
Kip Ricker cfeaefb4e0 iOS: Fix font weight resolution
Summary:
**Issue:**
Some fonts are defined with weights that don't match with the UIFontWeight constants.

**Example:**
UIFontWeightTraits for Roboto font
Light: -0.230
Thin: -0.365

Currently, the UIFontWeightTrait is always used if it != 0.0, and given the UIFontWeight constants for Light and Thin:
UIFontWeightThin -0.6
UIFontWeightLight -0.4

A style font weight of "300" or "200" will both resolve to Roboto-Thin as its weight -0.365 is closer to -0.4 (UIFontWeightLight) and -0.6 (UIFontWeightThin) than -0.230 (Roboto-Light).

**Proposed fix:**
When resolving `getWeightOfFont` try to match the name of weight to the name of the font first, and guess the font with UIFontWeightTrait as the fall back.

**Test Plan:**
Attempt to display Roboto at weights "200" and "300" and Roboto-Thin and Roboto-Light should be displayed correctly.

Current:
![simulator screen shot jul 7 2017 11 44 42 am](https://user-images.githubusercontent.com/889895/28506859-31b274e8-6fe3-11e7-8f92-f41ff2183356.png)

Fixed:
![simulator screen shot jul 7 2017 11 42 25 am](https://user-images.githubusercontent.com/889895/28506861-365ea3f4-6fe3-11e7-992c-9f426785037f.png)
Closes https://github.com/facebook/react-native/pull/15162

Differential Revision: D5479817

Pulled By: javache

fbshipit-source-id: a9f93d8ce69a96fb685cb09393d1db42486cc0c2
2017-07-24 08:33:04 -07:00
Isaac Odhiambo 3683ff8d95 Update DrawerLayoutAndroid.android.js
Summary:
Currently in the documentation is not clear on how to use the `openDrawer` and `closeDrawer` methods. There is no mention of the requirement to use refs in order to access the Drawer. This should make it clear on how to do the above.
Closes https://github.com/facebook/react-native/pull/13961

Differential Revision: D5479993

Pulled By: hramos

fbshipit-source-id: 4d29f695fbaf097d47f75b345b9998f61156f467
2017-07-24 08:16:25 -07:00
Alex Dvornikov 9342f25d5f Inline requires in JSTimers
Reviewed By: javache

Differential Revision: D5466322

fbshipit-source-id: 0bcc71e19cdb48d95b5e35ae2f720d46baf9bb50
2017-07-24 07:20:34 -07:00
Alex Dvornikov 5da7629b44 Clean up property defines in InitializeCore
Reviewed By: javache

Differential Revision: D5472176

fbshipit-source-id: feb81bd9ee04eb7e54d51524c367b10b385b33ae
2017-07-24 07:20:34 -07:00
Alex Dvornikov 0736f5d190 Make Set and Map initialization lazy
Reviewed By: javache

Differential Revision: D5461810

fbshipit-source-id: 6f22528bac4dd6e073e98a093e02d84114d0706a
2017-07-24 07:20:33 -07:00
Pieter De Baets 98258b437c Simplify -[RCTModuleMethod processMethodSignature]
Reviewed By: fromcelticpark

Differential Revision: D5397371

fbshipit-source-id: d341d55fd8bd1a67a0980543f8defedfd12b5dd4
2017-07-24 07:01:53 -07:00
Pieter De Baets cb12080179 Replace exported method registration with statically allocated struct
Reviewed By: fromcelticpark

Differential Revision: D5389383

fbshipit-source-id: 9eb29b254b616574966b43ad24aa880d44589652
2017-07-24 07:01:53 -07:00
Paco Estevez Garcia d94f3e4b98 Debugger channel messages should be processed only on a background thread
Reviewed By: bnham

Differential Revision: D5470226

fbshipit-source-id: ccbc351e3f64f2baa8a3c74c5d0c67c44731bf32
2017-07-24 06:45:26 -07:00
Pieter De Baets a806e9035e Fix build-break in legacy React bridge
Reviewed By: fromcelticpark

Differential Revision: D5479832

fbshipit-source-id: 764672a489216910a4646bfe9a798bf728cfe8dd
2017-07-24 06:34:55 -07:00
Pieter De Baets 543cd217f6 Fix incorrect invocation of JSClassCreate
Reviewed By: kathryngray

Differential Revision: D5465118

fbshipit-source-id: 16e1a1af52fb1ef41fa02e380223e9e90c0611ba
2017-07-24 05:03:53 -07:00
Pieter De Baets db3df3400a Breaking - make RCTDeviceEventEmitter warnings fatal
Reviewed By: davidaurelio

Differential Revision: D5469832

fbshipit-source-id: 1eb4ad3a2b3e1fa10d75e42d1d2f7baa291cb6f4
2017-07-24 03:47:59 -07:00
Tomas Reimers 3eae3df5d1 Add docs for onMomentumScrollBegin
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/15158

Differential Revision: D5479401

Pulled By: shergin

fbshipit-source-id: d4864e1630a36deb1a227c1b6242255ac1f788e6
2017-07-24 01:17:30 -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
Tomas Reimers b8118d1b79 Add documentation for onMomentumScrollEnd
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/15144

Differential Revision: D5478574

Pulled By: shergin

fbshipit-source-id: 33c49f0efdfb3a518e1ee254b1dc01ec22f09269
2017-07-23 14:07:44 -07:00
Jordan Papaleo 7aec6aef4a resolved the broken links for all components method in page linking
Summary:
Fixed #12327

- Run the website locally
- Navigate to: http://localhost:8079/react-native/docs/statusbar.html
- Click the StatusBarAnimation and the StatusBarStyle in the Method section
- The links will now go to the correct in page anchor tags instead of the getting started page

The `website/layout/*.js` files could use some serious love.  I would really like the opportunity to do that with the react team I run.  Let me know :)
Closes https://github.com/facebook/react-native/pull/14028

Differential Revision: D5478418

Pulled By: hramos

fbshipit-source-id: b565847da3c280466ed088fd820b5bfe0474bba0
2017-07-23 09:54:25 -07:00
Louis Lagrange 8dea90ba8b Update Images.md with ImageBackground
Summary:
This part of the documentation was outdated since v0.46. :)
Closes https://github.com/facebook/react-native/pull/15151

Differential Revision: D5478408

Pulled By: shergin

fbshipit-source-id: a9d442560ad2768a684b9bbb11285b5f20f9d00d
2017-07-23 08:45:44 -07:00
Abi Raja c748d692a4 fix typo in Animations guide
Summary: Closes https://github.com/facebook/react-native/pull/15130

Differential Revision: D5469665

Pulled By: shergin

fbshipit-source-id: 096e876b60234d90921467d5497a8250e765f885
2017-07-22 00:23:32 -07:00
Miguel Jimenez Esun 98e61de19f Add missing "getPolyfills" tag
Reviewed By: jjmaestro

Differential Revision: D5476971

fbshipit-source-id: 264d80d5370d3d1cff174dacc7349d2d0be0ff89
2017-07-21 22:04:36 -07:00
Garrett McCullough 8117fa16c9 Improve the documentation for ListView and ListViewDataSource
Summary:
What existing problem does the pull request solve?
My motivation was to improve the documentation for ListView and ListViewDataSource because I always have trouble remembering how they work and the documentation was lacking an example for `cloneWithRowsAndSections`

My PR does the following:
* add a note about how headers and footers are rendered on a horizontal ListView
* fix a typo in an example
* clarify that the sectionIdentities should match the keys or array indexes of the data source
* add an example of cloneWithRowsAndSections
* add notes on the return values of `getRowCount` and `getRowAndSectionCount`

n/a; documentation only

![screenshot of ListViewDataSource changes](https://cloud.githubusercontent.com/assets/580060/25768881/d339544a-31c1-11e7-88a1-5e60bc008500.png)
Closes https://github.com/facebook/react-native/pull/13811

Differential Revision: D5473192

Pulled By: hramos

fbshipit-source-id: f31fc6edfdeb8dff75d39bbcceda06fd839df934
2017-07-21 14:31:17 -07:00
Martin Kralik 436218b08d Export stringForScriptTag symbol
Reviewed By: javache

Differential Revision: D5470782

fbshipit-source-id: 889d3251f01b5f5d4e75b32dceb12a99e9e61262
2017-07-21 14:05:34 -07:00
sunnylqm 214f544e37 Remove unnatural indent in doc
Summary:
http://facebook.github.io/react-native/docs/animated.html#animatedvalue

before
![before](https://cloud.githubusercontent.com/assets/615282/25734690/172c105e-3198-11e7-99a6-394a88559924.png)

after
![after](https://cloud.githubusercontent.com/assets/615282/25734692/1b89687c-3198-11e7-83e8-a53f0b6c46b7.png)
Closes https://github.com/facebook/react-native/pull/13794

Differential Revision: D5472001

Pulled By: hramos

fbshipit-source-id: 5ac16a15f2d1a63392ff442ab9ba177e9bc90721
2017-07-21 12:45:59 -07:00
Spencer Ahrens a946f86039 Hide vs. Show --> Toggle Inspector
Reviewed By: javache

Differential Revision: D5470663

fbshipit-source-id: e2b3ac013d0c97d02acc619bb72543d3d1a82218
2017-07-21 11:46:28 -07:00
Christoph Nakazawa 4caf79471b Improve transform speed by 8.5%
Reviewed By: jeanlauliac

Differential Revision: D5443966

fbshipit-source-id: 06a151f44b7b9f8307be2ea47ce35deb3663869f
2017-07-21 09:40:15 -07:00
Spencer Ahrens 365aea3415 Libraries/Shared --> Libraries/www-shared, EventEmitter --> vendor/emitter
Reviewed By: fkgozali

Differential Revision: D5455575

fbshipit-source-id: 0eb4da4b1d8688b704f2f751143610e6ed836ce7
2017-07-21 09:40:15 -07:00
Alex Dvornikov 70edc2fd80 Upgrade metro-bundler to v0.10.0
Reviewed By: davidaurelio

Differential Revision: D5469746

fbshipit-source-id: 1d2c0f6c5bb9761cfc54b6c9fdbb1a9f20f535ea
2017-07-21 09:40:15 -07:00
Pieter De Baets eb0d99c812 Conditionally export JSTimers (retry)
Reviewed By: davidaurelio

Differential Revision: D5469811

fbshipit-source-id: db7d783d7104123f4402c147d9553f8d393bbf83
2017-07-21 08:16:11 -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
Fred Liu 1728a866ef Revert D5465182: creatClass codemod
Differential Revision: D5465182

fbshipit-source-id: a15de76f50294123323e211f8e11106b90fff911
2017-07-20 19:32:33 -07:00
Brian Vaughn 500d5e23a6 creatClass codemod
Reviewed By: acdlite, flarnie

Differential Revision: D5465182

fbshipit-source-id: 084d364abb7bf74e799dbf24a4c1c01a3bf7cd46
2017-07-20 18:18:56 -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
Nat Mote 8e8fecdcf8 Upgrade to Flow v0.50.0
Reviewed By: gabelevi

Differential Revision: D5438335

fbshipit-source-id: 7a96f68e7147e984c6f0cb84f957e639d36ca6b3
2017-07-20 14:48:56 -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
Marc Horowitz 2334899dfe in RCT_DEBUG mode, make the js stack bigger
Reviewed By: javache

Differential Revision: D5459755

fbshipit-source-id: 169cb542c92ea6d5e438c4bbe35879e7a097a3aa
2017-07-20 12:16:21 -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
Chirag Jain bf752014a9 use propTypes directly
Summary:
Just noticed this commit creates a new variable for propTypes instead of using it directly. c2c97ae4b1

Should be straighforward.
Closes https://github.com/facebook/react-native/pull/15113

Differential Revision: D5460980

Pulled By: javache

fbshipit-source-id: 7446be8af22557d4bd4eddb711272b914ca48112
2017-07-20 03:19:45 -07:00
Shir Levkowitz ced1513b62 Pass actual loaded image size to load (iOS).
Summary:
Motivation: The JavaScript image component's onLoad callback optionally
accepts dimensions width and height, allowing the parent of the image to
obtain the native size (without an extra bridge call). It was found that
the dimensions passed into this callback on iOS are frequently (0,0),
not the true native dimensions. This change ensures that the image's
dimensions are passed to the callback. (Examination of the initializer
for RCTImageSource, + (RCTImageSource *)RCTImageSource:(id)json,
indicates that not all code paths produce a size other than CGSizeZero.)
Closes https://github.com/facebook/react-native/pull/15116

Differential Revision: D5460979

Pulled By: javache

fbshipit-source-id: 2dca03c3aae974ef70e981039aa6a804b8e128c8
2017-07-20 03:05:11 -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
Janic Duplessis 3ce36698de Validate the content type of the bundle returned by the packager
Summary:
When using the packager behind something like an http tunnel it is possible something else than JS is returned, in that case throw an error instead of trying to parse it.

This is useful for Expo since the packager runs behind ngrok. This allows to intercept that error and show a more meaningful error message based on the ngrok response.

**Test plan**
Tested by changing the packager to return text/html content type and validate that the error shows up properly.
Also tested that it works when multipart response is disabled.

<img width="354" alt="screen shot 2017-07-19 at 8 01 58 pm" src="https://user-images.githubusercontent.com/2677334/28394905-39e86d52-6cbe-11e7-9059-13a85816a57e.png">
Closes https://github.com/facebook/react-native/pull/15112

Differential Revision: D5459395

Pulled By: shergin

fbshipit-source-id: aaea7ab2e1311ee8dc10feb579adf9b9701d8d4c
2017-07-19 19:10:00 -07:00