mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
VirtualizedSectionList: Fix flow error about this.props.onViewableItemsChanged being null
Summary: Flow complains that the function could be null or undefined even after checking that because this._convertviewable is called first and could potentially muck with the type. Here is an example in try flow: https://flow.org/try/#0CYUwxgNghgTiAEA3W8AeAueBvAZpg-ABSEB2ArgLYBGIMAlPALwB8SA9gJbB0C+A3ACgcZEmAAuHNiXg5CdTOWq1s8OGLIxpAZh4CBHHPEKoAdIYCEjeOQgQGWAfDRnCsunUE8gA Changelog: [Internal] Reviewed By: jbrown215 Differential Revision: D17863358 fbshipit-source-id: 7689819de4c15f22e427cf5af520566bcea17bbc
This commit is contained in:
committed by
Facebook Github Bot
parent
ce3628e9d8
commit
bd70cbf042
@@ -341,8 +341,9 @@ class VirtualizedSectionList<
|
||||
viewableItems: Array<ViewToken>,
|
||||
changed: Array<ViewToken>,
|
||||
}) => {
|
||||
if (this.props.onViewableItemsChanged) {
|
||||
this.props.onViewableItemsChanged({
|
||||
const onViewableItemsChanged = this.props.onViewableItemsChanged;
|
||||
if (onViewableItemsChanged != null) {
|
||||
onViewableItemsChanged({
|
||||
viewableItems: viewableItems
|
||||
.map(this._convertViewable, this)
|
||||
.filter(Boolean),
|
||||
|
||||
Reference in New Issue
Block a user