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.

Changing onViewableItemsChanged on the fly is not supported

See original GitHub issue

I’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:closed
  • Created 5 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

8reactions
jan-miksikcommented, Jan 11, 2020

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

7reactions
skurgansky-sugarcrmcommented, Dec 19, 2019

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

Read more comments on GitHub >

github_iconTop 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 >

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