react-native-deck-swiper icon indicating copy to clipboard operation
react-native-deck-swiper copied to clipboard

Only one card visible after update to react native 0.76

Open padoski opened this issue 1 year ago • 8 comments

As in title only one card visible after update to react native 0.76, to reproduce this bug just create expo blank expo project with sdk 0.52 which use 0.76 react native version and no matter stacksize, no matter stackSeparation, only first card is visible, and after scrolling it, then next one appear. So swiping is working, bust stack is not visible, just card which is first in front.

padoski avatar Nov 15 '24 13:11 padoski

I have the same issue. But its not just that.

After swiping the first card it appears like the image I attached. only the card behind is swipeable. the first/small card is not swipeable. Should we expect an update or just switch to an other card library?

deckswiper

The new architecture seems like breaking things.

rbayramo avatar Nov 16 '24 16:11 rbayramo

Exact same issue on my side, please help !

stackSize={amount} + showSecondCard={true}

isn't working anymore

HexaaJS avatar Nov 21 '24 10:11 HexaaJS

The issue appears to be caused by the negative z-index values assigned to the cards beneath the first one.

What fixed the problem for me was changing

const styles = StyleSheet.create({
    ...
    container: {
        alignItems: 'stretch',
        position: 'absolute',
        top: 0,
        left: 0,
        right: 0,
        bottom: 0
    }
    ...
}

to

const styles = StyleSheet.create({
    ...
    container: {
        alignItems: 'stretch',
        position: 'relative', // HERE
        top: 0,
        left: 0,
        right: 0,
        bottom: 0
    }
    ...
}

in styles.js

bartoszstepien01 avatar Nov 22 '24 00:11 bartoszstepien01

Okay i found a solution that worked for me :

this i what my Swiper code looks like :

                            <Swiper
                                ref={swiperRef}
                                cards={users}
                                renderCard={renderCard}
                                onSwipedRight={handleSwipeRight}
                                onSwipedLeft={handleSwipeLeft}
                                onSwipedAll={handleSwipedAll}
                                backgroundColor={'transparent'}
                                cardIndex={currentIndex}
                                disableBottomSwipe
                                disableTopSwipe
                                useViewOverflow={true}
                                stackSize={3}
                                animateOverlayLabelsOpacity
                                showSecondCard={true}
                                overlayLabels={{
                                    left: {
                                        title: "NOPE",
                                        style: {
                                            label: {
                                                backgroundColor: 'rgba(255, 0, 0, 0.4)',
                                                color: 'white',
                                                fontSize: 34,
                                                borderRadius: 10,
                                                width: Dimensions.get('window').width * 0.9,
                                                height: Dimensions.get('window').height * 0.65,
                                                textAlign: 'center',
                                                textAlignVertical: 'center',
                                                position: 'absolute',
                                                top: 0,
                                                left: 0,
                                            },
                                            wrapper: {
                                                flexDirection: 'column',
                                                borderRadius: 10,
                                                alignItems: 'center',
                                                justifyContent: 'center',
                                                marginTop: 20,
                                                marginLeft: 0,
                                                width: Dimensions.get('window').width * 0.9,
                                                height: Dimensions.get('window').height * 0.65,
                                                position: 'absolute',
                                            }
                                        },
                                    },
                                    right: {
                                        title: "LIKE",
                                        style: {
                                            label: {
                                                backgroundColor: 'rgba(0, 128, 0, 0.4)',
                                                color: 'white',
                                                fontSize: 34,
                                                borderRadius: 10,
                                                width: Dimensions.get('window').width * 0.9,
                                                height: Dimensions.get('window').height * 0.65,
                                                textAlign: 'center',
                                                textAlignVertical: 'center',
                                                position: 'absolute',
                                                top: 0,
                                                left: 0,
                                            },
                                            wrapper: {
                                                flexDirection: 'column',
                                                borderRadius: 10,
                                                alignItems: 'center',
                                                justifyContent: 'center',
                                                marginTop: 20,
                                                marginLeft: 0,
                                                width: Dimensions.get('window').width * 0.9,
                                                height: Dimensions.get('window').height * 0.65,
                                                position: 'absolute',
                                            }
                                        },
                                    },
                                }}
                            />
                        </View>```
                        
                        
                        i got a styling for it "styles.swiperContainer"
                        
                        ` swiperContainer: {
        flex: 1,
        justifyContent: 'center',
        alignItems: 'center',
        width: '100%',
        marginTop:70,
        position: 'relative',
        zIndex: 9999
    },`


What i did is added around the Swiper code a container and what was missing was the z-index; 9999, just add this and it should be working


Hope that will work for you good luck friends.

HexaaJS avatar Nov 25 '24 08:11 HexaaJS

                    ` swiperContainer: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    width: '100%',
    marginTop:70,
    position: 'relative',
    zIndex: 9999
},`

For me, getting rid of "flex: 1" worked perfectly. It now stacks and the animation of the cards moving forward works as well.

epifye avatar Nov 30 '24 17:11 epifye

sorry where did u put that ?, i cant fidn a swiperContainer on the props

                    ` swiperContainer: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    width: '100%',
    marginTop:70,
    position: 'relative',
    zIndex: 9999
},`

For me, getting rid of "flex: 1" worked perfectly. It now stacks and the animation of the cards moving forward works as well.

leo0grau avatar Feb 26 '25 17:02 leo0grau

@leo0grau wrap with a view and put that style, it'll be solved

batuhanbag avatar Apr 03 '25 11:04 batuhanbag

+1

urminv avatar Nov 11 '25 05:11 urminv