[英]Sharing data to social media in React native
我有一个应用程序,一旦用户点击社交图标,我想在其中将特定数据共享到社交媒体,如 facebook、twitter、pinterest 等。 我已经使用了 react native 链接,它将我发送到这些平台的页面。 但是我想在点击后与这些共享数据。 我已经为 whatsapp 做了这个,就像这样:
<TouchableOpacity onPress={() => { let url = 'whatsapp://send?text=${hello}&phone=${01753362960}'; Linking.openURL(url).then((data) => { console.log('open whatsapp', data) }).catch(() => { console.log('App not installed') }); }} > <Icon name='logo-whatsapp' style={{color: '#395894', fontSize: 30, marginRight: 10}}/> </TouchableOpacity>
let url = 'twitter://send?text=hello this is checked'
我如何为其他社交媒体平台执行此操作?
对于推特,请使用这个,
let url = 'twitter://post?message=${yourMsg}'
我会这样做: https : //facebook.github.io/react-native/docs/share
通过这种方式,用户可以根据用户设备上安装的应用程序选择他想要共享的应用程序
react-native-share 是一个很好的包,用于在不同平台上共享一些东西。 早在 2019 年初,这个包还没有那么成熟,但现在它真的很有用。
https://github.com/react-native-community/react-native-share
看看这里。 谢谢。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.