require('react-native')。NativeModules是一个空对象 [英] require('react-native').NativeModules is an empty object

查看:1571
本文介绍了require('react-native')。NativeModules是一个空对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我在项目顶部使用的其中一个node_modules中,它说:

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

不幸的是,似乎需要('react-native')。NativeModules是一个空对象{}。我该如何从这里开始?

Unfortunately, it appears that require('react-native').NativeModules is an empty object {}. How can I proceed from here?

我正在尝试使用的包是:'react-native-secure-randombytes'。

The package that I'm trying to use is: 'react-native-secure-randombytes'.

如果有人有这方面的经验,我真的很感激。

If anyone has experience with this I'd really appreciate it.

谢谢

推荐答案

你可以用这种方式帮助你

You can use this way may be it help you

import {NativeModules} from 'react-native';

这篇关于require('react-native')。NativeModules是一个空对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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