react-native-document
v0.1.2
Published
This allows you to render documents like PDF, DOC, XLS and PPT.
Downloads
52
Maintainers
Readme
React Native Document
This allows you to render documents like PDF, DOC, XLS and PPT.
Installation
Expo
expo install react-native-document react-native-webview
Other
npm install react-native-document react-native-webview
# OR
yarn add react-native-document react-native-webview
#OR
pnpm add react-native-document react-native-webview
Usage
import DocumentView from 'react-native-document';
export default function App() {
return (
<DocumentView uri="https://..." />
)
}
Props
uri
The URI of the file to be rendered.
➤ Type: string
scale
An optional scale value or object that determines the initial, minimum, and maximum scale of the document. If a number is provided, it sets for all properties. If an object is provided, it can have optional properties initial
, min
, and max
to set the initial, minimum, and maximum scale, respectively.
➤ Type: number
| { initial?: number; min?: number; max?: number }
controls
An optional boolean value or object that determines whether controls are displayed and which controls are displayed. If a boolean value is provided, it determines whether all controls are displayed. If an object is provided, it can have optional properties page
and zoom
to determine whether page and zoom controls are displayed, respectively.
➤ Type: boolean
| { page?: boolean; zoom?: boolean }
style
An optional StyleProp object that can be used to apply custom styles to the component.
➤ Type: StyleProp<ViewStyle>
renderLoading
➤ Type: () => React.ReactElement
onLoad
Function that returns a loading indicator.
➤ Type: (event: DocumentViewEvent) => void
onError
An optional callback function that is called when the document cannot be loaded. It receives an event object of type DocumentViewEvent
.
➤ Type: (event: DocumentViewEvent) => void