I have a question, I want to share an image with react native and I have the following: the function getUri I get an image that is a code, I get it to base 64 and my function to share is the share Invitation, what happens is what next, I can not share it if the message is empty, and seeing another example on the web both the url and the message are the same in this case two have 'this.state.uri', but at the time of sharing is sent base 64 in text and not the image, my question is as follows. DO I HAVE TO CODIFY THE BASE 64 OR ONLY WHEN SHARING IT DOES IT? o WHAT I HAVE TO DO, FOR ANDROID
getUri (callback) {
this.setState({
generatingUri: true
}, () => {
this.svg.toDataURL(uri => {
this.setState({
uri: 'data:image/png;base64,${uri}'
}, () => {
this.setState({
generatingUri: false
})
callback()
})
})
})
}
shareInvitation () {
let options = {
type: 'image/png',
title: 'Compartir Invitación',
message: '',
url: this.state.uri
}
this.getUri(_ => {
Share.share(options, {
// Android only:
dialogTitle: 'Compartir Invitación',
// iOS Only
excludedActivityTypes: [
'com.apple.UIKit.activity.Mail',
'com.apple.UIKit.activity.CopyToPasteboard',
'com.apple.UIKit.activity.AssignToContact',
'com.apple.UIKit.activity.SaveToCameraRoll',
'com.apple.UIKit.activity.AddToReadingList',
'com.apple.UIKit.activity.PostToFlickr',
'com.apple.UIKit.activity.PostToVimeo',
'com.apple.UIKit.activity.PostToWeibo',
'com.apple.UIKit.activity.PostToTencentWeibo',
'com.apple.UIKit.activity.AirDrop',
'com.apple.UIKit.activity.OpenInIBooks',
'com.apple.UIKit.activity.MarkupAsPDF',
'com.apple.reminders.RemindersEditorExtension', // Reminders
'com.apple.mobilenotes.SharingExtension', // Notes
'com.apple.mobileslideshow.StreamShareService' // iCloud Photo Sharing - This also does nothing :{
]
}).catch(err => {
console.log(err)
})
})
}