react-native-swipeout onPress方法禁用包含组件的onPress方法
发布时间:2020-12-15 20:30:33 所属栏目:百科 来源:网络整理
导读:我有以下flatlist render方法,在点击列表项时,它将调用this._onPress方法: render() { return ( TouchableOpacity onPress={this._onPress} View style={styles.bookItem} Image style={styles.cover} source={{uri:this.props.coverURL}}/ View style={sty
我有以下flatlist render方法,在点击列表项时,它将调用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功能的响应性降低
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |