Skip to content
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

Removing cards from deck just doesn't work (adding cards at the end does work tho) #138

Open
Gabotron-ES opened this issue Dec 15, 2024 · 0 comments

Comments

@Gabotron-ES
Copy link

Hi everybody, the lib is pretty amazing but there is a fundamental issue, removing cards on swipe just doesn't work, it causes all kinds of issues, like active card jumping two places, or jumping one place right when card drag starts, my current version is 2.0.17 so dynamic list should be working as per this PR : #87

<Swiper ref={swiper} 
            cards={root.userStore.users}
            renderCard={(user) => {
                return (
                    <TinderScrollable  user={user}></TinderScrollable>
                )}}
            onSwipedAll={() => { addUsers() )}} //Adding users at the end of the deck works
            cardIndex={root.userStore.cardIndex} 
            stackSize= {2}  verticalSwipe={false} 
            onSwipedRight={(cardIndex) => {
                console.log('Right, index swiped', cardIndex);
                root.userStore.setCardIndex(cardIndex); 
                onLiked(); 
                
            }}
            >
        </Swiper>


    const onLiked = async () => 
    {
            let cardIndex = root.userStore.cardIndex;
            let toLikeUser = root.userStore.users[cardIndex];
            
            await root.userStore.liked(toLikeUser,0,true);
            root.userStore.removeUserFromUsers(toLikeUser.id);
    };


Removing swiped users or users that have been blocked from the deck would be ideal but right not its pretty glitchy and just doesnt work, is there a way to remove cards from the deck WITHOUT re-rendering the deck each time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant