The Share API provides the ability to share text, files, images, and links via social networks, SMS, and email.
// Check if sharing via email is supported
Share.canShareViaEmail()
.then(() => {
// Sharing via email is possible
Share.shareViaEmail('Body', 'Subject', ['recipient@example.org']).then(() => {
// Success!
}).catch(() => {
// Error!
});
}).catch(() => {
// Sharing via email is not possible
});
// Check if sharing via email is supported
window.Share.canShareViaEmail()
.then(() => {
// Sharing via email is possible
window.Share.shareViaEmail("Body", "Subject", ["recipient@example.org"])
.then(() => {
// Success!
})
.catch(() => {
// Error!
});
})
.catch(() => {
// Sharing via email is not possible
});
// Check if sharing via email is supported
window.Share.canShareViaEmail()
.then(() => {
// Sharing via email is possible
Share.shareViaEmail("Body", "Subject", ["recipient@example.org"])
.then(() => {
// Success!
})
.catch(() => {
// Error!
});
})
.catch(() => {
// Sharing via email is not possible
});
// Check if sharing via email is supported
(<any>window).Share.canShareViaEmail()
.then(() => {
// Sharing via email is possible
(window).Share.shareViaEmail("Body", "Subject", ["recipient@example.org"])
.then(() => {
// Success!
})
.catch(() => {
// Error!
});
})
.catch(() => {
// Sharing via email is not possible
});
// Check if sharing via email is supported
window.Share.canShareViaEmail()
.then(() => {
// Sharing via email is possible
Share.shareViaEmail("Body", "Subject", ["recipient@example.org"])
.then(() => {
// Success!
})
.catch(() => {
// Error!
});
})
.catch(() => {
// Sharing via email is not possible
});
canShareVia(appName: <string>, message?: <string>, subject?: <string>, image?: <string>, url?: <string>): Promise<any>
Checks if you can share via a specific app.
canShareViaEmail(): Promise<any>
Checks if you can share via email.
saveToPhotoAlbum(fileOrFileArray: string | string[]) Promise<any>
share(message?: string, subject?: string, file?: string | string[], url?: string): Promise<any>
Shares using the share sheet.
shareVia(appName: string, message: string, subject?: string, image?: string, url?: string): Promise<any>
Share via AppName.
shareViaEmail(message: string, subject: string, to: string[], cc?: string[], bcc?: string[], files?: string | string[]): Promise<any>
Share via Email.
shareViaFacebook(message: string, image?: string, url?: string): Promise<any>
Shares directly to Facebook.
shareViaFacebookWithPasteMessageHint(message: string, image?: string, url?: string, pasteMessageHint?: string): Promise<any>
Shares directly to Facebook with a paste message hint.
shareViaInstagram(message: string, image: string): Promise<any>
Shares directly to Instagram.
shareViaSMS(message: string, image: string): Promise<any>
Share via SMS.
shareViaTwitter(message: string, image?: string, url?: string): Promise<any>
Shares directly to Twitter.
shareViaWhatsApp(message: string, image?: string, url?: string): Promise<any>
Shares directly to WhatsApp.
shareViaWhatsAppToReceiver(receiver: string, message: string, image?: string, url?: string): Promise<any>
Shares directly to a WhatsApp Contact.
shareWithOptions(options: object): Promise<any>
Shares using the share sheet with additional options and returns a result object or an error message.