File tree Expand file tree Collapse file tree 2 files changed +34
-25
lines changed
example/examples/src/routes Expand file tree Collapse file tree 2 files changed +34
-25
lines changed Original file line number Diff line number Diff line change 1
1
import React , { useRef , useState } from 'react' ;
2
2
import { SafeAreaView , Image , View , Text } from 'react-native' ;
3
- import { QuickList , List } from '@uiw/react-native' ;
3
+ import { QuickList , List , SwipeAction } from '@uiw/react-native' ;
4
4
import { ComProps } from '../../routes' ;
5
5
import Layout from '../../Layout' ;
6
6
const { Header} = Layout ;
@@ -62,26 +62,36 @@ const QuickListView = (props: ListViewProps) => {
62
62
63
63
const ListItem = ( item : any ) => {
64
64
return (
65
- < List flat = { false } >
66
- < View
67
- style = { {
68
- padding : 10 ,
69
- display : 'flex' ,
70
- alignItems : 'center' ,
71
- flexDirection : 'row' ,
72
- } } >
73
- < Image
74
- source = { {
75
- uri : item . img ,
76
- } }
77
- style = { { height : 70 , width : 70 , borderRadius : 50 } }
78
- />
79
- < View style = { { marginLeft : 10 } } >
80
- < Text style = { { marginBottom : 5 , fontSize : 18 } } > react-native</ Text >
81
- < Text style = { { color : '#808080' } } > { item . name } </ Text >
65
+ < SwipeAction
66
+ right = { [
67
+ {
68
+ text : '删除' ,
69
+ color : 'red' ,
70
+ x : 250 ,
71
+ onPress : ( ) => { } ,
72
+ } ,
73
+ ] } >
74
+ < List flat = { false } >
75
+ < View
76
+ style = { {
77
+ padding : 10 ,
78
+ display : 'flex' ,
79
+ alignItems : 'center' ,
80
+ flexDirection : 'row' ,
81
+ } } >
82
+ < Image
83
+ source = { {
84
+ uri : item . img ,
85
+ } }
86
+ style = { { height : 70 , width : 70 , borderRadius : 50 } }
87
+ />
88
+ < View style = { { marginLeft : 10 } } >
89
+ < Text style = { { marginBottom : 5 , fontSize : 18 } } > react-native</ Text >
90
+ < Text style = { { color : '#808080' } } > { item . name } </ Text >
91
+ </ View >
82
92
</ View >
83
- </ View >
84
- </ List >
93
+ </ List >
94
+ </ SwipeAction >
85
95
) ;
86
96
} ;
87
97
Original file line number Diff line number Diff line change @@ -38,7 +38,9 @@ export default class Index extends Component<IndexProps, IndexState> {
38
38
< Container keyboardShouldPersistTaps = "always" >
39
39
< Layout >
40
40
< Header title = { title } description = { description } />
41
- < Body keyboardShouldPersistTaps = "always" >
41
+ < Body
42
+ keyboardShouldPersistTaps = "always"
43
+ style = { { paddingHorizontal : 10 } } >
42
44
< View style = { styles . divider } />
43
45
< SearchInputBar
44
46
ref = { this . ref }
@@ -76,9 +78,6 @@ export default class Index extends Component<IndexProps, IndexState> {
76
78
Toast . info ( '你点击了搜一下' , 2 , 'info' ) ;
77
79
} ,
78
80
} }
79
- containerStyle = { {
80
- marginHorizontal : 10 ,
81
- } }
82
81
/>
83
82
</ Body >
84
83
< Footer />
@@ -100,6 +99,6 @@ const styles = StyleSheet.create({
100
99
search : {
101
100
justifyContent : 'center' ,
102
101
borderWidth : 0 ,
103
- paddingRight : 10 ,
102
+ paddingLeft : 10 ,
104
103
} ,
105
104
} ) ;
You can’t perform that action at this time.
0 commit comments