-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bugfix][FlatList] Objects as props trigger invariant errors #16776
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ const View = require('View'); | |
const VirtualizedList = require('VirtualizedList'); | ||
|
||
const invariant = require('fbjs/lib/invariant'); | ||
const areEqual = require('fbjs/lib/areEqual'); | ||
|
||
import type {StyleObj} from 'StyleSheetTypes'; | ||
import type { | ||
|
@@ -419,16 +420,21 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> { | |
'changing the number of columns to force a fresh render of the component.', | ||
); | ||
invariant( | ||
nextProps.onViewableItemsChanged === this.props.onViewableItemsChanged, | ||
areEqual( | ||
nextProps.onViewableItemsChanged, | ||
this.props.onViewableItemsChanged | ||
), | ||
'Changing onViewableItemsChanged on the fly is not supported', | ||
); | ||
invariant( | ||
nextProps.viewabilityConfig === this.props.viewabilityConfig, | ||
areEqual(nextProps.viewabilityConfig, this.props.viewabilityConfig), | ||
'Changing viewabilityConfig on the fly is not supported', | ||
); | ||
invariant( | ||
nextProps.viewabilityConfigCallbackPairs === | ||
this.props.viewabilityConfigCallbackPairs, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. prettier/prettier: Replace There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is it pointing to the prev version of the diff? |
||
areEqual( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no-trailing-spaces: Trailing spaces not allowed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. prettier/prettier: Delete There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ??? |
||
nextProps.viewabilityConfigCallbackPairs, | ||
this.props.viewabilityConfigCallbackPairs | ||
), | ||
'Changing viewabilityConfigCallbackPairs on the fly is not supported', | ||
); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prettier/prettier: Replace
nextProps.onViewableItemsChanged,·this.props.onViewableItemsChanged
with⏎········nextProps.onViewableItemsChanged,⏎········this.props.onViewableItemsChanged,⏎······
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
???