Loading indicator stays during loading always at 0.00% and sometimes goes into -839393.0%
What react-native version are you using? 0.74.0
What react-native-pdf version are you using? 6.7.5
What platform does your issue occur on? (android/ios/both) both
Describe your issue as precisely as possible :
The pdf is loading eventually, but the indicator always stays at 0.00% during the loading time. Also when a pdf gets opened via deep link then the indicator shows the percentage in minus, for example -839393.0%. When I tried to implement my own activityIndicator the progress was also always 0. And when trying to use onLoadProgress, this does not even get executed.
Show us the code you are using?
<Pdf
trustAllCerts={Platform.OS === 'ios'}
style={styles.viewer}
source={{
uri: ${currentUrl},
headers: { Cookie: ;${authCookie} },
}}
/>
<Pdf
ref={pdfRef}
trustAllCerts={false}
source={{
uri,
}}
onLoadProgress={(percent) => calculateLoadingProgress(percent)}
style={{
width,
height,
}}
onPageSingleTap={(e, x, y) => handlePosition(e, x, y)}
onLoadComplete={(numberOfPages, path, { height, width }) =>
console.log(`height & width : ${height} ${width}`)
}
/>
and
const calculateLoadingProgress = (percent) => {
if (percent === 1) {
setPdfLoading(true);
}
};
I used this way for managing loading it shows loading from 0 to 1 for complete
@rajivchaulagain This worked for me! Thanks
@LorandP no worries I'm glad that it worked.