react-native-swiper
react-native-swiper copied to clipboard
can't use onPress with swiper
@Evacaca this solves the problem:
https://github.com/leecade/react-native-swiper/issues/201
Please close the thread if that works for you :)
@harrisrobin @Evacaca worked for me:
<View style={styles.slide2}>
<TouchableWithoutFeedback onPress={() => console.log("onPress")}>
<Image
resizeMode="stretch"
style={styles.image}
source={require("../images/test2.jpg")}
/>
</TouchableWithoutFeedback>
</View>
ios can't onPress
Does not work on iOS
<TouchableWithoutFeedback
onPressIn={() => console.log('in')}
onPressOut={() => console.log('out')}
onPress={() => {
console.log("clicked");
setVisible(!visible);
}}>
<Swiper
onIndexChanged={swiperIndexChange}
key={images ? images.length : 0}
width={width}
height={height}
showsPagination={false}
loop={false}>
{images.map((url, index) => {
return (
<View key={index}>
<ImageItem imageUrl={url} />
</View>
);
})}
</Swiper>
</TouchableWithoutFeedback>
if Swiper children data has been changed it renders back to index 0 element