From 887fa996b7b8746344f968175d4442db59413325 Mon Sep 17 00:00:00 2001 From: Xavier Carpentier Date: Mon, 13 Jan 2020 16:24:27 +0100 Subject: [PATCH] fix ios and add features --- App.tsx | 40 ++++- README.md | 20 ++- package.json | 2 +- react-pdf/Reader.tsx | 102 ++++++------ react-pdf/index.html | 1 + react-pdf/webpack.config.js | 8 +- src/bundleContainer.ts | 4 +- src/index.tsx | 320 ++++++++++++++++++++++++++---------- 8 files changed, 346 insertions(+), 151 deletions(-) diff --git a/App.tsx b/App.tsx index 74e17dc..bcfef61 100644 --- a/App.tsx +++ b/App.tsx @@ -1,6 +1,9 @@ import React from 'react' import PdfReader from './src/' -import { WebViewErrorEvent } from 'react-native-webview/lib/WebViewTypes' +import { + WebViewErrorEvent, + WebViewHttpErrorEvent, +} from 'react-native-webview/lib/WebViewTypes' import { View, Text, Modal, Button, SafeAreaView, Switch } from 'react-native' const base64 = @@ -20,11 +23,13 @@ const base64 = const uri = 'http://gahp.net/wp-content/uploads/2017/09/sample.pdf' function App() { - const [error, setError] = React.useState( - undefined, - ) + const [error, setError] = React.useState< + WebViewErrorEvent | WebViewHttpErrorEvent | string | undefined + >(undefined) const [visible, setVisible] = React.useState(false) const [pdfType, setPdfType] = React.useState(false) + const [useGoogleReader, setUseGoogleReader] = React.useState(false) + const [withScroll, setWithScroll] = React.useState(false) if (error) { return ( - {error.nativeEvent.description} + {error.toString()} ) } + return (