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

Some kind of onScroll prop needed

Open yahacom opened this issue 3 years ago • 0 comments

I want to have possibility to control some another custom animations related to translate position of Carousel scroll. For example in ScrollList/FlatList we have onScroll prop that pass NativeScrollEvent to callback. It's can be used with useAnimatedScrollHandler from reanimated v2.

const translateX = useSharedValue(0);
const scrollHandler = useAnimatedScrollHandler((event) => {
  translateX.value = event.contentOffset.x;
});

<Animated.ScrollView onScroll={scrollHandler}>{...}</Animated.ScrollView>

As I see most closest variable in your Carousel is handlerOffsetX that also is Animated SharedValue. So, I'll try to play with it, but probably you can suggest another way to get position on scrolling.

yahacom avatar Jul 28 '22 09:07 yahacom

try this image image

dohooo avatar Aug 12 '22 04:08 dohooo

I'll reopen this issue If you have any other questions.

dohooo avatar Aug 18 '22 06:08 dohooo