Commit Graph

1988 Commits

Author SHA1 Message Date
Mike Grabowski 9d7b537dd4 Mention native code in `Linking` docs
Summary:Fixes #5925
Closes https://github.com/facebook/react-native/pull/7101

Differential Revision: D3206134

fb-gh-sync-id: e65ae97c32685d6acc08be2019dd2da902e01bc9
fbshipit-source-id: e65ae97c32685d6acc08be2019dd2da902e01bc9
2016-04-20 19:23:19 -07:00
Philipp von Weitershausen ed930b4710 Add support for sending binary data in websockets
Summary:This is a reprise of #6327, but with iOS 7.0 compatibility and less `package.json` changes.

**Test Plan:** Load WebSocketExample in UIExplorer app and start websocket test server script (both provided in #6889) and test sending binary data on both iOS and Android
Closes https://github.com/facebook/react-native/pull/6961

Differential Revision: D3202022

Pulled By: mkonicek

fb-gh-sync-id: 38843d0a9c0172971c5c70a5139ded04042b280a
fbshipit-source-id: 38843d0a9c0172971c5c70a5139ded04042b280a
2016-04-20 08:53:25 -07:00
Spencer Ahrens ad15b74aae cleanup and open source JS BugReporting module
Summary:This is just the JS part of a bug reporting module that can be used with a pure JS flow or a native reporting
flow. It's handy for grabbing data from a bunch of random components, like the ids of the rows that are visible in a
list view at the time the bug is reported, or a description of the current navigation stack.

It's initialized in `AppRegistry` so it's always ready to go and bug reports will always include the universal
`runApplication` info, but won't actually do anything by default unless `collectExtraData` is called.

Note: some apps may call `runApplication` multiple times if they have multiple react native root views. This will just
overwrite the source so it will just report the most recently mounted one.

Reviewed By: foghina

Differential Revision: D3200203

fb-gh-sync-id: 8ed45fc9b289e8d9c50d3c85926213bd245d3ecc
fbshipit-source-id: 8ed45fc9b289e8d9c50d3c85926213bd245d3ecc
2016-04-20 08:09:07 -07:00
Dave Miller eb21b25e2d Fix Popover.android to bubble events correctly
Reviewed By: andreicoman11, fkgozali

Differential Revision: D3197104

fb-gh-sync-id: 882f85175f87200b7aef1ca4204d6dfb6c4c4c69
fbshipit-source-id: 882f85175f87200b7aef1ca4204d6dfb6c4c4c69
2016-04-20 00:59:27 -07:00
Hedger Wang 6731de7b45 Fix NavigationView.
Reviewed By: ericvicenti

Differential Revision: D3200293

fb-gh-sync-id: 3ffc7053b11f926461c45e19651d07295ca3ae72
fbshipit-source-id: 3ffc7053b11f926461c45e19651d07295ca3ae72
2016-04-19 19:56:21 -07:00
Elliot Lynde 7e515f8d4a Wait longer for debugger proxy
Reviewed By: yuzhi

Differential Revision: D3198412

fb-gh-sync-id: fe11f74b2a019accc24b08162746ce4793a49b90
fbshipit-source-id: fe11f74b2a019accc24b08162746ce4793a49b90
2016-04-19 17:13:25 -07:00
Hedger Wang 81c62c5f41 Fix initial scenes rendering.
Summary:The initial layout used to render scenes does not contain the actual
width and height measured and causes the issue as described at
https://github.com/ericvicenti/navigation-rfc/issues/61

The fix is to update the layout and re-render scenes once layout
is modified. Also scenes renderer should also consider the case that
when the layout is not measured yet.

Reviewed By: ericvicenti

Differential Revision: D3162143

fb-gh-sync-id: 197574329d3849cad2a21e07e1bd5e800f74c3ea
fbshipit-source-id: 197574329d3849cad2a21e07e1bd5e800f74c3ea
2016-04-19 15:57:20 -07:00
Spencer Ahrens ecae44aaae Fix potential "Should never unset includeInLayout" invariant
Reviewed By: devknoll

Differential Revision: D3194174

fb-gh-sync-id: 67d065ea90f8416a5fc7e3651c68350f895f9639
fbshipit-source-id: 67d065ea90f8416a5fc7e3651c68350f895f9639
2016-04-19 13:55:26 -07:00
Krzysztof Magiera ec5dfbf8c7 Support for Animated.multiply node
Summary:This change adds native animated support for Animated.multiply nodes.

Animated.multiply allows for defining nodes that would output a product of values of the input nodes.

**Test Plan**
Run JS tests: `npm test Libraries/Animated/src/__tests__/AnimatedNative-test.js`
Run java tests: `buck test ReactAndroid/src/test/java/com/facebook/react/animated`
Closes https://github.com/facebook/react-native/pull/7071

Differential Revision: D3197663

fb-gh-sync-id: 35f64244a2482c487a81e5e7cd08f3c0e56d9b78
fbshipit-source-id: 35f64244a2482c487a81e5e7cd08f3c0e56d9b78
2016-04-19 13:20:20 -07:00
Dave Miller 551c154261 Remove RKModal and Portal
Reviewed By: andreicoman11

Differential Revision: D3192529

fb-gh-sync-id: 4ea5d9d3e3b4f435e86a5dba4ddb7812f8d00fbc
fbshipit-source-id: 4ea5d9d3e3b4f435e86a5dba4ddb7812f8d00fbc
2016-04-19 07:42:29 -07:00
Thom Dixon d586daad51 Fix red screen due to ref being undefined in PullRefreshViewAndroid
Summary:This fixes the error
`undefined is not an object (evaluating 'this.refs[NATIVE_REF].setNativeProps')`, which seems to occur when the refresh fails (in our case due to CORS).

![screen shot 2016-03-16 at 12 23 52](https://cloud.githubusercontent.com/assets/461514/13826121/1f8b0aaa-eb73-11e5-81e3-b2c60e536bf0.png)
Closes https://github.com/facebook/react-native/pull/6489

Differential Revision: D3172217

fb-gh-sync-id: 5ba3b2653685888f5358ef32b01b441757eff7c8
fbshipit-source-id: 5ba3b2653685888f5358ef32b01b441757eff7c8
2016-04-19 06:58:22 -07:00
Krzysztof Magiera b5375bdc09 Support for Animated.add
Summary:This change adds suport native animated support for Animated.add.

Animated.add lets you declare node that outputs a sum of it input nodes.

**Test Plan**
Play with the following playground app: https://gist.github.com/39de37faf07480fcd7d1
Run JS tests: `npm test Libraries/Animated/src/__tests__/AnimatedNative-test.js`
Run java tests: `buck test ReactAndroid/src/test/java/com/facebook/react/animated`
Closes https://github.com/facebook/react-native/pull/6641

Differential Revision: D3195963

fb-gh-sync-id: bb1e1a36821a0e071ad0e7d0fa99ce0d6b088b0a
fbshipit-source-id: bb1e1a36821a0e071ad0e7d0fa99ce0d6b088b0a
2016-04-19 02:58:21 -07:00
Angela Hess 64d5da7754 Replace opacity console error with warning
Summary: This error message is remarkably aggressive relative to the severity of the issue, particularly since the pattern in question is used / necessary throughout the codebase. Animated ReactART components with set opacities trigger this error, and opacity coming from the style prop is not respected.

Reviewed By: sahrens

Differential Revision: D3177554

fb-gh-sync-id: 96061d5ff526177814996b28e4394e6649839582
fbshipit-source-id: 96061d5ff526177814996b28e4394e6649839582
2016-04-18 18:53:20 -07:00
Philipp von Weitershausen ebb44d202b Clean up and simplify WebSocket implementation on the JS side
Summary:- Get rid of no longer necessary WebSocket.js v WebSocketBase.js split
- Use `EventTarget(list, of, events)` as base class to auto-generate `oneventname` getters/setters that get invoked along with other event handlers
- Type annotation `any` considered harmful, especially when we can easily spell out the actual type
- Throw in some `const` goodness for free

**Test Plan:** Launch UIExplorer example app, supplied `websocket_test_server` script, and try different combinations of sending and receiving text and binary data on both iOS and Android.
Closes https://github.com/facebook/react-native/pull/6889

Differential Revision: D3184835

Pulled By: mkonicek

fb-gh-sync-id: f21707f4e97aa5a79847f5157e0a9f132a1a01cd
fbshipit-source-id: f21707f4e97aa5a79847f5157e0a9f132a1a01cd
2016-04-18 15:43:25 -07:00
Dan Nolan c342d3d75d Update Switch.js
Summary:Hi there,

This PR reorganises the flow for updating native props so that if you have a switch that's replaced with a spinner to handle a network action, you don't get a crash trying to update native props when an item may be moved out from underneath you. This was previously accepted but I had to rebase it so I just recreated it given it was a two line fix
Closes https://github.com/facebook/react-native/pull/6989

Differential Revision: D3190326

fb-gh-sync-id: 357ffb36bb31bd23970e4ab396fc29a49ec18e1c
fbshipit-source-id: 357ffb36bb31bd23970e4ab396fc29a49ec18e1c
2016-04-17 21:01:29 -07:00
Olivier Notteghem b505fdb57d Decrease TTRR (time to relay request) by lazy rendering fake group header
Reviewed By: astreet

Differential Revision: D3155945

fb-gh-sync-id: b8ab8934555428aef98901288edc66d9ef251d96
fbshipit-source-id: b8ab8934555428aef98901288edc66d9ef251d96
2016-04-17 15:04:19 -07:00
Jia Rong Lim 7851572b40 Fix DrawerLayoutAndroid not able to set opacity
Summary:I'm just cleaning up my branch, but please refer to https://github.com/facebook/react-native/pull/6948.
Closes https://github.com/facebook/react-native/pull/7012

Differential Revision: D3189533

fb-gh-sync-id: 3953b1373ddcfd0fe29c0011c943855b55e1f181
fbshipit-source-id: 3953b1373ddcfd0fe29c0011c943855b55e1f181
2016-04-16 22:45:22 -07:00
Sokovikov 849a0f31ac Allow to set refresh control title color
Summary:Closes #6812

![simulator screen shot 14 apr 2016 12 13 36](https://cloud.githubusercontent.com/assets/1488195/14521441/0abccf5c-0232-11e6-94dc-0ebdbfac4b3f.png)
Closes https://github.com/facebook/react-native/pull/6970

Differential Revision: D3189244

fb-gh-sync-id: 7625b6ab5859aaa20bc0cb379855c5daeb584abf
fbshipit-source-id: 7625b6ab5859aaa20bc0cb379855c5daeb584abf
2016-04-16 15:15:25 -07:00
Spencer Ahrens d5c1de7708 Hook up touchable debugging to Inspector button
Reviewed By: vjeux

Differential Revision: D3188719

fb-gh-sync-id: 271e902399900242f577a77807868bd2a28add37
fbshipit-source-id: 271e902399900242f577a77807868bd2a28add37
2016-04-16 11:57:22 -07:00
Tomasz Netczuk 9a82c03e1f Navigator.SceneConfigs.PushFromRight similar to native iOS animation.
Summary:The animation looks ok now.

However, the original iOS navigator adds transparent overlay and shadow. Any idea how to implement it? I'd like to add it.
Closes https://github.com/facebook/react-native/pull/5061

Differential Revision: D3129246

Pulled By: ericvicenti

fb-gh-sync-id: ee86261a49ea4b8f6854abf69bef3ebfd6878852
fbshipit-source-id: ee86261a49ea4b8f6854abf69bef3ebfd6878852
2016-04-15 18:23:29 -07:00
Leland Richardson 4ee0f7b218 Round interpolation for RGB components
Summary:The CSS spec doesn't allow for decimal values inside of rgb colors, however the RN implementation does, so there was a disconnect here.

This tests to see if the output range is an rgb color, and if so, rounds the first 3 interpolated components (but not the 4th, since that would be opacity and allows for a decimal).

cc vjeux
Closes https://github.com/facebook/react-native/pull/6984

Differential Revision: D3186473

fb-gh-sync-id: a320bf2311764e084386700bf8c8a42ab2a347eb
fbshipit-source-id: a320bf2311764e084386700bf8c8a42ab2a347eb
2016-04-15 14:51:27 -07:00
grgmo d09cd62011 Add support for ontimeout and onerror handler when using XMLHttpRequest for Android and iOS
Summary:Currently React-Native does not have `ontimeout` and `onerror` handlers for [XMLHttpRequest](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest). This is an extension to [No timeout on XMLHttpRequest](https://github.com/facebook/react-native/issues/4648).

With addition to two handlers, both Android and iOS can now handle `ontimeout` if request times out and `onerror` when there is general network error.

**Test plan**

Code has been tested on both Android and iOS with [Charles](https://www.charlesproxy.com/) by setting a breakpoint on the request which fires `ontimeout` when the request waits beyond `timeout` time and `onerror` when there is network error.

**Usage**

JavaScript -

```
var request = new XMLHttpRequest();

function onLoad() {
    console.log(request.status);
};

function onTimeout() {
    console.log('Timeout');
};

function onError() {
    console.log('General network error');
};

request.onload = onLoad;
request.ontimeout = onTimeout;
request.onerr
Closes https://github.com/facebook/react-native/pull/6841

Differential Revision: D3178859

Pulled By: lexs

fb-gh-sync-id: 30674570653e92ab5f7e74bd925dd5640fc862b6
fbshipit-source-id: 30674570653e92ab5f7e74bd925dd5640fc862b6
2016-04-15 05:17:21 -07:00
Hedger Wang 7354ff33b2 Fix Portal
Summary:Portal keeps its opened modals as a state member. so if multiple consecutive `_showModal`
or `_closeModal` are called, it will only read the initial state and merge the end result,
which causes some close or open calls to be overwritten due to race condition.

This diff fixes such issue.

Reviewed By: dmmiller

Differential Revision: D3160561

fb-gh-sync-id: 6d936c795660b119e2d3fe8b3ab807307eca92c5
fbshipit-source-id: 6d936c795660b119e2d3fe8b3ab807307eca92c5
2016-04-15 02:18:21 -07:00
Matthew Arbesfeld ef8e688b20 Let inner nested stack reducers handle back actions first
Summary:Fix for #6963
Closes https://github.com/facebook/react-native/pull/6982

Differential Revision: D3180164

Pulled By: ericvicenti

fb-gh-sync-id: 234d3027097ae032ba0e24470adb3a5ebf07e351
fbshipit-source-id: 234d3027097ae032ba0e24470adb3a5ebf07e351
2016-04-14 18:24:25 -07:00
Spencer Ahrens 0e719bd5ca UNBREAK open source and prod apps
Reviewed By: bestander

Differential Revision: D3182004

fb-gh-sync-id: 7346e3fd85eeed8ba103ccc1fd60c86c8a656712
fbshipit-source-id: 7346e3fd85eeed8ba103ccc1fd60c86c8a656712
2016-04-14 15:47:17 -07:00
Spencer Ahrens 5c9b46c15e Improve touchable debugging
Summary:Set `Touchable.TOUCH_TARGET_DEBUG` to see colored borders/text to all touchables.

Different touchable types are color-coded differently.

If there is `hitSlop`, it will be rendered with an extra view with a dashed border of the same color (not visible on
Android because `overflow: 'hidden'`).

`Text` with `onPress` directly set is just colored.

Added some extra checks to `TouchableWithoutFeedback` since it could silently break if the child is not a native
component.

Also added better error output for `ensureComponentIsNative` so it's easier to track down issues. I really wish there
was a cleaner way to get the component and owner names consistently, it would help make good debug messages way easier
to write.

Reviewed By: ericvicenti

Differential Revision: D3149865

fb-gh-sync-id: 602fc3474ae7636e32af529eb7ac52ac5b858030
fbshipit-source-id: 602fc3474ae7636e32af529eb7ac52ac5b858030
2016-04-14 14:28:31 -07:00
James Ide eaba2abc0b Use function refs and support composed refs
Summary:Fixes an issue where if you implement `renderScrollComponent` and have a `ref` callback on the returned element, the ref used to be clobbered by the ref that ListView adds to the element.

This is accomplished by converting the ref from a legacy string-based ref to a callback-based ref, and then using `cloneReferencedElement`, which is a simple utility to compose callback refs.
Closes https://github.com/facebook/react-native/pull/6441

Differential Revision: D3064250

Pulled By: mkonicek

fb-gh-sync-id: 2d55d04e2144a1cc08900a57a1fc0dab07c87eea
fbshipit-source-id: 2d55d04e2144a1cc08900a57a1fc0dab07c87eea
2016-04-14 06:41:22 -07:00
Sebastian Markbage 0db5439892 Update the Spectrum downstream and add the new cloneWithProps dependency
Reviewed By: aglemann

Differential Revision: D3167482

fb-gh-sync-id: b8c9933e629b049b15f9ebaf885817086866893b
fbshipit-source-id: b8c9933e629b049b15f9ebaf885817086866893b
2016-04-13 17:11:38 -07:00
Yao Bin Then 7e2026a268 Copy comment from LocationModule.java to Geolocation.js
Summary:This is to give a hint to developers when getCurrentPosition not returning anything on Android
Closes https://github.com/facebook/react-native/pull/6770

Differential Revision: D3131152

Pulled By: mkonicek

fb-gh-sync-id: 6726ed0f232c3b2f460d025fe9567e0d0783a707
fbshipit-source-id: 6726ed0f232c3b2f460d025fe9567e0d0783a707
2016-04-13 07:53:23 -07:00
mattds 69534a3373 Added support for Image corner radii in Android
Summary:Split out from PR #4252 - kmagiera I've made the changes to how the radii arrays are allocated, is the approach I've taken correct? also it looks like ImageStylePropTypes are needed so I left them in for the moment. I suppose this pull request will only be valid if iOS supports image corner radii, but at least it's here if/when needed. Attached an image of how it handles the existing case:
![screen shot 2016-01-08 at 4 21 25 pm](https://cloud.githubusercontent.com/assets/1407729/12200126/d3caceac-b625-11e5-8281-06274732a281.png)
Closes https://github.com/facebook/react-native/pull/5197

Differential Revision: D3138725

Pulled By: mkonicek

fb-gh-sync-id: df772fd07fe85386ae4c681f9e79a19d2316d38b
fbshipit-source-id: df772fd07fe85386ae4c681f9e79a19d2316d38b
2016-04-13 07:42:20 -07:00
James Ide f7bcb3e98d Add a way to prefetch remote images to cache with Image.prefetch
Summary:Adds `Image.prefetch` to prefetch remote images before they are used in an actual `Image` component. This is based off of #4420 by sospartan and skevy's work.
Closes https://github.com/facebook/react-native/pull/6774

Differential Revision: D3153729

Pulled By: bestander

fb-gh-sync-id: ef61412e051a49b42ae885edce7905a8ca0da23f
fbshipit-source-id: ef61412e051a49b42ae885edce7905a8ca0da23f
2016-04-13 07:30:28 -07:00
Dave Sibiski 4450d789e0 Uppercases the `method` variable to sanitize the string
Summary:This prevents possible developer errors when using 'post' or 'put' instead of 'POST' and 'PUT'.

Fixes: https://github.com/facebook/react-native/issues/6855

**Test plan:**

Previously, a `method put must not have a request body` error would be thrown when the method was in lowercase and a request body was indeed included.

With this fix and the following code (note the method name in all lowercase), the request is properly completed.

```javascript
const url = 'http://myurl.com';
const request = new XMLHttpRequest();

request.open('put', url);
request.setRequestHeader("Content-type","application/json");

request.onload = function() {
    console.log('onload');
};

request.onerror = function() {
    console.log('error');
};

request.send(JSON.stringify({ something: 'here' }));
```
Closes https://github.com/facebook/react-native/pull/6956

Differential Revision: D3173467

Pulled By: davidaurelio

fb-gh-sync-id: add90e9f31cd4f548547a3f85267a782ae74a89c
fbshipit-source-id: add90e9f31cd4f548547a3f85267a782ae74a89c
2016-04-13 06:48:19 -07:00
Luke Dubert ca2fb70fa9 Fix: swiping in navigator too quickly causes the gesture to be lost
Summary:**Issue:**

In the Navigator if a user attempts to navigate backwards (or forwards) through the route stack by swiping and they perform the gesture too quickly, the gesture is lost and nothing happens.

**Cause:**

In the `_matchGestureAction` function, the variable `moveStartedInRegion` is created and evaluates the gesture to determine if it was initiated in a valid region, (a.k.a. within the `edgeHitWidth`). The issue arises because `moveStartedInRegion` uses `currentLoc` (which is created from `gestureState.moveX`/`Y`) and when the gesture is performed using a flick of the finger, the first value of the `currentLoc` is outside of the `edgeHitWidth`.

**Solution:**

The solution is to track the coordinates of the initial grant (`gestureState.x0`/`y0`), and use that value instead of the `currentLoc` when evaluating `moveStartedInRegion`. The `currentLoc` is still needed however, for when the gestureState does not have a an initial x and y value, because the pan responder has not been granted.
Closes https://github.com/facebook/react-native/pull/6249

Differential Revision: D3168726

Pulled By: ericvicenti

fb-gh-sync-id: f2ac462e59bdc38536b99cac6a4877c99fa4e869
fbshipit-source-id: f2ac462e59bdc38536b99cac6a4877c99fa4e869
2016-04-12 11:08:23 -07:00
Martin Rädlinger 8a7eceeb4f make NavigationHeader and NavigationHeaderTitle pointerEvents configurable
Summary:I basically want to build a transparent NavigationHeader, so I need to be able to set the pointerEvents of the NavigationHeader.
Closes https://github.com/facebook/react-native/pull/6881

Differential Revision: D3168620

Pulled By: ericvicenti

fb-gh-sync-id: 679f3f5858142f468be329771ea281c31e1f0d40
fbshipit-source-id: 679f3f5858142f468be329771ea281c31e1f0d40
2016-04-12 10:55:30 -07:00
Emil Sjolander 303428ea28 Import css-layout measure mode changes from pull request #163
Reviewed By: lucasr

Differential Revision: D3167760

fb-gh-sync-id: f4f13bcb09a2d8b2db2764bd31fa8cbd8edb484b
fbshipit-source-id: f4f13bcb09a2d8b2db2764bd31fa8cbd8edb484b
2016-04-12 07:02:29 -07:00
Maxi Ferreira 2039be9d32 Added support for textDecorationLine style prop on Android
Summary:As suggested by kmagiera in #3819, I've implemented `textDecorationLine` style for Android in `ReactTextShadowNode` using span operations so we can support nested Text components.

![Demo](http://c.hlp.sc/022k2l033p0n/Image%202016-01-03%20at%2011.17.15%20PM.png)
Closes https://github.com/facebook/react-native/pull/5105

Differential Revision: D3167756

Pulled By: andreicoman11

fb-gh-sync-id: 122701a53d50f47f89b49e1f343c97db5fa2323d
fbshipit-source-id: 122701a53d50f47f89b49e1f343c97db5fa2323d
2016-04-12 03:37:34 -07:00
Janic Duplessis eac617d6ee Add null check before accessing the refresh control ref
Summary:Unmounting the RefreshControl during onRefresh callback causes the native ref to become null, this simply adds a null check to prevent the crash.
Closes https://github.com/facebook/react-native/pull/6931

Differential Revision: D3167637

fb-gh-sync-id: c2420b7a3b672d62dd349a6d35bb05399a00620c
fbshipit-source-id: c2420b7a3b672d62dd349a6d35bb05399a00620c
2016-04-12 01:27:18 -07:00
Scott Foggo 24f03af0c3 Implement clipping rectangle for ReactNativeART
Reviewed By: sebmarkbage, taomin

Differential Revision: D3140869

fb-gh-sync-id: 0da27705c4cfca7a1fcae12eed11a7335a62631f
fbshipit-source-id: 0da27705c4cfca7a1fcae12eed11a7335a62631f
2016-04-11 19:19:17 -07:00
Sebastian Markbage 0b534d1c3d Add deprecation warnings to ReactNative.addons
Summary:These were moved out into individual packages in React 0.14.

Exceptions are batchedUpdates and TestModule that are already reachable
on the ReactNative exports.
Closes https://github.com/facebook/react-native/pull/6927

Differential Revision: D3166243

Pulled By: sebmarkbage

fb-gh-sync-id: f696c84eda3cda522c91ec2ca584f5dde2e01407
fbshipit-source-id: f696c84eda3cda522c91ec2ca584f5dde2e01407
2016-04-11 18:20:28 -07:00
Emil Sjolander 8ef551174b backout update of css-layout. breaks ios <9
Reviewed By: javache

Differential Revision: D3164127

fb-gh-sync-id: 3926430f365711466ba93cd2eb7c91f31ef0c7f8
fbshipit-source-id: 3926430f365711466ba93cd2eb7c91f31ef0c7f8
2016-04-11 14:56:21 -07:00
cpojer 838cc48059 Make object properties in NativeModules configurable.
Summary:In Jest, we sometimes wipe away the (partial) state of the world. I noticed that when we run the NativeModules file twice, it throws. Because Jest implicitly throws out the state, it isn't obvious what exactly is going on.

I figured I'll fix this in react-native directly as I don't see a reason why those fields shouldn't be configurable. This shouldn't have any negative impact on react-native apps themselves.

cc ide bestander tadeuzagallo davidaurelio
Closes https://github.com/facebook/react-native/pull/6914

Differential Revision: D3162561

Pulled By: cpojer

fb-gh-sync-id: d3418ec210278a44f8ad325f7e9e01872b4877d1
fbshipit-source-id: d3418ec210278a44f8ad325f7e9e01872b4877d1
2016-04-11 07:57:28 -07:00
David Aurelio fcc89e9d92 Add support for missing XHR response types
Summary:Fixes #6679

This adds support for the missing response types to XMLHttpRequest.
Don?t ship this yet. This is completely untested. yolo and stuff.
Closes https://github.com/facebook/react-native/pull/6870

Reviewed By: bestander

Differential Revision: D3153628

Pulled By: davidaurelio

fb-gh-sync-id: 76feae3377bc24b931548a9ac1af07943b1048ac
fbshipit-source-id: 76feae3377bc24b931548a9ac1af07943b1048ac
2016-04-11 05:54:28 -07:00
Janic Duplessis d66b944727 Fix DrawerLayoutAndroid method parameter
Summary:Oups, forgot to remove a test in #6890 :)
Closes https://github.com/facebook/react-native/pull/6898

Differential Revision: D3161421

Pulled By: mkonicek

fb-gh-sync-id: a7e6b4f31822e67dcf1d898306851a112160d20f
fbshipit-source-id: a7e6b4f31822e67dcf1d898306851a112160d20f
2016-04-11 04:27:27 -07:00
Kushal Dave c62cd44fdf Update AsyncStorage.js
Summary:Updating docs to discuss both iOS and Android and to make more sense standing alone on the web site.
Closes https://github.com/facebook/react-native/pull/6592

Differential Revision: D3161831

fb-gh-sync-id: 984621702fbf408445a04b771d3fc5f76a65af64
fbshipit-source-id: 984621702fbf408445a04b771d3fc5f76a65af64
2016-04-10 18:02:20 -07:00
Sebastian Markbage a7c8111605 Prefix warning module with fbjs/lib/
Summary:This works internally at FB but not here because mixed mode requires are mandatory. At FB www, only the providesModule version works. In React Core, we only use the providesModule name. I have to remember to change these back again when I do the move so that we can unify. 0f3bd02d0f

We really should pick a single convention per project. In React Core, we translate it in the package/build step to whatever output convention is needed.
Closes https://github.com/facebook/react-native/pull/6891

Differential Revision: D3160811

Pulled By: vjeux

fb-gh-sync-id: daf1f5e1cfae2a7c33cca88139fb5391d25bfe3e
fbshipit-source-id: daf1f5e1cfae2a7c33cca88139fb5391d25bfe3e
2016-04-09 13:24:28 -07:00
Janic Duplessis 49fdd99633 Display component methods on the website and tweak the documentation
Summary:The website now displays public methods on components. This was implemented mostly in react-docgen via #66. This adds a <Method> component that is used by the component and API doc pages to display documentation for a method.

It also adds some missing documentation and tweak some existing one to integrate with this feature. I also prefixed some component methods with an '_' so they don't show up in the doc.

**Test plan (required)**

Tested every component page locally to make sure the methods doc was displayed properly.
Tested an API page to make sure it still worked properly.
Closes https://github.com/facebook/react-native/pull/6890

Differential Revision: D3159911

Pulled By: vjeux

fb-gh-sync-id: 1e6a4640cda6794496d9844c1af6a1451c017dcc
fbshipit-source-id: 1e6a4640cda6794496d9844c1af6a1451c017dcc
2016-04-09 11:13:28 -07:00
Sebastian Markbage 2eafcd45db Add deprecation warnings for split of the react and react-native packages
Summary:This adds deprecation warnings that correspond to what React 0.14 did for the web.

I.e. `React.render` -> `ReactNative.render` but also `ReactNative.createClass` -> `React.createClass`.

This hopefully means that it will become easier and more idiomatic to write components that are decoupled from the react-native package.

It will be clear when you take on react-native as a dependency such as when using findNodeHandle.

This codemod is a little more invasive for React Native because the common stuff often used the `react-native` package. For web only the uncommon stuff needed to move.

Reviewed By: spicyj

Differential Revision: D3148860

fb-gh-sync-id: d87628d2089a2e012ad6ad50dd0a20ccec5e6c45
fbshipit-source-id: d87628d2089a2e012ad6ad50dd0a20ccec5e6c45
2016-04-09 04:18:25 -07:00
Sebastian Markbage a80dd9a92a Fix up this pattern var React = require('react-native');
Summary:First I searched for special cases that destructor PropTypes:

```
(?s)React\s*=\s*require\('react\-native'\).*(Children|PropTypes)[^\{\}]*\}\s*=\s*React;
```

I split them up manually.

Then I replaced the React = require('react-native') + destructuring pattern...

```
(?s)(const|var)\s+React\s*=\s*require\('react\-native'\)(.*[^\{\}]*\}\s*=\s*)React;
```

...with...

```
$1 React = require('react');
$1 ReactNative = require('react-native')$2ReactNative;
```

I used lint to figure out if I left some unnecessary imports.

Finally I grepped for just

```
React\s*=\s*require\('react\-native'\)
```

to catch any remaining patterns.

Also, `} = React.NativeModules` -> `} = ReactNative.NativeModules`.

Reviewed By: spicyj

Differential Revision: D3158991

fb-gh-sync-id: f97e8e921e193d6ea1a49d8d1bf3f09be7bed5c3
fbshipit-source-id: f97e8e921e193d6ea1a49d8d1bf3f09be7bed5c3
2016-04-08 20:37:22 -07:00
Steven Luscher 58db9f3996 Add key to footer wrapper in WindowedListView
Reviewed By: frantic

Differential Revision: D3155113

fb-gh-sync-id: 27d9f8b09e2d162c7537fefd02fc824a1c4709ae
fbshipit-source-id: 27d9f8b09e2d162c7537fefd02fc824a1c4709ae
2016-04-08 17:58:34 -07:00
Goran Gajic b7a32726aa Fix perf tab missing key warnings
Summary: Closes https://github.com/facebook/react-native/pull/6865

Differential Revision: D3155343

fb-gh-sync-id: e020d92e928723db1a96a47f45627a4d85af4a0f
fbshipit-source-id: e020d92e928723db1a96a47f45627a4d85af4a0f
2016-04-07 23:38:32 -07:00
Sebastian Markbage 613ca14612 React.findNodeHandle -> ReactNative.findNodeHandle
Summary:Since the React 0.14 split of modules, the findNodeHandle feature is part of the
renderer and not the generic React API.

This just greps for React.findNodeHandle and replace them with ReactNative.findNodeHandle. I fixed up the imports manually.

I also found two callers each of ReactNative.createClass and React.render with the exception of downstream and examples will fix them separately.

I'll need to find more things like `var { PropTypes } = ReactNative;` separately. I think this is a good start though.

Reviewed By: vjeux

Differential Revision: D3149356

fb-gh-sync-id: 50ed60bc67270b16f561d4c641f2f19e85724d3b
fbshipit-source-id: 50ed60bc67270b16f561d4c641f2f19e85724d3b
2016-04-07 19:44:31 -07:00
Felix Oghina 6038040f8e expose pageMargin prop on ViewPagerAndroid
Reviewed By: sahrens

Differential Revision: D3145366

fb-gh-sync-id: 6412d51a698b2c932c915e405e4bbc35e96060dc
fbshipit-source-id: 6412d51a698b2c932c915e405e4bbc35e96060dc
2016-04-07 18:09:29 -07:00
Henry Lung 7a1b07291a Fix 'Import css-layout measure mode changes from pull request #163'
Differential Revision: D3153045

fb-gh-sync-id: 29fa5aef3dbcc12d63c01d211b32bb598caadd0d
fbshipit-source-id: 29fa5aef3dbcc12d63c01d211b32bb598caadd0d
2016-04-07 17:47:28 -07:00
digeff 4c8a9f0d00 Added support for JavaScript third-party debuggers
Summary:* Add ability to configure the app that should open when starting debugging

axemclion discussed this feature with tadeuzagallo and martinbigio on: https://github.com/facebook/react-native/issues/5051
Closes https://github.com/facebook/react-native/pull/5683

Reviewed By: martinbigio

Differential Revision: D2971497

Pulled By: mkonicek

fb-gh-sync-id: 91c3ce68feed989658124bb96cb61d03dd032599
fbshipit-source-id: 91c3ce68feed989658124bb96cb61d03dd032599
2016-04-07 13:15:58 -07:00
Emil Sjolander 3b5a49bfb6 Import css-layout measure mode changes from pull request #163
Reviewed By: astreet

Differential Revision: D3059432

fb-gh-sync-id: 56cc13ffbc4805aa0789df62a04e19f23a438bd3
fbshipit-source-id: 56cc13ffbc4805aa0789df62a04e19f23a438bd3
2016-04-07 10:16:30 -07:00
Martin Konicek 5f77f15bac Remove confusing warning from ScrollResponder
Summary:I get this warning in cases when nothing went wrong.

Not sure what I can do about the warning. I placed a few sliders in a ScrollView and everything works as expected, so the warning is very confusing.

Lots of people have been hitting the warning and getting confused by it as well:
- https://github.com/facebook/react-native/issues/1501
- https://productpains.com/post/react-native/scrollview-warning-scrollview-doesnt-take-rejection-well-scrolls-anyway (it's one of the [highest rated](https://productpains.com/product/react-native?tab=top) issues).

Reviewed By: sahrens

Differential Revision: D3138736

fb-gh-sync-id: 601b8dfc275a14dff6f17a7903c65bd8347a73e9
fbshipit-source-id: 601b8dfc275a14dff6f17a7903c65bd8347a73e9
2016-04-07 10:15:25 -07:00
Krzysztof Magiera 874bcd3ee3 JS tests.
Summary:JEST tests for `useNativeDriver` option in AnimatedImplementation.js. Adding this to protect from potential changes in Animated.js that might break the interaction with the NativeAnimatedModule. Most of those tests just verify that a valid method of NativeAnimatedModule gets called as a result of animated nodes management operations.

**Test plan (required)**
Run `npm test Libraries/Animated/src/__tests__/AnimatedNative-test.js`
See 9 tests passed
Closes https://github.com/facebook/react-native/pull/6821

Differential Revision: D3149876

fb-gh-sync-id: 8911c5b0f96074115a62153c05162ff24ee2caa1
fbshipit-source-id: 8911c5b0f96074115a62153c05162ff24ee2caa1
2016-04-07 01:27:20 -07:00
Hedger Wang eecdf7d356 disable interaction during transition.
Summary:When navigating from one view to another you can still interact with
the current view. This means that a user can tap a button multiple times and trigger multiple transitions.

The view that is being transitioned off the screen should not be allowed to
receive any user interaction while it is being transitioned.

Reviewed By: javache

Differential Revision: D3143202

fb-gh-sync-id: cc033bbdf0cb9e717f62d2fcf751155406da846c
fbshipit-source-id: cc033bbdf0cb9e717f62d2fcf751155406da846c
2016-04-06 16:15:28 -07:00
Spencer Ahrens 06b2998de8 Rework scroll management
Reviewed By: devknoll

Differential Revision: D3138464

fb-gh-sync-id: fd1bb7f623c689836ae52ea8bf384d8efccddfea
fbshipit-source-id: fd1bb7f623c689836ae52ea8bf384d8efccddfea
2016-04-06 14:09:27 -07:00
Nick 2a03182b1c CHORE - Remove Trailing Spaces
Summary:Remove Trailing Spaces.

Why:
Sometimes there are conflicts with trailing spaces
Saves space
Those whose tools automatically delete them will have their pr watered down with trailing space removal
Closes https://github.com/facebook/react-native/pull/6787

Differential Revision: D3144704

fb-gh-sync-id: d8a62f115a3f8a8a49d5b07f56c540a02af38cf8
fbshipit-source-id: d8a62f115a3f8a8a49d5b07f56c540a02af38cf8
2016-04-06 09:21:53 -07:00
Aleksei Androsov 9e78a63f84 Remove double to string convertion in FormData
Summary:These convertions introduced by 2 different PRs
5061fde317
de392b5351
Closes https://github.com/facebook/react-native/pull/5815

Differential Revision: D3144703

fb-gh-sync-id: a483916bb7387a64d89f809ccfb35ecb9a065b1e
fbshipit-source-id: a483916bb7387a64d89f809ccfb35ecb9a065b1e
2016-04-06 09:01:30 -07:00
kapil verma 97696b61c8 Fixed typo in docs
Summary: Closes https://github.com/facebook/react-native/pull/6772

Differential Revision: D3144702

fb-gh-sync-id: f7e6743bc361652f16f50af19305822d05a047fa
fbshipit-source-id: f7e6743bc361652f16f50af19305822d05a047fa
2016-04-06 08:55:20 -07:00
Martin Konicek 9adef91333 Fix website after open sourcing Slider
Reviewed By: bestander

Differential Revision: D3144673

fb-gh-sync-id: bdfc35606c29b227228474e5e6a9c0087898783d
fbshipit-source-id: bdfc35606c29b227228474e5e6a9c0087898783d
2016-04-06 08:51:23 -07:00
Konstantin Raev 1bdb6caa0e fixed flow error introduced with Sldier
Summary:cc mkonicek
Closes https://github.com/facebook/react-native/pull/6838

Differential Revision: D3144492

fb-gh-sync-id: 49eeb95fd2ccaa1b77905bd258b36f48c84463e4
fbshipit-source-id: 49eeb95fd2ccaa1b77905bd258b36f48c84463e4
2016-04-06 07:41:33 -07:00
Martin Konicek a461d25601 Open source Android slider
Reviewed By: bestander

Differential Revision: D3127200

fb-gh-sync-id: d3d51b312c2e32cc7a0f4c0bc084139343e97c3e
fbshipit-source-id: d3d51b312c2e32cc7a0f4c0bc084139343e97c3e
2016-04-06 04:50:57 -07:00
Morgan Pretty 86d5c5249b Fixed an issue where the title in NavigationExperimentalHeader would block touches for the left component
Summary:There was an issue where the title component could overlap the left component and it would block the left component from receiving touches.

I only stumbled across this because we have a default title component which stretches most of the width and it was covering the edge of the left component. I think left/right components are more likely to be actionable than the title component so they should take priority in the touch order (ie. be rendered last).
Closes https://github.com/facebook/react-native/pull/6618

Differential Revision: D3144191

fb-gh-sync-id: 9ccd31714b2401d02eaaf4b5b24ed6afb60041c7
fbshipit-source-id: 9ccd31714b2401d02eaaf4b5b24ed6afb60041c7
2016-04-06 03:10:31 -07:00
Eric Vicenti 5162eb3254 Only accept card gestures within a certain range, 30px
Summary: The iOS native card stack only responds if the gesture starts on the left 30 px on the screen.

Reviewed By: hedgerwang

Differential Revision: D3137201

fb-gh-sync-id: 40e28d5696870b98731e92d6e42d00638b9bb15f
fbshipit-source-id: 40e28d5696870b98731e92d6e42d00638b9bb15f
2016-04-06 02:52:24 -07:00
Kyle Corbitt bafc506f7c Ignore Navigator touch events for background buttons
Summary:Currently, if the Navigator with the default `NavigatorNavigationBar` has two scenes on its `routeStack` and the bottom one defines a `RightButton` but the top one doesn't, a touch to the location of the underlying  `RightButton` will trigger its action.

This fix checks if the button's opacity is set to 0 (indicating it has been transitioned off the scene and shouldn't be interacted with) and ignores touch events if so.
Closes https://github.com/facebook/react-native/pull/5624

Differential Revision: D3139553

fb-gh-sync-id: 6d6da1459e289499b6d8769120a3b6114548c090
fbshipit-source-id: 6d6da1459e289499b6d8769120a3b6114548c090
2016-04-05 11:33:27 -07:00
Spencer Ahrens ab44d32ec5 Better Incremental/TaskQueue error reporting
Reviewed By: yungsters

Differential Revision: D3135010

fb-gh-sync-id: 2d6d8800c7f7557221bd57869b6a6fa30d65f122
fbshipit-source-id: 2d6d8800c7f7557221bd57869b6a6fa30d65f122
2016-04-05 02:35:22 -07:00
Martin Konicek 52ddfd9b51 Bugfix: Make iOS Slider it the responder
Summary:This fixes issues with other view (like the Navigator) stealing the responder and becoming interactive while the user is dragging the slider.

From [documentation](https://facebook.github.io/react-native/docs/gesture-responder-system.html):
- `onStartShouldSetResponder`: Does this view want to become responder on the start of a touch? -> Yes.
- `onResponderTerminationRequest`: Something else wants to become responder. Should this view release the responder? -> No.

Reviewed By: ericvicenti

Differential Revision: D3133337

fb-gh-sync-id: 3d7e1e6a2ed6fa605857cfb0549ffa71df85fd22
fbshipit-source-id: 3d7e1e6a2ed6fa605857cfb0549ffa71df85fd22
2016-04-04 08:24:18 -07:00
Christine Abernathy 09958618c5 Adding emulator, simulator UIExplorer example across docs
Summary:Current docs show an Appetize.io example for AlertIOS doc. This pull request adds that feature across all applicable iOS and Android docs. So if a doc has an example in UIExplorer, it shows up in the top right and clicking to Play should navigate to the relevant example.

The changes here also touched NavigationExperimental to fix a typo that prevented iOS deep link from working. Code was also added to help support Android deep links but there's an outstanding issue (a race condition) around how Android deep links trigger getInitialURL in NavigationRootContainer that prevents this from fully working.

For adding the docs, a few things were done outside this pull request:

1/ Release builds for UIExplorer Android and iOS apps were uploaded to Appetize.io. The Appetize.io info (public key to run the build) is embedded in the docs.
2/ The iOS build was generated by making a few changes to get a local bundle. The current UIExplorer set up doesn't support "react-native run-ios".

Regarding the Appetize bu
Closes https://github.com/facebook/react-native/pull/6306

Differential Revision: D3129651

Pulled By: bestander

fb-gh-sync-id: d296d64db8236faa36f35484bb6b362990caf934
fbshipit-source-id: d296d64db8236faa36f35484bb6b362990caf934
2016-04-04 06:05:23 -07:00
Spencer Ahrens cd79e269dc cleanup and open source WindowedListView
Summary:`WindowedListView` is designed for memory efficient scrolling of
huge/infinite lists of variable height rows. It works by measuring row heights
with `onLayout` and caching the results, then unmounting rows that scroll
offscreen, replacing them with an equivalent offset in the spacer view. Care is
taken to render a constant number of rows, and to only render one new row per
tick to improve framerate and app responsiveness. WLV is also compatible with
<Incremental> used within the rows themselves.

`WindowedListView` is not a drop-in replacement for `ListView` - it doesn't
support many of the features of `ListView`, such as section headers, only
accepts a simple array of data instead of a datasource, and doesn't support
horizontal scrolling. This may change in the future.

This is still experimental - we haven't deployed this for any production apps
yet.

Differential Revision: D2791402

fb-gh-sync-id: 5f104e0903f6ba586d2d651bdf82863a231279d8
fbshipit-source-id: 5f104e0903f6ba586d2d651bdf82863a231279d8
2016-04-01 13:54:29 -07:00
Paul O’Shannessy cb5d37713f Remove use of Object.assign module
Summary:I'm [getting rid of it from React](https://github.com/facebook/react/pull/6376) and so I'd like to get this in before we accidentally break RN. There are a bunch of other uses of Object.assign directly so this should be perfectly safe.
Closes https://github.com/facebook/react-native/pull/6766

Differential Revision: D3128135

Pulled By: vjeux

fb-gh-sync-id: 675913ba457abcd8c194facb9ff58255c9dceda5
fbshipit-source-id: 675913ba457abcd8c194facb9ff58255c9dceda5
2016-04-01 13:50:22 -07:00
Robin Breuker d5dffceec0 Updated documentation of local notifications for PushNotificationIOS addEventListener()
Summary:I've updated the documentation of addEventListener, so it mentions the use of the 'localNotification' event. Which is currently not mentioned at all.

**Test plan (required)**
<img width="1019" alt="screen shot 2016-03-22 at 08 09 15" src="https://cloud.githubusercontent.com/assets/1757473/13963693/a47c0636-f066-11e5-859c-445a0f9d823c.png">

?
Closes https://github.com/facebook/react-native/pull/6591

Differential Revision: D3126643

Pulled By: vjeux

fb-gh-sync-id: bf2bb301cc5d94d324a3b34ca14f038158092a7c
fbshipit-source-id: bf2bb301cc5d94d324a3b34ca14f038158092a7c
2016-04-01 09:56:24 -07:00
Bruno Barbieri 9eb75b4dfb - added available SceneConfigs to Navigator docs
Summary:At the beginning of the navigator docs it says " See Navigator.SceneConfigs for default animations and more info on scene config options."

but then this is the only information available:

<img width="658" alt="screen shot 2016-03-23 at 2 40 49 am" src="https://cloud.githubusercontent.com/assets/1247834/13977670/733cdaa6-f0a1-11e5-92e6-fc98725f65e0.png">

And the only way of knowing about the available options is to look at the source code. I think a lot of people will appreciate this...

If you think this is too much, maybe adding a link to the source code would help.
Closes https://github.com/facebook/react-native/pull/6599

Differential Revision: D3088592

fb-gh-sync-id: f11025b76441e9394ce42ed6c796fa1ace3e8c27
fbshipit-source-id: f11025b76441e9394ce42ed6c796fa1ace3e8c27
2016-04-01 09:03:25 -07:00
Nicolas Charpentier a74d05be62 Add default render loading on Android WebView
Summary:I just noticed that Android WebView do not have a render loading default like iOS, so I added one.

**Test plan**

I used WebView without renderLoading on Android.

![image](https://cloud.githubusercontent.com/assets/7189823/14028408/bd94c83e-f1d2-11e5-8791-3372684b429e.png)
Closes https://github.com/facebook/react-native/pull/6635

Differential Revision: D3126416

Pulled By: andreicoman11

fb-gh-sync-id: 422966ba3dd6912cbcb0b540e26a3ec48c85daea
fbshipit-source-id: 422966ba3dd6912cbcb0b540e26a3ec48c85daea
2016-04-01 08:05:21 -07:00
Dmitry Gladkov b5106a8fca Implement TextInput.selectTextOnFocus for Android
Summary:Uses native Android `TextView.setSelectAllOnFocus` method. Triggers TextInput's `onSelectionChanged` event on focus as expected.
Closes https://github.com/facebook/react-native/pull/6654

Differential Revision: D3126354

Pulled By: mkonicek

fb-gh-sync-id: faa64314c0ddc87296277ccd707f18effef8f407
fbshipit-source-id: faa64314c0ddc87296277ccd707f18effef8f407
2016-04-01 07:16:20 -07:00
Pieter De Baets b00c77af80 Increase RN devtools retry timeout
Summary:The 200ms timeout was causing resource issues and causing a lot of overhead when you're not running the devtools, since it will basically create a new socket every 200ms.

Also clean up the way we do logging so it's completely compiled out in prod, and standardize all the names we use for threading to lowercase react.

Reviewed By: frantic

Differential Revision: D3115975

fb-gh-sync-id: e6e51c0621d8e9fc4eadb864acd678b8b5d322a1
fbshipit-source-id: e6e51c0621d8e9fc4eadb864acd678b8b5d322a1
2016-04-01 07:02:25 -07:00
Nicolas Charpentier b098d0e839 Fix typos in NavigationExperimental
Summary: Closes https://github.com/facebook/react-native/pull/6749

Differential Revision: D3122485

fb-gh-sync-id: 86f10407a398f9dc73177f3d85076729e4d8d574
fbshipit-source-id: 86f10407a398f9dc73177f3d85076729e4d8d574
2016-03-31 13:54:24 -07:00
Lane Rettig 928fd0d605 Add support for "message" option to ActionSheetIOS and improve docs
Summary:Updated docs:

![screen shot 2016-03-27 at 12 41 02](https://cloud.githubusercontent.com/assets/3316532/14066504/35509612-f419-11e5-923f-e354ad939ee5.png)
Closes https://github.com/facebook/react-native/pull/6685

Differential Revision: D3119791

Pulled By: javache

fb-gh-sync-id: fadd5ea1a1b979f79b41c80b6a19fdb9ea3f100f
fbshipit-source-id: fadd5ea1a1b979f79b41c80b6a19fdb9ea3f100f
2016-03-30 22:10:31 -07:00
Nathan Spaun 4498bc8197 Add prop to FbReactScrollView to fill the rest of the background to avoid overdraw
Reviewed By: foghina

Differential Revision: D3079290

fb-gh-sync-id: b824d235ca34f8e0408f5f40e6b73e028006ac9f
fbshipit-source-id: b824d235ca34f8e0408f5f40e6b73e028006ac9f
2016-03-30 18:06:19 -07:00
Andrei Coman ac03c47895 Use monotonic clock instead of currentTimeMillis
Reviewed By: javache

Differential Revision: D3115208

fb-gh-sync-id: c0fef5a162ab023d55736b38c51c87b8759f089d
fbshipit-source-id: c0fef5a162ab023d55736b38c51c87b8759f089d
2016-03-30 12:47:20 -07:00
sunnylqm 53355c692a Add a missing parenthese
Summary: Closes https://github.com/facebook/react-native/pull/6724

Differential Revision: D3115214

fb-gh-sync-id: 2b97ed162c15d8e6ad4ce4906a8b6fcba44864ca
fbshipit-source-id: 2b97ed162c15d8e6ad4ce4906a8b6fcba44864ca
2016-03-30 10:04:54 -07:00
Janic Duplessis 039924ec70 Add statusBarBackgroundColor to DrawerLayoutAndroid to allow it to open over the status bar
Summary:The navigation drawer of most apps on android opens over the status bar, this adds an option to do so. It implements a similar API to the native DrawerLayout by adding a statusBarBackgroundColor to DrawerLayoutAndroid.

Without statusBarBackgroundColor:
![image](https://cloud.githubusercontent.com/assets/2677334/13414490/50ebcdf4-df21-11e5-974f-c6a1343c2a4e.png)

With statusBarBackgroundColor:
![image](https://cloud.githubusercontent.com/assets/2677334/13414459/1fdc4086-df21-11e5-9658-bd47bfdb925f.png)

This PR depends on the changes in #6195 to add the `StatusBar.HEIGHT` constant I just want to put it out there now to see if this looks good. To test without the other PR just change `StatusBar.HEIGHT` for `25`.

It is implemented by making the native status bar translucent and making its background color transparent so we can draw a view of the same height as the status bar under it as a child of the DrawerLayoutAndroid. Then we can draw a semi-transparent gray View inside the drawer view to make it
Closes https://github.com/facebook/react-native/pull/6218

Differential Revision: D3017444

Pulled By: bestander

fb-gh-sync-id: ca48a47a20a2feecae360a76f3e2c9bbe6a37700
fbshipit-source-id: ca48a47a20a2feecae360a76f3e2c9bbe6a37700
2016-03-30 05:30:22 -07:00
Sokovikov e20e8a3cc8 Add support for vibration patterns
Summary:and "not supported" warnings for ios
Closes https://github.com/facebook/react-native/pull/6400

Differential Revision: D3113988

fb-gh-sync-id: 169623f157ec59c38b4368cbc668c85201b67ed8
fbshipit-source-id: 169623f157ec59c38b4368cbc668c85201b67ed8
2016-03-29 21:45:20 -07:00
Hedger Wang 68918e8773 Clean up NavigationView.
Summary:This address the issue reported at
https://github.com/facebook/react-native/issues/6579#issuecomment-200984628

NavigationView should have the same API as NavigationAnimatedView does except
that NavigationView does not need the APIs for animation.

This unify the API of our core components so that people can freely
compose views with both NavigationAnimatedView or NavigationView.

Reviewed By: fkgozali

Differential Revision: D3096076

fb-gh-sync-id: 7536777a7d637da62a2636d750f9d91c5a0eb45f
fbshipit-source-id: 7536777a7d637da62a2636d750f9d91c5a0eb45f
2016-03-29 15:57:28 -07:00
Quinten Powell 258b43948f Fix minor typo in Imperative API notes
Summary:Thanks for submitting a pull request! Please provide enough information so that others can review your pull request:

(You can skip this if you're fixing a typo or adding an app to the Showcase.)

Explain the **motivation** for making this change. What existing problem does the pull request solve?

Prefer **small pull requests**. These are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it.

**Test plan (required)**

Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI.

Make sure tests pass on both Travis and Circle CI.

**Code formatting**

Look around. Match the style of the rest of the codebase. See also the simple [style guide](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#style-guide).
Closes https://github.com/facebook/react-native/pull/6706

Differential Revision: D3109403

fb-gh-sync-id: 4c92b4dc7950377f9efad6129a49c594bcd9a68a
fbshipit-source-id: 4c92b4dc7950377f9efad6129a49c594bcd9a68a
2016-03-29 09:18:26 -07:00
Andy Street ede99eeadd Backed out changeset 13a4ea1d64ce
Reviewed By: ericvicenti

Differential Revision: D3093064

fb-gh-sync-id: c9b68c8c5ab8ddaf77570d2cf8024e36925e5e76
fbshipit-source-id: c9b68c8c5ab8ddaf77570d2cf8024e36925e5e76
2016-03-29 03:42:18 -07:00
Hedger Wang a28e59bd97 move `propTypes`, `defaultProps`, and `childContextTypes` into class.
Summary: This will make the code more readable.

Reviewed By: ericvicenti

Differential Revision: D3096663

fb-gh-sync-id: 540d2107ea3cd4c60aabdf7a6503c8c22bc4a985
fbshipit-source-id: 540d2107ea3cd4c60aabdf7a6503c8c22bc4a985
2016-03-28 16:48:27 -07:00
Satyajit Sahoo ce81f8b35a Make 'onRequestClose' a required prop for Modal on Android. Fixes #6612
Summary:The `onRequestClose` prop can be used to handle dismissing the modal by back button. It's pretty easy to miss the `onRequestClose` prop on Android. So making it a required prop makes sure that it generates a warning when not supplied.

Context #6612
Closes https://github.com/facebook/react-native/pull/6667

Differential Revision: D3102054

Pulled By: javache

fb-gh-sync-id: 878240606285d231b5592a438918e441765bfe5f
fbshipit-source-id: 878240606285d231b5592a438918e441765bfe5f
2016-03-26 10:24:24 -07:00
Weijia Wang d0f6a1a13e Imporve docs for the prop "navigationBar" in Navigator
Summary:The doc of props "navigationBar" in Navigator is not  detailed enough. I make an improvement to it.
Closes https://github.com/facebook/react-native/pull/6615

Differential Revision: D3102065

fb-gh-sync-id: da96e3c422e053d0a8203bbd160ea10ed590878a
fbshipit-source-id: da96e3c422e053d0a8203bbd160ea10ed590878a
2016-03-26 07:01:23 -07:00
Manas 21c433d998 Caches array length in flattenStyles methods for loop
Summary:Gains minor perf improvement in the for loop by caching the array length
Closes https://github.com/facebook/react-native/pull/6671

Differential Revision: D3102064

fb-gh-sync-id: 2303d83f3672a2768c60d0e5dae999b1dda0d6bd
fbshipit-source-id: 2303d83f3672a2768c60d0e5dae999b1dda0d6bd
2016-03-26 06:54:18 -07:00
Tim Yung 235b16d932 RN: Improve <Switch> Documentation
Summary: Minor improvements to the <Switch> docblock, including adding some keywords to make it easier to find. Also, I updated documentation for the deprecated platform-specific versions of the component.

Reviewed By: jingc

Differential Revision: D3098626

fb-gh-sync-id: 86d0f1a45eb8ac1bd9e58ac4ba9c73a4a3dfa846
fbshipit-source-id: 86d0f1a45eb8ac1bd9e58ac4ba9c73a4a3dfa846
2016-03-25 15:17:20 -07:00
Manas 9b9cc6b543 Documents StyleSheet.flatten()
Summary:Indicates the purpose and an alternative use for the method too.
Closes https://github.com/facebook/react-native/pull/6662

Differential Revision: D3099823

Pulled By: vjeux

fb-gh-sync-id: 44633161a3df9b11d44afaed72fe6127f0b6bf7b
fbshipit-source-id: 44633161a3df9b11d44afaed72fe6127f0b6bf7b
2016-03-25 15:13:17 -07:00
Janic Duplessis 56c40baa06 Fix bad wording in pointer events doc
Summary:Fix bad wording in the docs change I did in #6534

cc mkonicek
Closes https://github.com/facebook/react-native/pull/6598

Differential Revision: D3085957

Pulled By: vjeux

fb-gh-sync-id: 2b45ac72acf089be6cf8e815aac430a2ce9d08ed
shipit-source-id: 2b45ac72acf089be6cf8e815aac430a2ce9d08ed
2016-03-24 19:53:26 -07:00
Spencer Ahrens ca353d0829 A little more debugging code for Incremental
Reviewed By: astreet

Differential Revision: D3091688

fb-gh-sync-id: 4f91d5126a16b56904fa4af7acdc32b9bb873c6d
shipit-source-id: 4f91d5126a16b56904fa4af7acdc32b9bb873c6d
2016-03-24 19:44:29 -07:00
Hedger Wang 62e80a600e Refactor <NavigationHeader /> API.
Summary:- All the public sub component renderers should implement the interface
  NavigationSceneRenderer, which will help to reuse renderer or
  replace renders for different composition.

- Perf improvement. <NavigationHeader /> is rendering way more
  sub component than necessary, we shall fix that.

- No UI or behavior change.

Reviewed By: ericvicenti

Differential Revision: D3091442

fb-gh-sync-id: fba5f7ce74597fa6036b5b216c02b06052801983
shipit-source-id: fba5f7ce74597fa6036b5b216c02b06052801983
2016-03-24 15:49:28 -07:00
Sebastian Markbage 433fb336af Refactor Attribute Processing (Step 4)
Summary:This avoids flattening styles in most common cases. It diffs against the nested
arrays. The special case is when a property gets removed, it creates an object
that stores the removed keys which then gets resolved using a second pass
through the nested array.

You can conceptually think of this algorithm as:
1) Diff and store changes as you go
2) If something was removed, flatten as necessary

I also merged in another commit that renames the StyleSheetRegistry to ReactNativePropRegistry. There is nothing in here that makes it specific to styles anymore. That's just a decoupled view attribute configuration option. This registry can be used for any set of nested props, if we even want to keep this feature at all.

Reviewed By: vjeux

Differential Revision: D2492885

fb-gh-sync-id: c976ac28b7e63545132c36da0ee0c1c562e7c9e5
shipit-source-id: c976ac28b7e63545132c36da0ee0c1c562e7c9e5
2016-03-24 15:13:24 -07:00
Dom Christie 07697d15cc Improve consistency of NavigationCardStack animations.
Summary:Currently there?s an inconsistency between the animations used in `NavigationAnimatedView` (`spring`) and those in `NavigationCardStack` (`timing`), which is noticeable when switching between the two implementations.

By removing the `_applyAnimation` method, the `NavigationAnimatedView` will simply use its [default `applyAnimation`](6c22a2174e/Libraries/NavigationExperimental/NavigationAnimatedView.js (L56-L67)), making the animation styles the same.

**Before** (with `Animated.timing`)
Video: http://quick.as/Yexku8DdJ

**After** (with the default `NavigationAnimatedView` animations)
Video: http://quick.as/qrqbsnj8n
Closes https://github.com/facebook/react-native/pull/6636

Differential Revision: D3094638

Pulled By: ericvicenti

fb-gh-sync-id: 6e1c7c54b4ef102c4003719381d334d2c6f7a531
shipit-source-id: 6e1c7c54b4ef102c4003719381d334d2c6f7a531
2016-03-24 14:50:25 -07:00
Satyajit Sahoo 6c22a2174e Fix fetching sourcemap in genymotion. Fixes #5338
Summary:Source maps are broken on Genymotion right now as they aren't being loaded from the correct URL. refer - https://github.com/facebook/react-native/issues/5338#issuecomment-188232402

**Test plan**

Build and install UIExplorer from master branch in genymotion and enable hot reload. When you change a file and save it, you'll see a Yellow box due to source map fetching failed, as per the referenced comment.

Doing the same for this branch doesn't produce any yellow boxes.
Closes https://github.com/facebook/react-native/pull/6594

Differential Revision: D3088218

Pulled By: martinbigio

fb-gh-sync-id: 0d1c19cc263de5c6c62061c399eef33fa4ac4a7b
shipit-source-id: 0d1c19cc263de5c6c62061c399eef33fa4ac4a7b
2016-03-24 12:06:45 -07:00
Krzysztof Magiera 65ccdffc8d Execute Animated.js declarative animation on UIThread on Android.
Summary:This is the first from the series of PRs I'm going to be sending shorty that would let Animated.js animations to run off the JS thread (for Android only).

This PR introduce a new native module that will be used for offloading animations - NativeAnimatedModule. It has a simple API that allows for animated nodes management via methods like: create/drop animated node, connect/disconnect nodes, start animation of a value node, attach/detach animated from a native view.

Similarly to how we handle UIManager view hierarchy updates we create a queue of animated graph operations that are then executed on the UI thread. This isolates us from problems that may be caused by concurrent updates of animated graph while UI thread is "executing" the animation.

The most important class NativeAnimatedNodesManager.java implements a management interface for animated nodes graph as well as implements a graph traversal algorithm that is run for each animation frame. For each animation frame we visit animated nodes th
Closes https://github.com/facebook/react-native/pull/6466

Differential Revision: D3092739

Pulled By: astreet

fb-gh-sync-id: 665b49900b7367c91a93b9d8864f78fb90bb36ba
shipit-source-id: 665b49900b7367c91a93b9d8864f78fb90bb36ba
2016-03-24 06:19:27 -07:00
Dave Miller bd8007300f Remove sendMomentumEvents property from public ScrollView properties
Summary: This property is only used by the native code as an optimization to not send events that no one is listening to.  We don't need to expose it externally on the js api.  Set sendMomentumEvent to be a native only property.

Reviewed By: bestander

Differential Revision: D3092650

fb-gh-sync-id: 95f5f0ae4cd04a7d1cbc9cf17c93647d3c644878
shipit-source-id: 95f5f0ae4cd04a7d1cbc9cf17c93647d3c644878
2016-03-24 05:43:25 -07:00
Dave Miller ad41a0b326 Clean up dead code in ScrollView
Summary: I see dead code

Reviewed By: bestander

Differential Revision: D3092668

fb-gh-sync-id: d80a0267aafd856b63e1d2ff1ae8b8e9f6deb8ce
shipit-source-id: d80a0267aafd856b63e1d2ff1ae8b8e9f6deb8ce
2016-03-24 05:29:20 -07:00
Hedger Wang 4f8668b110 Support animation and gesture for Pager.
Summary: We need to support animation and gesture for Pager.

Reviewed By: ericvicenti

Differential Revision: D3066596

fb-gh-sync-id: 1c1a3d34b4298b4b0dd158f817057ae22dea72f4
shipit-source-id: 1c1a3d34b4298b4b0dd158f817057ae22dea72f4
2016-03-23 12:51:00 -07:00
Sokovikov 67efe4c1a9 custom back button handler
Summary:sometimes it is nessesary to handle back button
specifically for component, by changing its state.
 For ex. exit from edit mode.
Closes https://github.com/facebook/react-native/pull/5062

Differential Revision: D3084590

Pulled By: ericvicenti

fb-gh-sync-id: 13a4ea1d64ce725daa5d3af0d629a0c132a3f3d5
shipit-source-id: 13a4ea1d64ce725daa5d3af0d629a0c132a3f3d5
2016-03-23 12:22:20 -07:00
Andre Giron fd2cf119b1 Fix issue #6300: Improve error message for unregistered callbacks.
Summary:Fix for issue #6300:
Motivation: When more than one callback is registered to a native module, the error message that a user receives is not indicative of what is really happening.
Closes https://github.com/facebook/react-native/pull/6436

Differential Revision: D3087551

Pulled By: tadeuzagallo

fb-gh-sync-id: 93c703348dc53b75c5b507edc71754680ab5c438
shipit-source-id: 93c703348dc53b75c5b507edc71754680ab5c438
2016-03-23 10:08:29 -07:00
Chirag Shah 777983c05b Typo in NativeMethodsMixin.js
Summary:Fixed a typo in NativeMethodsMixin.js

Before:
![before](https://cloud.githubusercontent.com/assets/6805530/13948549/a429c224-f046-11e5-903f-a04bd9eaa1b3.png)

After:
![after](https://cloud.githubusercontent.com/assets/6805530/13948555/a9ba505a-f046-11e5-84fa-87f236aca486.png)
Closes https://github.com/facebook/react-native/pull/6583

Differential Revision: D3081509

Pulled By: javache

fb-gh-sync-id: 016febb449ac61870a161673120f706c6c7992ed
shipit-source-id: 016febb449ac61870a161673120f706c6c7992ed
2016-03-22 06:53:21 -07:00
Satyajit Sahoo 720c76f94d Rework the NavigationHeader
Summary:Add ability to specify custom left, right components, and title component. Style the `NavigationBar` according to the Platform.

Refer https://github.com/ericvicenti/navigation-rfc/pull/21

cc ericvicenti
Closes https://github.com/facebook/react-native/pull/5971

Differential Revision: D3080601

Pulled By: ericvicenti

fb-gh-sync-id: 7b921cd36b4c2ec1edf6f52629f1f9890d272dfd
shipit-source-id: 7b921cd36b4c2ec1edf6f52629f1f9890d272dfd
2016-03-21 22:07:26 -07:00
Adrien Brault 7fdabd8f14 Navigator: emit didFocus after routeStack reset
Summary:Hi,

I am using https://github.com/aksonov/react-native-router-flux / https://github.com/exponentjs/ex-navigator and I needed a way to update my redux store with the current route.

I'm using the navigation context to do this:

```javascript
if (navigationContext) {
  const handler = () => {
    updateCurrentRouteState(navigationContext.currentRoute);
  };
  navigationContext.addListener('willfocus', handler);
  navigationContext.addListener('didfocus', handler);
}
```

However, when the whole stack is replaced, no event is emitted. This PR aims to fix that.
Closes https://github.com/facebook/react-native/pull/5596

Differential Revision: D3080004

Pulled By: ericvicenti

fb-gh-sync-id: 0ef4ecebec7076275b6433c80aae6102cf28c039
shipit-source-id: 0ef4ecebec7076275b6433c80aae6102cf28c039
2016-03-21 19:18:53 -07:00
Martín Bigio 1ef9e4dc59 Make HMR compatible with numeric IDs
Summary:We recently refactor the packager to transform the module names into numeric IDs but we forgot to update the HMR call site. As a consequence, HMR doesn't work the first time a file is saved but the second one.

This is affecting master as of 3/20. If we don't land this before v0.23 is cut we'll have to cherry pick it. This rev does *not* need to be picked on v0.22.

Reviewed By: bestander

Differential Revision: D3075192

fb-gh-sync-id: 410e4bf8f937c0cdb8f2b462dd36f928a24e8aa8
shipit-source-id: 410e4bf8f937c0cdb8f2b462dd36f928a24e8aa8
2016-03-21 15:51:24 -07:00
Satyajit Sahoo 97a97b3c11 Tweak error message for HMR
Summary:The error messages are iOS specific right now. This PR improves them to include the Android bits also.

![screenshot_20160322-000431](https://cloud.githubusercontent.com/assets/1174278/13929839/2bccce5e-efc2-11e5-9db3-f72dcf486412.png)
Closes https://github.com/facebook/react-native/pull/6546

Differential Revision: D3077815

Pulled By: martinbigio

fb-gh-sync-id: 344430d350023e78bd5fdae923eb4b6ce2924be5
shipit-source-id: 344430d350023e78bd5fdae923eb4b6ce2924be5
2016-03-21 14:08:26 -07:00
Marc Horowitz 7a2698475e Replace :React with :FBReactOpenSourceKit
Reviewed By: javache

Differential Revision: D3055168

fb-gh-sync-id: 68cf6ab19ef1a2c8e7c9670474eeddd227412a34
shipit-source-id: 68cf6ab19ef1a2c8e7c9670474eeddd227412a34
2016-03-21 11:37:22 -07:00
Hedger Wang 206f846507 Move scenes reducer logic into a separate module.
Reviewed By: ericvicenti

Differential Revision: D3068237

fb-gh-sync-id: 0146f38be6024c080ed4e00ac6b7c1e2f3d8e56f
shipit-source-id: 0146f38be6024c080ed4e00ac6b7c1e2f3d8e56f
2016-03-21 11:14:22 -07:00
Janic Duplessis 61483aa15d Add support for elevation in DrawerLayoutAndroid
Summary:It didn't work for a few reason. First, the drawer view NEEDS to have a background color or no shadow will ever render. Second, we need to use the `setDrawerElevation` method instead of `setElevation` for DrawerLayout. Finally we need to actually pass the style value (maybe we could just pass elevation but I don't really think it can cause any issues) down to the native component as it is not the case at the moment.

I also added a default style to elevation of 16 which is the standard for material design according to https://www.google.com/design/spec/patterns/navigation-drawer.html#navigation-drawer-specs. I could also default it to 0 so it keeps the same appearance as before but I think it looks better this way.

Closes #6022
**Test plan**
Tested using the DrawerLayout in the UIExplorer app.

Before, elevation 0
<img width="420" alt="screen shot 2016-02-23 at 1 55 42 am" src="https://cloud.githubusercontent.com/assets/2677334/13244000/008afdb2-d9d1-11e5-95b8-9c345ea0ea8d.png">

After, elevation
Closes https://github.com/facebook/react-native/pull/6100

Reviewed By: bestander

Differential Revision: D3012242

Pulled By: lexs

fb-gh-sync-id: 4967d7ec920f0229d823032ba95c8a3cace329c6
shipit-source-id: 4967d7ec920f0229d823032ba95c8a3cace329c6
2016-03-21 06:24:33 -07:00
pedramsaleh b85f0ac74f Update SegmentedControlIOS.ios.js
Summary:Updating the comments to clarify that the selectedIndex prop is not just for pre-selecting an index, but that it can also be used to programmatically change the value of the selected index.
Closes https://github.com/facebook/react-native/pull/6519

Differential Revision: D3075199

Pulled By: mkonicek

fb-gh-sync-id: 8ce336ad491bb2fed13df15ebddb1b24535c50ff
shipit-source-id: 8ce336ad491bb2fed13df15ebddb1b24535c50ff
2016-03-20 18:07:23 -07:00
Janic Duplessis f1a0695c7d Improve pointerEvents doc
Summary:The docs for touchEvents was really unclear and assumed that you know what `pointer-events` does in CSS. This is confusing especially for native developers, see [this issue](http://stackoverflow.com/questions/36068392/set-userinteractionenabled-false-in-react-native/36096413) on stack overflow.

I added a short description to the prop and all the possible enum values and made it so the comment that explain why it is a prop and not a style doesn't appear on the website as it is not really relevant there.

**Test plan (required)**
Tested by running the website locally.
Closes https://github.com/facebook/react-native/pull/6534

Differential Revision: D3075198

Pulled By: mkonicek

fb-gh-sync-id: 57c8444fc83a31599dc872c361b142531cdd4885
shipit-source-id: 57c8444fc83a31599dc872c361b142531cdd4885
2016-03-20 18:02:18 -07:00
Martín Bigio bcb37c0b6a inline `__accept` call so that sourcemaps work
Summary:Sourcemaps on HMR where a couple of line off. The problem is that since the `__accept` call doesn't go through the sourcemaps pipeline we need to make sure that call is a single-line one.

This was originally written in a single line but I incorrectly updated it on 436db67126. Would be great having test coverage for this.

Reviewed By: davidaurelio

Differential Revision: D3075164

fb-gh-sync-id: c77ea99f26bdd675f241c5d20a620eb4ddfbf701
shipit-source-id: c77ea99f26bdd675f241c5d20a620eb4ddfbf701
2016-03-20 17:39:22 -07:00
Aaron Franks 11985d5c77 Remove invalid comma from Animated example
Summary:Helps for suckers like me, who copy and paste example code ;)
Closes https://github.com/facebook/react-native/pull/5133

Differential Revision: D3074849

Pulled By: mkonicek

fb-gh-sync-id: 8311dc26b173e341433866f66db374464c3c9f63
shipit-source-id: 8311dc26b173e341433866f66db374464c3c9f63
2016-03-20 11:02:27 -07:00
Nick Hudkins a3ba25ed90 Correct scrollEventThrottle docs
Summary:The docs indicated that a higher number was more accurate, however based on the implementation:

```
  /**
   * TODO: this logic looks wrong, and it may be because it is. Currently, if _scrollEventThrottle
   * is set to zero (the default), the "didScroll" event is only sent once per scroll, instead of repeatedly
   * while scrolling as expected. However, if you "fix" that bug, ScrollView will generate repeated
   * warnings, and behave strangely (ListView works fine however), so don't fix it unless you fix that too!
   */
  if (_allowNextScrollNoMatterWhat ||
      (_scrollEventThrottle > 0 && _scrollEventThrottle < (now - _lastScrollDispatchTime)))
```
https://github.com/facebook/react-native/blob/master/React/Views/RCTScrollView.m#L564

It appears that only 0 is a special case here, and perhaps a known issue ;)
Closes https://github.com/facebook/react-native/pull/3729

Differential Revision: D3074801

Pulled By: mkonicek

fb-gh-sync-id: f63b00755f7565165cc628085efa5ed96badcfe1
shipit-source-id: f63b00755f7565165cc628085efa5ed96badcfe1
2016-03-20 09:52:22 -07:00
Michelle Hwang ac2571d5ec Revert changes to Modal.js styling
Differential Revision: D3074138

fb-gh-sync-id: 85bdf536154319e8361e55aadcaf81ab3c214d65
shipit-source-id: 85bdf536154319e8361e55aadcaf81ab3c214d65
2016-03-19 14:21:22 -07:00
Alon Schwarz fb8340d289 Add center ImageResizeMode option
Summary:Adds a `center` option to `Image`'s `resizeMode` prop, which doesn't enlarge images.
This is how it looks in UIExplorer:
{F60386921}

Reviewed By: dmmiller

Differential Revision: D3064284

fb-gh-sync-id: 79cd2da8f44c5b3da2e42d3bebf3131335f53c28
shipit-source-id: 79cd2da8f44c5b3da2e42d3bebf3131335f53c28
2016-03-19 11:25:24 -07:00
Jiajie Zhu e50271cbe3 fix warning about async CameraRoll.getPhotos
Differential Revision: D3065326

fb-gh-sync-id: fea016f0f14078d61d4becf9f9bcbca4fe1f1d92
shipit-source-id: fea016f0f14078d61d4becf9f9bcbca4fe1f1d92
2016-03-18 10:21:23 -07:00
Dave Miller a6ada1e946 Remove DEV warning about ScrollEventThrottle on Android where it is not supported
Reviewed By: bestander

Differential Revision: D3069574

fb-gh-sync-id: f0d9aca754e45a34836d26febdabacb6424ca371
shipit-source-id: f0d9aca754e45a34836d26febdabacb6424ca371
2016-03-18 09:05:22 -07:00
Dave Miller db7a154360 Open source Modal
Summary: This open sources an internal Modal View

Reviewed By: mkonicek

Differential Revision: D3065229

fb-gh-sync-id: 763996aef375883d94f70e617bfc7835a9cecb6f
shipit-source-id: 763996aef375883d94f70e617bfc7835a9cecb6f
2016-03-18 04:21:48 -07:00
Janic Duplessis 18f38ecdc0 Add StatusBar height constant and improve implementation
Summary:This adds a `HEIGHT` constant on `StatusBar` on Android. I needed only this for now but I will work on a better status bar dimensions API later (see TODO).

It also improves the implementation to fix a bug that happened when multiple `StatusBar` components get updated in the same frame as well as remove useless calls to the `StatusBarModule` when values did not change.

Instead of calling the `StatusBarManager` immediately when the component gets updated and relying on the order of the calls that get dispatched to native we now wait at the end of the frame to send the calls to the `StatusBarManager` using `setImmediate`. To make this work properly we need to change the data structure of the props stack a little bit to store the desired transition/animation too for each value.

Finally this updates the example to only show the ones that work for the current platform.

**Test plan**
In the UIExplorer Example, in the 'StatusBar dimensions' section it should show 25 for the height of the status bar.
A
Closes https://github.com/facebook/react-native/pull/6195

Differential Revision: D3017559

fb-gh-sync-id: d6f4c6a72a2dfde83496ecc0f56dca4abaf3055e
shipit-source-id: d6f4c6a72a2dfde83496ecc0f56dca4abaf3055e
2016-03-17 16:54:26 -07:00
Reem Helou 9cb3ec9424 Add blur effect to RCTImageView
Summary: This diff introduces a blur radius property to the Image component on ios. If the radius specified is greater then 0 then native will apply a blur filter to the image

Reviewed By: nicklockwood

Differential Revision: D3054671

fb-gh-sync-id: d7a81ce5a08a3a2091c583f5053c6a86638b21b2
shipit-source-id: d7a81ce5a08a3a2091c583f5053c6a86638b21b2
2016-03-17 12:25:40 -07:00
Dilan Edirisinghe 8d7b419ed7 Add missing conditional to ListView.
Reviewed By: jingc

Differential Revision: D3062338

fb-gh-sync-id: 52f9477604f488b7bc4829046f166c8e30aef868
shipit-source-id: 52f9477604f488b7bc4829046f166c8e30aef868
2016-03-17 12:11:25 -07:00
Michelle Hwang 14555063bb backout (and remove) props.lineBreakMode from Text
Reviewed By: jingc

Differential Revision: D3063164

fb-gh-sync-id: 81776866c09bb06411b9660f1f4833ba515e046a
shipit-source-id: 81776866c09bb06411b9660f1f4833ba515e046a
2016-03-17 11:48:24 -07:00
Hedger Wang 3dbf9b9844 Port `onWillFocus` and `onDidFocus` from `Navigator` to `NavigationLegacyNavigatorRouteStack`.
Summary: Port the legendary props `onWillFocus` and `onDidFocus` from `Navigator` to `NavigationLegacyNavigatorRouteStack`.

Reviewed By: fkgozali

Differential Revision: D3063530

fb-gh-sync-id: 89583b8c80ee6ed0ef844a56b942a2d74b98717f
shipit-source-id: 89583b8c80ee6ed0ef844a56b942a2d74b98717f
2016-03-17 11:27:24 -07:00
Dave Miller 998d68d36d Add Android support for Modal
Summary:This adds support for Modal.js on Android.

I added the ModalExample to UIExplorer to demonstrate the usage.

Reviewed By: andreicoman11

Differential Revision: D3053732

fb-gh-sync-id: 292173bdd5cb518e87cbb1d622af436704bb6329
shipit-source-id: 292173bdd5cb518e87cbb1d622af436704bb6329
2016-03-17 08:53:26 -07:00
Hedger Wang 55477ffd67 Make NavigationLegacyNavigator more testable.
Summary:- Move the logics that manage the routes stack into `NavigationLegacyNavigatorRouteStack`
- Add more unit tests for NavigationLegacyNavigatorRouteStack.
- Keep NavigationLegacyNavigator as a pure view as possible as we could.

Reviewed By: fkgozali

Differential Revision: D3060459

fb-gh-sync-id: 2c6802115c3f6ca5e396903f0d314ff54129524c
shipit-source-id: 2c6802115c3f6ca5e396903f0d314ff54129524c
2016-03-16 17:20:25 -07:00
Thomas Beverley 0be6031bc6 Added mediaPlaybackRequiresUserAction to WebView
Summary:Just added a pass through to the `WebView` for `mediaPlaybackRequiresUserAction` and `setMediaPlaybackRequiresUserGesture` to allow auto-playing audio and video elements
Closes https://github.com/facebook/react-native/pull/5956

Differential Revision: D3053554

Pulled By: mkonicek

fb-gh-sync-id: a1f362c1551de1a0218f5d23c70668e4c8078993
shipit-source-id: a1f362c1551de1a0218f5d23c70668e4c8078993
2016-03-16 10:03:26 -07:00
Konstantin Raev 2273e012c0 Fixes OSS build: haste module -> commonJS invariant
Reviewed By: mkonicek

Differential Revision: D3058276

fb-gh-sync-id: 07b98608f4e684b0e192f64743a82717e65772ea
shipit-source-id: 07b98608f4e684b0e192f64743a82717e65772ea
2016-03-16 06:57:26 -07:00
Zahan Malkani 2209131933 Introduce custom asset resolver to resolveAssetSource(..)
Reviewed By: frantic

Differential Revision: D2989112

fb-gh-sync-id: a678d091aeb6904448c890653f57dd7944ce95c3
shipit-source-id: a678d091aeb6904448c890653f57dd7944ce95c3
2016-03-15 20:20:27 -07:00
Hedger Wang 28649b8cf0 Simplify <NavigationCard />.
Summary:Per offline discussion with ericvicenti,  we'd like to reudce the complexity by
keeping <NavigationCard /> nothing more than just a simple `<Animated.View />`,
which helps us to avoid over generalize the styles, gestures of what the Navigation card
needs to be.

The proposalis to use the same props (NavigationSceneRendererProps) that is used to render
the scene to generate the style and pan handlers needed for the navigation card.

No behavior changes, just implementation details clean up work.

Reviewed By: ericvicenti

Differential Revision: D3037225

fb-gh-sync-id: f6e718a282d25a319f5d8efd3e2ffebc66b2c8cb
shipit-source-id: f6e718a282d25a319f5d8efd3e2ffebc66b2c8cb
2016-03-15 15:59:26 -07:00
Eaden d63762194d Fix bug #5604 - Unrecognised signal for touchable no longer on the screen
Summary:Fixes bug https://github.com/facebook/react-native/issues/5604 ("Redscreen error when TouchRelease triggered on a component no longer in the tree")

( maybe not ideally )

This issue is triggered by the following:

A Touch event on a component ( Keep Pressing )
A state/props update removes the component from the tree and render is performed
A Touch Release event. ( When you release the press on the component no longer there )

This fix adds an early return to the signal handling code if a RESPONDER_RELEASE signal happens when the responder has disappeared
Closes https://github.com/facebook/react-native/pull/5637

Differential Revision: D3053729

Pulled By: sahrens

fb-gh-sync-id: 21a2a303d8921654607eaab824ef28fc16df9500
shipit-source-id: 21a2a303d8921654607eaab824ef28fc16df9500
2016-03-15 12:23:32 -07:00
Petr Glotov e07fe0cc60 render empty section headers
Summary:Changed behavior so that empty section headers are rendered, fixes this [issue](https://github.com/facebook/react-native/issues/5639).
Closes https://github.com/facebook/react-native/pull/5713

Differential Revision: D3053765

Pulled By: sahrens

fb-gh-sync-id: 59a78a4b19288b2acc04a7b166de8c2ad16eacd7
shipit-source-id: 59a78a4b19288b2acc04a7b166de8c2ad16eacd7
2016-03-15 12:14:28 -07:00
Alexey Dodonov cc2068e201 Backed out changeset 183744d2415b
Reviewed By: nicklockwood

Differential Revision: D3053067

fb-gh-sync-id: de20718b5bf82eae433637847143e32b7a4bb216
shipit-source-id: de20718b5bf82eae433637847143e32b7a4bb216
2016-03-15 11:49:28 -07:00
Christopher Dro e674e45c2e Reverted commit D3040735
Summary:This is a follow up of 9b87e6c860.

- Allows custom headers on connection request
- Adds a default `origin` header to Android, just like iOS

**Introduces no breaking changes.**

I was working on something similar and would like to propose a few changes that make the API more consistent across both iOS and Android platforms and brings this closer to [spec](https://tools.ietf.org/html/rfc6455).

I believe aprock first implementation of adding custom `headers` was correct. It makes sense naming this argument `headers` since we have no other general options available, and the current `options` field is being used to pass in a header anyway.

My use case for custom headers was attaching a token to the `Authorization` header on the connection request. I have been testing this by passing a JWT inside the `Authorization` header and verifying it on the server before establishing a connection.
Closes https://github.com/facebook/react-native/pull/6016

Differential Revision: D3040735

fb-gh-sync-id: 183744d2415b895f9d9fd8ecf6023a546e18a546
shipit-source-id: 183744d2415b895f9d9fd8ecf6023a546e18a546
2016-03-15 07:20:26 -07:00
Pieter De Baets b653d43e2e Update Dimensions when device orientation changes
Reviewed By: nicklockwood

Differential Revision: D2939877

fb-gh-sync-id: ec6161448bff34c07b93f19e1ee953657675bad5
shipit-source-id: ec6161448bff34c07b93f19e1ee953657675bad5
2016-03-15 05:49:25 -07:00
David Aurelio f87b673a29 Add possibility to `console.error`/redbox on promise rejections
Summary: Adds a possibility to `console.error` / redbox if any promise is rejected.

Differential Revision: D3048130

fb-gh-sync-id: b1a44b421ec3b1f7913226c86b2a48f00f27b105
shipit-source-id: b1a44b421ec3b1f7913226c86b2a48f00f27b105
2016-03-15 05:22:22 -07:00
Christopher Dro 205b5d4732 Update options parameter to headers. Update to spec.
Summary:This is a follow up of 9b87e6c860.

- Allows custom headers on connection request
- Adds a default `origin` header to Android, just like iOS

**Introduces no breaking changes.**

I was working on something similar and would like to propose a few changes that make the API more consistent across both iOS and Android platforms and brings this closer to [spec](https://tools.ietf.org/html/rfc6455).

I believe aprock first implementation of adding custom `headers` was correct. It makes sense naming this argument `headers` since we have no other general options available, and the current `options` field is being used to pass in a header anyway.

My use case for custom headers was attaching a token to the `Authorization` header on the connection request. I have been testing this by passing a JWT inside the `Authorization` header and verifying it on the server before establishing a connection.
Closes https://github.com/facebook/react-native/pull/6016

Differential Revision: D3040735

Pulled By: nicklockwood

fb-gh-sync-id: f81bd14ccbdba36309b9d4b4850fb66fe4deae11
shipit-source-id: f81bd14ccbdba36309b9d4b4850fb66fe4deae11
2016-03-15 05:14:21 -07:00
aleclarsoniv 64a09feaf7 Add 'props.lineBreakMode' to Text
Summary:I've tested this manually, but I'm not sure how to write a test for this. Hopefully someone can help out there. The least I could do is provide a starting point for a PR to be accepted.

Additionally, I've renamed the existing `NSLineBreakMode` enum converter (inside `RCTConvert`) to use dashes in the names instead of camelcase (eg: `word-wrapping` instead of `wordWrapping`).

Fixes #6338
Closes https://github.com/facebook/react-native/pull/6339

Differential Revision: D3052391

Pulled By: nicklockwood

fb-gh-sync-id: 1536dfc139d7995095e9ee9d5f13ca86f90783c5
shipit-source-id: 1536dfc139d7995095e9ee9d5f13ca86f90783c5
2016-03-15 04:16:30 -07:00
Mike Grabowski 6481e0ea6a Setup RCTNativeAppEventEmitter on init
Summary: Fixes #6227 as discussed in FB group, also a follow up to ide commit 6ec4d65aec

Differential Revision: D3041185

Pulled By: javache

fb-gh-sync-id: 544c55b14d238eb8bfed3ab1588c6e48d164943e
shipit-source-id: 544c55b14d238eb8bfed3ab1588c6e48d164943e
2016-03-15 03:45:33 -07:00
Chris Geirman afffcde15c add examples that demonstrate how to use mergeItem, multiMerge, multi…
Summary:Thanks for submitting a pull request! Please provide enough information so that others can review your pull request:

(You can skip this if you're fixing a typo or adding an app to the Showcase.)

Explain the **motivation** for making this change. What existing problem does the pull request solve?

it wasn't clear how to use various methods such as mergeItem, multiMerge, etc, so after figuring it out I thought it would be useful to provide clear examples for others.

Example: When "Adding a function to do X", explain why it is necessary to have a way to do X.

**Test plan (required)**

Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI.

Make sure tests pass on both Travis and Circle CI.

**Code formatting**

See the simple [style guide](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#style-guide).

…Set, multiGet, and multiRemove
Closes https://github.com/facebook/react-native/pull/6423

Differential Revision: D3048502

Pulled By: vjeux

fb-gh-sync-id: dfe13c6a88fa9d3e7646b5ecaa5f594bfaba8271
shipit-source-id: dfe13c6a88fa9d3e7646b5ecaa5f594bfaba8271
2016-03-14 17:38:22 -07:00
David Aurelio 06b5bda349 Bring back "Use numeric identifiers when building a bundle"
Summary:This brings back "Use numeric identifiers when building a bundle", previously backed out.
This version passes on the correct entry module name to code that decides transform options.

Original Description:
Since the combination of node and haste modules (and modules that can be required as both node and haste module) can lead to situations where it’s impossible to decide an unambiguous module identifier, this diff switches all module ids to integers. Each integer maps to an absolute path to a JS file on disk.

We also had a problem, where haste modules outside and inside node_modules could end up with the same module identifier.

This problem has not manifested yet, because the last definition of a module wins. It becomes a problem when writing file-based unbundle modules to disk: the same file might be written to concurrently, leading to invalid code.

Using indexed modules will also help indexed file unbundles, as we can encode module IDs as integers rather than scanning string IDs.

Reviewed By: martinbigio

Differential Revision: D2855202

fb-gh-sync-id: 9a011bc403690e1522b723e5742bef148a9efb52
shipit-source-id: 9a011bc403690e1522b723e5742bef148a9efb52
2016-03-14 16:17:20 -07:00
Szabó Krisztián 265b63866a Fix typo in ScrollView childLayoutProps error message
Summary:Thanks for submitting a pull request! Please provide enough information so that others can review your pull request:

(You can skip this if you're fixing a typo or adding an app to the Showcase.)

Explain the **motivation** for making this change. What existing problem does the pull request solve?

Example: When "Adding a function to do X", explain why it is necessary to have a way to do X.

**Test plan (required)**

Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI.

Make sure tests pass on both Travis and Circle CI.

**Code formatting**

See the simple [style guide](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#style-guide).
Closes https://github.com/facebook/react-native/pull/6454

Differential Revision: D3049074

Pulled By: sahrens

fb-gh-sync-id: 61d085bb5c7bedf80204cdfb94e5c23542e15333
shipit-source-id: 61d085bb5c7bedf80204cdfb94e5c23542e15333
2016-03-14 14:35:27 -07:00
Janic Duplessis 88ebdb2a65 RefreshControl refreshing prop and doc improvements
Summary:This makes the `refreshing` prop more 'controlled'. Before forgetting to set the refreshing prop in the onRefresh callback would make the js and native `refreshing` prop get out of sync and make the RefreshControl stop refreshing properly (see #5839).

I also added a simple usage example and a note about the refreshing prop in the doc.

There was also a small bug in the doc generation code that made the array of color show as [[object Object]] instead of [color] so I fixed that too.

** Test plan**
Tested using the UIExplorer example on iOS and Android. Not setting the `refreshing` prop to true in the `onRefresh` function should cause the RefreshControl to stop refreshing immediately and continue working properly after.

Closes #5839
Closes https://github.com/facebook/react-native/pull/6434

Differential Revision: D3046279

Pulled By: nicklockwood

fb-gh-sync-id: ebda04c659a10f0b9d468473c8d5c659256ca1b5
shipit-source-id: ebda04c659a10f0b9d468473c8d5c659256ca1b5
2016-03-13 03:04:24 -07:00
Gaëtan Renaudeau b5985cf690 Refactor bezier implementation from bezier-easing library
Summary:fast & accurate implementation
See https://github.com/gre/bezier-easing
the library is embedded in React Native

fixes #6207 & to follow #6340 (or to replace it)
cc vjeux

tests
 ---

[the lib tests](https://github.com/gre/bezier-easing/blob/master/test/test.js) ensure the library is accurate.
It is tested that the library have a precision better than ±0.000001 .

performance
 ---

On my macbook pro, [the lib benchmark](https://github.com/gre/bezier-easing/blob/master/benchmark.js) have:

```
BezierEasing: instanciation x 1,043,725 ops/sec ±1.46% (82 runs sampled)
BezierEasing: call x 7,866,642 ops/sec ±0.93% (85 runs sampled)
BezierEasing: instanciation + call x 803,051 ops/sec ±1.58% (74 runs sampled)
```
Closes https://github.com/facebook/react-native/pull/6433

Differential Revision: D3045854

Pulled By: vjeux

fb-gh-sync-id: b3c5dba19195a6719967b4fdc8ef940cc067b1f4
shipit-source-id: b3c5dba19195a6719967b4fdc8ef940cc067b1f4
2016-03-12 14:13:22 -08:00
Hedger Wang 3833c1b751 Implements `renderHeader` for legacy navigator.
Reviewed By: ericvicenti

Differential Revision: D3029188

fb-gh-sync-id: 6f0b91244bc0d0e5eee0e610764a39adaaffe001
shipit-source-id: 6f0b91244bc0d0e5eee0e610764a39adaaffe001
2016-03-10 17:17:21 -08:00
Hedger Wang 7da65a817c backed out changeset 87e6fe282c08
Reviewed By: ericvicenti

Differential Revision: D3033857

fb-gh-sync-id: 7391ae943a88c675f8539f5cc81587caec36e80e
shipit-source-id: 7391ae943a88c675f8539f5cc81587caec36e80e
2016-03-10 14:28:35 -08:00
Charles Pletcher f5a1600a20 Fixes #1509 -- Add note about side-specific properties on TextInput
Summary:Add note about side-specific properties not being applied to `TextInput`s if `multiline=false`.

Fix formatting of docs describing other `multiline={true/false}` quirks.
Closes https://github.com/facebook/react-native/pull/2240

Differential Revision: D3037154

Pulled By: andreicoman11

fb-gh-sync-id: d64db906c2ab0054f2357b8e218725414d9868d6
shipit-source-id: d64db906c2ab0054f2357b8e218725414d9868d6
2016-03-10 13:44:23 -08:00
Eric Vicenti b1090bfae1 NavigationExperimental: Handle generic back action from stack reducer
Reviewed By: hedgerwang

Differential Revision: D3036422

fb-gh-sync-id: 8cf454a76ddc14b5601e84dee1ae5aaf98060d5f
shipit-source-id: 8cf454a76ddc14b5601e84dee1ae5aaf98060d5f
2016-03-10 12:33:22 -08:00
Eric Vicenti 9ca853d4d1 NavigationExperimental: Fix missed renaming of setTiming to applyAnimation
Summary:f2483eb1ee (diff-0d0be087e61cb933286a7cc733767cbeR106)

approve2ship

Reviewed By: hedgerwang

Differential Revision: D3034798

fb-gh-sync-id: 74d0688f935bc324791cf43b15c0106f3c4dd703
shipit-source-id: 74d0688f935bc324791cf43b15c0106f3c4dd703
2016-03-10 11:34:26 -08:00
Eric Vicenti 30166c52cb NavigationExperimental: Avoid double push on double-tap in UIExplorer
Reviewed By: javache

Differential Revision: D3033918

fb-gh-sync-id: 9085db138754f1aa557f0190456529e5e71ac27b
shipit-source-id: 9085db138754f1aa557f0190456529e5e71ac27b
2016-03-10 11:16:33 -08:00
Nick Lockwood 520ad05ba0 Removed unnecessary exportedConstants
Summary: The exportedConstants method incurrs a penalty at bridge startup time for every module that implements it. This diff removes exportedConstants from a few modules that don't really need to use it.

Reviewed By: majak

Differential Revision: D2982341

fb-gh-sync-id: be016187d7b731a073311daacfcf88a0402e1688
shipit-source-id: be016187d7b731a073311daacfcf88a0402e1688
2016-03-10 10:21:34 -08:00
Ken Wheeler ec9efb8a01 Updating AppState to support the inactive state.
Summary:**Motivation**

AppStateIOS never currently returns `inactive` as a possible state. I had a requirement that when inactive, certain portions of the app should be blacked out in accordance with compliance rules. This is not possible currently, due to `inactive` never being returned. This PR fixes that.

**Test plan**

All base tests are passing. Are there AppState specific tests in place at the moment that I'm missing?

**Demonstration**

![appstate](https://cloud.githubusercontent.com/assets/286616/13640546/1cb6eeb0-e5e3-11e5-8d64-332ea3383a54.gif)
Closes https://github.com/facebook/react-native/pull/6379

Differential Revision: D3035530

Pulled By: nicklockwood

fb-gh-sync-id: 93deccc8184816809926dca8a95f2bebd1434987
shipit-source-id: 93deccc8184816809926dca8a95f2bebd1434987
2016-03-10 08:30:24 -08:00
sunnylqm 20cd7ac339 add hyphen on drawerLockMode values
Summary: Closes https://github.com/facebook/react-native/pull/6396

Differential Revision: D3034612

Pulled By: nicklockwood

fb-gh-sync-id: cd20d405b7064e167b895411decedfae215f3b8b
shipit-source-id: cd20d405b7064e167b895411decedfae215f3b8b
2016-03-10 08:24:23 -08:00
Spencer Ahrens f21da3aa31 <Incremental> for incremental rendering
Summary:Everything wrapped in `<Incremental>` is rendered sequentially via `InteractionManager`.
The `onDone` callback is called when all descendent incremental components have
finished rendering, used by `<IncrementalPresenter>` to make the story visible all at once
instead of the parts popping in randomly.

This includes an example that demonstrates streaming rendering and the use of
`<IncrementalPresenter>`.  Pressing down pauses rendering and you can see the
`TouchableOpacity` animation runs smoothly.  Video:

https://youtu.be/4UNf4-8orQ4

Ideally this will be baked into React Core at some point, but according to jordwalke that's
going to require a major refactoring and take a long time, so going with this for now.

Reviewed By: ericvicenti

Differential Revision: D2506522

fb-gh-sync-id: 5969bf248de10d38b0ac22f34d7d49bf1b3ac4b6
shipit-source-id: 5969bf248de10d38b0ac22f34d7d49bf1b3ac4b6
2016-03-10 08:14:23 -08:00
Björn Pötzschke 1832d79bd1 TextStorage in RCTText is now only set when it differs from old value.
Summary:**Motivation**
Multiple instances of `Text` inside a `ListView` is a bad idea for the performance of the app.
When you create 1000 elements and you scroll through the list it is really slow and laggy because the `NSTextStorage`, which is the backbone of the `RCTText` element, will set more than 1,000 times and also the method `setNeedsDisplay` is called multiple times. This will causes huge memory problems and the app crashes.

With this commit I check in `RCTText` if the `NSTextStorage` differs from the old value. If yes then set it otherwise don't set the `NSTextStorage`. This will prevent to call `setNeedsDisplay` when not really needed.

Gist with sample app to show behavior can be found here: https://gist.github.com/bpoetzschke/28a17969c6aa54219e18
Closes https://github.com/facebook/react-native/pull/6341

Differential Revision: D3035485

Pulled By: nicklockwood

fb-gh-sync-id: 181f01b7f87f765dbb01a4ad3196fc40f9d50694
shipit-source-id: 181f01b7f87f765dbb01a4ad3196fc40f9d50694
2016-03-10 07:46:52 -08:00
Jeff Morrison 593d766ec5 Fix fbsource errors
Reviewed By: kassens

Differential Revision: D3032708

fb-gh-sync-id: e697a2433dcdcb70ddeafdee607f14e570cfb245
shipit-source-id: e697a2433dcdcb70ddeafdee607f14e570cfb245
2016-03-09 16:54:24 -08:00
Laurence Bortfeld 336dbe4c00 getCurrentConnectivity should resolve with object
Summary:`getCurrentConnectivity()` should resolve with object instead of array otherwise in `NetInfo.fetch().done(reach => console.log('Initial: ' + reach))` `reach` will be undefined (see https://github.com/l-urence/react-native/blob/master/Libraries/Network/NetInfo.js#L200).

cc satya164
Closes https://github.com/facebook/react-native/pull/6373

Differential Revision: D3032773

fb-gh-sync-id: edc545548d3c17387545b6c59894c27e4563cb18
shipit-source-id: edc545548d3c17387545b6c59894c27e4563cb18
2016-03-09 16:30:30 -08:00
Konstantin Raev 9213d0411d Backed out changeset ed509fc86e9d
Reviewed By: javache

Differential Revision: D3029704

fb-gh-sync-id: 87e6fe282c08d7128e1f5f00a956af0b6e341b30
shipit-source-id: 87e6fe282c08d7128e1f5f00a956af0b6e341b30
2016-03-09 08:25:25 -08:00
Richard Lai f2483eb1ee Rename setTiming to applyAnimation
Summary:Given that you can do all kinds of animations other than `Animated.timing`, it made no sense to have `setTiming`. In addition, you can't intuitively tell that this is the callback where you would do custom animations.

The discussion took place on Discord with ericvicenti: https://discordapp.com/channels/102860784329052160/154015578669973504
Closes https://github.com/facebook/react-native/pull/6235

Differential Revision: D2999121

Pulled By: hedgerwang

fb-gh-sync-id: f587b865de11ba5e8dc9c430720252ffb5d12794
shipit-source-id: f587b865de11ba5e8dc9c430720252ffb5d12794
2016-03-08 23:37:34 -08:00
Laurence Bortfeld 6470ff842b Reject promise if network request failed
Summary:This adds missing check and promise reject for failing network requests. Which was missing in the fetch.js update. Sorry for the trouble.

cc davidaurelio
Closes https://github.com/facebook/react-native/pull/6368

Differential Revision: D3026830

Pulled By: davidaurelio

fb-gh-sync-id: 028037678e148bb9b0a6a098d29ec7d82f64b607
shipit-source-id: 028037678e148bb9b0a6a098d29ec7d82f64b607
2016-03-08 16:37:24 -08:00
Hedger Wang fa5783e3ee Initial implementation of the Navigator with NavigationExperimental.
Summary:This is the initial implementation of the Navigator done with the NavigationExperimental library.
There will be following diffs to support more features that are currently available from the Navigator.

Reviewed By: ericvicenti

Differential Revision: D3016084

fb-gh-sync-id: ed509fc86e9dc67b5334be9e60b582494fd52844
shipit-source-id: ed509fc86e9dc67b5334be9e60b582494fd52844
2016-03-08 16:26:24 -08:00
Martín Bigio 179ac1e359 Remove HMRClient out of the bundle
Reviewed By: elynde

Differential Revision: D3024020

fb-gh-sync-id: 26e8be8a1b2c1986e4ca7b510aac263f1a2ced1c
shipit-source-id: 26e8be8a1b2c1986e4ca7b510aac263f1a2ced1c
2016-03-08 13:27:32 -08:00
Jeff Morrison b473d496c4 Update FBSource to use Flow 0.22
Reviewed By: gabelevi

Differential Revision: D3021265

fb-gh-sync-id: f4c857505c1a7b6b813bcdccd629e595ef7a81af
shipit-source-id: f4c857505c1a7b6b813bcdccd629e595ef7a81af
2016-03-08 12:39:29 -08:00
mangogogos 06a41c3785 Forward touchable events to TouchableNativeFeedback
Summary:Fixes #6256
Closes https://github.com/facebook/react-native/pull/6344

Differential Revision: D3021478

Pulled By: mkonicek

fb-gh-sync-id: 350cf72ad73d06d97cc1663e0d69c0c97977689e
shipit-source-id: 350cf72ad73d06d97cc1663e0d69c0c97977689e
2016-03-08 12:12:39 -08:00
Hedger Wang b5ae8a8ece Clean up NavigationAnimatedView
Summary:- Add flow type checks.
- Fix code styles.
- Improve the logics to update `this.state.scenes`.
- Improve the logics to pass the layout.

Reviewed By: ericvicenti

Differential Revision: D3022107

fb-gh-sync-id: 23f4ed22db797f68bde0ba4f3cdd123701934fc3
shipit-source-id: 23f4ed22db797f68bde0ba4f3cdd123701934fc3
2016-03-08 10:57:22 -08:00
Laurence Bortfeld 87c26885a3 Update fetch to latest https://github.com/github/fetch
Summary:This fixes https://github.com/facebook/react-native/issues/6326 with updating https://github.com/facebook/react-native/blob/master/Libraries/Fetch/fetch.js to latest from  https://github.com/github/fetch.

cc skevy steveluscher
Closes https://github.com/facebook/react-native/pull/6347

Differential Revision: D3024308

Pulled By: davidaurelio

fb-gh-sync-id: da87827b94d683aeb66be345e255bd771fdba1be
shipit-source-id: da87827b94d683aeb66be345e255bd771fdba1be
2016-03-08 09:48:29 -08:00
realaboo 49b2805da2 Geolocation Accuracy and Cached Location Bug
Summary:There are two issues:

1. When calling startObserving or getCurrentPosition for the first time, _locationManager is not initialized and the accuracy value set in options is lost.

2. When using the cached location _lastLocationEvent, current timestamp retrieved by CFAbsoluteTimeGetCurrent() is from 2001, but the timestamp of the location is from 1970. In addition, the comparison between _lastLocationEvent[@"coords"][@"accuracy"] and options.accuracy is incorrect. Less value indicates more accurate location.
Closes https://github.com/facebook/react-native/pull/6198

Differential Revision: D3023786

Pulled By: nicklockwood

fb-gh-sync-id: 869c0e34252470275bf99cf0e5861747247f1158
shipit-source-id: 869c0e34252470275bf99cf0e5861747247f1158
2016-03-08 05:17:21 -08:00
Tim Yung d0a26a75fb RN: Fix Exponential WebSocket Growth from DevTools
Summary:025281230de2e316f2770a2db71f8bec6fe43a07 changed `WebSocket` to fire both `onerror` and `onclose`.

However, `setupDevtools` assumed that only one of the two handlers would ever be invoked. When the handler is invoked, it re-invokes itself to keep a socket open. But since both handelrs are invoked, a series of closed or failed sockets can cause an exponential increase in sockets opened.

Symptoms of this bug include eventually reaching the maximum number of file descriptors allowed by the operating system, or a non-responsive system. Within React Native applications, symptoms include a failure to load resources from the React Native server or application crashes.

Reviewed By: frantic

Differential Revision: D3022697

fb-gh-sync-id: 8131ecbd6d8ba30281253340d30370ff511a5efd
shipit-source-id: 8131ecbd6d8ba30281253340d30370ff511a5efd
2016-03-07 19:20:25 -08:00
David Aurelio fd3a0ba781 Play nice with `fetch` after the newest changes that add support for `XMLHttpRequest.response`
Summary:After adding support for `XMLHttpRequest#response`, the `fetch` polyfill detects buffer support when debugging in Chrome and sets `responseType` to `'blob'`.
In that case, the response was always empty.

This change will construct a blob if `responseType` has been set to `'blob'` in order to avoid that problem

Reviewed By: steveluscher

Differential Revision: D3018884

fb-gh-sync-id: 4ade0413de67242c3565d95c2880d4a981ba2342
shipit-source-id: 4ade0413de67242c3565d95c2880d4a981ba2342
2016-03-07 13:30:41 -08:00
Zack 025281230d WebSocket: call onclose before closing in event of error
Summary:Motivation: Developer expects `onclose` to be called before/during close of the websocket. The `websocketFailed` event triggers a close but does not invoke onclose.

Testplan: Connect to a websocket server from android, terminate the server, observe that onerror is called, the websocket is closed, but onclose is not called.

Note: the observed bug is in android only because in iOS the underlying websocket implementation fires the `websocketClosed` rather than `websocketFailed` event when the server terminates. Nevertheless, the justification for this change stands that regardless of the cause of the close, if `this.close` is called it is expected this.onclose should be called as well.
Closes https://github.com/facebook/react-native/pull/6307

Differential Revision: D3017458

fb-gh-sync-id: c9e2dfefa597b4e99ee85eaa991667c347f86d83
shipit-source-id: c9e2dfefa597b4e99ee85eaa991667c347f86d83
2016-03-06 15:02:27 -08:00
Zahan Malkani 87245b2d40 Support the scriptURLs observed on Android for asset source resolver
Reviewed By: frantic

Differential Revision: D3005791

fb-gh-sync-id: 99acb350c8c80ebe22687294a0069891686885fc
shipit-source-id: 99acb350c8c80ebe22687294a0069891686885fc
2016-03-05 22:43:25 -08:00
Richard Lai ebf5842fe6 Fix listener name in NavigationAnimatedView
Summary:Should be self-explanatory.

__Edit__: oh turns out I fixed a memory leak too because of a typo of the typo on teardown.

cc ericvicenti
Closes https://github.com/facebook/react-native/pull/6309

Differential Revision: D3016576

fb-gh-sync-id: 608a39ad293154e47480003bc9b450b521cddbb1
shipit-source-id: 608a39ad293154e47480003bc9b450b521cddbb1
2016-03-05 15:48:26 -08:00
Hedger Wang 71e59761c9 Clean up APIs.
Reviewed By: ericvicenti

Differential Revision: D3010136

fb-gh-sync-id: 310864450bfc86ebc2d696f8ef4876b14fa3a57f
shipit-source-id: 310864450bfc86ebc2d696f8ef4876b14fa3a57f
2016-03-04 14:57:31 -08:00
Frank Yan d815d1df9a Move cssVar out of react-native-github
Reviewed By: jingc

Differential Revision: D3008870

fb-gh-sync-id: 2c3d9a13ba6952540369cb68d96d375cb8cf757a
shipit-source-id: 2c3d9a13ba6952540369cb68d96d375cb8cf757a
2016-03-04 13:22:03 -08:00
Varun Vachhar d6ded2f807 Display a warning when using src property for an Image rather than source.
Summary:When using the `Image` component with a `src` property instead of `source` the component fails silently. vjeux suggested to add a warning (https://twitter.com/Vjeux/status/704509214937317378).

Tested with the UIExplorer example on iOS and Android simulators.
Closes https://github.com/facebook/react-native/pull/6221

Differential Revision: D3011659

Pulled By: mkonicek

fb-gh-sync-id: c9bae6c802c173ef85d9c4552747db994c58906e
shipit-source-id: c9bae6c802c173ef85d9c4552747db994c58906e
2016-03-04 07:32:22 -08:00
Hedger Wang 1caebf175a Add data structure to manage the stack for the legacy navigator.
Reviewed By: ericvicenti

Differential Revision: D3002015

fb-gh-sync-id: 27519a1b67fe514bd6d9102031ea482f76fae16b
shipit-source-id: 27519a1b67fe514bd6d9102031ea482f76fae16b
2016-03-03 22:52:51 -08:00
Wenjing Wang 8a1629166e nested emit call in a queue should be handled in FIFO
Summary: I think we should dispose events in FIFO order

Reviewed By: fkgozali

Differential Revision: D2987425

fb-gh-sync-id: a4ad256512725d0bed0086b642e10fe7e7715070
shipit-source-id: a4ad256512725d0bed0086b642e10fe7e7715070
2016-03-03 18:57:52 -08:00
Eric Lo 8c25181c44 Add onShow callback for RCTModalHostView
Summary: Added ability to include a callback to the modal. The callback is invoked when the modal is shown.

Reviewed By: javache

Differential Revision: D3005212

fb-gh-sync-id: 12648e17bd1cf831daf65529b87ae8cfdb901c65
shipit-source-id: 12648e17bd1cf831daf65529b87ae8cfdb901c65
2016-03-03 12:43:36 -08:00
Konstantin Raev 5ffeb9764c Back out of D3000972
Reviewed By: dmmiller

Differential Revision: D3003211

fb-gh-sync-id: e64f1f17dcbf19a32066de91d6e839d59cd5d27c
shipit-source-id: e64f1f17dcbf19a32066de91d6e839d59cd5d27c
2016-03-03 04:21:36 -08:00
Sokovikov 1bab7c5182 vibration module
Summary:I will fix other notes from https://github.com/facebook/react-native/pull/2794 if I get positive feedback.
Closes https://github.com/facebook/react-native/pull/6061

Reviewed By: nicklockwood

Differential Revision: D2982173

Pulled By: dmmiller

fb-gh-sync-id: d1e9407798b0293b090897a10996085b0f0c1b3e
shipit-source-id: d1e9407798b0293b090897a10996085b0f0c1b3e
2016-03-03 04:08:31 -08:00
Nick Lockwood dc13115445 Dispatch module setup asynchronously to avoid blocking main thread when bridge starts
Summary:Initializing native modules can block the main thread for tens of milliseconds when it starts up, making it difficult to instantiate the bridge on demand without causing a performance blip.

This diff splits up the initialization of modules so that - although they still happen on the main thread - they don't block the thread continuously.

Reviewed By: javache

Differential Revision: D2965438

fb-gh-sync-id: 38c9c9d281e4672b5874d68b57d4c60d1d268344
shipit-source-id: 38c9c9d281e4672b5874d68b57d4c60d1d268344
2016-03-03 02:21:36 -08:00
Frank Yan 8f3e5b1e93 Update usage names of React Native color palette
Reviewed By: weicool

Differential Revision: D2978557

fb-gh-sync-id: ef6b6b24e7db7faf3aecee0a9755565e1b41be58
shipit-source-id: ef6b6b24e7db7faf3aecee0a9755565e1b41be58
2016-03-03 00:51:31 -08:00
Martin Konicek 8717b2d19c Rework the NavigationHeader
Reviewed By: dmmiller, ericvicenti

Differential Revision: D3000972

fb-gh-sync-id: fcd4e63b72a70440e611289f03ed4757e230dc5b
shipit-source-id: fcd4e63b72a70440e611289f03ed4757e230dc5b
2016-03-02 12:21:36 -08:00
David Aurelio eb531943aa Fix the last imports of `'invariant'`
Summary:This changes the last two imports of `'invariant'` that I could find to `'fbjs/lib/invariant'`.
Closes https://github.com/facebook/react-native/pull/6248

Differential Revision: D3000440

fb-gh-sync-id: 15ebd08bb749d1d82b12902dd3dec00914fc1ed5
shipit-source-id: 15ebd08bb749d1d82b12902dd3dec00914fc1ed5
2016-03-02 10:14:59 -08:00
David Aurelio c331d113dc Fix breakages caused by switch to fbjs
Summary: This fixes a couple of breakages introduced by the switch to fbjs

Reviewed By: bestander

Differential Revision: D3000078

fb-gh-sync-id: 2971d049030f754d5001f6729716373a64078ddf
shipit-source-id: 2971d049030f754d5001f6729716373a64078ddf
2016-03-02 08:26:33 -08:00
David Aurelio d3f2081d90 Fix unit tests in open source environment
Summary:**Test plan**

run `npm test`, see all tests pass
Closes https://github.com/facebook/react-native/pull/6243

Differential Revision: D2999993

Pulled By: davidaurelio

fb-gh-sync-id: 54f2d5f9d28a31d132783694133df78370660421
shipit-source-id: 54f2d5f9d28a31d132783694133df78370660421
2016-03-02 07:07:38 -08:00
AbilashK ab12189f87 Enable blurOnSubmit for text input in android
Summary:PR for https://github.com/facebook/react-native/issues/6098, Added tests to UIExplorer based on existing iOS example.

Before:
![blur_true](https://cloud.githubusercontent.com/assets/11550281/13401854/cd66117a-df33-11e5-875d-e1f132e2fc82.gif)

After:
![blur_false](https://cloud.githubusercontent.com/assets/11550281/13401874/de1dd1ce-df33-11e5-8210-e6bee80240fb.gif)
Closes https://github.com/facebook/react-native/pull/6215

Differential Revision: D3000042

Pulled By: mkonicek

fb-gh-sync-id: 7f01270580b198498505d92e38a456c0b3a01488
shipit-source-id: 7f01270580b198498505d92e38a456c0b3a01488
2016-03-02 07:07:32 -08:00
Martin Konicek 4654b34c97 Revert Remove invariant hack for jest
Summary: This reverts D2988899 as it consistently broke the Invariant test on Travis: https://travis-ci.org/facebook/react-native

Reviewed By: bestander

Differential Revision: D2999915

fb-gh-sync-id: 781ab5f6fc8e3b97bc4d215af855823f4b5014dd
shipit-source-id: 781ab5f6fc8e3b97bc4d215af855823f4b5014dd
2016-03-02 05:46:33 -08:00
David Aurelio ad8a335864 Remove knowledge of fbjs from the packager
Summary:Follow-up to https://github.com/facebook/react-native/pull/5084

This…
- changes all requires within RN to `require('fbjs/lib/…')`
- updates `.flowconfig`
- updates `packager/blacklist.js`
- adapts tests
- removes things from `Libraries/vendor/{core,emitter}` that are also in fbjs
- removes knowledge of `fbjs` from the packager

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

Reviewed By: bestander

Differential Revision: D2926835

fb-gh-sync-id: 2095e22b2f38e032599d1f2601722b3560e8b6e9
shipit-source-id: 2095e22b2f38e032599d1f2601722b3560e8b6e9
2016-03-02 04:28:38 -08:00
Nick Lockwood ca67648f03 Revert ArrayBuffer support
Summary:The ArrayBuffer support added in https://github.com/facebook/react-native/pull/6156 crashed on iOS7 as Uint8Array is unavailable.

This diff removes that feature. We can revisit it again once we drop support for iOS 7.

Reviewed By: javache

Differential Revision: D2999762

fb-gh-sync-id: b497eac92ca5a0865b308d2a08c9409fcce97156
shipit-source-id: b497eac92ca5a0865b308d2a08c9409fcce97156
2016-03-02 04:07:32 -08:00
Hedger Wang caac520952 Add gesture handling for the card stack.
Reviewed By: ericvicenti

Differential Revision: D2995958

fb-gh-sync-id: f66759440b03072b650a572f011cadd06a0180d2
shipit-source-id: f66759440b03072b650a572f011cadd06a0180d2
2016-03-01 18:45:37 -08:00
Spencer Ahrens 85801ef874 Remove invariant hack for jest
Reviewed By: vjeux, cpojer

Differential Revision: D2988899

fb-gh-sync-id: e1b2a32a3f665b8f8a246e73e8dd620ff8506ea7
shipit-source-id: e1b2a32a3f665b8f8a246e73e8dd620ff8506ea7
2016-03-01 13:42:59 -08:00
Hedger Wang 0db22f184d NavigationCardStack - Add card stack item.
Summary: Add card stack item that moves from the right or the bottom.

Reviewed By: ericvicenti

Differential Revision: D2975659

fb-gh-sync-id: a04724943375ba0a9931eafb2aa82d6d8c31acfe
shipit-source-id: a04724943375ba0a9931eafb2aa82d6d8c31acfe
2016-03-01 09:44:31 -08:00
Sreejumon cbc0e21926 Support for XHR responseType and response attributes
Summary:Currently the XMLHttpRequest don't support any response types other than text. This PR will add responseType attribute as well response attribute.

This PR will partially solve the issue https://github.com/facebook/react-native/issues/6017
Closes https://github.com/facebook/react-native/pull/6156

Differential Revision: D2994267

Pulled By: nicklockwood

fb-gh-sync-id: 24642c48655930c8350112bac38e6ed4a42bd40d
shipit-source-id: 24642c48655930c8350112bac38e6ed4a42bd40d
2016-03-01 09:36:33 -08:00
Pieter De Baets f67fa82008 Add UIManager.measureInWindow to get window coordinates
Summary: When embedding in a hybrid app, we sometimes present new modal views or windows that have a different frame from the original root view. This API allows us to get coordinates in the application's window frame, which should be valid in any fullscreen view.

Reviewed By: majak

Differential Revision: D2939827

fb-gh-sync-id: 06b93cc2cb3519a25819c6efa445c779314dd673
shipit-source-id: 06b93cc2cb3519a25819c6efa445c779314dd673
2016-03-01 06:51:33 -08:00