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

#1

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.

#2

React Native has this functionality built in: https://facebook.github.io/react-native/docs/share.html

#3

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.

#4

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);
                    });
1 Like
closed #5

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