hz-react-native-doc-view
A React Native bridge module: Document Viewer for files (pdf, png, jpg, xls, doc, ppt, xlsx, docx, pptx etc.)
IMPORTANT INFORMATION: THIS IS A OPEN SOURCE PROJECT, SOMETIMES I HAVE NO TIME TO DEVELOP THIS PROJECT. THANK YOU FOR YOUR PULL REQUEST AND YOUR SUPPORT. I will continue to develop it as it is possible in time.
Getting started
$ npm install hz-react-native-doc-view --save
Automatic installation
$ react-native link hz-react-native-doc-view
API DOC
IOS Document Viewer Doc
resource | description |
---|---|
DoneButtonEvent |
return true |
RNDownloaderProgress |
return Progress Float |
resource | description |
---|---|
openDoc |
{url:String,fileNameOptional:String (optional)} |
openDocb64 |
{url:String,fileName:String,fileType:String } |
openDocBinaryinUrl |
{url:String,fileName:String,fileType:String } |
Android Document Viewer Doc
resource | description |
---|---|
openDoc |
{url:String,fileName:String, cache:boolean} |
openDocb64 |
{url:String,fileName:String,fileType:String, cache:boolean } |
openDocBinaryinUrl |
not implemented yet |
Usage
;;;var RNFS = ;var SavePath = PlatformOS === 'ios' ? RNFSMainBundlePath : RNFSDocumentDirectoryPath; { superprops; thisstate = animating: false progress: "" donebuttonclicked: false thiseventEmitter = NativeModulesRNDocViewer; thiseventEmitter thisdidPressToObjcButton = thisdidPressToObjcButton; } { // download progress thiseventEmitter; } { thiseventEmitter; } /* * Handle WWW File Method * fileType Default == "" you can use it, to set the File Extension (pdf,doc,xls,ppt etc) when in the Url the File Extension is missing. */ { this; ifPlatformOS === 'ios' OpenFile else //Android this; OpenFile } /* * Handle Local File Method * fileType Default == "" you can use it, to set the File Extension (pdf,doc,xls,ppt etc) when in the Url the File Extension is missing. */ { this; ifPlatformOS === 'ios' OpenFile else OpenFile } { this; ifPlatformOS === 'ios' OpenFile else OpenFile } /* * Binary in URL * Binary String in Url * fileType Default == "" you can use it, to set the File Extension (pdf,doc,xls,ppt etc) when in the Url you dont have an File Extensions */ { this; ifPlatformOS === 'ios' OpenFile else OpenFile } /* * Base64String * put only the base64 String without data:application/octet-stream;base64 * fileType Default == "" you can use it, to set the File Extension (pdf,doc,xls,ppt etc) when in the Url you dont have an File Extensions */ { ifPlatformOS === 'ios' OpenFile else //Android OpenFile /* * Video File */ { ifPlatformOS === 'ios' OpenFile else Alert; } <Button onPress=thishandlePress title="Press Me Open Doc Url" accessibilityLabel="See a Document" /> <Button onPress=thishandlePressBinaryinUrl title="Press Me Open BinaryinUrl" accessibilityLabel="See a Document" /> <Button onPress=thishandlePressLocal title="Press Me Open Doc Path" accessibilityLabel="See a Document" /> <Button onPress=thishandlePressLocalXLS title="Press Me Open XLS DOC Path" accessibilityLabel="See a Document" /> <Button onPress=thishandlePressb64 title="Press Me Open Base64 String" accessibilityLabel="See a Document" /> <Button onPress=this title="Press Me Open Video" accessibilityLabel="See a Document" />}