Sharing image with EXPO

I searched much , looks this process is not direct while using Expo

looks I need to download the file locally , then share it

import {Share} from 'react-native';

const imageURL = "https://i.imgur.com/7RhCHg2.png";

const url = await downloadAsync(imageURL , cacheDirectory + "tmp.png");
            console.log(url); // it prints a local image file
            Share.share({url : url.uri , message : "Event Invitation" });

The expected behavior

the app should share the image plus the message “Event Invitation”

The current behavior

the app share only the message “Event Invitation” , it does not see the image or share it

SDK Version: 37.0.0
Platform: Android

Hi

Yes, unfortunately that appears to be the case.

I think it would be useful to share an actual URL (rather than the data that a URL points to), and in addition it would be useful to be able to share the data for a file:///... URL (which is possible) and also for a data:... URL (which is apparently not possible currently).

According to the Share documentation, you can only specify a URL on iOS. You might want to upvote the following feature request, although I’m not sure it will completely solve your problem and even if it is implemented in SDK 39 you’d have to wait until September for that:

https://expo.canny.io/feature-requests/p/share-api-support-for-sharing-urls-on-android

You can share an image using the Sharing module, but this only allows you to share a file. You can’t share a message in addition to the file. See the following snack for an example:

I had the same question, thanks for asking it and thanks for answering. Seems like I’m going to have to download the image first with expo install expo-file-system

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.