'在Chrome中调试'不能用于本机的反应原因

zq0*_*010 2 debugging android react-native

当我在emulator64-x86中打开官方演示时,它加载成功,然后我按'F2',然后在弹出窗口中单击'在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
Run Code Online (Sandbox Code Playgroud)

有没有人有这些问题?怎么解决?提前致谢.

小智 5

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

替换以下行

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

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

Modal仅支持ios.所以我们需要应用if条件