react-native-swiper: swiper image not showing
Swiper image not showing, only can see the dot changing the position. Saw this https://github.com/leecade/react-native-swiper/issues/416 but i added removeClippedSubviews={false}
also have same issue. Every time i have to delete <swiper/>
and save and reload and paste back it only show up. I try to export as apk also have same issue. Any idea to fix this ?
<View style={styles.container}>
<ScrollView>
<Swiper height={Dimensions.get('window').width / 1.3} showsButtons={false} removeClippedSubviews={false} autoplay={true} autoplayTimeout={3} autoplayDirection={true}
dot={<Swiperdot/>} activeDot={<Swiperactivedot/>} paginationStyle={{bottom: 10}}>
<SwiperImgItem pathuri={this.state.path1}/>
<SwiperImgItem pathuri={this.state.path2}/>
<SwiperImgItem pathuri={this.state.path3}/>
</Swiper>
</ScrollView>
</View>
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor:'#000000'
},
});
About this issue
- Original URL
- State: open
- Created 7 years ago
- Reactions: 3
- Comments: 39
try setting removeClippedSubviews prop to false.
<Swiper removeClippedSubviews={false}>
Guys, sometimes when the parent View has a
flex-direction
oralign-items
then it does not render correctly. Try to remove those flex properties from the parent and see if it renders correctly.@arribbar @cyperus @koansang guys, I have solution, I try using setTimeout to delay some time for swiper render. This worked for me, hope u guys also.
It worked for me changing width from 99% to 100%, for both iOS and Android
+1, change to react-native-snap-carousel
I use blow code resolve this problem,but why?
I’m experiencing this issue on Android as well. Sometimes the images won’t show at all and sometimes it only renders the first 3 images (loadMinimalSize = 2). I these cases the pagination doesn’t update properly either… Can we give this problem some priority as a lot of people seem to have issues on Android devices?
This is a sad, sad hack, but adding this to a parent of
Swiper
fixes the issue for me:Hopefully this gives a clue as to the proper solution, I really can’t find a library I’d like to use as an alternative to this.
Update: The above hack made it happen less frequently, but it was still flaky at a lower rate. So I ended up switching to https://github.com/archriss/react-native-snap-carousel (which works great).
Why There Is No Solution Yet???
resolve for me!
I don’t know if this issue has something to do with the “resizeMode” of <Image/> component. In my situation. when
resizeMode="stretch"
, like belowone of images will not show up, only one of them. But, every thing woks fine if you change the props to
resizeMode="cover"
.Solution
the problem is by the height in SwiperI added swiper in my project,sometimes it was wrong.Specifically,it didn’t work.The fact is images and dots all missing.Why?
+1, same issue here. It only repros in Android, iOS works fine for me. Sometimes the contents render, sometimes they don’t. When they don’t render, the inspector show that the children of
Swiper
are empty.