Stop scrolling in react-native-snap-carousel when end item is reached

15 Views Asked by At

below is my code to display a carousel. I want to stop scrolling further to the right as soon as the last item is reached. Currently, the last item can be scrolled to left most side and I am seeing empty white space in the right.

const CARD_MARGIN = 2;
const SLIDER_WIDTH = Dimensions.get('window').width + CARD_MARGIN - 32;
const ITEM_WIDTH = CARD_WIDTH + horizontalMargin * 2;

<Carousel
        data={carouselList}
        renderItem={renderItem}
        activeSlideAlignment = 'start'
        sliderWidth={SLIDER_WIDTH}
        itemWidth={ITEM_WIDTH}
        inactiveSlideScale={1}
        inactiveSlideOpacity={1}
        scrollEnabled={true}
        enableSnap={false}
        useScrollView={true}
/>

Any help would be appreciated

0

There are 0 best solutions below