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);
.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(){
shareOnSocialMedia = (platform: string, sharerUrl: string) => () => {
Share.shareSingle({
message: 'pillarproject.io/wallet',
url: 'https://pillarproject.io/wallet',
social: Share.Social[platform.toUpperCase()],
})
.catch(() => {
Linking.openURL(sharerUrl);
});
};
setTimeout(() => {
Share.shareSingle(Object.assign(shareOptions, {
"social": "whatsapp"
}))
.then(info => {
this.setState({
modalVisible: false
});
})
.catch((err) => {
alert(`WhatsApp:${err && err.error && err.error.message}`)
this.setState({
modalVisible: false
});
return;
});
},300);
}
setTimeout(() => {
Share.shareSingle(
Object.assign(shareOptions, {
social: type
})
).catch(err => {
return;
});
}, 300);
}