0.0.2 • Published 7 years ago

react-native-fetch-http v0.0.2

Weekly downloads
4
License
ISC
Repository
github
Last release
7 years ago

介绍

在fetch基础上封装一层,可以设置timeout,支持get,post请求

安装

npm install react-native-fetch-http

用法

import { AppRegistry, View } from "react-native";
import React, { Component } from "react";
import Http from "react-native-fetch-http";

export default class Index extends Component {
  componentDidMount() {
    var http = new Http(50000); //50000ms
    http
      .get("http://api.m.panda.tv/ajax_get_live_list_by_multicate", {
        hotroom: 1,
        __plat: "h5"
      })
      .then(content => {
        alert(content.errno);
      });
  }

  render() {
    return <View />;
  }
}

AppRegistry.registerComponent("Test", () => Index);