question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Swipe gesture stuck - snap carousel loop

See original GitHub issue

Is this a bug report, a feature request, or a question?

question but possible bug.

Have you followed the required steps before opening a bug report?

Have you made sure that it wasn’t a React Native bug?

Yes

Is the bug specific to iOS or Android? Or can it be reproduced on both platforms?

Both

Environment

React: 16.11.0
React native: 0.62.2
react-native-snap-carousel: ^3.9.1

Target Platform: Android (>6.0) iOS (>12)

Expected Behavior

Performing a swipe gestures slow and fast with the carousel component with the loop property enabled without stuck any itens.

Actual Behavior

Performing a swipe gestures slow and fast with the carousel component with the loop property enabled occurs stuck with the last “item 3”.

Reproducible Demo

View the demo

import * as React from 'react';
import {
  Text, 
  View,
  SafeAreaView } from 'react-native';

import Carousel from 'react-native-snap-carousel';

export default class App extends React.Component {

 
    constructor(props){
        super(props);
        this.state = {
          activeIndex:0,
          carouselItems: [
          {
              title:"Item 1",
              text: "Text 1",
          },
          {
              title:"Item 2",
              text: "Text 2",
          },
          {
              title:"Item 3",
              text: "Text 3",
          }
        ]
      }
    }

    _renderItem({item,index}){
        return (
          <View style={{
              backgroundColor:'floralwhite',
              borderRadius: 5,
              height: 250,
              padding: 50,
              marginLeft: 25,
              marginRight: 25, }}>
            <Text style={{fontSize: 30}}>{item.title}</Text>
            <Text>{item.text}</Text>
          </View>

        )
    }

    render() {
        return (
          <SafeAreaView style={{flex: 1, backgroundColor:'rebeccapurple', paddingTop: 50, }}>
            <View style={{ flex: 1, flexDirection:'row', justifyContent: 'center', }}>
                <Carousel
                  layout={"default"}
                  ref={ref => this.carousel = ref}
                  data={this.state.carouselItems}
                  sliderWidth={300}
                  itemWidth={300}
                  [loop={true}]([url](url))
                  inactiveSlideOpacity={1}
                inactiveSlideScale={1}
                  renderItem={this._renderItem}
                  onSnapToItem = { index => this.setState({activeIndex:index}) } />
            </View>
          </SafeAreaView>
        );
    }
}

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:6
  • Comments:23 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
joseakicommented, Mar 26, 2021

as @emilioheinz suggested if you set this prop loopClonesPerSide={data.length} with the data length the problem disappear ¯_(ツ)_/¯

1reaction
ZainaliSyedcommented, Feb 11, 2021

Still same issue , swipe gesture had a problem in android , very difficult to swipe left or right in android only

Read more comments on GitHub >

github_iconTop Results From Across the Web

Swipe gesture stuck - snap carousel loop · Issue #720 - GitHub
Performing a swipe gestures slow and fast with the carousel component with the loop property enabled without stuck any itens. Actual Behavior.
Read more >
Developers - Swipe gesture stuck - snap carousel loop -
Performing a swipe gestures slow and fast with the carousel component with the loop property enabled without stuck any itens.
Read more >
Facing an issue using react-native-snap-carousel. Is there a ...
Snap always works perfectly. Issues are following: A medium finger swipe skips to 2 items later, instead of next item; A very light...
Read more >
react-native-reanimated-carousel - npm package - Snyk
The common RN infinite scroll component. It get stuck on a fast slide. Wait for the next element to appear. This component will...
Read more >
IOS (React-native) app crashes in … | Apple Developer Forums
I am stuck on this for a few days now. ... + 396 (CADisplay.mm:1687) 27 ThrivApp 0x0000000102830088 -[RCTDisplayLink addToRunLoop:] + 76 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found