question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FlatList onEndReached not working if onScroll is set in renderScrollComponent

See original GitHub issue
  <FlatList
    onEndReached={() => {
      console.log("reached");
    }}
    renderScrollComponent={props => {
      return (
        <Animated.ScrollView
          {...props}
          onScroll={Animated.event(
            [{ nativeEvent: { contentOffset: { y: value } } }],
            { useNativeDriver: true }
          )}
        />
      );
    }}
  />;

I did get the value update. However, onEndReached is never called.

Any idea how to get the value update and not breaking onEndReached?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

6reactions
jvasquez864commented, Aug 2, 2020

@CallMeHeisenberg @jkadamczyk I also managed to work around this by memoizing the animated flatlist

    const AnimatedFlatList = useMemo(
      () => Animated.createAnimatedComponent(FlatList),
      [],
    );

Not sure if this is the right approach, but it got me working since the other suggestions above didn’t seem to work.

2reactions
yilinjuangcommented, Feb 21, 2020

Yes it does! thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

ReactNative Flatlist onEndReached not working
In my case the problem was with nativebase <Content> . It was creating problems when <FlatList> was used inside it. Solution :
Read more >
FlatList - React Native
A performant interface for rendering basic, flat lists, supporting the most handy features:
Read more >
scrolleventthrottle flatlist - You.com | The search engine you control.
To render multiple columns, use the numColumns prop. Using this approach instead of a flexWrap layout can prevent conflicts with the item height...
Read more >
Usage | FlashList
If you are familiar with FlatList, you already know how to use ... This can sometimes cause issues when used with initialScrollIndex in ......
Read more >
Unable to render data to ReactNative FlatList on Scroll down ...
I am using FlatList's onEndReached prop to get new items on scroll. ... Http GET requests, but when I use Http POST method...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found