react-native-reanimated: [3.9.0] useAnimatedScrollHandler does not fire events from FlashList onScroll

Description

Events are not being captured by useAnimatedScrollHandler from FlashList@1.6.4 onScroll prop at least on react-native@0.73.7 on Paper.

Steps to reproduce

  1. Install 3.9.0
  2. Add onScroll handler on an Animated FlashList
  3. useAnimatedScrollHandler won’t listen to events

By replacing FlashList with FlatList works with no issues.

Let me know if you need a repro, I guess you already got FlashList setup/tests on your setups.

Snack or a link to a repository

nope

Reanimated version

3.9.0

React Native version

0.73.7

Platforms

Android, iOS

JavaScript runtime

Hermes

Workflow

React Native

Architecture

Paper (Old Architecture)

Build type

Debug app & dev bundle

Device

iOS simulator

Device model

No response

Acknowledgements

Yes

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 8
  • Comments: 22 (11 by maintainers)

Most upvoted comments

Hi everyone! We have identified the issue and can tell where the problem lies - but the potential fix has brought up many more questions than we thought and we are currently discussing what to do. Stay tuned ™️

@szydlovsky after applying patch 3.11.0 life got back to normal 😅. Thank you!

Hey everyone! As the fix got merged it should be available in the next nightly build at around 2AM CEST time - see npm page. It will also be there in the next stable version/patched version.

I also experience this issue in the latest version (3.11.0)

Here is patch created from @szydlovsky PR. Can be used with patch-package:

react-native-reanimated+3.10.0.patch

Same issue here. useAnimatedScrollHandler is not firing when using

const AnimatedFlashList = Animated.createAnimatedComponent(FlashList)

Unfortunately useAnimatedScrollHandler doesn’t seem to be firing for me with 3.11.0. I downgraded to 3.8.1 and it works. Would appreicate any assistance getting this to work.

const AnimatedFlashList = Animated.createAnimatedComponent(FlashList);
  const translationY = useSharedValue(0);
  const animatedHeaderStyle = useAnimatedStyle(() => {
    return {
      opacity: interpolate(translationY.value, [0, 100], [1, 0]),
    };
  });

const scrollHandler = useAnimatedScrollHandler(event => {
  translationY.value = event.contentOffset.y;
});

Standard stuff right?

@efstathiosntonas That’s a relief 😅

let me give it a shot. I used the 3.10.0, I missed the 3.11.0 one.

@efstathiosntonas Hi! Which patch did you use? This one is imperfect and I’d rather suggest latest nightly version - there was some stuff missing in the patch.

@ElSeniorMikael no - the release 3.10.0 had a different purpose: https://github.com/software-mansion/react-native-reanimated/pull/5963#issuecomment-2088155015. The PR with fix will probably be reviewed next week. Until then you can install Reanimated the way I mentioned above.