将react-d3添加到我的react-native应用程序会导致错误 [英] Adding react-d3 to my react-native app causes a error

查看:162
本文介绍了将react-d3添加到我的react-native应用程序会导致错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对reactJS还是很陌生,并且刚开始使用react-native.

我使用npm install --save-dev react-d3添加了react-d3,但是当我刷新或重建应用程序时,我得到了:

TypeError: undefined is not an object
(evaluating 
'require('BatchedBridge').flushedQueue')

{
 "line":1 ,
 "column": 25
}

如果我从库中删除或卸载react-d3,它将正常工作.

谢谢

解决方案

D3JS需要浏览器DOM,而React Native则没有.

唯一可行的方法是使用WebView包装D3JS视图.

它可能会变得很凌乱,但这是可行的.

I am quite new to reactJS, and have just started working with react-native.

I added react-d3 using npm install --save-dev react-d3 but when I refresh or rebuild the app I am getting:

TypeError: undefined is not an object
(evaluating 
'require('BatchedBridge').flushedQueue')

{
 "line":1 ,
 "column": 25
}

If I remove or uninstall react-d3 from the library it works fine.

Thanks

解决方案

D3JS requires browser DOM, which React Native doesn't directly have.

The only way to possibly do this is to use a WebView to wrap the D3JS view.

It could get pretty messy, but it is doable.

这篇关于将react-d3添加到我的react-native应用程序会导致错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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