meliorence / meliorence/react-native-snap-carousel
When swiping item, they stop in the middle
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.5k
- Forks
- 2.3k
- PR merge metrics
- No merged PRs in 30d
Description
Hello everyone,
There are some issues on some Android devices. Slider can't move full next one.
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Carousel configuration shown in the issue and reproduce the incomplete swipe on an Android device. Trace the carousel's swipe and snap behavior; done means each swipe advances fully to the next item rather than stopping between items.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react-native
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100