Skip to content

Repository files navigation

react-native-multi-share

Drop-in replacement of react-native Share module, provides the ability to share multiple images.

Installation

npm i react-native-multi-share --save
react-native link react-native-multi-share

Using CocoaPods

# Add to Podfile
pod 'react-native-multi-share', :path => '../node_modules/react-native-multi-share'

Usage

importMultiSharefrom'react-native-multi-share';asyncfunctiononShare(){awaitMultiShare.share({images: ['file:///.../image1.jpg', ...]});}

Common Issues

Does not work android

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;}

Todos

  • Test on react-native
  • Test on detached expo.io project
  • iOS
  • Android
  • Pull request to react-native
  • Test using images along with other fields

About

Share multiple images with react native

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages