-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Examples with HTTP loading #36
Comments
@leifg Hey glad you like my module! Yes this problem has been very apparent when developing this module. For instance if you take a look at my advanced example you can see a very ugly work around for this using a global variable of which cards to be removed (https://github.com/3DJakob/react-tinder-card-demo/blob/master/src/examples/Advanced.js#L28). I did this to avoid rerenders while cards are animating. With this in mind you can do a similar implementation. It is fine to modify the cards array as long as the user is not moving any cards and secondly there are no cards currently animating. This is problematic because although I might revisit this plugin in the future as I believe it would be possible to fix this in a smarter way but I don't have time for that right now unfortunately. Another possible solution for your specific problem could be having two tinder card stacks with different state arrays on top of each other. As soon as the first one is depleted you could move it to the bottom and add new cards. This would probably solve your issue! An even better variant of this would probably be just rendering 2 cards at the time. As soon as one of them calls I hope this helps! And if it does please reply here so I can see how you solved it. Good luck! |
Hi guys, I think I implemented endless loading quite well here: https://github.com/msveshnikov/swiper/blob/master/src/App.js Demo: https://swiper.ml/ |
I absolutely love this library. It makes the swiping gesture super convenient.
I was wondering though if anyone ever achieved a loading additional parts of the stack from an external resource (load 10 cards initially, once you get to 2 or 3 cards, load the rest and add them to the "back").
For me unfortunately updating the stack seems to get in the way of the animation. whenever I call a
setState
in one of the callback function, the animation gets messed up.I already try to make sure to just use
useRef
for the onSwipe callback and only set the new state in theonLeftScreen
callback but it still seems kinda clunky.What I'm doing right now is only fetching new cards once the whole stack has been depleted, that seems to work but it would be great if I could have an "endless" stack by loading new cards whenever the stack gets close to zero.
The text was updated successfully, but these errors were encountered: