@@ -3,17 +3,16 @@ List 列表
33
44单个连续模块垂直排列,显示当前的内容、状态和可进行的操作。eg:联系人列表。
55
6- ![ ] ( https://user-images.githubusercontent.com/66067296/139397639-1bb004ac-fd66-495e-8991-6b6910f84e60.png ) <!-- rehype:style=zoom: 33%;float: right; margin-left: 15px;-->
7- ![ ] ( https://user-images.githubusercontent.com/66067296/139397695-5de2fb65-4931-454b-baed-9115a80abebc.png ) <!-- rehype:style=zoom: 33%;float: right; margin-left: 15px;-->
86
97### 基础示例
108
11- <!-- DemoStart -->
12- ``` jsx
9+ ``` jsx mdx:preview
10+
1311import { View , Text } from ' react-native' ;
1412import { List } from ' @uiw/react-native' ;
13+ import React from " react"
1514
16- export default function Demo () {
15+ function Demo () {
1716 return (
1817 < List>
1918 < List .Item style= {{ height: 50 }}> " X战警新变种人" 首曝海报特写诡异人脸< / List .Item >
@@ -27,15 +26,18 @@ export default function Demo() {
2726 < / List>
2827 );
2928}
29+
30+ export default Demo
31+
3032```
31- <!-- End-->
3233
33- ### 简单
34+ ### 自定义渲染列表
35+
36+ ``` jsx mdx:preview
3437
35- <!-- DemoStart-->
36- ``` jsx
3738import { View , Text } from ' react-native' ;
3839import { List } from ' @uiw/react-native' ;
40+ import React from " react"
3941
4042export default function Demo () {
4143 return (
@@ -49,7 +51,7 @@ export default function Demo() {
4951 ]}
5052 renderItem= {({ item }) => {
5153 return (
52- < View>
54+ < View style = {{borderWidth : 1 }} >
5355 < Text > {item .date }< / Text >
5456 < Text > {item .time }< / Text >
5557 < / View>
@@ -59,51 +61,9 @@ export default function Demo() {
5961 )
6062}
6163```
62- <!-- End-->
6364
6465
65- ### 基础示例
66-
67- <!-- DemoStart-->
68- ``` jsx
69- import { View , Text } from ' react-native' ;
70- import { List , Icon } from ' @uiw/react-native' ;
7166
72- export default function Demo () {
73- return (
74- < List
75- flat= {true }
76- data= {[
77- { date: ' 8月12日' , title: ' 这里是标题' , des: ' 这里是详情内容' },
78- { date: ' 8月10日' , title: ' SO18081000004' , des: ' 这里是详情内容' },
79- { date: ' 8月2日' , title: ' SO18080200003' , des: ' 这里是详情内容' },
80- { date: ' 8月1日' , title: ' SO18080100002' , des: ' 这里是详情内容' },
81- { date: ' 8月1日' , title: ' SO18080100001' , des: ' 这里是详情内容' }
82- ]}
83- renderItem= {({ item, index }) => {
84- return (
85- < List .Item
86- key= {index}
87- extra= {< Icon name= " right" fill= " #abb0b5" size= {14 } / > }
88- size= " large"
89- paddingLeft= {15 }
90- style= {{ borderBottomWidth: 0 , }}
91- onPress= {() => { }}
92- >
93- < View>
94- < Text > {item .title }< / Text >
95- < View>
96- < Text > {item .des }< / Text >
97- < / View>
98- < / View>
99- < / List .Item >
100- )
101- }}
102- / >
103- );
104- }
105- ```
106- <!-- End-->
10767
10868### Props
10969
@@ -142,7 +102,7 @@ export default function Demo() {
142102
143103| 参数 | 说明 | 类型 | 默认值|
144104| ------| ------| -----| ------|
145- | ` size ` | 单元格大小 | ` small ` , ` default ` , ` large ` | List ` default ` , List.Item '-' |
105+ | ` size ` | 单元格大小 | ` small ` , ` default ` , ` large ` | ` default ` |
146106| ` extra ` | 额外内容,展示右侧内容 | ReactNode | - |
147107| ` extraStyle ` | 设置 ` extra ` 包裹样式 | ViewProps[ 'style'] | TextProps[ 'style'] | - |
148108| ` paddingLeft ` | 左边补白 | Number | ` 16 ` |
0 commit comments