X Tutup
Skip to content

listView

brainpoint edited this page Mar 2, 2017 · 1 revision

Example


'use strict';
import React, { Component } from 'react';
import { AppRegistry, StyleSheet, } from 'react-native';
import { RefreshListView, RefreshScrollView } from 'react-componet'

class app extends Component {
  render() {
    return (
      <ListView
        dataSource={ds}
        renderHeader={this.renderHeader}
        renderRow={(rowData) =>
          <ProductCell url={rowData.url} desc={rowData.desc} price={rowData.price} price_v={rowData.price_v} stock={utils_string.format_number(rowData.stock)} price_src={rowData.price_src}/>
        }

        onPulling={(resolve)=>resolve()} 
        onPullOk={(resolve)=>resolve()} 
        onPullRelease={(resolve)=>resolve()} 
        topIndicatorRender={(pulling, pullok, pullrelease) =>
            <View style={{flex: 1, flexDirection: 'row', justifyContent: 'center', alignItems: 'center', height: 60}}>
              <ActivityIndicator size="small" color="gray" />
              {pulling ? <Text>下拉刷新pulling...</Text> : null}
              {pullok ? <Text>松开刷新pullok......</Text> : null}
              {pullrelease ? <Text>玩命刷新中pullrelease......</Text> : null}
            </View> 
        } 
        topIndicatorHeight={60}
      />
    );
  }
}

Props.


onPulling: function(resolve) {} // resolve: function(){}

当下拉时的处理函数.

onPullOk: function(resolve) {} // resolve: function(){}

当下拉完成时的处理函数.

onPullRelease: function(resolve) {} // resolve: function(){}

当释放时的处理函数. 调用resolve() 之后将完成更新.

topIndicatorRender: function(pulling, pullok, pullrelease) {}

自定义提示内容

topIndicatorHeight: number

自定义提示内容的高度.

Method.


scrollToTop()

移到顶部

scrollToBottom()

移到底部

Clone this wiki locally

X Tutup