FlatList ScrollView Error on any State Change - Invariant Violation: Changing onViewableItemsChanged on the fly is not supported

前端 未结 7 1582
北荒
北荒 2020-12-31 10:11

onViewableItemsChanged does not seem to work when there is a state change in the app. Is this correct?

Seems like it wouldn\'t be very useful if this

7条回答
  •  情歌与酒
    2020-12-31 10:31

    this works for me, is there any way to pass an additional argument to onViewRef? Like in the below code how can i pass type argument to onViewRef. Code:

            function getScrollItems(items, isPendingList, type) {
        return (
             index.toString()}
                showsHorizontalScrollIndicator={false}
                renderItem={({item, index}) => renderScrollItem(item, index, isPendingList, type)}
                viewabilityConfig={viewConfigRef.current}
                onViewableItemsChanged={onViewRef.current}
            />
        )
    }
    

提交回复
热议问题