Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
message: '',
title: '',
subject: '',
excludedActivityTypes: '',
showAppsToView: true,
});
// $ExpectType Promise
Share.shareSingle({
url: '',
message: '',
social: 'facebook',
});
// $ExpectType Promise
Share.shareSingle({
url: '',
type: '',
message: '',
title: '',
subject: '',
social: 'facebook',
});
// $ExpectType Promise
Share.shareSingle({
url: '',
type: '',
message: '',
title: '',
subject: '',
filename: 'test',
this.timer = setTimeout(() => {
Share.shareSingle(
Object.assign(shareOptions, {
social: "whatsapp"
})
)
.then(info => {
// console.log(info);
this.setState({
modalVisible: false
});
})
.catch(err => {
alert(`WhatsApp:${err && err.error && err.error.message}`);
// console.log(err);
return;
});
}, 300);
this.timer = setTimeout(() => {
Share.shareSingle(
Object.assign(shareOptions, {
social: "whatsapp"
})
)
.then(info => {
// console.log(info);
this.setState({
modalVisible: false
});
})
.catch(err => {
alert(`WhatsApp:${err && err.error && err.error.message}`);
// console.log(err);
return;
});
}, 300);
setTimeout(function() {
Share.open({
url: `data:${mime};base64,${base64}`,
message: `Eggirl - ${media.caption}`,
type: "image/jpeg"
}).catch(err => err && console.log(err));
}, 0);
}).catch(err => {
share: function () {
Mixpanel.trackWithProperties('Share Post', {
share_text: this.state.post.name,
share_URL: this.state.post.redirect_url
});
Share.open({
share_text: this.state.post.name,
share_URL: this.state.post.redirect_url,
title: "Sharing is Caring"
}, function (e) {
console.log(e);
});
},
this.qrCodeSVG.toDataURL(data => {
let shareImageBase64 = {
message: `lightning:${invoice.payment_request}`,
url: `data:image/png;base64,${data}`,
};
Share.open(shareImageBase64).catch(error => console.log(error));
});
});
.then(supported => {
if (!supported) {
Share.shareSingle({
...shareOptions,
social: "whatsapp"
});
} else {
return ReactNative.Linking.openURL(
"whatsapp://send?text=" +
config.strings.share.message +
" " +
config.strings.share.url_article +
id
);
}
})
.catch(err => console.error("An error occurred", err));
openShareApp(platformName){
const { shareOptions } = this.props;
if(platformName == 'line') {
const bodyURI = encodeURIComponent(`${shareOptions.message} ${shareOptions.url}`);
Linking.openURL(`line://msg/text/?${bodyURI}`)
.then(() => this.props.onSocialShareCompleted(platformName))
.catch(() => this.props.onSocialShareAborted())
}
if(platformName == 'clipboard') {
Clipboard.setString(shareOptions.url);
this.props.onPushNotification('Link Copied');
this.props.onSocialShareCompleted(platformName);
this.closeScreen();
return true;
}
return Share.shareSingle({...shareOptions, social: platformName})
.then(data => {
console.log('social share completed');
this.props.onSocialShareCompleted(platformName);
this.closeScreen();
}).catch(err => {
console.log('social share failed',err);
this.props.onSocialShareAborted(platformName);
});
}
componentDidUpdate(){
const shareEmailImage = async () => {
const shareOptions = {
title: 'Share file',
email: 'email@example.com',
social: Share.Social.EMAIL,
failOnCancel: false,
urls: [images.image1, images.image2],
};
try {
const ShareResponse = await Share.open(shareOptions);
setResult(JSON.stringify(ShareResponse, null, 2));
} catch (error) {
console.log('Error =>', error);
setResult('error: '.concat(getErrorString(error)));
}
};
setTimeout(() => {
Share.open(config.strings.share);
}, 300);
}}