SwipeableFlatList

SwipeableFlatList

具有侧滑效果的FlatList

react native 官方提交15de8d1

#props

renderQuickActions?: ?(rowdata, sectionID, rowID) => ? React.Element<any>

用于创建侧滑菜单

maxSwipeDistance?: ?PropTypes.number\PropTypes.func

设置最大滑动距离

bounceFirstRowOnMount?: boolean

默认值flase,为true时第一行先向左滑动,再向右滑动。

_onClose() — (Function) — Reference method that close QuickActions if any.

关闭quickAction面板 this.swipeableList._onClose()

其余属性参考FlatList

详细信息可查看链接

#实例

        <SwipeableFlatList
          //数据源
          data={this.state.dataArray}
          // 每个item的View
          renderItem={data => this._renderItem(data)}
          // refreshing={this.state.isLoading}
          // onRefresh={this.loadData}
          // 下拉刷新
          refreshControl={
            <RefreshControl
              title={"Loading"} //ios
              colors={["red"]}
              size={5}
              refreshing={this.state.isLoading}
              onRefresh={() => this.loadData(true)}
            />
          }
          // 上拉加载
          ListFooterComponent={this.getIndicator}
          onEndReached={() => this.loadData()}
          //侧滑菜单
          renderQuickActions={this.getQuickAction} //侧滑展示的View
          maxSwipeDistance={60} //侧滑最大距离
          bounceFirstRowOnMount={false}
        />
getQuickAction = () => {
    return(
      <View style={styles.quickContainer}>
        <TouchableHighlight
          onPress={() => alert("确认删除?")}
        >
          <View style={styles.quick}>
            <Text style={styles.text}>删除</Text>
          </View>
        </TouchableHighlight>
      </View>
    )
  }
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值