Changing onViewableItemsChanged on the fly is not supported
See original GitHub issueI’m testing the example on the readme, this is what I get:
Changing onViewableItemsChanged on the fly is not supported https://imgur.com/a/02qPbCE
I see that the line
// REQUIRED for ReactNativePagination to work correctly
onViewableItemsChanged = ({ viewableItems, changed }) =>
this.setState({ viewableItems });
Tells that this is crucial but how if it breaks everything? Did something change in newer versions?
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Changing onViewableItemsChanged on the fly is not supported
As soon as It renders, I got the onViewableItemsChanged on the fly is not supported, the only way I found to deal with...
Read more >react native - FlatList ScrollView Error on any State Change
The error "Changing onViewableItemsChanged on the fly is not supported" occurs because when you update the state, you are creating a new ...
Read more >Changing onViewableItems on the fly is not supported - Reddit
Hi everybody, I want to use onViewableItemsChanged prop on FlatList to check if last item on FlatList is viewable on the screen but...
Read more >changing onviewableitemschanged on the fly is not supported
Changing onViewableItemsChanged on the fly is not supported ; 1. onst onViewRef = React.useRef((viewableItems)=> { ; 2. console.log(viewableItems) ; 3. // Use ...
Read more >React-native – FlatList ScrollView Error on any State Change ...
React-native – FlatList ScrollView Error on any State Change – Invariant Violation: Changing onViewableItemsChanged on the fly is not supported.
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
For me worked this https://stackoverflow.com/questions/48045696/flatlist-scrollview-error-on-any-state-change-invariant-violation-changing-on/57502343#_=_ In short it is about useRef hook for onViewableItemsChanged and viewabilityConfig
what should i do if i intend to render FlatList in function component with hooks ? I can’t have methods or bind there… and i can’t useCallback because my onViewableItemsChanged depends on state values