Update the state breaks the slides.
See original GitHub issueWhich OS ?
MAC OS
Version
Which versions are you using: ^1.6.0-nightly.3
- react-native-swiper v?
- react-native v0.59.5
Hello Guys, I am using Swiper like this:
renderThumb() {
return (
<Swiper style={styles.wrapper} showsButtons={false} horizontal={false} showsPagination={false} loop={false} onIndexChanged={this.onSlideIndexUpdate} onMomentumScrollEnd={() => { console.log('on touch end') }}>
{this.state.cachedThumbnails.map((thumb) => {
console.log('HERE THUMB', thumb)
return (
<View key={thumb.key} style={styles.thumbnailContainer}>
<Loader loading={this.state.showThumbnail} withBackground={false} showLoadingText={false} />
<Image
source={{ uri: thumb.thumbLink }}
style={styles.backgroundVideo}
resizeMode='cover'
/>
</View>
);
})}
</Swiper>
);
};
Every time when the state is changed, the component is re-rendered, but the slide is pushed up and the next slide is seeing from the bottom, as showed here in the image:
Please note, this happens only on the images with index>0. If I swipe to the first slide, the slide is ok.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:6
- Comments:33
Top Results From Across the Web
Why does my map-function break Swiperjs component in React?
Problem Solved! I think the Swiper was initialized before anything was in it so the Swiper thought it had zero slides and wouldn't...
Read more >Organize your PowerPoint slides into sections
Try it! Right-click between slides and select Add Section. An Untitled Section is added in the thumbnail pane, and the Rename Section dialog...
Read more >Reporter breaks ribs tumbling down Bernie Brewers' slide
Dodgers reporter breaks ribs, wrist tumbling down Bernie Brewers' slide. By Jason Fechner Wisconsin. UPDATED 5:30 PM ET Aug.
Read more >Governor Newsom Releases California Blueprint to Take on ...
The Governor's California Blueprint bolsters state's ongoing work to address COVID-19, climate change, homelessness, inequality and keeping ...
Read more >CircuitBreaker - resilience4j
The CircuitBreaker uses atomic operations to update the state with side-effect-free functions. Recording calls and reading snapshots from the Sliding Window is ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If set prop loadMinimal it works in my case.
As it stands the lib seems completely unusable due to this. Building from @hanford 's advice, the following seems to fix the issue on the latest version. https://github.com/kyle-ssg/react-native-swiper/commit/eeddedb4205d28c79853f8d39b2fa5750d254069#diff-1fdf421c05c1140f6d71444ea2b27638
Looks like some internal state values aren’t being included when rendering, maybe it could just use this.internals.offset. Added a PR for this.