Tapping/Clicking last item causes carousel to snap back to second last item
See original GitHub issueI have TouchableOpacity child Items within the Carousel component - where the onPress on the TouchableOpacity items work fine.
However, when tapping/clicking on the last item, it will cause the carousel to snap back to the second last item.
Has anyone else experienced the same issue?
// Example
render() {
const slides = this.props.items.map((entry, index) => {
return (
<TouchableOpacity
onPress={() => { this.props.onPress() }}
key={`entry-${index}`}
>
<View>
<Image
style={styles.imageContainer}
source={entry.illustration}
/>
</View>
</TouchableOpacity>
);
});
return(
<Carousel
{...this.props}
ref={(carousel) => { this._carousel = carousel; }}
showsHorizontalScrollIndicator={false}
snapOnAndroid={true}
removeClippedSubviews={false}
sliderWidth={sliderWidth}
itemWidth={itemWidth}
slideStyle = {0}
onSnapToItem = {(index) => { this.props.onSnapToItem() }}
>
{ slides }
</Carousel>
)
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
Input inside Carousel Item causes jump back to ... - GitHub
Carousel should move to the next item smoothly. Actual Behavior. Often, the carousel snaps back to the previous item and the <TextInput> gains ......
Read more >React Native Snap Carousel - First Item - Stack Overflow
Currently when the carousel loads it loads the first index instead of the one I tell it to with FirstItem. When I refresh...
Read more >react-native-snap-carousel - npm
Swiper/carousel component for React Native with previews, multiple layouts, parallax images, performant handling of huge numbers of items, ...
Read more >react-native-snap-carousel/CHANGELOG.md - UNPKG
147, * Fix issue with padding on iOS that could cause the carousel to snap back when its last item was clicked. 148....
Read more >React Native carousel with react-native-snap-carousel
Editor's note: This article was last updated 27 April 2022 to reflect ... reasons; onSnapToItem : Snaps to a carousel item programmatically ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok, seems like a top priority 😃 I’ll try to reproduce and fix it shortly.
@XavierColombel I know since I’d like to use it myself 😉 We’re still working on it but it’s really complicated and we didn’t have enough time to tackle it recently. Stay tuned though!