Skip to content
This repository was archived by the owner on Mar 16, 2019. It is now read-only.
This repository was archived by the owner on Mar 16, 2019. It is now read-only.

Feature: ios.previewDocument/openDocument custom action button #198

Closed
@blackburnian

Description

@blackburnian

We are downloading an opening a PDF via this code in our RN application:

RNFetchBlob.config({
    path: dirs.DocumentDir + '/test.pdf'
})
    .fetch('GET', `https://www.ets.org/Media/Tests/TOEFL/pdf/SampleQuestions.pdf`)
    .then((res) => {
                RNFetchBlob.ios.openDocument(res.path());
    })

This works beautifully:
img_0671

However, in our scenario, we need to prevent the user from sharing the PDF or doing anything else with it besides viewing it. We do however want to offer them the option to save it locally to their phone which we can also use your plugin for. Is there a way to pass some options to the openDocument method which would allow us to put a 'Save' button (instead of that action icon
image)
and give us a callback that we can fire when they click on it? Something like:

RNFetchBlob.config({
    path: dirs.DocumentDir + '/test.pdf'
})
    .fetch('GET', `https://www.ets.org/Media/Tests/TOEFL/pdf/SampleQuestions.pdf`)
    .then((res) => {
                RNFetchBlob.ios.openDocument(res.path(), {
                    actionButtonText: 'Save',
                    actionButtonCallback: () => {
                                
                    }                
                });
    })

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions