@nativescript-community/ui-share-file
TypeScript icon, indicating that this package has built-in type declarations

1.3.3 • Public • Published

Nativescript Share File

Send/Share files to other apps.

Android Intent, IOS InteractionController:

.

Installation

Install the plugin in your app.

npm install @nativescript-community/ui-share-file

Usage

Info: Shared files should be in the documents path.

    import { ShareFile } from '@nativescript-community/ui-share-file';
    import * as fs from '@nativescript/core/file-system';

    export class TestClass{

        shareFile;
        fileName;
        documents;
        path;
        file;

        constructor() {

            this.fileName = 'text.txt';
            this.documents = fs.knownFolders.documents();
            this.path = fs.path.join(this.documents.path, this.fileName);
            this.file = fs.File.fromPath(this.path);
            this.shareFile = new ShareFile();

            this.shareFile.open( { 
                path: this.path, 
                title: 'Open text file with:', // optional Android
                rect: { // optional iPad
                    x: 110,
                    y: 110,
                    width: 0,
                    height: 0
                },
                options: true, // optional iOS
                animated: true // optional iOS
            });
        }
    }

Arguments

path

Path to the file which will be shared.

String: Required

title

Title for the intent on Android.

String: (Optional) Default: Open file:.

rect

Positioning the view for iPads. On iPhones it's always shown on the bottom.

Object: (Optional) Default: {x: 0, y: 0, width: 0, height: 0 }.

options

Show additional opening options for iOS devices.

Boolean: (Optional) Default: false.

animated

Opening animation for iOS devices.

Boolean: (Optional) Default: false.

Package Sidebar

Install

npm i @nativescript-community/ui-share-file

Weekly Downloads

28

Version

1.3.3

License

Apache-2.0

Unpacked Size

34 kB

Total Files

16

Last publish

Collaborators

  • ammarahm-ed
  • dgmachado
  • classicoldsong
  • mayerlench
  • jcassidyav
  • sebjean
  • cjohn001
  • edusperoni
  • asharghi
  • farfromrefuge
  • triniwiz
  • eddyverbruggen
  • rigor789
  • walkerrunpdx
  • dnr
  • keerl
  • cvietor
  • bradmartin
  • rdlabo
  • tralves