通过 react-navigation 在 `DrawerNavigator` 菜单中分享 `Play Store` Link
Share `Play Store` Link in `DrawerNavigator` Menu via react-navigation
我的 DrawerNavigator 菜单中有 3 个屏幕项目。
如何在项目“3”下的 DrawerNavigator 菜单中添加分享 Play Store
Link?
我的意思是那不是一个真实的页面,只是一个带有图标的应用程序共享 Link,当有人单击该共享区域时将打开。
const Router = DrawerNavigator(
{
Home: { screen: MainScreen },
New: { screen: News },
Photo: { screen: Photos },
})
您可以为 DrawerNavigator 使用自定义 contentComponent
选项 https://reactnavigation.org/docs/navigators/drawer#Providing-a-custom-contentComponent。像这样
const Router = DrawerNavigator(
{
Home: { screen: MainScreen },
New: { screen: News },
Photo: { screen: Photos },
},
{
contentComponent: props => {
return (
<ScrollView>
<DrawerItems {...props} />
<TouchableOpacity
onPress={() => {
Share.share({
message: PLAY_STORE_URL
});
}}>
<Text>
Share
</Text>
</TouchableOpacity>
</ScrollView>
);
}
)
我的 DrawerNavigator 菜单中有 3 个屏幕项目。
如何在项目“3”下的 DrawerNavigator 菜单中添加分享 Play Store
Link?
我的意思是那不是一个真实的页面,只是一个带有图标的应用程序共享 Link,当有人单击该共享区域时将打开。
const Router = DrawerNavigator(
{
Home: { screen: MainScreen },
New: { screen: News },
Photo: { screen: Photos },
})
您可以为 DrawerNavigator 使用自定义 contentComponent
选项 https://reactnavigation.org/docs/navigators/drawer#Providing-a-custom-contentComponent。像这样
const Router = DrawerNavigator(
{
Home: { screen: MainScreen },
New: { screen: News },
Photo: { screen: Photos },
},
{
contentComponent: props => {
return (
<ScrollView>
<DrawerItems {...props} />
<TouchableOpacity
onPress={() => {
Share.share({
message: PLAY_STORE_URL
});
}}>
<Text>
Share
</Text>
</TouchableOpacity>
</ScrollView>
);
}
)