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.

When swiping item, they stop in the middle

See original GitHub issue

Hello everyone,

There are some issues on some Android devices. Slider can’t move full next one.

Screen Shot 2021-07-22 at 14 41 43

This is my code:

const carouselRef = useRef<Carousel<{uri: string}>>(null);
  const SLIDER_WIDTH = Dimensions.get('window').width;

  const [index, setIndex] = React.useState(0);

  const _goToGallery = () => {
    navigation.navigate('PropertyDetailGallery');
  };

  const _renderItem = ({item}: {item: string}) => (
    <Pressable style={PropertyDetailStyles.carouselCard} onPress={_goToGallery}>
      <ImageIndicator source={item} style={PropertyDetailStyles.image} />
    </Pressable>
  );

  const _onSnapToItem = (index: number) => setIndex(index);

  return (
    <>
      <ButtonArrow
        onPress={goBack}
        containerStyle={PropertyDetailStyles.backButton}
      />
      <Carousel
        removeClippedSubviews
        /* @ts-ignore */
        ref={carouselRef}
        data={imageList}
        renderItem={_renderItem}
        sliderWidth={SLIDER_WIDTH}
        itemWidth={SLIDER_WIDTH}
        onSnapToItem={_onSnapToItem}
      />
      <Pagination
        dotsLength={imageList.length}
        activeDotIndex={index}
        containerStyle={PropertyDetailStyles.carouselPagination}
        dotContainerStyle={PropertyDetailStyles.carouselDotContainer}
        dotStyle={PropertyDetailStyles.carouselDot}
        dotColor={BLACK_COLOR}
        inactiveDotColor={FIFTH_GREY}
        inactiveDotScale={1}
        tappableDots={true}
        /* @ts-ignore */
        carouselRef={carouselRef}
      />
    </>
  );

Do you meet this issue? Is there any way to resolve it? Thank you.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:4
  • Comments:17

github_iconTop GitHub Comments

12reactions
wangzeshencommented, Jul 26, 2021

4.0.0-beta6

6reactions
AggravatedAstronomercommented, Aug 6, 2021

For anyone struggling with this, there is a . before the beta number. Without this, the install command will fail @fengjueji @geovrisco

npm i react-native-snap-carousel@4.0.0-beta.6

You can find this out for yourself by doing:

npm view react-native-snap-carousel and checking the dist-tags at the bottom.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can RecyclerView ItemTouchHelper lock swipe item?
Then, when you release you see the item starting from the middle again because the real dX you receive is still pointing to...
Read more >
Understanding swipe and drag gestures in RecyclerView
We initialized our ItemTouchHelper with an object of the same. It takes 2 parameters viz. dragDirs and swipeDirs . For the former, we...
Read more >
Gesture, swipe, and press to navigate your iPhone 13 and ...
Use gestures on your iPhone with Face ID to quickly navigate, multitask, adjust settings, and access all the things you do most.
Read more >
Android RecyclerView Swipe to Delete and Undo ... - YouTube
In this video I show you how to implement swipe to delete on a recyclerview, with an icon and background to indicated deletion...
Read more >
Use your Chromebook touchpad - Google Support
Here's how it works: ... To close it, swipe down with three fingers. ... the item you want to move. Drag the item...
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