react native使用SwipeableFlatList组件实现类似QQ消息列表左滑出现操作按钮的效果

说明

使用的组件是SwipeableFlatList和FlatList实现的效果差不多,只是在列表上左滑出现了类似QQ消息列表的操作按钮,直接贴出列表代码。公用属性请看 这里

SwipeableFlatList组件特有属性说明

  1. renderQuickActions:function 返回element或组件,即左滑渲染出来的按钮。
  2. maxSwipeDistance:number 组件的宽度
  3. bounceFirstRowOnMount:Boolean 打开SwipeableFlatList列表页。列表的第一个元素默认会向左滑动一下以表示此列表有滑动效果,如果不想有此效果可以将值设置为false

示例代码

App.js

import React from 'react'
import {
   
   createStackNavigator,createAppContainer} from 'react-navigation'
import Home from './components/Home'
import ScrollViewList from './components/lists/ScrollViewList'
import FlatListPage from './components/lists/FlatListPage'
import SwipeableFlatList from './components/lists/SwipeableFlatList'

const StackNavigator = createStackNavigator(
    {
   
   
        Home:{
   
   
            screen: Home,
            navigationOptions:{
   
   
                title:"首页"
            }
        },
        SwipeableFlatList:{
   
   
            screen: SwipeableFlatList,
            navigationOptions:{
   
   
                title:"SwipeableFlatList"
            }
        }
    },
    {
   
   
        headerLayoutPreset:"center"
    }
)

const AppContainer = createAppContainer(StackNavigator)
export default AppContainer

Home.js

import React from 'react'
import {
   
   View,Button,StyleSheet} from 'react-native'
export default class Home extends React.Component{
   
   
    render(){
   
   
        return(
            <View>
                <View style={
   
   style.button}>
                    
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值