wonday / react-native-pdf

A <Pdf /> component for react-native

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PDF preview issue in Android & iOS

Aditya402 opened this issue · comments

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>

  1. 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

I am experiencing the same issue on Android and iOS

I am experiencing the same issue on Android and iOS

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

Experiencing same issue

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

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