Network Communication

Most of what’s covered in Facebook React Native’s Networking topic is also applicable to You.i React Native, except Known Issues with fetch and cookie based authentication.

But we have added a new API, clearCookies() that works with You.i React Native, for asynchronously clearing all stored cookies.

Example Usage:

export default class TestNetworkRequestCookiesApp extends Component {
  clearCookies() {
    NativeModules.Networking.clearCookies();
}

The XMLHttpRequest Response Type

You.i React Native supports one of the following XMLHttpRequest response types: text and arraybuffer. The default response type is text.

An Arraybuffer Request Example

var oReq = new XMLHttpRequest();

oReq.onload = function(e) {
  var arraybuffer = oReq.response;
  // ...
}
oReq.open("GET", url);
oReq.responseType = "arraybuffer";
oReq.send();

An Text Request Example

If you don’t set the responseType, it will be set to text by default.

var oReq = new XMLHttpRequest();

oReq.onload = function(e) {
  var response = oReq.response;
  // ...
}
oReq.open("GET", url);
oReq.send();