Share API — share content with other apps.
Basic usage:
1import { Share, Button } from "react-native";23async function shareContent() {4 try {5 const result = await Share.share({6 message: "Check out this content!",7 title: "Share Title",8 url: "https://example.com",9 });1011 if (result.action === Share.sharedAction) {12 if (result.activityType) {13 console.log("Shared via:", result.activityType);14 }15 } else if (result.action === Share.dismissedAction) {16 console.log("Share dismissed");17 }18 } catch (error) {19 console.error("Share error:", error);20 }21}
Share with image (iOS):
1const result = await Share.share({2 title: "Share Image",3 url: "file:///path/to/image.jpg",4});
Result actions:
sharedAction — content was shared.dismissedAction — share dialog was dismissed.Notes: