Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all articles
Browse latest Browse all 28463

Share custom file using React Native

$
0
0

I have a custom file something like file.myext wich I create it using rn-fetch-blob:

RNFetchBlob.fs.writeFile(path, JSON.stringify(data), 'utf8')

And I'm using react-native-share to share the file, I tried both:

Share.open({type: 'text/plain', url: 'file://'+path})

and

RNFetchBlob.fs.readFile(path, 'base64')
.then((data) => {
   Share.open({url: 'data:text/plain;base64,'+data})
})

but doesn't work, the second one share .txt file.

anyway to solve this?


Viewing all articles
Browse latest Browse all 28463

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>