2016-12-05 26 views
0

說明錯誤拉刷新的ListView顯示爲Android

當我使用refreshControl與列表視圖,標題顯示在錯誤位置,如PIC: enter image description here

紅色區域是拉刷新頭,但示出了通過列表視圖不是listerview的標題。 當listview渲染所有的數據源,然後拉刷新UI可能是正常的,只是當listview不呈現所有的數據源拉來刷新UI顯示爲上面的圖片。

拉動用本機UI組件 刷新UI參考,但與ScrollView相同的刷新控制沒有這樣的問題。

其他信息

陣營原生版本:[0.33] 平臺:[Android]產品

回答

0

@舒文頡

<ListView 
        initialListSize={5} 
        pageSize={10} 
        showsVerticalScrollIndicator={false} 
        dataSource={data} 
        renderRow={this._renderRow.bind(this)} 
        onEndReached={this._onEndReached.bind(this)} 
        onEndReachedThreshold={10} 
        enableEmptySections={true} 
        onScroll={this._onScroll.bind(this)} 
        renderFooter={this._renderFooter.bind(this)} 
        ref={ (listView) => {this.listView = listView;} } 
        refreshing={this.props.articleListRedecuer.isRefreshing} 
        onRefresh={() => this._onRefresh()} 
        renderScrollComponent={(props) => (<ScrollView {...props} />)} 
1

我建議你使用refreshControl屬性

<ListView 
 
     dataSource={this.state.dataSource.cloneWithRows(data)} 
 
     renderRow={this.renderItems.bind(this)} 
 
     renderFooter={this.renderFooter.bind(this)} 
 
     onEndReached={() => this._onEndReached()} 
 
     onEndReachedThreshold={10} 
 
     onScroll={() => this._onScroll()} 
 
     refreshControl={ 
 
      <RefreshControl 
 
      style={{ backgroundColor: 'transparent' }} 
 
      refreshing={goods.isRefreshing} 
 
      onRefresh={() => this._onRefresh()} 
 
      title="Loading..." 
 
      colors={['#ffaa66cc', '#ff00ddff', '#ffffbb33', '#ffff4444']} 
 
      /> 
 
     } 
 
     />

+0

是的,我已經使用renderScrollComponent = {(道具)=>(),而不是refreshControl.Because我需要更改deftut頭的pulltorefresh listview header.with相同的refreshControl,滾動視圖會很好。 –