onSnapToItem never gets called
See original GitHub issueUsing “react-native-snap-carousel”: “3.7.5” Testing on iOS
Here is my code
<Carousel
ref={(c) => { this._carousel = c; }}
vertical={true}
data={["1", "2", "3", "4", "5", "6", "7", "8"]}
renderItem={({ item, index }) =>
<TouchableOpacity
style={{ flex: 1, backgroundColor: "transparent" }}
onPress={() => { this._carousel.snapToItem(index) }}>
<Text
style={{
height: 30,
textAlignVertical: 'center',
flex: 1,
textAlign: 'center',
fontSize: 16
}} key={"money" + item}>{item}</Text>
</TouchableOpacity>
}
onSnapToItem={(index) => {
console.log("Moved to=====> " + index)
alert(index)
}}
inactiveSlideOpacity={0.4}
inactiveSlideScale={0.9}
enableSnap={true}
removeClippedSubviews={false}
autoplay={false}
sliderHeight={80}
sliderWidth={90}
itemHeight={30}
itemWidth={90}
/>
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:9
Top Results From Across the Web
onSnapToItem never gets called · Issue #541 - GitHub
I am facing something similar in Desktop, but the difference is that on Android works OK. I have not tested on iOS yet....
Read more >Recording user interactions in React Native / Snap Carousel
onSnapToItem is triggered everytime I change from one slide to another. ... Hmm hard to say but if you have an async/await call...
Read more >React Native carousel with react-native-snap-carousel
Create a carousel in a React Native mobile application with a Tinder-style swipe animation using the react-native-snap-carousel package.
Read more >snap-carousel-onSnapToItem - Expo Snack
snap-carousel-onSnapToItem. No description. Open with Expo Go. Open in editor. Need Expo? Don't have the Expo Go? Download the app to try this...
Read more >react-native-snap-carousel takes a lot of time to render photos
... sliderWidth={sliderWidth} itemWidth={itemWidth} activeSlideAlignment={'center'} onSnapToItem={index => setActiveSlide(index)} />).
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
@cesar3030 I was facing this issue while I scroll fast on Android. I resolved it by adding
Here is my final code
Hi folks, Seems very cosmetic bug. Setting
activeSlideOffset={2}
solved my issue