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

"Deprecated API usage: getDocument" with Functioning Component #124

Open
AdamWhitehurst opened this issue Nov 25, 2019 · 1 comment · May be fixed by #127
Open

"Deprecated API usage: getDocument" with Functioning Component #124

AdamWhitehurst opened this issue Nov 25, 2019 · 1 comment · May be fixed by #127

Comments

@AdamWhitehurst
Copy link

AdamWhitehurst commented Nov 25, 2019

My team currently has a Component that implements <FileViewer> that works, but our tests warn us that:

console.log node_modules/react-file-viewer/dist/index.js:11
      Deprecated API usage: getDocument is called with pdfDataRangeTransport, passwordCallback or progressCallback argument

Would love to see this updated as react-file-viewer a good library.

Similar issue (but this appears to be a non-functioning component): #83

Relevant information on updating package:
mozilla/pdf.js#8538
mozilla/pdf.js@5135aa9#diff-dd42e9b2d2a652b8e312efa567698aa6

It appears the call to getDocument simply needs to be updated to the simplified parameters, with callbacks being set with onProgress, onPassword, etc.

@startgirl
Copy link

Maybe I solved this problem by putting FileViewer in the mod and getting an error: Depreciated API usage: getDocument is called with pdfDataRangeTransport, passwordCallback or progressCallback argument, Then I only showed FileViewer 3 seconds after the modal display, and the file could be displayed normally

<Modal title={'预览' + get(materialInfo, 'name')} visible={true} onCancel={() => { setVisible(false); props.closeFun() }} footer={null} width={1300} bodyStyle={{ padding: 0, overflow: 'auto' }} > <div style={{ height: 450,textAlign:'center' }} className='pdf'> { getType() == 'pdf' &&materialInfo&&show&& <FileViewer fileType='pdf' filePath={get(materialInfo, 'file_url')} onError={(err)=>{console.log(err)}} /> } </Modal> setTimeout(() => { setShow(true) }, 3000);

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