如何在React Native中使用React开发工具? [英] How to use React dev tools with react native?

查看:103
本文介绍了如何在React Native中使用React开发工具?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用react native开发带有genymotion仿真的android应用.我已经尝试按照此处所述使用React开发人员工具调试应用程序.控制台中引发了JS错误,但是我无法在chrome开发工具中选择react选项卡.

I'm currently using react native to develop an android app, with emulation in genymotion. I've attempted to debug my application using react developer tools as described here. JS errors are thrown in the console, but I'm unable to select the react tab in chrome dev tools.

出现这种情况的原因似乎是html中没有生成react组件,只是这样:

The reason for this appears to be that no react components are generated in html, just this:

<body>
  <div id="devtools-banner">
    <h3>Install React DevTools</h3>
    <p>
       React Developer Tools is an extension that allows you to inspect the
       React component hierarchies in the Chrome Developer Tools.
    </p>
    <a href="https://fb.me/react-devtools" target="_blank">
      Install
    </a>
  </div>
  <div class="content">
    <p>
      React Native JS code runs inside this Chrome tab.
    </p>
    <p>Press <span class="shortcut">⌘⌥J</span> to open Developer Tools. Enable <a href="http://stackoverflow.com/a/17324511/232122" target="_blank">Pause On Caught Exceptions</a> for a better debugging experience.</p>
    <p>Status: <span id="status">Debugger session #0 active.</span></p>
  </div>
</body>

我在iOS上也遇到了同样的问题,如何将React dev工具与react native一起使用?

I have the same issue with iOS.How do I use the React dev tools with react native?

注意:我目前正在使用React开发工具v0.14.5.

推荐答案

对于React Native 0.43或更高版本,您应该使用独立的DevTools应用程序:

With React Native 0.43 or higher you should use standalone DevTools app: https://github.com/facebook/react-devtools/tree/master/packages/react-devtools

这篇关于如何在React Native中使用React开发工具?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆