Files viewer component that wraps the iOS QuickLook preview - supports images, pdf, Microsoft office files etc.
Enables pinch to zoom, double tap and swiping between files.
$ npm install rn-files-view-ios --save
$ react-native link rn-files-view-ios
In XCode, in the project navigator, select your project. Add QuickLook.framework
to your project's Build Phases
➜ Link Binary With Libraries
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜rn-files-view-ios
and addRNFilesViewIos.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNFilesViewIos.a
andQuickLook.framework
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)<
import FilesViewIOS from 'rn-files-view-ios';
onChangeFile(event) {
//The currently visible file
const index = event.nativeEvent.index;
}
onPreviewFailed(event) {
//The failed file url
const url = event.nativeEvent.url;
}
render() {
return <FilesViewIOS
style={{ flex: 1 }}
previewBackgroundColor={"#474A5C"}
initialIndex={0}
urls={["file://pathToFile/myfile1.jpeg", "file://pathToFile/myfile2.pdf", "file://pathToFile/myfile3.docx"]}
onFileChange={this.onChangeFile}
onPreviewFailed={this.onPreviewFailed}
/>;
}