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

Question: is there a warmup time?

Open ACoolmanBigHealth opened this issue 7 years ago • 7 comments

question: sometimes .snapToItem(index) fails

I call this.carousel.snapToItem(index) within componentDidUpdate(). This sometimes works, but sometimes doesn't (to "fix" this I put the call in the setTimeout).

I was just wondering if there was a "warm up" time for the carousel (or the underlying Views).

And if so, how can I check that it is "ready".

Thanks

ACoolmanBigHealth avatar Feb 20 '19 18:02 ACoolmanBigHealth

I have same issue and it turns out that renderItem function in carousel is excuted after componentDidMount of parent component is excuted. I guess same thing would happen for the componentDidMount. I couldn't figure out how to avoid this issue except setTimeout yet

JonghunYu avatar Mar 14 '19 06:03 JonghunYu

I have the same issue, is there no better way around this?

baeteja avatar Apr 03 '19 12:04 baeteja

you should try using firstItem props:

<Carousel
  firstItem={2}
/>

wsliaw avatar Apr 22 '19 16:04 wsliaw

Yeah, I have the same issue. I don't really know why that is happening. Prob the is a race condition that make that strange behavior to happen.

fedu44 avatar Jun 27 '19 13:06 fedu44

I am also running into this problem. Has anyone managed to make progress?

kashi-halma avatar Jul 10 '19 21:07 kashi-halma

Struggling with this too, any help would be very much appreciated.

r-bman avatar Oct 10 '19 17:10 r-bman

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 05:10 dohooo