Comments (2)
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.
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)
- Not able to mock this module for unit tests HOT 1
- Handle starting from a random point in the bidirectional-list HOT 3
- OnStartReached method is triggered frequently HOT 7
- Get `ref` not exist error in typescript
- How to display a small list at the top HOT 1
- Error on package? HOT 1
- Data page size must fill area in order for scroll, or events to work
- error with horizontal scroll using rnbis com.facebook.react.view.scroll.ReactHorizontalScrollView cannot be cast to com.facebook.react.views.scroll.ReactScrollView HOT 3
- TypeError: undefined is not a function HOT 3
- Maintained HOT 1
- Cannot build example project
- Sticky Header - Enhancement
- List jumps to the top of the List when onStartReached is called HOT 2
- Type Error: from onEndReached prop HOT 1
- DOES THIS LIB DEAD???
- Unable to install sub-dependency @stream-io/flat-list-mvcp with npm install
- ListHeaderComponent not working HOT 1
- onEndReached Not called every time HOT 2
- How to make the bottom activity loader to be evident
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-bidirectional-infinite-scroll.