diff --git a/Libraries/Lists/FlatList.js b/Libraries/Lists/FlatList.js index 9b145cdbd4b5bc..efa374e32cf491 100644 --- a/Libraries/Lists/FlatList.js +++ b/Libraries/Lists/FlatList.js @@ -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 extends React.PureComponent, 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, + areEqual( + nextProps.viewabilityConfigCallbackPairs, + this.props.viewabilityConfigCallbackPairs + ), 'Changing viewabilityConfigCallbackPairs on the fly is not supported', );