我需要在所有屏幕中出现一个浮动按钮,我将它放在具有绝对位置的底部选项卡导航器中,但我无法为其设置 onPress 导航..如何在选项卡导航器中访问 navigation.navigate?
我的代码
MoreStack.navigationOptions = {
tabBarLabel: 'More',
tabBarIcon: ({ focused, navigation }) => (
<View>
<TabBarIcon
focused={focused}
name={Platform.OS === 'ios' ? 'ios-more' : 'md-more'}
type='ionicon'
/>
<View
style={{
flex: 1,
position: 'absolute',
bottom: 20,
alignItems: 'center',
right: 10,
}}
>
<TouchableOpacity onPress={() => navigation.navigate('Chat')}>
<Image
source={require('../assets/chat.png')}
style={{ alignSelf: 'center', height: 60, width: 60 }}
/>
</TouchableOpacity>
</View>
</View>
),
};