FlatList android 滑动 报错



  • ![alt text](![image url](0_1508826575143_屏幕快照 2017-10-24 14.29.09.png)



  • onMomentumScrollEnd=
    {
    (flatList)=>{
    var page=flatList.nativeEvent.contentOffset.x/ITEM_WIDTH;
    if (page>=0&&page<this.state.dataSource.length) {
    this._barList.scrollToIndex({viewPosition:0.5,index:page});
    if (page!=this.state.currentPage) {
    var array=this.state.selected;
    array[this.state.currentPage].isSelected=false;
    array[page].isSelected=true;
    this.setState({selected:this.state.selected.copyWithin(array),currentPage:page});
    }
    }
    }
    }