Summary:
Currently XHR also supports Android platform, so document should include this information.
Closes https://github.com/facebook/react-native/pull/7729
Differential Revision: D3345168
fbshipit-source-id: 8dee7d573a47aede5dc5be97640fc711747df65c
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
Summary:I updated the Network documentation to not lead users to use Parse, since its service is shutting down.
Closes https://github.com/facebook/react-native/pull/6140
Differential Revision: D2974665
fb-gh-sync-id: 2a784ad00f742f9f2e2ce369f8b3e1eaab0e2ad4
shipit-source-id: 2a784ad00f742f9f2e2ce369f8b3e1eaab0e2ad4
Using the provided WebSocket example under react-native 0.17, the sample code throws the following error:
"TypeError: ws.on is not a function(…)"
It's listening on ".on" which does not exist, rather than assigning a function to onopen, onmessage, onerror and onclose.
See: https://developer.mozilla.org/en-US/docs/Web/API/WebSocket
- Mention that Fetch returns a Promise
(makes example with .then clearer to newcomers to ES6/ES7)
- Add example of Fetch usage with second argument
(helps clarify how e.g., a POST request to an API might be constructed)
- Add async/await example