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

前端 未结 7 1634
北荒
北荒 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:25

    Move the viewabilityConfig object to the constructor.

    constructor() {
        this.viewabilityConfig = {
            viewAreaCoveragePercentThreshold: 50
        };
    }
    
    render() {
         return(
            console.log(info)}
                viewabilityConfig={this.viewabilityConfig}
                renderItem={({item}) =>
                    
                        Dogs and Cats
                    
                }
            />
        )
    }
    

提交回复
热议问题