meliorence / react-native-snap-carousel

Swiper/carousel component for React Native featuring previews, multiple layouts, parallax images, performant handling of huge numbers of items, and more. Compatible with Android & iOS.
BSD 3-Clause "New" or "Revised" License
10.37k stars 2.29k forks source link

useScrollView - Warning: Function components cannot be given refs. #878

Open Aryk opened 3 years ago

Aryk commented 3 years ago

Issue is here:

https://github.com/meliorence/react-native-snap-carousel/blob/master/src/carousel/Carousel.js#L1357

Change to:

typeof(useScrollView) === 'object' || typeof(useScrollView) === 'function' ? useScrollView : AnimatedScrollView

Any component will be an object so we need to handle that case as well.

dohooo commented 3 years ago

@Aryk 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