Skip to content

Commit

Permalink
fix ios
Browse files Browse the repository at this point in the history
  • Loading branch information
xcarpentier committed Jan 7, 2020
1 parent 17f93c4 commit ae2e593
Show file tree
Hide file tree
Showing 10 changed files with 217 additions and 416 deletions.
25 changes: 25 additions & 0 deletions App.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,38 @@
import React from 'react'
import PdfReader from './src/'

const base64 =
'data:application/pdf;base64,JVBERi0xLjcKCjEgMCBvYmogICUgZW50cnkgcG9pbnQKPDwKICAvVHlwZSAvQ2F0YWxvZwog' +
'IC9QYWdlcyAyIDAgUgo+PgplbmRvYmoKCjIgMCBvYmoKPDwKICAvVHlwZSAvUGFnZXMKICAv' +
'TWVkaWFCb3ggWyAwIDAgMjAwIDIwMCBdCiAgL0NvdW50IDEKICAvS2lkcyBbIDMgMCBSIF0K' +
'Pj4KZW5kb2JqCgozIDAgb2JqCjw8CiAgL1R5cGUgL1BhZ2UKICAvUGFyZW50IDIgMCBSCiAg' +
'L1Jlc291cmNlcyA8PAogICAgL0ZvbnQgPDwKICAgICAgL0YxIDQgMCBSIAogICAgPj4KICA+' +
'PgogIC9Db250ZW50cyA1IDAgUgo+PgplbmRvYmoKCjQgMCBvYmoKPDwKICAvVHlwZSAvRm9u' +
'dAogIC9TdWJ0eXBlIC9UeXBlMQogIC9CYXNlRm9udCAvVGltZXMtUm9tYW4KPj4KZW5kb2Jq' +
'Cgo1IDAgb2JqICAlIHBhZ2UgY29udGVudAo8PAogIC9MZW5ndGggNDQKPj4Kc3RyZWFtCkJU' +
'CjcwIDUwIFRECi9GMSAxMiBUZgooSGVsbG8sIHdvcmxkISkgVGoKRVQKZW5kc3RyZWFtCmVu' +
'ZG9iagoKeHJlZgowIDYKMDAwMDAwMDAwMCA2NTUzNSBmIAowMDAwMDAwMDEwIDAwMDAwIG4g' +
'CjAwMDAwMDAwNzkgMDAwMDAgbiAKMDAwMDAwMDE3MyAwMDAwMCBuIAowMDAwMDAwMzAxIDAw' +
'MDAwIG4gCjAwMDAwMDAzODAgMDAwMDAgbiAKdHJhaWxlcgo8PAogIC9TaXplIDYKICAvUm9v' +
'dCAxIDAgUgo+PgpzdGFydHhyZWYKNDkyCiUlRU9G'

export default class App extends React.Component {
render() {
return (
<PdfReader
source={{
uri: 'http://gahp.net/wp-content/uploads/2017/09/sample.pdf',
}}
style={{ paddingTop: 20 }}
customStyle={{
readerContainerZoomContainer: {
borderRadius: 30,
backgroundColor: '#a0a',
},
readerContainerZoomContainerButton: {
borderRadius: 30,
},
}}
/>
)
}
Expand Down
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,22 @@ interface Props {
style?: View['props']['style'] // style props to override default container style
webviewStyle?: WebView['props']['style'] // style props to override default WebView style
noLoader?: boolean
customStyle?: {
readerContainer?: CSS.Properties
readerContainerDocument?: CSS.Properties
readerContainerNumbers?: CSS.Properties
readerContainerNumbersContent?: CSS.Properties
readerContainerZoomContainer?: CSS.Properties
readerContainerZoomContainerButton?: CSS.Properties
readerContainerNavigate?: CSS.Properties
readerContainerNavigateArrow?: CSS.Properties
}
onLoad?(): void // callback that runs after WebView is loaded
onLoadEnd?(): void // callback that runs after WebView is loaded
onError?(): void // callback that runs when WebView is on error
}
```

## Features

- **For Android, use react-pdf / pdfjs in the webview**
- For iOS devices, display file directly to the WebView (react-native-webview)

## What rn-pdf-reader-js use?

- react-pdf (pdf.js)
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rn-pdf-reader-js",
"version": "0.4.2",
"version": "0.5.0",
"description": "PDF reader for Expo",
"main": "node_modules/expo/AppEntry.js",
"types": "lib/index.d.ts",
Expand Down Expand Up @@ -43,6 +43,7 @@
},
"dependencies": {
"buffer": "5.1.0",
"csstype": "2.6.8",
"js-base64": "2.4.5"
},
"devDependencies": {
Expand All @@ -53,10 +54,10 @@
"babel-preset-expo": "^8.0.0",
"crypto": "1.0.1",
"expo": "^36.0.2",
"json": "^9.0.6",
"react": "16.9.0",
"expo-constants": "~8.0.0",
"expo-file-system": "~8.0.0",
"json": "^9.0.6",
"react": "16.9.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-36.0.1.tar.gz",
"react-native-webview": "7.4.3",
"tslint": "^5.20.1",
Expand Down
Loading

0 comments on commit ae2e593

Please sign in to comment.