webraptor / react-native-deck-swiper

tinder like react-native deck swiper
ISC License
134 stars 83 forks source link

Cards not rendering straight #31

Closed sturrock closed 1 year ago

sturrock commented 4 years ago

When the Swiper renders the cards they are coming out weird, sometimes it works but most the time it doesn't. You cant swipe it either.

I noticed it does it when you open the app, then once you refresh the app with Ctrl+R it fixes itself. Its rendering the first card as the swipeBackCard then its rendering the other cards with rotation, and out of order indexes.

Any ideas whats going on and is there a fix?

94981805-8cb7c400-0578-11eb-9b78-984cbc8fc138
webraptor commented 3 years ago

Duplicate

sturrock commented 3 years ago

This is a different error, I figured out how to fix it.

In Swiper.js you need to change line 8 from const { height, width } = Dimensions.get('window') to const { height, width } = Dimensions.get('screen')

webraptor commented 3 years ago

This is a different error, I figured out how to fix it.

In Swiper.js you need to change line 8 from const { height, width } = Dimensions.get('window') to const { height, width } = Dimensions.get('screen')

If you’ve got it solved in a fork please submit a PR. Thanks!

webraptor commented 3 years ago

The change would also impact only Androids.

https://stackoverflow.com/questions/44978804/whats-the-difference-between-window-and-screen-in-the-dimensions-api/44979327

ali14a commented 3 years ago

changed line 8 still getting tilt card. anyone found any solution?

webraptor commented 3 years ago

The issue is likely from the pan responder not the width / height of the the deck of cards.

Fazatholomew commented 3 years ago

Same problem here. The card will be displaced after the first swipe. Also, some how the images flicker when interacting with the swiper. Any ideas?

Below is the props: <Swiper ref={swiperRef} cards={data} cardIndex={index} renderCard={(card) => ( <Card card={card} handleClick={() => handleClick(data[index])} /> )} infinite keyExtractor={(card) => ${card.ticker} ${Date.now()}} backgroundColor={'transparent'} onSwiped={onSwiped} onSwipedRight={() => handleClick(data[index])} onSwipedLeft={() => handleReject(data[index])} onTapCard={() => swiperRef.current.swipeLeft()} cardVerticalMargin={50} stackSize={stackSize} stackScale={10} stackSeparation={14} disableTopSwipe disableBottomSwipe /> IMG_910E3AF50545-1

webraptor commented 1 year ago

Fixed on 2.0.11