share image base64 not showing on social
See original GitHub issuehere my code:
captureScreen({
format: "png",
quality: 0.8,
result:'data-uri'
})
.then(
uri =>{
console.log("Image saved to", uri)
let shareImage = {
title: 'share image',//string
message: 'share image description',//string
url:uri,
};
Share.open(shareImage).catch(err => console.log(err));
},
error => console.error("Oops, snapshot failed", error)
);
my console.log: but image not showing anymore when sharing, for example share with email:
Environment
- React Native version: 0.55.4
- React Native platform + platform version: Android 8.0
react-native-share
Version: 1.0.27
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:14 (2 by maintainers)
Top Results From Across the Web
Error sharing base64 image on SocialShare plugin
The image is somehow getting converted to jpeg , I guess. TRY either, drawing a white background before drawing the text or specifying...
Read more >Share image using Social Sharing Plugin | OutSystems
From your screenshots, it seems you are trying to share with Facebook a file by using a Base64 encoded data-URL, which could explain...
Read more >Share Image With Web Share API - Kush Kumar
Initially, I tried to store the user banner to firebase and sharing the file URL to social media but sharing the file as...
Read more >Navigator.share() - Web APIs - MDN Web Docs
` return } if (navigator.canShare({ files })) { try { await navigator.share({ files, title: 'Images', text: 'Beautiful images' }) output.textContent = 'Shared!' } ......
Read more >Automatic Social Share Images | CSS-Tricks
Any time the image is requested, check to see if you've already created it. If so, serve it from Cloudinary; if not, make...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I solved it by correcting the format " url: “data:image/jpeg;base64,”+uri, " I have been using jpg instead of jpeg as it was said “extension name” in docs.
Actually it works fine if I put that data URL in a constant like in the examples from Readme. But if I use the value from https://github.com/iddan/react-native-canvas#canvastodataurl it doesn’t work. I log it in console and it has the same value.
L.E. Nevermind, it looks like the value returned by https://github.com/iddan/react-native-canvas#canvastodataurl is included in quotes for some reason. If I trim those quotes with
const url = dataURL.replace(/^"+|"+$/g, '');
it works well.