A possible way to show a share menu with expo without detaching

Hi there,

Is it possible to show a share menu with expo https://i.stack.imgur.com/El6Xb.png
without detaching expo ? I want to share a downloaded pdf file in my app.

React Native has this functionality built in: Share · React Native

Unfortunately, build in RN method Share allows to share only text or url, but you can’t share a file. I’ve tried to use base64 but it did’t work. I count’t find a possible way to share a file without detaching(
I found this useful plugin https://github.com/react-native-community/react-native-share but you need to detach to use it.

You was right @cmeredith :slight_smile:
It is possible to use RN Share
If someone wants to use Share, you need to to that:

Example:

Expo.FileSystem.downloadAsync(
                    urlToYourFile,
                    Expo.FileSystem.documentDirectory + `test.pdf`)
                    .then(({ uri }) => {
                      
                        Share.share({
                            url: uri,
                            title: 'title share',         
                        });
                    })
                    .catch(error => {
                        console.error(error);
                    });
2 Likes

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