react-doc-viewer icon indicating copy to clipboard operation
react-doc-viewer copied to clipboard

Page rerender making empty document viewer

Open sridharvemulapalli opened this issue 2 years ago • 1 comments

The document viewer is a child element of a page, when the page loads initially the document viewer is working perfect. Refer the screen shot #1.

The page state modification will trigger the re render cycle, at this time document viewer is becoming empty refer the screen shot # 2.

Screen shot #1 : image

Screen Shot #2:

image
    const docs = [
        { uri: require('./lorem-ipsum.pdf'), fileType: 'pdf' },
        { uri: require('./loremipsum.pdf'), fileType: 'pdf' },
    ];
    
     <DocViewer
                 documents={docs}
                 pluginRenderers={DocViewerRenderers}
                config={{ pdfVerticalScrollByDefault: true }}
        />

Question 2: Is there any way setPageNumber directly and how to know the total number of pages.

Please provide some help or comments.

sridharvemulapalli avatar Jan 15 '24 05:01 sridharvemulapalli

Please refer to this, using key should rerender the viewer. https://github.com/cyntler/react-doc-viewer/issues/161

prajilshrestha avatar Jan 26 '24 07:01 prajilshrestha