Drop-in replacement of react-native Share module, provides the ability to share multiple images.
npm i react-native-multi-share --save
react-native link react-native-multi-share
# Add to Podfile
pod 'react-native-multi-share', :path => '../node_modules/react-native-multi-share'
importMultiSharefrom'react-native-multi-share';asyncfunctiononShare(){awaitMultiShare.share({images: ['file:///.../image1.jpg', ...]});}The images has to be copy to external storage, other apps cannot read your document folder.
// Copy the files to the external storageimportRNFetchBlobfrom'react-native-fetch-blob';constfs=RNFetchBlob.fs;// Android OnlyasyncfunctiongetExternalCacheDirAsync(){constdir=`${fs.dirs.SDCardApplicationDir}/cache`;if(!awaitfs.isDir(dir)){awaitfs.mkdir(dir);}returndir;}exportasyncfunctioncopyToExternalCacheDirAsync(from){constdir=awaitgetExternalCacheDirAsync();constfilename=from.replace(/^.*[\\/]/,'');constto=`${dir}/${filename}`;awaitRNFetchBlob.fs.cp(from,to);returnto;}- Test on react-native
- Test on detached expo.io project
- iOS
- Android
- Pull request to react-native
- Test using images along with other fields