Skip to content

Commit 89f3778

Browse files
committed
fix:update quicklist & searchinputbar example
1 parent 4301f98 commit 89f3778

File tree

2 files changed

+34
-25
lines changed

2 files changed

+34
-25
lines changed

example/examples/src/routes/QuickList/index.tsx

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, {useRef, useState} from 'react';
22
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';
44
import {ComProps} from '../../routes';
55
import Layout from '../../Layout';
66
const {Header} = Layout;
@@ -62,26 +62,36 @@ const QuickListView = (props: ListViewProps) => {
6262

6363
const ListItem = (item: any) => {
6464
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>
8292
</View>
83-
</View>
84-
</List>
93+
</List>
94+
</SwipeAction>
8595
);
8696
};
8797

example/examples/src/routes/SearchInputBar/index.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ export default class Index extends Component<IndexProps, IndexState> {
3838
<Container keyboardShouldPersistTaps="always">
3939
<Layout>
4040
<Header title={title} description={description} />
41-
<Body keyboardShouldPersistTaps="always">
41+
<Body
42+
keyboardShouldPersistTaps="always"
43+
style={{paddingHorizontal: 10}}>
4244
<View style={styles.divider} />
4345
<SearchInputBar
4446
ref={this.ref}
@@ -76,9 +78,6 @@ export default class Index extends Component<IndexProps, IndexState> {
7678
Toast.info('你点击了搜一下', 2, 'info');
7779
},
7880
}}
79-
containerStyle={{
80-
marginHorizontal: 10,
81-
}}
8281
/>
8382
</Body>
8483
<Footer />
@@ -100,6 +99,6 @@ const styles = StyleSheet.create({
10099
search: {
101100
justifyContent: 'center',
102101
borderWidth: 0,
103-
paddingRight: 10,
102+
paddingLeft: 10,
104103
},
105104
});

0 commit comments

Comments
 (0)