Share Social , Sending Simple Data to Other Apps
NOTE: React Native now implements share functionality Read more
npm install react-native-share --save
react-native link react-native-share
npm install react-native-share --save
npm install react-native-share --save
- In XCode, in the project navigator, right click
Libraries
âžśAdd Files to [your project's name]
- Go to
node_modules
âžśreact-native-share
âžśios
and addRNShare.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNShare.a
to your project'sBuild Phases
âžśLink Binary With Libraries
- In XCode, in the project navigator, select your project. Add
Social.framework
andMessageUI.framework
to your project'sGeneral
âžśLinked Frameworks and Libraries
- In file Info.plist, add
<key>LSApplicationQueriesSchemes</key> <array> <string>whatsapp</string> <string>mailto</string> </array>
- (Optional) Also following lines allows users to save photos, add them in
info.plist
<key>NSPhotoLibraryAddUsageDescription</key> <string>$(PRODUCT_NAME) wants to save photos</string>
- Run your project (
Cmd+R
)
npm install react-native-share --save
- Open up
android/app/src/main/java/[...]/MainApplication.java
- Add
import cl.json.RNSharePackage;
andimport cl.json.ShareApplication;
to the imports at the top of the file - Add
new RNSharePackage()
to the list returned by thegetPackages()
method
-
Append the following lines to
android/settings.gradle
:include ':react-native-share' project(':react-native-share').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-share/android')
-
Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-share')
-
Follow this guide. For example:
-
Put this in
AndroidManifest.xml
whereapplicationId
is something that you have defined inandroid/app/build.gradle
:<application> <provider android:name="android.support.v4.content.FileProvider" android:authorities="${applicationId}.provider" android:grantUriPermissions="true" android:exported="false"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/filepaths" /> </provider> </application>
-
Create a
filepaths.xml
under this directory:android/app/src/main/res/xml
. In this file, add the following contents:<?xml version="1.0" encoding="utf-8"?> <paths xmlns:android="http://schemas.android.com/apk/res/android"> <external-path name="myexternalimages" path="Download/" /> </paths>
- Edit your
MainApplication
class to implementShareApplication
-
Also add the
getFileProviderAuthority
method to your MainApplication class, and have it return theandroid:authorities
that was added in AndroidManifest file. -
For example: Replace the
com.example.yourappidhere
below with theapplicationId
that is defined in yourandroid/app/build.gradle
. It must be hard-coded here to work properly.import cl.json.ShareApplication class MyApplication extends Application implements ShareApplication, ReactApplication { { //... @Override public String getFileProviderAuthority() { return "com.example.yourappidhere.provider"; } }
npm install react-native-share --save
- In Visual Studio add the
RNShare.sln
innode_modules/react-native-share/windows/RNShare.sln
folder to their solution, reference from their app. - Open up your
MainPage.cs
app
- Add
using Cl.Json.RNShare;
to the usings at the top of the file - Add
new RNSharePackage()
to theList<IReactPackage>
returned by thePackages
method
Open Simple share dialog
Returns a promise that fulfills or rejects as soon as user successfully open the share action sheet or cancelled/failed to do so. As a result you might need to further handle the rejection while necessary. e.g.
Share.open(options)
.then((res) => { console.log(res) })
.catch((err) => { err && console.log(err); });
Supported options:
Name | Type | Description |
---|---|---|
url | string | URL you want to share (you can share a base64 file url only in iOS & Android ) |
urls | Array[string] | URL's you want to share, Only for iOS and Android (you can share a base64 file url only in iOS & Android ) |
type | string | File mime type (optional) |
message | string | |
title | string | (optional) |
subject | string | (optional) |
excludedActivityTypes | string | (optional) |
failOnCancel | boolean | (defaults to true) On iOS, specifies whether promise should reject if user cancels share dialog (optional) |
showAppsToView | boolean | (optional) only android |
Open share dialog with specific application
This returns a promise too.
Supported options:
Name | Type | Description |
---|---|---|
url | string | URL you want to share |
type | string | File mime type (optional) |
message | string | |
title | string | (optional) |
subject | string | (optional) |
social | string | supported social apps: List |
NOTE: If both message
and url
are provided url
will be concatenated to the end of message
to form the body of the message. If only one is provided it will be used
These can be assessed using Share.Social property
For eg.
import Share from 'react-native-share';
const shareOptions = {
title: 'Share via',
url: 'some share url',
social: Share.Social.WHATSAPP
};
Share.shareSingle(shareOptions);
Name | Android | iOS | Windows |
---|---|---|---|
yes | yes | no | |
PAGESMANAGER | yes | no | no |
yes | yes | no | |
yes | yes | no | |
GOOGLEPLUS | yes | yes | no |
yes | yes | no |
Android | IOS | Windows | |
---|---|---|---|
Simple Share | |||
UI Component | TODO |
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
TouchableOpacity,
View,
Clipboard,
ToastAndroid,
AlertIOS,
Platform
} from 'react-native';
import Share, {ShareSheet, Button} from 'react-native-share';
class TestShare extends Component {
constructor(props) {
super(props);
this.state = {
visible: false
}
}
onCancel() {
console.log("CANCEL")
this.setState({visible:false});
}
onOpen() {
console.log("OPEN")
this.setState({visible:true});
}
render() {
let shareOptions = {
title: "React Native",
message: "Hola mundo",
url: "http://facebook.github.io/react-native/",
subject: "Share Link" // for email
};
let shareImageBase64 = {
title: "React Native",
message: "Hola mundo",
url: REACT_ICON,
subject: "Share Link" // for email
};
return (
<View style={styles.container}>
<TouchableOpacity onPress={()=>{
Share.open(shareImageBase64);
}}>
<View style={styles.instructions}>
<Text>Simple Share Image Base 64</Text>
</View>
</TouchableOpacity>
<TouchableOpacity onPress={()=>{
Share.open(shareOptions);
}}>
<View style={styles.instructions}>
<Text>Simple Share</Text>
</View>
</TouchableOpacity>
<TouchableOpacity onPress={this.onOpen.bind(this)}>
<View style={styles.instructions}>
<Text>Share UI Component</Text>
</View>
</TouchableOpacity>
<ShareSheet visible={this.state.visible} onCancel={this.onCancel.bind(this)}>
<Button iconSrc={{ uri: TWITTER_ICON }}
onPress={()=>{
this.onCancel();
setTimeout(() => {
Share.shareSingle(Object.assign(shareOptions, {
"social": "twitter"
}));
},300);
}}>Twitter</Button>
<Button iconSrc={{ uri: FACEBOOK_ICON }}
onPress={()=>{
this.onCancel();
setTimeout(() => {
Share.shareSingle(Object.assign(shareOptions, {
"social": "facebook"
}));
},300);
}}>Facebook</Button>
<Button iconSrc={{ uri: WHATSAPP_ICON }}
onPress={()=>{
this.onCancel();
setTimeout(() => {
Share.shareSingle(Object.assign(shareOptions, {
"social": "whatsapp"
}));
},300);
}}>Whatsapp</Button>
<Button iconSrc={{ uri: GOOGLE_PLUS_ICON }}
onPress={()=>{
this.onCancel();
setTimeout(() => {
Share.shareSingle(Object.assign(shareOptions, {
"social": "googleplus"
}));
},300);
}}>Google +</Button>
<Button iconSrc={{ uri: EMAIL_ICON }}
onPress={()=>{
this.onCancel();
setTimeout(() => {
Share.shareSingle(Object.assign(shareOptions, {
"social": "email"
}));
},300);
}}>Email</Button>
<Button
iconSrc={{ uri: CLIPBOARD_ICON }}
onPress={()=>{
this.onCancel();
setTimeout(() => {
if(typeof shareOptions["url"] !== undefined) {
Clipboard.setString(shareOptions["url"]);
if (Platform.OS === "android") {
ToastAndroid.show('Link copiado al portapapeles', ToastAndroid.SHORT);
} else if (Platform.OS === "ios") {
AlertIOS.alert('Link copiado al portapapeles');
}
}
},300);
}}>Copy Link</Button>
<Button iconSrc={{ uri: MORE_ICON }}
onPress={()=>{
this.onCancel();
setTimeout(() => {
Share.open(shareOptions)
},300);
}}>More</Button>
</ShareSheet>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
instructions: {
marginTop: 20,
marginBottom: 20,
},
});
// twitter icon
const TWITTER_ICON = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAMAAAANIilAAAABvFBMVEUAAAAA//8AnuwAnOsAneoAm+oAm+oAm+oAm+oAm+kAnuwAmf8An+0AqtUAku0AnesAm+oAm+oAnesAqv8An+oAnuoAneoAnOkAmOoAm+oAm+oAn98AnOoAm+oAm+oAmuoAm+oAmekAnOsAm+sAmeYAnusAm+oAnOoAme0AnOoAnesAp+0Av/8Am+oAm+sAmuoAn+oAm+oAnOoAgP8Am+sAm+oAmuoAm+oAmusAmucAnOwAm+oAmusAm+oAm+oAm+kAmusAougAnOsAmukAn+wAm+sAnesAmeoAnekAmewAm+oAnOkAl+cAm+oAm+oAmukAn+sAmukAn+0Am+oAmOoAmesAm+oAm+oAm+kAme4AmesAm+oAjuMAmusAmuwAm+kAm+oAmuoAsesAm+0Am+oAneoAm+wAmusAm+oAm+oAm+gAnewAm+oAle0Am+oAm+oAmeYAmeoAmuk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5gAX5gAX5YAXpoAYJijtTrqAAAAIHRSTlMABFis4vv/JL0o4QvSegbnQPx8UHWwj4OUgo7Px061qCrcMv8AAAB0SURBVEjH7dK3DoAwDEVRqum9BwL//5dIscQEEjFiCPhubziTbVkc98dsx/V8UGnbIIQjXRvFQMZJCnScAR3nxQNcIqrqRqWHW8Qd6cY94oGER8STMVioZsQLLnEXw1mMr5OqFdGGS378wxgzZvwO5jiz2wFnjxABOufdfQAAAABJRU5ErkJggg==";
// whatsapp icon
const WHATSAPP_ICON = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAMAAAANIilAAAACzVBMVEUAAAAArQAArgAArwAAsAAAsAAAsAAAsAAAsAAAsAAAsAAAsAAArwAAtgAAgAAAsAAArwAAsAAAsAAAsAAAsAAAsgAArwAAsAAAsAAAsAAAsQAAsAAAswAAqgAArQAAsAAAsAAArwAArwAAsAAAsQAArgAAtgAAsQAAuAAAtAAArwAAsgAAsAAArAAA/wAAsQAAsAAAsAAAsAAAzAAArwAAsAAAswAAsAAAsAAArQAAqgAAsAAAsQAAsAAAsAAAsAAAqgAAsQAAsAAAsAAArwAAtAAAvwAAsAAAuwAAsQAAsAAAsAAAswAAqgAAswAAsQAAswAAsgAAsAAArgAAsAAAsAAAtwAAswAAsAAAuQAAvwAArwAAsQAAsQAAswAAuQAAsAAAsAAArgAAsAAArgAArAAAsAAArgAArgAAsAAAswAArwAAsAAAsQAArQAArwAArwAAsQAAsAAAsQAAsQAAqgAAsAAAsAAAsAAAtAAAsAAAsQAAsAAAsAAAsAAArgAAsAAAsQAAqgAAsAAAsQAAsAAAswAArwAAsgAAsgAAsgAApQAArQAAuAAAsAAArwAAugAArwAAtQAArwAAsAAArgAAsAAAsgAAqgAAsAAAsgAAsAAAzAAAsQAArwAAswAAsAAArwAArgAAtwAAsAAArwAAsAAArwAArwAArwAAqgAAsQAAsAAAsQAAnwAAsgAArgAAsgAArwAAsAAArwAArgAAtAAArwAArwAArQAAsAAArwAArw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ACXvXis0B89DUqXpnFwSy4fUb29SaO291bWSkTZGZlo12MBs1y/oqJqnSAx5pjbQQGtdnVw84doAMFSmZV1T0Vk3p20rmvw/yMTRiKqgMsl0EtC+um0R2D+uKGE6FnxW0MtogZevyywEVG5MEHsIBrSr0s31T8clrGL4kFE3TgfXhYcBYCKG+Ykin0SzjNO9ubp3JanUbKEwvyDzEVhR9GvMjQRe4tFweulk7q4u1ClpX4rvmUNKec01WczxfsX5KlOrM86w0CQRlhCcQmaLiX5SxxeRKWPA1XszwNBZjak5bdqGPg/fvQrpVYwtWAUq2Lx4hHSJY0Nz+3hnsx5iKwEoBVROEbWSDxCcyJ/SmfdhxG7ifPqnkI5turfSoE/0K5p2lMcrIG5Filmclgy7a01Qrerm+q8ycu6bPtvpKMN2R9M10WfvDjuuFhlN7dsbNd1wbpdRyVvXdYsd5b1gZDqTE58oB+fe6TOEFGJ+h1YssppvApU9R2oUidDb8dJn/iQKOsVZhDlKoZVm7X30HgvKkAhRk/8RAlBfmdYAxsuLSMznKyZdsIDTHwcFspGUvLSBE9bK/rQADvepX+0K09glFX/WGZJa/aBe06QT5EDfedOqRTnHWbOmeB5cQQw1S5IPSLetEJsC05cTf0S6u1WSwnX1xH8OzyLH/NNgN+u1bmJmEuUMGFlm7SkwhVlcb89bCsIIU0yBQphlulhOpARXTu/TkmWxqo1l9BMcy3caObJEQODIFDRITVuEyiyWuBxJH+yR7POQr3qrt3qrt3qrt3qrt3qrt3qrt3rrQ+3/ATxSgu3z5tTfAAAAAElFTkSuQmCC';
AppRegistry.registerComponent('TestShare', () => TestShare);
When share a base 64 file, please follow the format below:
url: "data:<data_type>/<file_extension>;base64,<base64_data>"
For example, when share a base 64 mp3
file, the url
should be:
url: "data:audio/mp3;base64,<base64_data>"
When share a base 64 image file with png
file extension, the url
should be:
url: "data:image/png;base64,<base64_data>"
When share a local file directly, please follow the format below:
url: "file://<file_path>",
For example, when share a pdf
file from: /storage/emulated/0/demo/test.pdf
, the url
should be:
url: "file:///storage/emulated/0/demo/test.pdf"
When sharing a pdf file with base64, there are two current problems.
- On WhatsApp base64 wont be recognized => nothing to share
- In the GmailApp the file extension is wrong (.dat).
Therefore we use this "workaround" in order to handle pdf sharing for iOS Apps to mentioned Apps
- Install react-native-fetch-blob
- Set a specific path in the RNFetchBlob configurations
- Download the PDF file to temp device storage
- Share the response's path() of the donwloaded file directly
Code:
static sharePDFWithIOS(fileUrl, type) {
let filePath = null;
let file_url_length = fileUrl.length;
const configOptions = {
fileCache: true,
path:
DIRS.DocumentDir + (type === 'application/pdf' ? '/SomeFileName.pdf' : '/SomeFileName.png') // no difference when using jpeg / jpg / png /
};
RNFetchBlob.config(configOptions)
.fetch('GET', fileUrl)
.then(async resp => {
filePath = resp.path();
let options = {
type: type,
url: filePath // (Platform.OS === 'android' ? 'file://' + filePath)
};
await Share.open(options);
// remove the image or pdf from device's storage
await RNFS.unlink(filePath);
});
}
Nothing to do on Android. You can share the pdf file with base64
static sharePDFWithAndroid(fileUrl, type) {
let filePath = null;
let file_url_length = fileUrl.length;
const configOptions = { fileCache: true };
RNFetchBlob.config(configOptions)
.fetch('GET', fileUrl)
.then(resp => {
filePath = resp.path();
return resp.readFile('base64');
})
.then(async base64Data => {
base64Data = `data:${type};base64,` + base64Data;
await Share.open({ url: base64Data });
// remove the image or pdf from device's storage
await RNFS.unlink(filePath);
});
}