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

When swiping item, they stop in the middle

Open trilam1409 opened this issue 2 years ago • 18 comments

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.

trilam1409 avatar Jul 22 '21 07:07 trilam1409

4.0.0-beta6

wangzeshen avatar Jul 26 '21 06:07 wangzeshen

Upgrading to '4.0.0-beta6' worked perfectly for me!

AndreBovolini avatar Jul 29 '21 19:07 AndreBovolini

@wangzeshen @AndreBovolini how to upgrade? mine still on "react-native-snap-carousel": "^3.9.1",

geovrisco avatar Aug 05 '21 03:08 geovrisco

@geovrisco you can choose the version you want like that:

yarn add [email protected]

AndreBovolini avatar Aug 05 '21 11:08 AndreBovolini

@geovrisco you can choose the version you want like that:

yarn add [email protected]

Hi,I have the same issues, but I can't find [email protected] in npm or yarn

fengjueji avatar Aug 06 '21 07:08 fengjueji

npm i [email protected]

you can just install it like that

geovrisco avatar Aug 06 '21 10:08 geovrisco

@AndreBovolini thanks btw,

geovrisco avatar Aug 06 '21 10:08 geovrisco

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

npm i [email protected]

You can find this out for yourself by doing:

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

AggravatedAstronomer avatar Aug 06 '21 14:08 AggravatedAstronomer

Funny enough npm i didn't work. I used npm install and it worked.

ringcoa avatar Aug 18 '21 04:08 ringcoa

enableMomentum fix this issue (RNSC 3.6v.)

Navipro70 avatar Sep 14 '21 14:09 Navipro70

In [email protected] "enableMomentum" prop is removed. so if you want to stop momentum you have to use disableIntervalMomentum: true Read More

hamzasajid1995 avatar Sep 15 '21 12:09 hamzasajid1995

@hamzasajid1995 - do we set disableIntervalMomentum as a prop right on the <Carousel> component? It doesn't appear in the typings...

princefishthrower avatar Sep 20 '21 16:09 princefishthrower

4.0.0-beta.6 fixed the issue for me.

jbolter avatar Sep 24 '21 21:09 jbolter

@trilam1409 Sorry, please allow me to advertise for my open source library! ~ I think this library react-native-reanimated-carousel will solve your problem. It is a high performance and very simple component, complete with React-Native reanimated 2

dohooo avatar Oct 08 '21 04:10 dohooo

@hamzasajid1995 - do we set disableIntervalMomentum as a prop right on the component? It doesn't appear in the typings...

试试: yarn add [email protected]

MrJYJ avatar Nov 25 '21 05:11 MrJYJ

Anyone know what changes make it correct?

jordan2816 avatar Jan 25 '22 02:01 jordan2816

Any Solution for the above issue?

NensiKasundra avatar May 09 '22 10:05 NensiKasundra

Upgrading to '4.0.0-beta6' worked perfectly for me!

Works perfectly

ganesh-oracle avatar Dec 18 '23 16:12 ganesh-oracle