Skip to content

Commit

Permalink
fix: 🐛 raf from webpack than from script tag
Browse files Browse the repository at this point in the history
  • Loading branch information
xcarpentier committed Jul 14, 2020
1 parent e4bf36a commit 5a665b3
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
3 changes: 2 additions & 1 deletion App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ const base64 =
'CjAwMDAwMDAwNzkgMDAwMDAgbiAKMDAwMDAwMDE3MyAwMDAwMCBuIAowMDAwMDAwMzAxIDAw' +
'MDAwIG4gCjAwMDAwMDAzODAgMDAwMDAgbiAKdHJhaWxlcgo8PAogIC9TaXplIDYKICAvUm9v' +
'dCAxIDAgUgo+PgpzdGFydHhyZWYKNDkyCiUlRU9G'
const uri = 'http://gahp.net/wp-content/uploads/2017/09/sample.pdf'
// const uri = 'http://gahp.net/wp-content/uploads/2017/09/sample.pdf'
const uri = 'https://www.dropbox.com/s/r7nfdzj6h2kosnh/bhjbjbj.pdf?dl=0&raw=1'

function App() {
const [error, setError] = React.useState<
Expand Down
1 change: 0 additions & 1 deletion react-pdf/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="//cdn.jsdelivr.net/npm/pdfjs-dist@2.1.266/build/pdf.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/pdfjs-dist@2.1.266/web/pdf_viewer.min.js"></script>
<script src="https://wzrd.in/standalone/raf@latest"></script>
<script
crossorigin
src="https://unpkg.com/react@16/umd/react.production.min.js"
Expand Down
1 change: 0 additions & 1 deletion react-pdf/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ module.exports = {
externals: {
react: 'React',
'react-dom': 'ReactDOM',
raf: 'raf',
'pdfjs-dist': 'pdfjsLib',
'pdfjs-dist/lib/web/pdf_link_service': 'pdfjsViewer',
},
Expand Down
4 changes: 2 additions & 2 deletions src/bundleContainer.ts

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ function viewerHtml(
}, user-scalable=${withPinchZoom ? 'yes' : 'no'}" />
<script src="https://cdn.jsdelivr.net/npm/pdfjs-dist@2.1.266/build/pdf.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/pdfjs-dist@2.1.266/web/pdf_viewer.min.js"></script>
<script src="https://wzrd.in/standalone/raf@latest"></script>
<script
crossorigin
src="https://unpkg.com/react@16/umd/react.production.min.js"
Expand Down Expand Up @@ -285,7 +284,13 @@ class PdfReader extends React.Component<Props, State> {

init = async () => {
try {
const { source, customStyle, withScroll, withPinchZoom, } = this.props
const {
source,
customStyle,
withScroll,
withPinchZoom,
maximumPinchZoomScale,
} = this.props
const { renderType } = this.state
switch (renderType!) {
case 'URL_TO_BASE64': {
Expand All @@ -295,6 +300,7 @@ class PdfReader extends React.Component<Props, State> {
customStyle,
withScroll,
withPinchZoom,
maximumPinchZoomScale,
)
break
}
Expand All @@ -305,6 +311,7 @@ class PdfReader extends React.Component<Props, State> {
customStyle,
withScroll,
withPinchZoom,
maximumPinchZoomScale,
)
break
}
Expand Down

0 comments on commit 5a665b3

Please sign in to comment.