react-native-pdf icon indicating copy to clipboard operation
react-native-pdf copied to clipboard

Loading indicator stays during loading always at 0.00% and sometimes goes into -839393.0%

Open alexandravychytill opened this issue 1 year ago • 3 comments

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} }, }} />

alexandravychytill avatar Oct 17 '24 08:10 alexandravychytill

 <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 avatar Oct 22 '24 08:10 rajivchaulagain

@rajivchaulagain This worked for me! Thanks

LorandP avatar Oct 22 '24 14:10 LorandP

@LorandP no worries I'm glad that it worked.

rajivchaulagain avatar Oct 23 '24 03:10 rajivchaulagain