我想在我的应用程序上添加我的社交媒体链接。但是当我用url添加它们时,它们会在浏览器上打开。当我使用facebook://系统时,它不能在Android上工作。
我希望我的URL的工作方式为“如果应用程序存在,则在应用程序上打开它。”
这在Android上是行不通的:
import * as Linking from 'expo-linking'
<TouchableOpacity style={[styles.iconButton, { backgroundColor: '#3b5998' }]} onPress={() => Linking.openURL('fb://page/blablabla')}>
<FontAwesome name="facebook" size={26} color="#fff" />
</TouchableOpacity>无法在其本地应用程序上打开URL:
<TouchableOpacity style={[styles.iconButton, { backgroundColor: '#3b5998' }]} onPress={() => Linking.openURL('https://www.facebook.com/blablabla')}>
<FontAwesome name="facebook" size={26} color="#fff" />
</TouchableOpacity>发布于 2021-07-30 06:19:35
这是您打开链接的方式。
import { View, Text, Image, Linking, TouchableOpacity} from 'react-native'
<TouchableOpacity style={{ marginVertical: 5 }} onPress={()=>{ Linking.openURL(item.link)}}>
<Text style={{ alignSelf: 'center', color: '#2575FC' }}>
Click here to read more
</Text>
</TouchableOpacity>https://stackoverflow.com/questions/68585940
复制相似问题