wonday / react-native-pdf

A <Pdf /> component for react-native
MIT License
1.58k stars 534 forks source link

PDF preview issue in Android & iOS #789

Open Aditya402 opened 8 months ago

Aditya402 commented 8 months ago

What react-native version are you using? 0.69.1

What react-native-pdf version are you using? 6.7.3

What platform does your issue occur on? (android/ios/both) Both

Describe your issue as precisely as possible : 1) Steps to reproduce the issue or to explain in which case you get the issue I am getting blank page when clicking preview button .

<View style={styles.container}> <Pdf source={source} onLoadComplete={(numberOfPages,filePath) => { console.log(Number of pages: ${numberOfPages}); }} onPageChanged={(page,numberOfPages) => { console.log(Current page: ${page}); }} onError={(error) => { console.log(error); }} onPressLink={(uri) => { console.log(Link pressed: ${uri}); }} style={styles.pdf}/> </View>

2) Interesting logs

No logs are coming

Join a screenshot or video of the problem on the simulator or device?

Show us the code you are using?

`const readContent = async (uri: string) => { try { const content = await RNFS.readFile(uri, 'base64'); console.log('Content of the file:', content); contentUri = content; // Handle the content as needed } catch (error) { console.error('Error reading content:', error); } };

const renderPdf = useCallback(() => { console.log('docInfo', docInfo),

  readContent(docInfo?.uri),
  console.log('docInfo', `data:${docInfo?.type};base64,${contentUri}`),

  docInfo?.name === "" ?
    <View style={styles.mainPDFcontainer}>
      <Pdf source={{ uri: docInfo?.uri }} style={styles.pdfContainer} />
    </View> :
    <View style={styles.mainPDFcontainer}>
      <Pdf source={{ uri: `data:${docInfo?.type};base64,${contentUri}` }} style={styles.pdfContainer} />
    </View>

}, [contentUri]); ` Screenshot_1700573677 Simulator Screenshot - iPhone 13 - 2023-11-21 at 19 10 56

henderson2350 commented 8 months ago

I am experiencing the same issue on Android and iOS

MUSHTHAK2899 commented 8 months ago

I am experiencing the same issue on Android and iOS

ljosorio commented 8 months ago

Hi guys , I have the same problem, but it only happens to me on iOS when but only when I publish the app

React native 0.66.5 react-native-pdf 6.7.3

IMG_9456

cgtorniado commented 8 months ago

Experiencing same issue

abanobmikaeel commented 6 months ago

Same issue here, except no problems on iOS side. Android only

rieg-ec commented 4 months ago

same issue on Android, the percentage loader seems to indicate the file is downloading, but then i see no preview of the pdf just a blank screen