Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
alexandravychytill opened this issue Oct 17, 2024 · 4 comments

Comments

@alexandravychytill
Copy link

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

@rajivchaulagain
Copy link

 <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

@LorandP
Copy link

LorandP commented Oct 22, 2024

@rajivchaulagain This worked for me! Thanks

@rajivchaulagain
Copy link

rajivchaulagain commented Oct 23, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@LorandP @rajivchaulagain @alexandravychytill and others