'Debug in Chrome' 不适用于 android 的 React Native

'Debug in Chrome' not work in react native for android

当我在emulator64-x86打开官方demo时,加载成功,然后我按'F2',在弹窗中点击'Debug in Chrome',我的chrome浏览器打开'http://localhost:8081/debugger-ui' 自动,但它不会将我的项目加载为模拟器。我在控制台中收到如下警告:

Warning: Native component for "RCTModalHostView" does not exist
Warning: Native component for "RCTTextView" does not exist
Warning: Native component for "RCTTextField" does not exist
Running application "AwesomeProject" with appParams: {"initialProps":{},"rootTag":1}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF
Unknown method: undefined

有人遇到过这些问题吗?如何解决?提前致谢。

这些警告将在即将发布的版本中修复0.12-RC 通过获取日志,调试工作正常;您的应用未加载的原因将是另一个问题。

打开文件react-native/Libraries/Modal/Modal.js

替换下面一行

var RCTModalHostView = requireNativeComponent('RCTModalHostView', null);

var Platform = require('Platform'); if (Platform.OS === 'ios') { var RCTModalHostView = requireNativeComponent('RCTModalHostView', null); }

仅 ios 支持模式。所以我们需要应用 if 条件