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

useAnimatedScrollHandler with refreshControl not working

Open SumitSharmaJii opened this issue 9 months ago • 3 comments

Description

useAnimatedScrollHandler is not working on Android with RefreshControl similar to https://github.com/software-mansion/react-native-reanimated/issues/3937

Steps to reproduce

<Animated.ScrollView 
    onScroll={scrollHandler}
    refreshControl={<RefreshControl refreshing={refreshing} onRefresh={onRefresh} />
}> {children}  </Animated.ScrollView>

Snack or a link to a repository

https://snack.expo.dev/OAXfUmXwP1DilS_uErLED

Reanimated version

3.10.0

React Native version

0.74.1

Platforms

Android

JavaScript runtime

None

Workflow

None

Architecture

None

Build type

None

Device

None

Device model

No response

Acknowledgements

Yes

SumitSharmaJii avatar May 03 '24 18:05 SumitSharmaJii

Same issue on Android

Reanimated version 3.11.0

Does not even gets called.

  const onScroll = useAnimatedScrollHandler({
    onScroll: event => {
      const currentOffset = event.contentOffset.y;
      //Scroll not outside of top bounds
      if (currentOffset > 0) {
        isScrollingUp.value = scrollY.value > currentOffset;
        scrollY.value = currentOffset;

        isAtBottom.value =
          currentOffset >=
          event.contentSize.height - event.layoutMeasurement.height;
      }
    },
  });
<Animated.FlatList
        ListEmptyComponent={ListEmptyComponent}
        ListHeaderComponent={<HomeHeader navigation={navigation} />}
        ListFooterComponent={<HomeFooter />}
        ref={flatListRef}
        contentContainerStyle={styles.contentContainer}
        showsVerticalScrollIndicator={false}
        onScroll={onScroll}
        onEndReached={hasMore ? onNextPage : null}
        onEndReachedThreshold={2}
        onRefresh={onRefresh}
        refreshing={false}
        scrollEventThrottle={16}
        data={data}
        keyExtractor={(item, index) => `${item.id}-${index}`}
        renderItem={renderItem}
        initialNumToRender={5}
        removeClippedSubviews
      />

same issue here on Android

bogdanovic91 avatar May 13 '24 14:05 bogdanovic91

This patch fixes the issue on 3.11.0

Ravnravn avatar May 13 '24 14:05 Ravnravn

Hello everyone, the patch @Ravnravn mentioned is already included in 3.12 version - please upgrade Reanimated and it should be gone 👍

szydlovsky avatar Jun 06 '24 17:06 szydlovsky