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

White screen on first load #194

Closed
SBRKH opened this issue Aug 11, 2023 · 8 comments
Closed

White screen on first load #194

SBRKH opened this issue Aug 11, 2023 · 8 comments

Comments

@SBRKH
Copy link

SBRKH commented Aug 11, 2023

Issue Description

Hello,
I display my pdfs in a modal.
When I load a pdf for the first time, I get a blank screen. I have to close the modal and then reopen it to see the pdf displayed correctly...
I can't figure out what I'm doing wrong or where this problem might be coming from.

Steps to Reproduce / Code Snippets

<Modal>
<SFView style={{flex: 1}}>
                        <SFFlatList data={data}
                                    style={{flex: 1}}
                            //pagingEnabled={true}
                                    horizontal={true}
                                    showsHorizontalScrollIndicator={false}
                                    onScroll={onScroll}
                                    {...flatListOptimizationProps}
                                    renderItem={({item}) =>
                                        <SFView style={{flex: 1}}>
                                            <PdfReader
                                                    noLoader={true}
                                                    withPinchZoom={true}
                                                    useGoogleReader={true}
                                                    onLoadEnd={() => setLoading(false)}
                                                    onError={(e) => console.error("error = ", e)}
                                                    source={{
                                                        uri: `${encodeURIComponent(item.url)}`,
                                                    }}
                                                    style={{width: windowWidth, height: windowHeight}}
                                                />
                                        </SFView>
                                    }
                        />
                        {documents &&
                            <AttachedFilesStepperView length={documents.length} index={index}/>
                        }
                    </SFView>
                </SFView>
</Modal>

Expected Results

The pdf is displayed normally the first time

Additional Information

  • Nodejs version: v18.12.1
  • React version: v18.2.0
  • React Native version: v0.72.3
  • rn-pdf-reader-js version: v^4.1.1
  • Platform(s) (iOS, Android, or both?): both
  • TypeScript version: v5.1.6

Thank you for your help !

@maskowe
Copy link

maskowe commented Aug 26, 2023

@SBRKH Have you gotten any resolution? I’ve the same versions and same behavior,
. Thanks for any answer.

@SBRKH
Copy link
Author

SBRKH commented Aug 28, 2023

@SBRKH Have you gotten any resolution? I’ve the same versions and same behavior, . Thanks for any answer.

Hey ! Unfortunately not yet but I saw maybe a solution in #195 so it may resolve our problem !

@maskowe
Copy link

maskowe commented Aug 28, 2023

@SBRKH Thanks for the info, but since m white screen only happened intermittently, I believe that my problem was a simple RN timing/state bug, which I hope I just fixed with a tweak in my code. I have to wait on someone else to test. If that’s not my solution, I’m in trouble because the other fixes don’t work for me.

@SBRKH
Copy link
Author

SBRKH commented Sep 4, 2023

@maskowe Can u share me your tweak please ? Even with the solution a told you, I've the bug....

@maskowe
Copy link

maskowe commented Sep 6, 2023

@SBRKH Unfortunately, it reappeared on a preview install on my android pixel. I'm trying to come up with a solution -- I'll post here if I get something.

@maskowe
Copy link

maskowe commented Sep 6, 2023

@SBRKH Ok - Evidently this was my own bug - I was awaiting Image.getSize (react native) incorrectly. Also, the original problem was also self-induced by bad timing for state variables.

@SBRKH
Copy link
Author

SBRKH commented Sep 7, 2023

@maskowe Looks like my problem was a bad timing too... I need to apply a little sleep before set my loader to false and show the pdf.

@SBRKH
Copy link
Author

SBRKH commented Sep 7, 2023

@SBRKH SBRKH closed this as completed Sep 7, 2023
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

2 participants