webraptor / react-native-deck-swiper

tinder like react-native deck swiper
ISC License
137 stars 84 forks source link

[iOS] Swiping and Tapping Quickly Causes Unintended Swipe of Next Card #134

Open PlamenPanayotov opened 1 month ago

PlamenPanayotov commented 1 month ago

Bug Report: Card Swiping Issue on iOS

Issue Description:

On iOS, when swiping a card and quickly tapping the next card before the previous one is fully swiped away, the next card is unintentionally swiped. This seems to occur when interacting with the next card before the swiped card has completely left the screen.

Steps to Reproduce:

  1. Swipe a card.
  2. Before the swiped card is fully gone, quickly tap the next card.
  3. Observe that the next card is unintentionally swiped.

Expected Behavior:

Actual Behavior:

Affected Platforms:

Environment:

Code Example:

import { StyleSheet, View, Button, Text } from 'react-native';
import Swiper from 'react-native-deck-swiper';
import React from 'react';

export default function HomeScreen() {
  return (
    <View style={styles.container}>
      <Swiper
        cards={['DO', 'MORE', 'OF', 'WHAT', 'MAKES', 'YOU', 'HAPPY']}
        renderCard={(card) => {
          return (
            <View style={styles.card}>
              <Text style={styles.text}>{card}</Text>
            </View>
          );
        }}
        onSwiped={(cardIndex) => console.log(cardIndex)}
        onSwipedAll={() => console.log('onSwipedAll')}
        cardIndex={0}
        backgroundColor={'#4FD0E9'}
        infinite={true}
        stackSize={3}
      >
        <Button
          onPress={() => console.log('oulala')}
          title="Press me"
        />
      </Swiper>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#F5FCFF',
  },
  card: {
    flex: 1,
    borderRadius: 4,
    borderWidth: 2,
    borderColor: '#E8E8E8',
    justifyContent: 'center',
    backgroundColor: 'white',
  },
  text: {
    textAlign: 'center',
    fontSize: 50,
    backgroundColor: 'transparent',
  },
});

package.json

{
  "name": "test-swiper",
  "main": "expo-router/entry",
  "version": "1.0.0",
  "scripts": {
    "start": "expo start",
    "reset-project": "node ./scripts/reset-project.js",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "test": "jest --watchAll",
    "lint": "expo lint"
  },
  "jest": {
    "preset": "jest-expo"
  },
  "dependencies": {
    "@expo/vector-icons": "^14.0.2",
    "@react-navigation/native": "^6.0.2",
    "expo": "~51.0.28",
    "expo-constants": "~16.0.2",
    "expo-font": "~12.0.9",
    "expo-linking": "~6.3.1",
    "expo-router": "~3.5.23",
    "expo-splash-screen": "~0.27.5",
    "expo-status-bar": "~1.12.1",
    "expo-system-ui": "~3.0.7",
    "expo-web-browser": "~13.0.3",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-native": "0.74.5",
    "react-native-deck-swiper": "^2.0.17",
    "react-native-gesture-handler": "~2.16.1",
    "react-native-reanimated": "~3.10.1",
    "react-native-safe-area-context": "4.10.5",
    "react-native-screens": "3.31.1",
    "react-native-web": "~0.19.10"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@types/jest": "^29.5.12",
    "@types/react": "~18.2.45",
    "@types/react-test-renderer": "^18.0.7",
    "jest": "^29.2.1",
    "jest-expo": "~51.0.3",
    "react-test-renderer": "18.2.0",
    "typescript": "~5.3.3"
  },
  "private": true
}
shirafel commented 1 month ago

same here

ronCohen2 commented 4 weeks ago

same here