【问题标题】:react-native-file-viewer don't work in my appreact-native-file-viewer 在我的应用程序中不起作用
【发布时间】:2017-12-20 09:05:13
【问题描述】:

我尝试使用 react-native-file-viewer 在我的应用程序中查看 pdf 文件。 我已经像这样导入库:import FileViewer from 'react-native-file-viewer';

而且我有 make à 功能:

getPdf(){
        const path = '../images/Charte.pdf';
        FileViewer.open(path).then((res) => {
            console.log(res);
        }).catch(error => {
            console.log(error);
        });
    }

但是当它给我这个错误时:

enter image description here

你有线索吗?

【问题讨论】:

  • 您是否将此软件包与react-native link react-native-file-viewer 关联?你也可以使用webview来阅读pdf,它适用于Ios。
  • @Dyo 感谢您的回复,是的,我在文档中这样做了。啊?好的,它适用于 android 吗?

标签: javascript reactjs react-native


【解决方案1】:

我个人使用react-native-pdf-view for android 和 webView for ios,您也可以使用 google doc 技巧在 android webView 中阅读 pdf,但它需要连接(更多信息 here

【讨论】:

    猜你喜欢
    • 2020-04-29
    • 2017-02-13
    • 2022-12-29
    • 2021-11-02
    • 2021-02-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-23
    相关资源
    最近更新 更多