Skip to content

Commit ad8d3a4

Browse files
ChenlingasMxrenovate[bot]renovate-botjaywcjlovedependabot[bot]
authored
feat(Table): Add scroll props & Update example & Update menu to website & Update (QuickList) example (#176)
* chore(deps): add renovate.json (#6) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): pin dependencies (#7) Co-authored-by: Renovate Bot <bot@renovateapp.com> * chore(deps): update react-navigation monorepo * fix(deps): update dependency @types/color to v3.0.1 * chore(deps): update dependency react-navigation-stack to v2 * released v1.6.1 * feat(CheckBox): Enhance checkedIcon/unCheckedIcon props. * chore: Update @uiw/icons to v2.4.3 * released v1.6.2 * doc(CheckBox): Update README.md * feat: Modify unCheckedIcon default value. * released v1.6.3 * chore(deps): Update react-native to v0.62.2 * chore(deps): pin dependencies * chore(deps): update dependency tsbb to v1.7.3 * chore: Modify example. * chore: Fix homepage layout issue. * chore: Format the code. * released v1.7.0 * released v1.7.1 * chore: Remove redundant codes. * released v1.7.2 * feat: Add MaskLayer component. * feat: Add usePrevious. * fix: Fix Animated errors. * fix: Fix Modal style. * released v1.7.3 * released v1.7.4 * Update dependency tsbb to v1.7.4 * Update dependency react-native-safe-area-context to v2 * Update dependency @types/react-native to v0.62.11 * Update react-navigation monorepo * Update dependency react-native-safe-area-context to v2.0.1 * Update react-navigation monorepo * Update dependency react-native-safe-area-context to v3 * chore(deps): bump lodash from 4.17.15 to 4.17.19 Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](lodash/lodash@4.17.15...4.17.19) Signed-off-by: dependabot[bot] <support@github.com> * Update dependency tsbb to v1.7.6 * Upgrade react-native to v0.63.2 (#61) Co-authored-by: songjie@nihaosi.com <songjie@nihaosi.com> * 恢复babel.config的eslink,删除不需要上传的flowconfig (#65) * react-native升级0.63.2 * 恢复babel的eslink * flx删除不需要上传的flowconfig Co-authored-by: songjie@nihaosi.com <songjie@nihaosi.com> * chore(deps): bump logkitty from 0.6.1 to 0.7.1 Bumps [logkitty](https://github.com/zamotany/logkitty) from 0.6.1 to 0.7.1. - [Release notes](https://github.com/zamotany/logkitty/releases) - [Commits](zamotany/logkitty@v0.6.1...v0.7.1) Signed-off-by: dependabot[bot] <support@github.com> * doc: Update README.md * fix:解决MenuDropdown组件下拉报错 * 升级TypeScript,注释babel.config.js两行代码 (#68) * react-native升级0.63.2 * 恢复babel的eslink * flx删除不需要上传的flowconfig * flx升级TypeScript,注释babel.config.js两行代码 Co-authored-by: songjie@nihaosi.com <songjie@nihaosi.com> * Create LICENSE * fix(SelectCascader): update native Pick * chore: Update ios/UIW.xcodeproj/project.pbxproj &yarn.lock * chore: Update dependencies * released v1.7.5 * fix: update react-native-svg * fix: update react-native-svg * doc: Update README.md * chore: Update dependencies. * released v1.7.5 * released v1.7.6 * chore(deps): pin dependencies * chore: remove package-lock.json * chore(deps): update dependency typescript to v4 * chore: Update yarn.lock * doc: Update README.md * chore(deps): update dependency tsbb to v1.7.8 * fix(Icon): Add fill default value. * chore(deps): update dependency react-native to v0.64 * chore: update yarn.lock * released v1.7.6 * type: Fix type errors. * released v1.7.6 * released v1.8.0 * fix:SearchBar组件 * released v1.9.0 * type(SearchBar): Fix type errors. #93 * released v1.9.1 * fix:SearchBar组件 * fix:Table表格 * #95 * released v1.10.0 * chore(doc): Update README.md * fix(deps): update dependency @react-native-picker/picker to v1.16.0 * chore(deps): update react-navigation monorepo * Wx (#103) * fix:解决MenuDropdown组件下拉报错 * fix:SearchBar组件 * fix:Table表格 * fix:展开组件封装,修复xcode14.5无法运行问题 * fix:update package.json * released v1.11.0 * chore: publish npm using workflows. * chore: update workflows config. * type: fix tsconfig.json errors. * chore(deps): update dependency fs-extra to v10 * chore(deps): update dependency prettier to v2.3.1 * chore(deps): update dependency tsbb to v2.2.1 * fix(deps): update dependency @uiw/icons to v2.5.1 * chore(deps): update dependencies. * released v1.12.0 * fix:team团队页面调用github用户信息接口 * fix:解决svg报错 * fix:Tab example报错和封装quickList 组件 * fix:QuickList routes Demo * fix:删除Table demo 多余代码 * fix:Card 组件 * fix:QuickLidt文档 * fix:Card组件增加点击选中功能 * fix:QuickList Demo & Table组件增加滚动功能 Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Renovate Bot <bot@renovateapp.com> Co-authored-by: jaywcjlove <398188662@qq.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: cc <33281802+matuanc@users.noreply.github.com> Co-authored-by: songjie@nihaosi.com <songjie@nihaosi.com> Co-authored-by: 小弟调调™ <kennyiseeyou@gmail.com> Co-authored-by: xingyuefeng <15262870437@163.com>
1 parent 50fc01f commit ad8d3a4

File tree

6 files changed

+188
-124
lines changed

6 files changed

+188
-124
lines changed

example/examples/src/routes.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ export const stackPageData: Routes[] = [
311311
component: require('./routes/QuickList').default,
312312
params: {
313313
title: 'QuickList 快速请求列表',
314-
description: 'QuickList 快速请求上拉下拉数据列表',
314+
description: 'QuickList 高效率快速请求上拉下拉数据列表',
315315
},
316316
},
317317
{

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

Lines changed: 46 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,53 @@
1-
import React, {useRef, useState} from 'react';
2-
import {SafeAreaView} from 'react-native';
3-
import {QuickList, List} from '@uiw/react-native';
4-
import {ComProps} from '../../routes';
1+
import React, { useRef, useState } from 'react';
2+
import { SafeAreaView, Image, View, Text } from 'react-native';
3+
import { QuickList, List } from '@uiw/react-native';
4+
import { ComProps } from '../../routes';
55
import Layout from '../../Layout';
6-
const {Header} = Layout;
6+
const { Header } = Layout;
77

8-
export interface ListViewProps extends ComProps {}
8+
export interface ListViewProps extends ComProps { }
99

1010
interface fethProp {
1111
page: number;
1212
pageSize: number;
1313
}
14-
15-
const defaultData: Array<{name: string; id: number}> = [
16-
{name: '最好用的快速List列表', id: 1},
17-
{name: '最好用的快速List列表', id: 2},
18-
{name: '最好用的快速List列表', id: 3},
19-
{name: '最好用的快速List列表', id: 4},
20-
{name: '最好用的快速List列表', id: 5},
21-
{name: '最好用的快速List列表', id: 6},
22-
{name: '最好用的快速List列表', id: 7},
23-
{name: '最好用的快速List列表', id: 8},
24-
{name: '最好用的快速List列表', id: 9},
25-
{name: '最好用的快速List列表', id: 10},
14+
const imageUrl = 'https://c-ssl.duitang.com/uploads/item/202004/13/20200413013923_25wds.jpeg'
15+
const defaultData: Array<{ name: string; id: number; img: string }> = [
16+
{ name: '@uiw/react-native QuickList', id: 1, img: imageUrl },
17+
{ name: '@uiw/react-native QuickList', id: 2, img: imageUrl },
18+
{ name: '@uiw/react-native QuickList', id: 3, img: imageUrl },
19+
{ name: '@uiw/react-native QuickList', id: 4, img: imageUrl },
20+
{ name: '@uiw/react-native QuickList', id: 5, img: imageUrl },
21+
{ name: '@uiw/react-native QuickList', id: 6, img: imageUrl },
22+
{ name: '@uiw/react-native QuickList', id: 7, img: imageUrl },
23+
{ name: '@uiw/react-native QuickList', id: 8, img: imageUrl },
24+
{ name: '@uiw/react-native QuickList', id: 9, img: imageUrl },
25+
{ name: '@uiw/react-native QuickList', id: 10, img: imageUrl },
2626
];
2727

2828
const QuickListView = (props: ListViewProps) => {
2929
const baseRef = useRef();
30-
const {route} = props;
30+
const { route } = props;
3131
const description = route.params.description;
3232
const title = route.params.title;
3333
const [total, setTotal] = useState(0);
34-
const [data, setData] = useState<Array<{name: string; id: number}>>([]);
34+
const [data, setData] = useState<Array<{ name: string; id: number; img: string }>>([]);
3535

3636
const sleep = (time: any) =>
3737
new Promise(resolve => setTimeout(() => resolve(''), time));
3838
// 模拟请求
3939
const fethList = async (params: fethProp) => {
40-
const {page, pageSize} = params;
40+
const { page, pageSize } = params;
4141
if (page === 1) {
4242
await sleep(500);
4343
setData(defaultData);
4444
} else {
4545
let fetchData = [];
4646
for (let i = 0; i < pageSize; i++) {
4747
const id = data.length + (1 / 10) * pageSize + i;
48-
const name = '最好用的快速List列表';
49-
let obj = {name, id};
48+
const name = '@uiw/react-native QuickList';
49+
const img = imageUrl
50+
let obj = { name, id, img };
5051
fetchData.push(obj);
5152
}
5253
let newData = [...data, ...fetchData];
@@ -56,20 +57,35 @@ const QuickListView = (props: ListViewProps) => {
5657
setTotal(40);
5758
};
5859

60+
const ListItem = (item:any) => {
61+
return (
62+
<List flat={false}>
63+
<View
64+
style={{ padding: 10, display: "flex", alignItems: "center", flexDirection: "row" }}>
65+
<Image
66+
source={{
67+
uri: item.img,
68+
}}
69+
style={{ height: 70, width: 70, borderRadius: 50 }}
70+
/>
71+
<View style={{ marginLeft: 10 }}>
72+
<Text style={{ marginBottom: 5, fontSize: 18 }}>react-native</Text>
73+
<Text style={{ color:"#808080"}}>{item.name}</Text>
74+
</View>
75+
</View>
76+
</List>
77+
)
78+
}
79+
5980
return (
60-
<SafeAreaView style={{flex: 1}}>
81+
<SafeAreaView style={{ flex: 1 }}>
6182
<Header title={title} description={description} />
6283
<QuickList
6384
ref={baseRef}
6485
onFetch={fethList}
6586
data={data}
6687
total={total}
67-
renderItem={({item}) => (
68-
<List flat={false}>
69-
<List.Item
70-
style={{height: 70}}>{`${item.id}-${item.name}`}</List.Item>
71-
</List>
72-
)}
88+
renderItem={({ item }) => ListItem(item)}
7389
keyId="id"
7490
/>
7591
</SafeAreaView>

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

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,58 @@
11
import React from 'react';
2-
import {SafeAreaView, TouchableHighlight, Text} from 'react-native';
3-
import {Table} from '@uiw/react-native';
4-
import {ComProps} from '../../routes';
2+
import { SafeAreaView, TouchableHighlight, Text } from 'react-native';
3+
import { Table } from '@uiw/react-native';
4+
import { ComProps } from '../../routes';
55
import Layout from '../../Layout';
66
const SearchBarDemo = (props: ComProps) => {
7-
const {Header} = Layout;
8-
const {route} = props;
7+
const { Header } = Layout;
8+
const { route } = props;
99
const description = route.params.description;
1010
const title = route.params.title;
1111

1212
return (
13-
<SafeAreaView style={{flex: 1}}>
13+
<SafeAreaView style={{ flex: 1 }}>
1414
<Header title={title} description={description} />
1515
<Table
1616
columns={[
1717
{
18-
title: '类型',
19-
dataIndex: 'reportType',
20-
ellipsis: true,
18+
title: '配件名称',
19+
dataIndex: 'partName',
20+
style: { width: 100 },
21+
},
22+
{
23+
title: '配件品牌',
24+
dataIndex: 'partBrand',
25+
style: { width: 100 },
26+
},
27+
{
28+
title: '配件型号',
29+
dataIndex: 'partModel',
30+
style: { width: 100 },
2131
},
2232
{
2333
title: '备注',
2434
dataIndex: 'remark',
2535
ellipsis: true,
36+
style: { width: 100 },
2637
},
2738
{
2839
title: '操作',
2940
dataIndex: 'id',
41+
style: { width: 90 },
3042
render: () => {
3143
return (
32-
<TouchableHighlight onPress={() => {}}>
33-
<Text style={{color: '#888'}}>查看</Text>
44+
<TouchableHighlight onPress={() => { }}>
45+
<Text style={{ color: '#888' }}>查看</Text>
3446
</TouchableHighlight>
3547
);
3648
},
3749
},
3850
]}
3951
data={[
40-
{id: '1', reportType: '❤️爱永恒', remark: 'ff爱zz,三生三世用相随'},
41-
{id: '2', reportType: '❤️爱永恒', remark: 'ff爱zz,三生三世用相随'},
42-
{id: '3', reportType: '❤️爱永恒', remark: 'ff爱zz,三生三世用相随'},
43-
{id: '4', reportType: '❤️爱永恒', remark: 'ff爱zz,三生三世用相随'},
52+
{ id: '1', partName: 'Chanel', partBrand: '香奈儿', partModel: 'xl', remark: 'ff爱zz,三生三世用相随' },
53+
{ id: '2', partName: 'Chanel', partBrand: '香奈儿', partModel: 'xl', remark: 'ff爱zz,三生三世用相随' },
54+
{ id: '3', partName: 'Chanel', partBrand: '香奈儿', partModel: 'xl', remark: 'ff爱zz,三生三世用相随' },
55+
{ id: '4', partName: 'Chanel', partBrand: '香奈儿', partModel: 'xl', remark: 'ff爱zz,三生三世用相随' },
4456
]}
4557
rowKey="id"
4658
/>

packages/core/src/QuickList/README.md

Lines changed: 39 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,26 @@ QuickList 快速请求列表
88
<!--DemoStart-->
99
```jsx
1010
import React, { useRef, useState } from 'react';
11-
import { SafeAreaView } from 'react-native';
11+
import { SafeAreaView, Image, View, Text } from 'react-native';
1212
import { QuickList, List } from '@uiw/react-native';
1313

14-
const defaultData =[
15-
{ name: '最好用的快速List列表', id: 2 },
16-
{ name: '最好用的快速List列表', id: 3 },
17-
{ name: '最好用的快速List列表', id: 4 },
18-
{ name: '最好用的快速List列表', id: 5 },
19-
{ name: '最好用的快速List列表', id: 6 },
20-
{ name: '最好用的快速List列表', id: 7 },
21-
{ name: '最好用的快速List列表', id: 8 },
22-
{ name: '最好用的快速List列表', id: 9 },
23-
{ name: '最好用的快速List列表', id: 10 },
24-
]
14+
const imageUrl = 'https://c-ssl.duitang.com/uploads/item/202004/13/20200413013923_25wds.jpeg'
15+
16+
const defaultData = [
17+
{ name: '@uiw/react-native QuickList', id: 1, img: imageUrl },
18+
{ name: '@uiw/react-native QuickList', id: 2, img: imageUrl },
19+
{ name: '@uiw/react-native QuickList', id: 3, img: imageUrl },
20+
{ name: '@uiw/react-native QuickList', id: 4, img: imageUrl },
21+
{ name: '@uiw/react-native QuickList', id: 5, img: imageUrl },
22+
{ name: '@uiw/react-native QuickList', id: 6, img: imageUrl },
23+
{ name: '@uiw/react-native QuickList', id: 7, img: imageUrl },
24+
{ name: '@uiw/react-native QuickList', id: 8, img: imageUrl },
25+
{ name: '@uiw/react-native QuickList', id: 9, img: imageUrl },
26+
{ name: '@uiw/react-native QuickList', id: 10, img: imageUrl },
27+
];
2528

2629
const QuickListDemo = (props) => {
2730
const baseRef = useRef();
28-
const { route } = props;
29-
const description = route.params.description;
30-
const title = route.params.title;
3131
const [total, setTotal] = useState(0)
3232
const [data, setData] = useState([])
3333

@@ -43,8 +43,9 @@ const QuickListDemo = (props) => {
4343
let fetchData = []
4444
for (let i = 0; i < pageSize; i++) {
4545
const id = (data.length + 1 / 10 * pageSize) + i
46-
const name = `最好用的快速List列表`;
47-
let obj = { name, id }
46+
const name = `@uiw/react-native QuickList`;
47+
const img = imageUrl
48+
let obj = { name, id,img }
4849
fetchData.push(obj)
4950
}
5051
let newData = [...data, ...fetchData]
@@ -53,6 +54,26 @@ const QuickListDemo = (props) => {
5354
}
5455
setTotal(40)
5556
}
57+
// 列表渲染
58+
const ListItem = (item:any) => {
59+
return (
60+
<List flat={false}>
61+
<View
62+
style={{ padding: 10, display: "flex", alignItems: "center", flexDirection: "row" }}>
63+
<Image
64+
source={{
65+
uri: item.img,
66+
}}
67+
style={{ height: 70, width: 70, borderRadius: 50 }}
68+
/>
69+
<View style={{ marginLeft: 10 }}>
70+
<Text style={{ marginBottom: 5, fontSize: 18 }}>react-native</Text>
71+
<Text style={{ color:"#808080"}}>{item.name}</Text>
72+
</View>
73+
</View>
74+
</List>
75+
)
76+
}
5677

5778
return (
5879
<SafeAreaView style={{ flex: 1 }}>
@@ -61,11 +82,7 @@ const QuickListDemo = (props) => {
6182
onFetch={fethList}
6283
data={data}
6384
total={total}
64-
renderItem={({ item }) =>
65-
<List flat={false}>
66-
<List.Item style={{ height: 70 }}>{`${item.id}-${item.name}`}</List.Item>
67-
</List>
68-
}
85+
renderItem={({ item }) => ListItem(item)}
6986
keyId="id"
7087
/>
7188
</SafeAreaView>

packages/core/src/Table/README.md

Lines changed: 46 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,38 +8,50 @@ import { Table } from '@uiw/react-native';
88

99
function Demo() {
1010
return (
11-
<Table
12-
columns={[
13-
{
14-
title: '类型',
15-
dataIndex: 'reportType',
16-
ellipsis: true,
17-
},
18-
{
19-
title: '备注',
20-
dataIndex: 'remark',
21-
ellipsis: true,
22-
},
23-
{
24-
title: '操作',
25-
dataIndex: 'id',
26-
render: record => {
27-
return (
28-
<TouchableHighlight onPress={()=>{ }}>
29-
<Text style={{color: '#888'}}>查看</Text>
30-
</TouchableHighlight>
31-
);
11+
<Table
12+
columns={[
13+
{
14+
title: '配件名称',
15+
dataIndex: 'partName',
16+
style: { width: 100 },
3217
},
33-
},
34-
]}
35-
data={[
36-
{id: '1', reportType: '❤️爱永恒', remark: 'ff爱zz,三生三世用相随'},
37-
{id: '2', reportType: '❤️爱永恒', remark: 'ff爱zz,三生三世用相随'},
38-
{id: '3', reportType: '❤️爱永恒', remark: 'ff爱zz,三生三世用相随'},
39-
{id: '4', reportType: '❤️爱永恒', remark: 'ff爱zz,三生三世用相随'},
40-
]}
41-
rowKey="id"
42-
/>
18+
{
19+
title: '配件品牌',
20+
dataIndex: 'partBrand',
21+
style: { width: 100 },
22+
},
23+
{
24+
title: '配件型号',
25+
dataIndex: 'partModel',
26+
style: { width: 100 },
27+
},
28+
{
29+
title: '备注',
30+
dataIndex: 'remark',
31+
ellipsis: true,
32+
style: { width: 100 },
33+
},
34+
{
35+
title: '操作',
36+
dataIndex: 'id',
37+
style: { width: 90 },
38+
render: () => {
39+
return (
40+
<TouchableHighlight onPress={() => { }}>
41+
<Text style={{ color: '#888' }}>查看</Text>
42+
</TouchableHighlight>
43+
);
44+
},
45+
},
46+
]}
47+
data={[
48+
{ id: '1', partName: 'Chanel', partBrand: '香奈儿', partModel: 'xl', remark: 'ff爱zz,三生三世用相随' },
49+
{ id: '2', partName: 'Chanel', partBrand: '香奈儿', partModel: 'xl', remark: 'ff爱zz,三生三世用相随' },
50+
{ id: '3', partName: 'Chanel', partBrand: '香奈儿', partModel: 'xl', remark: 'ff爱zz,三生三世用相随' },
51+
{ id: '4', partName: 'Chanel', partBrand: '香奈儿', partModel: 'xl', remark: 'ff爱zz,三生三世用相随' },
52+
]}
53+
rowKey="id"
54+
/>
4355
);
4456
}
4557
```
@@ -51,6 +63,8 @@ function Demo() {
5163
| `columns` | 表格列的配置描述,具体项见下表 | ColumnsType[] | - |
5264
| `data` | 数据数组 | object[] | - |
5365
| `rowKey` | 表格行 key 的取值,可以是字符串或一个函数 | string | function(record): string | key |
66+
| `horizontal` | 是否水平排成一行 | bool | true |
67+
| `style` | Table样式 | object | - |
5468

5569
### Column
5670

@@ -60,3 +74,4 @@ function Demo() {
6074
| `ellipsis` | 超过宽度将自动省略 | - |
6175
| `title` | 列头显示文字 | string | - |
6276
| `render` | 生成复杂数据的渲染函数,参数为当前行数据 | function(record) {} | - |
77+
| `style` | Table行内样式 | object | - |

0 commit comments

Comments
 (0)