已完成按手势滑动,但我需要在单击“按钮或图标”时也具有相同的行为
这是强制执行手势滑动的代码。 我需要“ image.plus”点击功能。
const listItems = props => {
var swipeoutBtns = [
{
text: delete,
backgroundColor: theme.TEXT_RED_COLOR,
onPress: () => props.onClickDeleteItem(props.item),
}
]
return (
<SwipeOut //
right={swipeoutBtns}
autoClose={true}
close={props.itemId !== props.itemId}
onOpen={() => {
props.onOpen(props.itemId);
}}
>
<TouchableOpacity
testID={props.itemId}
accessible={false}
style={styles.container}
onPress={() => props.onPressItem(props.title, props.itemId, props.item)}
>
<View style={[styles.content]} >
{
props.clearMode && <View onFocus={props.onPress} > //when this condition is true then
icon will appear on appearing icon, user can click on icon it will swipe same as by
gesture
<Image //here i need to give onclick function
testID="imgPlus"
source={images.plus}
style={styles.image}
resizeMode="contain"
/>
</View>
}
<View style={styles.eloborateContainer}>
<TextView testID="txtItemandcolor" h6 style={styles.headerText}>
{props.title}
</TextView>
<TextView
testID="txtItems"
style={styles.descriptionBody}
extras={{ ellipsizeMode: "tail", numberOfLines: 3 }}
>
{props.item}
</TextView>
</View>
{
!props.clearMode && <View onFocus={!props.onPress}>
<Image
testID="imgPlus"
source={images.plus}
style={styles.image}
resizeMode="contain"
/>
</View>
}
</View>
</TouchableOpacity>
</SwipeOut>
);
};
使用动画有什么想法吗?尝试了一些没有成功的事情..