说明
使用的组件是SwipeableFlatList和FlatList实现的效果差不多,只是在列表上左滑出现了类似QQ消息列表的操作按钮,直接贴出列表代码。公用属性请看 这里
SwipeableFlatList组件特有属性说明
- renderQuickActions:
function
返回element或组件,即左滑渲染出来的按钮。 - maxSwipeDistance:
number
组件的宽度 - 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}>