【问题标题】:How to disable pop-out option in pdf viewer with google doc from Webview in React Native如何在 React Native 中使用来自 Webview 的 google doc 禁用 pdf 查看器中的弹出选项
【发布时间】:2019-12-25 18:19:39
【问题描述】:

我在 Webview 中显示 PDF 文件,该文件是从服务器获取的 URL。为了显示这一点,我使用了谷歌驱动器查看器,如下所示。

let uri = pdfURL;

      if (/\.pdf$/.test(uri)) {
        uri = `https://drive.google.com/viewerng/viewer?embedded=true&url=${uri}`;
      }

            <WebView
              source={{ uri }}
              style={styles.webView}
              onLoad={() => this.hideSpinner()}
              startInLoadingState
              scalesPageToFit
              embedded
              onError={(err) => {
              }}
            />

但是,它显示的是共享选项,一旦点击它,它显示的是谷歌登录,我想禁用登录选项。

有什么建议吗?

【问题讨论】:

  • 你为什么使用谷歌驱动器?
  • @Idan 感谢您的回复,您的意思是,我需要使用库来显示 pdf 吗?
  • 你不能使用谷歌驱动器中该文件的可共享链接吗?
  • 不,我必须禁用 googlesignin
  • 你能分享你的 pdf 网址吗?

标签: react-native pdf ecmascript-6 webview google-signin


【解决方案1】:

我还没有找到任何解决这个问题的方法,但是,我集成了以下库来显示来自 URL 的 pdf,然后我的问题得到了解决。希望这对将来的人有所帮助。

react-native-pdf

https://www.npmjs.com/package/react-native-pdf

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-02-28
    • 1970-01-01
    • 1970-01-01
    • 2018-03-19
    • 2019-05-11
    • 1970-01-01
    • 2017-04-12
    相关资源
    最近更新 更多