@@ -9,42 +9,46 @@ DragDrawer 拖曳抽屉
99
1010``` jsx
1111import React , { useState , Fragment } from ' react' ;
12- import { View , Text } from ' react-native' ;
13- import { DragDrawer , Card , Icon } from ' @uiw/react-native' ;
12+ import { View , Text , FlatList } from ' react-native' ;
13+ import { DragDrawer , Card , Icon , List } from ' @uiw/react-native' ;
1414import Layout , { Container } from ' ../../Layout' ;
1515import { ComProps } from ' ../../routes' ;
1616const { Header , Body , Footer } = Layout;
17-
17+ const data = [];
18+ for (let i = 1 ; i < 21 ; i++ ) {
19+ data .push (i);
20+ }
1821export interface DragDrawerViewProps extends ComProps { }
1922export default function DragDrawerView ({ route }: DragDrawerViewProps ) {
2023 const description = route .params .description ;
2124 const title = route .params .title ;
25+
26+ const renderItem = ({ item }) => (
27+ < View style= {{ borderWidth: 0.5 , padding: 10 , borderColor: ' #D9D9D9' }}>
28+ < Text style= {{ fontSize: 20 , textAlign: ' center' }}> {item}< / Text >
29+ < / View>
30+ )
2231 return (
2332 < Fragment>
2433 < DragDrawer
2534 drawerHeight= {350 }
2635 // drawerBackgroundColor='lightblue' //抽屉背景
2736 // icon={<Icon name="smile" fill="red" size={30} />} //自定义拖曳图标
2837 >
29- < View>
30- < Text > 按住图标可上下拖曳抽屉< / Text >
31- < / View>
38+ < FlatList
39+ data= {data}
40+ renderItem= {renderItem}
41+ keyExtractor= {item => item .id }
42+ / >
3243 < / DragDrawer>
3344 < Container>
3445 < Layout>
3546 < Header title= {title} description= {description} / >
36- < Body>
37- < Card title= " 下边抽屉可上下拖曳" >
38- < Text > 下边抽屉可上下拖曳< / Text >
39- < / Card>
40- < / Body>
41- < Footer / >
4247 < / Layout>
4348 < / Container>
4449 < / Fragment>
4550 );
4651}
47-
4852```
4953
5054### props
0 commit comments