How to customize look/feel of React Native ListView's RefreshControl

后端 未结 2 770
忘了有多久
忘了有多久 2020-12-14 18:00

React Native\'s ListView has a built-in pull-to-refresh control called RefreshControl. It\'s super easy to use.

I\'d like to customize the look and feel of the cont

2条回答
  •  佛祖请我去吃肉
    2020-12-14 18:44

    You can outsmart it by doing:

    • setting transparent properties to ListView
    • Adding component with absolute position

    Example:

    
      {/* custom refresh control */}
      
        
      
      {/* list view*/}
       console.log(e.nativeEvent)}
            // all properties must be transparent
            tintColor="transparent"
            colors={['transparent']}
            style={{backgroundColor: 'transparent'}}
            refreshing={this.state.refreshing}
            onRefresh={() => {
              this.setState({refreshing:true});
              setTimeout(() => {
                this._addRows()
              }, 2000);
            }}
            />
        }
        renderRow={(rowData) => {rowData}} />
    
    

    This is the result:

提交回复
热议问题