Git Product home page Git Product logo

react-native-doc-preview's Introduction

react-native-doc-preview

ReactNative: Read Documents within application in iOS and use 3rd party library in-case of Android

Getting started

$ yarn add react-native-doc-preview

๐Ÿ’ป Usage

import { NativeModules } from 'react-native'
let { MSDocPreview } = NativeModules

 MSDocPreview.shareDoc(
   [
     {
       url: path,
       fileName: item.get('name')
     }
   ],
   (error, url) => {
     if (error) {
       let { Dialog } = imports('uikit')

       Dialog.error({
         title: LocaleManager.getLocale('UIkit', 'android-error'),
         description: LocaleManager.getLocale('UIkit', 'no-app-support'),
         positiveText: Locale.continue,
         onPositive: () => {}
       })
     } else {
     }
   }
)

MSDocPreview.openDoc(
  [
    {
      url: path,
      fileName: item.get('name')
    }
  ],
  () => {}
)

or 

import {DocPreview} from 'react-native-doc-preview'

<DocPrewview url={} fileName={}/>

๐Ÿ’ก Api

  • iOS
API Params Description
openDoc url, fileName This api internally uses QLPreview to display the document within the app
  • Android
API Params Description
shareDoc url, fileName This api invokes an Intent to select an app from list of 3rd party apps to support Document Reading

๐Ÿ’ก Props

  • General (Android/iOS)
Prop Type Default Note
url: mandatory string Path of the file to Read
fileName: mandatory string Name of the file Read.

react-native-doc-preview's People

Contributors

kartiksubramaniam avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.