如何设置reactotron-apisauce反应原生?

时间:2018-03-14 04:04:05

标签: react-native

我是初学者和反应者的新手。

我想监控axios HTTP请求,但我不能。

在我的想法中,networking = XMLHttpRequests,apisauce = axios。 下面是我的代码。

// Reactotron.config
import Reactotron, { networking } from 'reactotron-react-native'
import apisaucePlugin from 'reactotron-apisauce'

Reactotron
  .configure()
  .useReactNative(networking())
  .useReactNative(apisaucePlugin())
  .connect()

//App.js
import './config/ReactotronConfig';
import Reactotron from 'reactotron-react-js'
// I tried import Reactotron from 'reactotron-react-native'

api.addMonitor(Reactotron.apisauce)

有什么问题?

1 个答案:

答案 0 :(得分:0)

如果监控axios请求是您想要解决的唯一目的。

我建议你提出全球要求。

index.js文件中添加此行。

GLOBAL.XMLHttpRequest = GLOBAL.originalXMLHttpRequest || GLOBAL.XMLHttpRequest; 现在,在您的模拟器上启用Debug JS Remotely,您可以在那里看到来自网络标签的所有网络请求。