将 LightningChart 导入 React Native 时出错

问题描述

我正在尝试将 Lightning Chart 与 React Native 结合使用,但我立即遇到了错误

我用yarn安装@arction/lcjs然后在我的App.js顶部写...

import { lightningChart } from '@arction/lcjs';

然后我收到的错误消息是...

Error: Requiring module "node_modules/@arction/lcjs/dist/lcjs.js",which threw an exception: TypeError: Si.atob is not a function. (In 'Si.atob(aV[t[0]][r].toString())','Si.atob' is undefined)
Process terminated. Press <enter> to close the window

任何指针将不胜感激!

解决方法

LightningChart JS 不直接兼容 React Native。您需要将其加载到 WebView 中。对于 React Native 兼容的 WebView 实现,您可以使用 React Native WebView 之类的库。在 WebView LightningChart JS 中可以像在浏览器中一样使用。