Skip to content

Commit 203a82e

Browse files
mrochfacebook-github-bot
authored andcommitted
fix flow suppression in VirtualizedList
Summary: flow 0.146 became more conservative about refinement invalidation, no longer accepting that `this.props.onViewableItemsChanged` is truthy. this was suppressed at the time. instead, we can assign to a const to restore typechecking. Changelog: [Internal] Reviewed By: motiz88 Differential Revision: D33743126 fbshipit-source-id: 0b1f0b83c2fe812e88b027c3b1d3d8aca7b09277
1 parent 851e87a commit 203a82e

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Libraries/Lists/VirtualizedList.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -703,12 +703,14 @@ class VirtualizedList extends React.PureComponent<Props, State> {
703703
onViewableItemsChanged: pair.onViewableItemsChanged,
704704
}),
705705
);
706-
} else if (this.props.onViewableItemsChanged) {
707-
this._viewabilityTuples.push({
708-
viewabilityHelper: new ViewabilityHelper(this.props.viewabilityConfig),
709-
// $FlowFixMe[incompatible-call]
710-
onViewableItemsChanged: this.props.onViewableItemsChanged,
711-
});
706+
} else {
707+
const {onViewableItemsChanged, viewabilityConfig} = this.props;
708+
if (onViewableItemsChanged) {
709+
this._viewabilityTuples.push({
710+
viewabilityHelper: new ViewabilityHelper(viewabilityConfig),
711+
onViewableItemsChanged: onViewableItemsChanged,
712+
});
713+
}
712714
}
713715

714716
let initialState = {

0 commit comments

Comments
 (0)