Skip to content

Opening a local file href in webview #7955

@bnns

Description

@bnns

Platform
RN 0.26
iOS and Android
Mac OSX

My application allows users to download documents to their phone's Documents/ folder using react-native-fs - but I'm unable to open these downloaded files. I have tried rendering <a href="..."></a> tags with the following formats

file:///path/file.pdf
/path/file.pdf
../path/file.pdf

Nothing happens when I press the link. I'm thinking maybe the path returned by RNFS.DocumentDirectoryPath is not correct, although when I paste this path into a browser (on my desktop running the simulator), I am able to get to the file.

Edit: I am able to open the file using a Webview with a source={{uri: ...}} prop though. I suppose I could launch a new webview each time a user launches something which should be render-able. But this doesn't solve cases of files that need some type of native app.

2nd Edit: source={{uri:...}} doesn't work for PDFs in android, but works in iOS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions