rn-pdf-reader-js
rn-pdf-reader-js copied to clipboard
not working in android and iOS both
Issue Description
while loading pdf in this package we getting error in android and white screen in the IOS
In android
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]
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.
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
Its working well in IOS and Android
<PdfReader
style={{ flexGrow: 1 }}
source={{
uri: pdfUrl,
}}
/>
Happy Coding!
Create your own component name
PdfReader
and copy the all code fromrn-pdf-reader-js\lib\index.js
replace the linesource: renderedOnce || !isAndroid ? source : undefined
withsource: renderedOnce || !isAndroid ? source : { uri: undefined }
copy the bundleContainer.js to components directory
Its working well in IOS and Android
<PdfReader style={{ flexGrow: 1 }} source={{ uri: pdfUrl, }} />
Happy Coding!
Resolveu, muito obrigado!
Create your own component name
PdfReader
and copy the all code fromrn-pdf-reader-js\lib\index.js
replace the linesource: renderedOnce || !isAndroid ? source : undefined
withsource: renderedOnce || !isAndroid ? source : { uri: undefined }
copy the bundleContainer.js to components directory
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 ?