Commit Graph

2061 Commits

Author SHA1 Message Date
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