├── .github ├── FUNDING.yml └── stale.yml ├── .gitignore ├── .npmignore ├── .npmrc ├── .prettierrc ├── App.tsx ├── ISSUE_TEMPLATE.md ├── LICENSE ├── README.md ├── app.json ├── babel.config.js ├── metro.config.js ├── package.json ├── react-pdf ├── .babelrc ├── .gitignore ├── Reader.less ├── Reader.tsx ├── components │ ├── Minus.tsx │ ├── Plus.tsx │ ├── down.tsx │ └── up.tsx ├── index.html ├── package.json ├── tsconfig.json └── webpack.config.js ├── scripts └── gen_bundle_string.js ├── src ├── assets │ └── images │ │ ├── icon.png │ │ └── splash.png ├── bundleContainer.ts └── index.tsx ├── tsconfig.json ├── tslint.json └── yarn.lock /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: xcarpentier 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | 2 | # Number of days of inactivity before an issue becomes stale 3 | daysUntilStale: 30 4 | # Number of days of inactivity before a stale issue is closed 5 | daysUntilClose: 5 6 | # Issues with these labels will never be considered stale 7 | exemptLabels: 8 | - pinned 9 | - security 10 | # Label to use when marking an issue as stale 11 | staleLabel: wontfix 12 | # Comment to post when marking an issue as stale. Set to `false` to disable 13 | markComment: > 14 | This issue has been automatically marked as stale because it has not had 15 | recent activity. It will be closed if no further activity occurs. Thank you 16 | for your contributions. 17 | # Comment to post when closing a stale issue. Set to `false` to disable 18 | closeComment: false 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (http://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # Typescript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | .expo/ 60 | react-pdf/dist 61 | lib -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | example 2 | scripts 3 | react-pdf 4 | App.tsx 5 | app.json 6 | babel.config.js 7 | metro.config.js 8 | app.json 9 | .expo 10 | src 11 | .prettierrc 12 | tsconfig.json 13 | tslint.json 14 | .github 15 | ISSUE_TEMPLATE.md 16 | LICENSE -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | package-lock=false -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "all", 3 | "semi": false, 4 | "singleQuote": true, 5 | "tabWidth": 2, 6 | "useTabs": false, 7 | "bracketSpacing": true, 8 | "jsxBracketSameLine": false, 9 | "jsxSingleQuote": true, 10 | "printWidth": 80 11 | } 12 | -------------------------------------------------------------------------------- /App.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import PdfReader from './src/' 3 | import { 4 | WebViewErrorEvent, 5 | WebViewHttpErrorEvent, 6 | } from 'react-native-webview/lib/WebViewTypes' 7 | import { View, Text, Modal, Button, SafeAreaView, Switch } from 'react-native' 8 | 9 | const base64 = 10 | 'data:application/pdf;base64,JVBERi0xLjcKCjEgMCBvYmogICUgZW50cnkgcG9pbnQKPDwKICAvVHlwZSAvQ2F0YWxvZwog' + 11 | 'IC9QYWdlcyAyIDAgUgo+PgplbmRvYmoKCjIgMCBvYmoKPDwKICAvVHlwZSAvUGFnZXMKICAv' + 12 | 'TWVkaWFCb3ggWyAwIDAgMjAwIDIwMCBdCiAgL0NvdW50IDEKICAvS2lkcyBbIDMgMCBSIF0K' + 13 | 'Pj4KZW5kb2JqCgozIDAgb2JqCjw8CiAgL1R5cGUgL1BhZ2UKICAvUGFyZW50IDIgMCBSCiAg' + 14 | 'L1Jlc291cmNlcyA8PAogICAgL0ZvbnQgPDwKICAgICAgL0YxIDQgMCBSIAogICAgPj4KICA+' + 15 | 'PgogIC9Db250ZW50cyA1IDAgUgo+PgplbmRvYmoKCjQgMCBvYmoKPDwKICAvVHlwZSAvRm9u' + 16 | 'dAogIC9TdWJ0eXBlIC9UeXBlMQogIC9CYXNlRm9udCAvVGltZXMtUm9tYW4KPj4KZW5kb2Jq' + 17 | 'Cgo1IDAgb2JqICAlIHBhZ2UgY29udGVudAo8PAogIC9MZW5ndGggNDQKPj4Kc3RyZWFtCkJU' + 18 | 'CjcwIDUwIFRECi9GMSAxMiBUZgooSGVsbG8sIHdvcmxkISkgVGoKRVQKZW5kc3RyZWFtCmVu' + 19 | 'ZG9iagoKeHJlZgowIDYKMDAwMDAwMDAwMCA2NTUzNSBmIAowMDAwMDAwMDEwIDAwMDAwIG4g' + 20 | 'CjAwMDAwMDAwNzkgMDAwMDAgbiAKMDAwMDAwMDE3MyAwMDAwMCBuIAowMDAwMDAwMzAxIDAw' + 21 | 'MDAwIG4gCjAwMDAwMDAzODAgMDAwMDAgbiAKdHJhaWxlcgo8PAogIC9TaXplIDYKICAvUm9v' + 22 | 'dCAxIDAgUgo+PgpzdGFydHhyZWYKNDkyCiUlRU9G' 23 | const uri = 'http://gahp.net/wp-content/uploads/2017/09/sample.pdf' 24 | 25 | function App() { 26 | const [error, setError] = React.useState< 27 | WebViewErrorEvent | WebViewHttpErrorEvent | string | undefined 28 | >(undefined) 29 | const [visible, setVisible] = React.useState(false) 30 | const [pdfType, setPdfType] = React.useState(false) 31 | const [useGoogleReader, setUseGoogleReader] = React.useState(false) 32 | const [withScroll, setWithScroll] = React.useState(false) 33 | const [withPinchZoom, setWithPinchZoom] = React.useState(false) 34 | if (error) { 35 | return ( 36 | 44 | 45 | {error.toString()} 46 | 47 | 48 | ) 49 | } 50 | 51 | return ( 52 | 55 |