Я пытаюсь поделиться изображением скриншота и ссылкой для загрузки приложения с реакцией-native-share и библиотекой Share.Android работает нормально только проблема с IOS только для WhatsApp.Если у кого-то есть решение, пожалуйста, дайте мне знать.
Вот мой код:
<ScrollView ref='Sc' collapsable={false}>
<View collapsable={false} ref={(shot) => { this.screenshot = shot; }} style={styles.innerContainer}>
<Image source={{uri : this.state.imageURI}} style={{width: 200, height: 300, resizeMode: 'contain', marginTop: 5}} />
<TouchableOpacity style={styles.shareBtn}
onPress={this.captureScreenss.bind(this)}>
<Icon style={styles.iconStyle} name="ellipsis-h" size={22} color="#fff" />
<Text style={styles.shareText}>More</Text>
</TouchableOpacity>
</View>
</ScrollView>
Вот функция:
captureScreenss = () => {
captureRef(this.refs.Sc, {
format: 'jpg',
quality: 0.8,
result: 'base64',
snapshotContentContainer: true
})
.then(res => {
console.log("return data",res);
this.setState({ imageURI:res });
const shareOptions = {
title: 'Title',
message: "Download ."+ "\n" + "Download link: https://github.com/react-native-community/react-native-share", // Note that according to the documentation at least one of "message" or "url" fields is required
url: "data:image/jpg;base64,"+res,
subject: 'Subject'
};
Share.share(shareOptions);
}).catch(error => {
console.log(error, 'this is error')
})
}
Пожалуйста, дайте мне знать, если кто-нибудьимея решение для того же.