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
This commit is contained in:
Marshall Roch authored and Facebook GitHub Bot committed 2022-01-25 15:23:47 -08:00
1 parent 851e87a1a6
commit 203a82e90a
1 file changed
+8 -6
+8 -6
View File
@@ -703,12 +703,14 @@ class VirtualizedList extends React.PureComponent<Props, State> {
onViewableItemsChanged: pair.onViewableItemsChanged,
}),
);
} else if (this.props.onViewableItemsChanged) {
this._viewabilityTuples.push({
viewabilityHelper: new ViewabilityHelper(this.props.viewabilityConfig),
// $FlowFixMe[incompatible-call]
onViewableItemsChanged: this.props.onViewableItemsChanged,
});
} else {
const {onViewableItemsChanged, viewabilityConfig} = this.props;
if (onViewableItemsChanged) {
this._viewabilityTuples.push({
viewabilityHelper: new ViewabilityHelper(viewabilityConfig),
onViewableItemsChanged: onViewableItemsChanged,
});
}
}
let initialState = {