rn-pdf-reader-js icon indicating copy to clipboard operation
rn-pdf-reader-js copied to clipboard

not working in android and iOS both

Open SayaliEdulab opened this issue 1 year ago • 4 comments

Issue Description

while loading pdf in this package we getting error in android and white screen in the IOS

In android

image

Steps to Reproduce / Code Snippets

//import libraries import { NavigationContainer } from '@react-navigation/native'; import React, { Component } from 'react'; import { View, Text, StyleSheet } from 'react-native'; import PDFReader from 'rn-pdf-reader-js'

// create a component const PdfViewer = (props) => {

return (

    <View style={{ backgroundColor: '#fff', width: '100%', height: '100%' }}>
        <PDFReader
            source={{
                uri: props.route.params.pdfUri,
            }}
            withPinchZoom={true}
            withScroll={true}
        />
    </View>

);

};

//make this component available to the app export default PdfViewer;

Expected Results

view pdf

Additional Information

  • Nodejs version: [16.13.0]
  • React Native version: [0.72.3]
  • rn-pdf-reader-js version: [4.1.1]
  • Platform(s) (iOS, Android, or both?): [both]

SayaliEdulab avatar Aug 18 '23 08:08 SayaliEdulab

Exact same problem here...

I tried to do the same trick as this issue : https://github.com/react-native-webview/react-native-webview/issues/2920 But didn't work for me.

SBRKH avatar Aug 24 '23 15:08 SBRKH

Create your own component name PdfReader and copy the all code from rn-pdf-reader-js\lib\index.js replace the line source: renderedOnce || !isAndroid ? source : undefined with source: renderedOnce || !isAndroid ? source : { uri: undefined }

copy the bundleContainer.js to components directory

Checkout Example Here

Its working well in IOS and Android

<PdfReader
        style={{ flexGrow: 1 }}
        source={{
          uri: pdfUrl,
        }}
/>

Happy Coding!

dev-jaydeep avatar Aug 25 '23 13:08 dev-jaydeep

Create your own component name PdfReader and copy the all code from rn-pdf-reader-js\lib\index.js replace the line source: renderedOnce || !isAndroid ? source : undefined with source: renderedOnce || !isAndroid ? source : { uri: undefined }

copy the bundleContainer.js to components directory

Checkout Example Here

Its working well in IOS and Android

<PdfReader
        style={{ flexGrow: 1 }}
        source={{
          uri: pdfUrl,
        }}
/>

Happy Coding!

Resolveu, muito obrigado!

rss14 avatar Oct 30 '23 17:10 rss14

Create your own component name PdfReader and copy the all code from rn-pdf-reader-js\lib\index.js replace the line source: renderedOnce || !isAndroid ? source : undefined with source: renderedOnce || !isAndroid ? source : { uri: undefined }

copy the bundleContainer.js to components directory

Checkout Example Here

Its working well in IOS and Android

<PdfReader
        style={{ flexGrow: 1 }}
        source={{
          uri: pdfUrl,
        }}
/>

Happy Coding!

Thanks for the solution ! @xcarpentier hi, can you merge this fix on Master ?

Tibze avatar Dec 07 '23 09:12 Tibze