require('react-native').NativeModules is an empty object
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: In one of the node_modules that I'm using in my project at the top of the file it says: let RNRandomBytes = require('react-native').NativeModules.RNRandomBytes Unfortunately, it appears that require('react-native').NativeModules is an empty object {}. How can I proceed from here? The package that I'm trying to use is: 'react-native-secure-randombytes'. If anyone has experience with this I'd really appreciate it. Thanks 回答1: You can use this way may be it help you import {NativeModules} from 'react-native'; 回答2: I would do this instead let