Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useAnimatedScrollHandler with refreshControl not working #5972

Open
SumitSharmaJii opened this issue May 3, 2024 · 3 comments
Open

useAnimatedScrollHandler with refreshControl not working #5972

SumitSharmaJii opened this issue May 3, 2024 · 3 comments
Labels
Platform: Android This issue is specific to Android Repro provided A reproduction with a snippet of code, snack or repo is provided

Comments

@SumitSharmaJii
Copy link

SumitSharmaJii commented May 3, 2024

Description

useAnimatedScrollHandler is not working on Android with RefreshControl similar to #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

@github-actions github-actions bot added Repro provided A reproduction with a snippet of code, snack or repo is provided Platform: Android This issue is specific to Android labels May 3, 2024
@Santhosh-Umapathi-Beautyze
Copy link

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
      />

@bogdanovic91
Copy link

bogdanovic91 commented May 13, 2024

same issue here on Android

@Ravnravn
Copy link

This patch fixes the issue on 3.11.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: Android This issue is specific to Android Repro provided A reproduction with a snippet of code, snack or repo is provided
Projects
None yet
Development

No branches or pull requests

4 participants