FlatList onViewableItemsChanged method does't trigger when first render?
See original GitHub issueReact Native version: +
Steps To Reproduce
When i used FlatList in Android, when i first entered the page, why onViewableItemsChanged method does’t trigger? Generally speaking, first render also means that the visibility of items have changed?
Describe what you expected to happen:
When first enter the page , onViewableItemsChanged method will trigger without scroll event !
My code just like this:
const VIEWABILITY_CONFIG = {
minimumViewTime: 300,
viewAreaCoveragePercentThreshold: 10,
waitForInteraction: false,
};
...
<FlatList
...
horizontal={false}
numColumns={2}
renderItem={({ item, index }) => this.renderItem(item, index)}
ItemSeparatorComponent={this.renderSeparator}
ListFooterComponent={this.footerView}
ListHeaderComponent={this.rederListHeader()}
onViewableItemsChanged={this._onViewableItemsChanged}
viewabilityConfig={VIEWABILITY_CONFIG} />
Please write soon, thanks !
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:13
Top Results From Across the Web
React Native "onViewableItemsChanged" not working while ...
Another thing that you should consider is that you should render the whole FlatList inside a View . here is my final code:...
Read more >Understand onViewableItemsChanged in FlatList - RY 's Blog
When you scroll a FlatList, the items showing on the FlatList change. Then, this function is called, telling you what current viewableItems are ......
Read more >Implementing a component visibility sensor with React Native
To solve this, we have to make sure that the function does not change after it is initially created; it needs to be...
Read more >How to avoid rendering non-changing items on React Native ...
After creating some sections with FlatList components to render a list of ... and clicking on an item to trigger its action took...
Read more >Display a List Using the FlatList Component in React Native
state.data will be updated by the fetch request, and it will trigger a re-rendering process in the FlatList ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I am facing the same issue, even though my
waitForInteractionis set to false Is there any progress or solution to this?The list renders as soon as i scroll even a bit. I tried using the scrollToOffset to simulate a scroll, didn’t work either.
Hope this helps
Few tips: