Open santiagogarzon opened 6 months ago
same +1
same +1
+1
same issue ?
{pdfUrl ? (
<Pdf
ref={pdfRef}
source={{
uri: pdfUrl,
cache: true,
cacheFileName: QuranCompletePdf
,
}}
onLoadComplete={handleLoadComplete}
onPageChanged={handlePageChanged}
onError={handleError}
style={styles.pdf}
/>
) : (
<LoadingIndicator loading={true} size={40} color={'#000'} />
)}
The error was caused by the key. I created a dynamic key, but the library does not support this and re-rendered, which caused the app to crash and close. The solution was to create a unique key.
Can you share the code?
{pdfPath && (
@JoaSebas
<Pdf trustAllCerts={false} // key={pdfPath} source={source} style={{flex: 1, width: Dimensions.get('window').width*0.87 }} page={1} scale={1.0} minScale={0.5} maxScale={3.0} renderActivityIndicator={() => (
)}
enablePaging={true}
onLoadProgress={(percentage) => console.log(`Loading :${percentage}`)}
onLoadComplete={() => console.log('Loading Complete')}
onPageChanged={(page, totalPages) => console.log(`${page}/${totalPages}`)}
onError={(error) => console.log(error)}
onPageSingleTap={(page) => alert(page)}
onPressLink={(link) => Linking.openURL(link)}
onScaleChanged={(scale) => console.log(scale)}
// singlePage={true}
spacing={10}
/>
can you help me as i might be doing something wrong idk, btw file source is a link
Yes , Tell me what is the issue ?
On Fri, 9 Aug 2024 at 05:24, Karanjot Singh @.***> wrote:
@JoaSebas https://github.com/JoaSebas
<Pdf trustAllCerts={false} // key={pdfPath} source={source} style={{flex: 1, width: Dimensions.get('window').width*0.87 }} page={1} scale={1.0} minScale={0.5} maxScale={3.0} renderActivityIndicator={() => (
)} enablePaging={true} onLoadProgress={(percentage) => console.log(Loading :${percentage})} onLoadComplete={() => console.log('Loading Complete')} onPageChanged={(page, totalPages) => console.log(${page}/${totalPages})} onError={(error) => console.log(error)} onPageSingleTap={(page) => alert(page)} onPressLink={(link) => Linking.openURL(link)} onScaleChanged={(scale) => console.log(scale)} // singlePage={true} spacing={10} />
can you help me as i might be doing something wrong idk, btw file source is a link
— Reply to this email directly, view it on GitHub https://github.com/wonday/react-native-pdf/issues/833#issuecomment-2277827981, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3DFAZPYNTSPCOVQ3OT63WTZQSYH7AVCNFSM6AAAAABHNKAHAOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZXHAZDOOJYGE . You are receiving this because you commented.Message ID: @.***>
So i am trying to load a pdf, it starts crashes the app as soon as loading completes
Don't comment the key, and agree validation that component is visible only if have a path, see my example. You can try setting the path is same key for the component.
@JoaSebas
{pdf&&<Pdf
source={source}
key={pdf}
trustAllCerts={false}
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={{
flex:1,
width:Dimensions.get('window').width,
height:Dimensions.get('window').height,
}}/>}
this is current component but still crashes on load + i lowered the version to 6.7.1
Tell me if i am still doing something wrong
@HamidAbdullah How is the crash going? Has it been resolved?
Experiencing the same issue.
What
react-native
version are you using? 0.73.6 Whatreact-native-pdf
version are you using? 6.7.5 What platform does your issue occur on? (android/ios/both) Android Describe your issue as precisely as possible : 1) Steps to reproduce the issue or to explain in which case you get the issue 2) Interestinglogs
just using PDF component on Android crash the app.
LOGS:
Join a screenshot or video of the problem on the simulator or device? Crash!
Show us the code you are using?