question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Update the state breaks the slides.

See original GitHub issue

Which 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.

Screen Shot 2019-09-05 at 16 39 46

Screen Shot 2019-09-05 at 16 39 55

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:6
  • Comments:33

github_iconTop GitHub Comments

58reactions
Jalson1982commented, Jan 17, 2020

If set prop loadMinimal it works in my case.

31reactions
kyle-ssgcommented, Oct 26, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found