Skip to content

Commit

Permalink
include some fix from PR #72
Browse files Browse the repository at this point in the history
  • Loading branch information
xcarpentier committed Jan 6, 2020
1 parent 3c867bd commit 024b681
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ interface Props {
## Requirements

- Use it into Expo app (from expo client, Standalone app or ExpoKit app).
- Because we need to have access to `Expo.FileSystem`
- Only React-Native 0.60+ support, **Expo SDK 36**

## Features
Expand All @@ -80,7 +79,6 @@ interface Props {

- react-pdf (pdf.js)
- WebView
- Expo FileSystem API
- Base64

## FAQ
Expand Down
11 changes: 7 additions & 4 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as React from 'react'
import { View, ActivityIndicator, Platform, StyleSheet } from 'react-native'
import { WebView } from 'react-native-webview'
import * as FileSystem from 'expo-file-system'
import Constants from 'expo-constants'
import * as FileSystem from 'expo-file-system'

const {
cacheDirectory,
Expand All @@ -28,9 +28,9 @@ function viewerHtml(base64: string): string {
</html>
`
}

const bundleJsPath = `${cacheDirectory}bundle.js`
const htmlPath = `${cacheDirectory}index.html`

async function writeWebViewReaderFileAsync(data: string): Promise<void> {
const { exists, md5 } = await getInfoAsync(bundleJsPath, { md5: true })
const bundleContainer = require('./bundleContainer')
Expand Down Expand Up @@ -210,7 +210,6 @@ class PdfReader extends React.Component<Props, State> {
if (data && ios) {
return (
<View style={[styles.container, style]}>
{!noLoader && !ready && <Loader />}
<WebView
onLoad={() => {
this.setState({ ready: true })
Expand Down Expand Up @@ -241,7 +240,11 @@ class PdfReader extends React.Component<Props, State> {
)
}

return <Loader />
return (
<View style={[styles.container, style]}>
{!noLoader && !ready && <Loader />}
</View>
)
}
}

Expand Down

0 comments on commit 024b681

Please sign in to comment.