Skip to content

[iOS] Webview source/uri cannot load base64 pdf #22416

Closed
@ColinKrist

Description

Environment

Run react-native info in your terminal and paste its contents here.
React Native Environment Info:
System:
OS: Windows 10
CPU: (8) x64 Intel(R) Core(TM) i7-7700T CPU @ 2.90GHz
Memory: 5.54 GB / 15.89 GB
Binaries:
Yarn: 1.10.1 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 5.6.0 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: Version 3.1.0.0 AI-173.4720617

Description

Describe your issue in detail. Include screenshots if needed. If this is a regression, let us know.

Prior to React Native 57+ Webview could load a base64 pdf on iOS since it was supported natively on UIWebview. After Expo recently upgraded to RN 57+ (Expo 31) our team hit this issue when using rn-pdf-reader-js since this library uses this functionality.

Usage

let data = "data:application/pdf;base64," + pdfbase64Data;

jsx:
<WebView
  style={{ flex: 1}}
  source={{ uri: data}}
/>

When loading the Webview we now get a promise rejection from resolveAssetSource().

yellowbox
NOTE: this image was taken from the expo forum post for rn-pdf-reader-js

NOTE: we haven't tried this with react-native-community/react-native-webview since it hasn't landed, but it seems that they have this working in their repository.

Reproducible Demo

Let us know how to reproduce the issue. Include a code sample, share a project, or share an app that reproduces the issue using https://snack.expo.io/. Please follow the guidelines for providing a MCVE: https://stackoverflow.com/help/mcve

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions