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.

Swiper freezes when adding new items

See original GitHub issue

I load 15 items from the server and add them to the Swiper, when I viewed 11 items, I load 15 new items, throw out the 11 already viewed and add the new ones behind the remaining 4.

Problem is now, that the swiper freezes when I do this. Sometimes it completes the current swipe after the update, sometimes it simply keeps stuck till I swipe again.

    if (itemsLeft < 5) {
      const nextPage = page + 1;
      const nextItems = await this.loadPage(nextPage);
      items.splice(0, items.length - itemsLeft);

      this.setState({
        items: [...items, ...nextItems],
        page: nextPage
      });
    }

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
webraptorcommented, Oct 19, 2017

Discarding viewed items will create issues for swipe back …

0reactions
georgeMoralescommented, Dec 27, 2018

Hi, thanks for this good library … I am trying to paginate with Firebase Firestore, I have implemented it successfully in FlatList but with deck swiper I do not start the way. When I call the onSwiped method (cardIndex) making the new request with the last element I get this error … Warning: Can’t call setState (or forceUpdate) on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.

onSwiped = async () => { const {users} = this.props; let lastUsers = users && users[users.length - 1]; console.log(‘lastUsers’, lastUsers); let nextQuery = await this.props.getUsersQuery(lastUsers); console.log(‘nextQuery’, nextQuery); }

Read more comments on GitHub >

github_iconTop Results From Across the Web

Freezing/jumps when swiping Pages in Framer-Motion
When you swipe left/right it swipes to a certain point, pauses momentarily, and then continues. It's like little freezes, and I've identified it ......
Read more >
Swiper Changelog
Dom7 update to latest v2.0.6: Fixed issue with remove event listeners when they was not added. Minor fixes. 4.2.6 - Released on May...
Read more >
The app is freezing or crashing iOS | Driving & Delivering
From the home screen, swipe up from the bottom of your screen and pause in the middle of the screen. Swipe right or...
Read more >
Use your Chromebook touchpad - Google Support
To go forward to a page you were just on, swipe right with two fingers. See all open windows ... Drag the item...
Read more >
Slow rendering - Android Developers
If you frequently see inflation causing jank as new items come on screen, verify that you don't have more view types than you...
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