Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@react-native-community/react-native-simple-share

Package Overview
Dependencies
Maintainers
23
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-native-community/react-native-simple-share

A minimal share package for react-native

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
23
Created
Source

react-native-simple-share

Manual installation

Android
  1. Open up android/app/src/main/java/[...]/MainActivity.java
  • Add import com.reactnativecommunity.modules.share.RNSimpleSharePackage; to the imports at the top of the file
  • Add new RNSimpleSharePackage() to the list returned by the getPackages() method
  1. Append the following lines to android/settings.gradle:
    include ':react-native-simple-share'
    project(':react-native-simple-share').projectDir = new File(rootProject.projectDir, 	'../node_modules/react-native-simple-share/android')
    
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:
      compile project(':react-native-simple-share')
    

Usage

import React, { Component } from "react";
import { View, Button } from "react-native";
import SimpleShare from "react-native-simple-share";

export default class ShareExample extends Component {
  onShare = async () => {
    try {
      const result = await SimpleShare.share({
        message:
          "React Native | A framework for building native apps using React"
      });

      if (result.action === SimpleShare.sharedAction) {
        if (result.activityType) {
          // shared with activity type of result.activityType
          console.log("result", result);
        } else {
          // shared
          console.log("result", result);
        }
      } else if (result.action === SimpleShare.dismissedAction) {
        // dismissed
        console.log("dismissed");
      }
    } catch (error) {
      console.log("error", error.message);
    }
  };

  render() {
    return (
      <View
        style={{
          backgroundColor: "white",
          flex: 1,
          justifyContent: "center",
          alignItems: "center"
        }}
      >
        <Button title="Share" onPress={this.onShare}>
          Share
        </Button>
      </View>
    );
  }
}

Keywords

FAQs

Package last updated on 03 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc