nativescript-url-share
by Long Nguyễn | v1.6.3
A NativeScript module to use the native url sharing widget
npm i --save nativescript-url-share
  • Version: 1.6.3
  • GitHub:
  • Downloads:
    • Last Day:   0
    • Last Week:  2
    • Last Month: 23

NativeScript Url Share Plugin

Forked from https://github.com/tjvantoll/nativescript-social-share.

A NativeScript plugin to use the native social sharing widget on Android and iOS. Currently this module supports image and text sharing.

Installation

Run the following command from the root of your project:

$ tns plugin add nativescript-url-share

This command automatically installs the necessary files, as well as stores nativescript-url-share as a dependency in your project's package.json file.

Usage

To use the social share module you must first require() it. After you require() the module you have access to its APIs.

// ------------ JavaScript ------------------
var UrlShare = require("nativescript-url-share");

// ------------- TypeScript ------------------
import * as UrlShare from "nativescript-url-share";

API

shareUrl(String url, String text, [optional] String subject)

The shareUrl() method excepts a url and a string.

UrlShare.shareUrl("https://www.nativescript.org/", "Home of NativeScript");

You can optionally pass shareUrl() a second argument to configure the subject on Android:

UrlShare.shareUrl("https://www.nativescript.org/", "Home of NativeScript", "How would you like to share this url?");

Tutorials

Looking for some extra help getting social sharing working in your mobile application? Check out these resources: