react-native-pdf-view icon indicating copy to clipboard operation
react-native-pdf-view copied to clipboard

unable to get pdf in android

Open Kapilbindal1 opened this issue 8 years ago • 2 comments

Kapilbindal1 avatar Nov 27 '17 12:11 Kapilbindal1

Hello

I have the same issue. I see a white screen.

I see no errors in logs

display /data/data/com.xxx/files/59fd09437da34d1cb322f8f2_59fd0b4c7da34d1cb322fb1a_.pdf 1 12-05 19:30:23.147 14894-14911/com.xxx D/PdfDroid: PdfDocument.nativeOpen(): return handle = 0x5f472e08 12-05 19:30:23.237 14894-14894/com.xxx D/PdfDroid: PdfPage.nativeOpenPage(): return handle = 0x5f7ecd80 12-05 19:30:23.237 14894-14894/com.xxx W/RCTPDFViewAndroid: /data/data/com.xxx/files/59fd09437da34d1cb322f8f2_59fd0b4c7da34d1cb322fb1a_ 1 / 4

Reac Native : 0.43.4

muskacirca avatar Dec 05 '17 18:12 muskacirca

You have to download it first using anohter package. I use react-native-fetch-blob:

        const { documentUrl, documentExt } = this.props;
        const res = await RNFetchBlob.config({ fileCache:true, appendExt:documentExt }).fetch('GET', documentUrl)
                                     .progress( (received, total) => !this.hasUnmounted && this.setState(() => ({ progress:received/total }) ) );
        const filePath = res.path(); // /data/user/0/com.trustedfamily/files/RNFetchBlobTmp_8edhypxhejjzp5os1bqd6s.zip
        if (this.hasUnmounted) RNFetchBlob.fs.unlink(filePath);
        else this.setState(() => ({ isDownloading:false, filePath, progress:1 }));

Noitidart avatar Dec 07 '17 00:12 Noitidart