2016-12-05 27 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,滚动视图会很好。 –