gpt4 book ai didi

reactjs - 查看或打开存储在本地 Expo React Native 的 PDF 文件

转载 作者:行者123 更新时间:2023-12-04 11:22:01 25 4
gpt4 key购买 nike

是否有使用 Expo(没有 Expo 弹出)查看或打开 PDF 文件的解决方案?
不需要在 App 内打开文件,它可以是本地文件管理器。

我试过的:

  • Linking不打开本地文件,只能在线来源
  • React Native PDF不适用于世博会
  • Expo Media Library允许下载文件,但不能打开它。
  • 最佳答案

    我的解决方案:

    使用 FileSystem.getContentUriAsync()Expo IntentLauncher

    import * as FileSystem from 'expo-file-system';
    import * as IntentLauncher from 'expo-intent-launcher';

    FileSystem.getContentUriAsync(uri).then(cUri => {
    IntentLauncher.startActivityAsync('android.intent.action.VIEW', {
    data: cUri.uri,
    flags: 1,
    type: 'application/pdf'
    });
    });


    enter image description here

    关于reactjs - 查看或打开存储在本地 Expo React Native 的 PDF 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59812941/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com