onClickItem 事件,点击希望有点击效果的处理
Closed this issue · 1 comments
yaogengzhu commented
这里希望 activeOpacity是一个 prop 默认值为1
<TouchableOpacity
activeOpacity = {1}
delayLongPress={this.props.delayLongPress}
onPressOut={()=> this.onPressOut()}
onLongPress={()=>this.startTouch(index)}
onPress={()=>{
if (this.props.onClickItem) {
this.props.onClickItem(this.getOriginalData(),item.data,index)
}
}}>
{this.props.renderItem(item.data,index)}
</TouchableOpacity>
lucioreyli commented
You can change the component TouchableOpacity
to Pressable
from react-native
. The Pressable
have more actions on press the button but have not any effect on press. You can read more about the component at the React Native Docs about Pressable.