react-native-reanimated-carousel icon indicating copy to clipboard operation
react-native-reanimated-carousel copied to clipboard

Carousel manuel swipe not working with react-navigation/material-top-tabs

Open Kepron opened this issue 1 year ago • 5 comments

Describe the bug Actually I'm not sure how to explain it. I am using react-navigation/material-top-tabs in my project. I have placed the carousel on my homepage but the manual swipe is not working properly.

...
return (
    <Tab.Navigator
      screenOptions={{
        swipeEnabled: true,
      }}
...

If swipeEnabled is true, manual swipe is not working properly. If swipeEnabled is false, manual swipe is working perfectly.

To Reproduce Steps to reproduce the behavior:

  1. Create a Expo project.
  2. Create a Navigator using react-navigation/material-top-tabs
  3. Put the Carousel to any page.
  4. Apply <Tab.Navigator screenOptions={{ swipeEnabled: true, }} settings.
  5. See what happens.

Expected behavior The swipe action should take precedence for the carousel.

Screenshots

https://user-images.githubusercontent.com/20345854/232549310-01a78431-cd61-43b2-bd49-ab7ef81fbe98.mp4

https://user-images.githubusercontent.com/20345854/232549410-bc83cf57-30ac-420c-b48b-7445831aab5e.mp4

Versions (please complete the following information):

"dependencies": {
  "@react-native-async-storage/async-storage": "1.17.11",
  "@react-navigation/bottom-tabs": "^6.5.7",
  "@react-navigation/material-top-tabs": "^6.6.2",
  "@react-navigation/native": "^6.1.6",
  "@react-navigation/native-stack": "^6.9.12",
  "@react-navigation/stack": "^6.3.16",
  "@types/react-native": "^0.71.5",
  "expo": "^48.0.10",
  "expo-splash-screen": "^0.18.1",
  "expo-status-bar": "~1.4.4",
  "react": "18.2.0",
  "react-native": "0.71.6",
  "react-native-appearance": "^0.3.4",
  "react-native-event-listeners": "^1.0.7",
  "react-native-gesture-handler": "~2.9.0",
  "react-native-ico-material-design": "^3.3.1",
  "react-native-pager-view": "6.1.2",
  "react-native-paper": "^5.6.0",
  "react-native-reanimated": "~2.14.4",
  "react-native-reanimated-carousel": "^3.3.0",
  "react-native-safe-area-context": "4.5.0",
  "react-native-screens": "~3.20.0",
  "react-native-svg": "13.4.0",
  "react-native-tab-view": "^3.5.1",
  "react-native-vector-icons": "^9.2.0",
  "touch": "^3.1.0"
},

Smartphone (please complete the following information):

  • Device: Android Device
  • OS: Android 10
  • Browser: App
  • Version: 10

Additional context https://snack.expo.dev/@lesques/material-top-tabs-and-carousel

Kepron avatar Apr 17 '23 16:04 Kepron

Expo snack added.

Kepron avatar Apr 22 '23 03:04 Kepron

If you disable swiping on the top tabs it could work, but you might want to make it so swiping is only disabled on the first tab. Example

nuppington-bit avatar Apr 30 '23 16:04 nuppington-bit

If you disable swiping on the top tabs it could work, but you might want to make it so swiping is only disabled on the first tab. Example

This is one of the things I tried. With context I did this; swipeEnabled is false if Carousel is touched. But it didn't work.

Kepron avatar Apr 30 '23 18:04 Kepron

@Jasermon Did you find a workaround for this behaviour?

nachovillaverde avatar Oct 25 '23 17:10 nachovillaverde

@Jasermon Did you find a workaround for this behaviour?

Nah. I couldn't solve the problem, so I turned off the swiping.

Kepron avatar Oct 27 '23 09:10 Kepron