请帮我制作可触摸的图像,以便我可以调用 onPress 函数
renderSideButtons = (isGift: boolean) => {
return (
<View style={{ bottom: 745 }}>
<View style={styles.threeButtonsCustom}>
{isGift &&
<TouchableOpacity style={styles.threeButtons}
onPress={this.openAllergenList}>
<Image
style={[styles.threeButtons, { top: 545 }]}
source={require('../../assets/images/icons/gift_fbutton.png')}
/>
</TouchableOpacity>}
<TouchableOpacity style={styles.threeButtons}>
<Image
source={require('../../assets/images/icons/star_white.png')}
style={[styles.threeButtons, { top: 235 }]}
/>
</TouchableOpacity>
<TouchableOpacity style={styles.threeButtons}>
<Image
source={require('../../assets/images/icons/share_white.png')}
style={[styles.threeButtons, { top: 195 }]}
/>
</TouchableOpacity>
</View>
</View>
);
};
这是styles.threeButtons 样式
threeButtons: {
position: 'absolute',
right: 175,
width: 50,
resizeMode: 'contain',
flexDirection: 'row-reverse'
},
和额外的样式
threeButtonsCustom:{
flex: 1,
flexDirection: 'row-reverse',
position: 'absolute',
marginTop: '20%',
zIndex:1 }
[1]: https://imgur.com/a/46K5bvi例如礼物图片