gpt4 book ai didi

react-native-swipeout onPress 方法禁用包含组件的 onPress 方法

转载 作者:行者123 更新时间:2023-12-04 15:51:24 26 4
gpt4 key购买 nike

我有以下 flatlist 渲染方法,在点击列表项时,它将调用 this._onPress 方法:

render() {
return (
<TouchableOpacity onPress={this._onPress} >
<View style={styles.bookItem} >
<Image style={styles.cover} source={{uri:this.props.coverURL}}/>
<View style={styles.info} >
<Text style={styles.title}>{this.props.title} </Text>
<Text style={styles.author}>{this.props.author}</Text>
<Text style={{height: 8}}/>
</View>
<View style={styles.rightIcon}>
<Icon name="chevron-right" size={28} color={'#AAAAAA'} />
</View>
</View>
</TouchableOpacity>
);
}

在我在以下代码中添加 swipeout 标签后,swipeout 工作但点击项目不再调用 this._onPress 方法:
 render() {
// Buttons
var swipeoutBtns = [
{
text: 'Delete',
onPress: this._buttonPress
}
]
return (
<TouchableOpacity onPress={this._onPress} >
<Swipeout right={swipeoutBtns} >
<View style={styles.bookItem} >
<Image style={styles.cover} source={{uri:this.props.coverURL}}/>
<View style={styles.info} >
<Text style={styles.title}>{this.props.title} </Text>
<Text style={styles.author}>{this.props.author}</Text>
<Text style={{height: 8}}/>
</View>
<View style={styles.rightIcon}>
<Icon name="chevron-right" size={28} color={'#AAAAAA'} />
</View>
</View>
</Swipeout>
</TouchableOpacity>
);
}

这是 react-native-swipeout 的限制吗?

最佳答案

如果您将 Swipeout 作为第一个标签并将可触摸作为下一个嵌套标签,我认为它会起作用。但是,它似乎使 Swipeout 功能的响应速度变慢

关于react-native-swipeout onPress 方法禁用包含组件的 onPress 方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48331341/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com