0.1.1 • Published 9 years ago
react-native-quick-look v0.1.1
react-native-quick-look
About
To show file previews on iOS, you can use the QuickLook Framework. Apple introduced a specialized view presented by QuickLook Preview Controller. However, this view is not available to be instantiated and presented directly (well, at least in a straight forward way).
However, you can access the view encapsulated by the QuickLook Preview Controller, and add it as a subview for any other instance of NSView. To make QuickLookView available on React Native, we instantiated the QuickLook Preview Controller, then customized and returned the view inside the controller.
NOTE: QuickLook Framework is only available on iOS.
Installation
iOS
npm install react-native-quick-look --save- In the Xcode's "Project navigator", right click on your project's Libraries folder ➜ Add Files to "Your Project Name"
- Go to
node_modules➜react-native-quick-look➜iOS➜ selectReactNativeQuickLook.xcodeproj - In the Xcode Project Navigator, click the root project, and in
Generaltab, look forLinked Frameworks and Libraries. Click on the+button at the bottom and addlibReactNativeQuickLook.aandQuickLook.frameworkfrom the list.
Android
Not available
Usage
iOS
// style it like any other View
// url is the url of the file you want to preview
<QuickLook style={{ flex: 1 }} url={ url } />
// or
// provide the filename of the asset included with the app
<QuickLook style={{ flex: 1 }} assetFileName={ 'demo.pdf' } />Android
Not available
Running the Example App
- Clone/download the repo
- Run
npm installfrom the Example folder - Open
Example.xcodeprojand run the app from Xcode
Screenshot

License
react-native-quick-look is available under the MIT license. See the LICENSE file for more info.