google-chrome - React 选项卡未与 Chrome 的 React 开发人员工具一起显示在 react-native 应用程序上

标签 google-chrome reactjs react-native

我已经安装了 react developer tools Chrome 中的扩展程序,如果我查看扩展程序列表,它被列为已启用。但是,在顶部菜单栏上,我有元素、控制台、源等,没有 React 选项卡。我可以打开我的 react-native 源文件之一,甚至可以在其中的断点处停止。

在 React 开发人员工具的自述文件中 gihub repository它指出

The "React" tab won't show up if React can't communicate with the devtools. When the page loads, the devtools sets a global named __REACT_DEVTOOLS_GLOBAL_HOOK__, then React communicates with that hook during initialization.

(In React 0.11 and older, it was necessary to expose a global called React for the devtools to function.)

You can test this on the React website or by inspecting Facebook.

在我的应用程序文件夹中,我没有直接使用 react,而是使用 react-native 并且相关版本是
react-native-cli: 0.1.10
react-native: 0.21.0

如果我访问 react-native 站点,会显示 React 选项卡,所以这可能与我的 react-native 设置有关。当我检查我的 react-native 应用程序时,如何让 React 选项卡出现?

最佳答案

It's currently not possible to use the "React" tab in the devtools to inspect app widgets. This is due to a change in how the application scripts are evaluated in the devtools plugin; they are now run inside a Web Worker, and the plugin is unaware of this and so unable to communicate properly with React Native.



https://facebook.github.io/react-native/docs/known-issues.html#devtools-react-tab-does-not-work

你可以试试http://nuclide.io/docs/platforms/react-native/#debugging__element-inspector正如在 github 上的问题中所建议的那样,但我无法让它与 RN 0.21 一起使用

关于google-chrome - React 选项卡未与 Chrome 的 React 开发人员工具一起显示在 react-native 应用程序上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35950226/

相关文章:

javascript - 使用钩子(Hook)进行条件渲染

typescript - 类型错误 : undefined is not an object (evaluating 'this._callListeners.bind' )

javascript - onunload 在 Chrome 中的作用

javascript - Cookie 不适用于跨站点配置。我正在使用 React (Next.js) 和 Node.js (Express)

javascript setTimeout 无法识别函数参数

javascript - 将 props 传递给 React 组件中的 componentDidMount()

react-native - Expo.FileSystem.downloadAsync不显示下载通知

javascript - 在 React Native 中使用 onPress 调用两个函数

visual-studio - 结束 Visual Studio 调试 session 时自动关闭 Chrome 或 Firefox(如 IE)

javascript - Javascript 中的数组行为