Git Product home page Git Product logo

Comments (2)

pierroo avatar pierroo commented on June 10, 2024

Facing the same issue @borasumer , did you manage to find a fix for it?
Basically from a chat app that fetches remote messages, then messages are added to the flatlist which triggers a scrollToEnd event, but at the start of the event we are at the top of the flatlist which triggers the onStartReached automatically (which we don't want, for obvious reasons)

I tried to add a state variable that gets activated and allows the triggered function under onStartReached to only work if this variable is true (after the list is initially mounted), however that also means it returns nothing at first which breaks the onStartReached function (if it ever returns nothing it assumes there is nothing left to return in the future either, which makes sense in a normal scenario)

EDIT: It's probably not ideal, but I "fixed" it by setting "onStartReachedThreshold" to 1.
I would rather have it as 10 for a better UX, but then it gets caught on initial load of chat messages which we try to avoid here so... compromise until the team looks into it? (@vishalnarkhede )

from react-native-bidirectional-infinite-scroll.

sumit-do-it avatar sumit-do-it commented on June 10, 2024

I find out that onStartReached is now added in the FlatList Props and this module is passing all the props, we are passing, to the Flatlist in its implementation. Due to this, it is getting invoked initially by Flatlist. For now, I'm using it by overriding the prop onStartReached={null} and added the patch.
Let me know, if there would be any better alternative and gives thumbs up, if it works for you!

from react-native-bidirectional-infinite-scroll.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.