尝试在Swipeout标签中使用touchablehighting,如下所示。然后将您的卡组件放在代码中的指定位置。这对我在iOS和Android上都有效。请同时安装以下计时器:
import Timer from 'react-native-timer';
我希望我能帮忙。
onPressFunction=()=>{
Timer.setTimeout(
this, 'modalBottom', () => {
//execute your function
}, 200
);
}
componentWillUnmount(){
Timer.clearTimeout('modalBottom');
}
render(rowData) {
// in this part you can design the button in swiped mode
let swipeBtns = [{
backgroundColor: 'transparent',
component: (<View style={{ flex:1, justifyContent:'center', alignItems:'center', }}>
</View>),
onPress: () => {
//execute your function
}
}];
return (
<Swipeout right={swipeBtns}
backgroundColor= 'transparent'>
<TouchableHighlight onPress={this.onPressFunction}>
<View style={styles.buttonStyle} >
////Put your card component here
</View>
</TouchableHighlight>
</Swipeout>
);
}
}