@xhsreds/reds-rn-next 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/benchmarks/out.json +1652 -1025
- package/coverage/.tmp/coverage-0.json +1 -1
- package/coverage/.tmp/coverage-1.json +1 -1
- package/coverage/.tmp/coverage-10.json +1 -1
- package/coverage/.tmp/coverage-11.json +1 -1
- package/coverage/.tmp/coverage-12.json +1 -1
- package/coverage/.tmp/coverage-13.json +1 -1
- package/coverage/.tmp/coverage-14.json +1 -1
- package/coverage/.tmp/coverage-15.json +1 -1
- package/coverage/.tmp/coverage-16.json +1 -1
- package/coverage/.tmp/coverage-17.json +1 -1
- package/coverage/.tmp/coverage-18.json +1 -1
- package/coverage/.tmp/coverage-19.json +1 -1
- package/coverage/.tmp/coverage-2.json +1 -1
- package/coverage/.tmp/coverage-20.json +1 -1
- package/coverage/.tmp/coverage-21.json +1 -1
- package/coverage/.tmp/coverage-22.json +1 -1
- package/coverage/.tmp/coverage-23.json +1 -1
- package/coverage/.tmp/coverage-24.json +1 -1
- package/coverage/.tmp/coverage-25.json +1 -1
- package/coverage/.tmp/coverage-26.json +1 -1
- package/coverage/.tmp/coverage-27.json +1 -1
- package/coverage/.tmp/coverage-28.json +1 -1
- package/coverage/.tmp/coverage-29.json +1 -1
- package/coverage/.tmp/coverage-3.json +1 -1
- package/coverage/.tmp/coverage-30.json +1 -1
- package/coverage/.tmp/coverage-31.json +1 -1
- package/coverage/.tmp/coverage-32.json +1 -1
- package/coverage/.tmp/coverage-33.json +1 -1
- package/coverage/.tmp/coverage-6.json +1 -1
- package/coverage/.tmp/coverage-7.json +1 -1
- package/coverage/.tmp/coverage-8.json +1 -1
- package/coverage/.tmp/coverage-9.json +1 -1
- package/lib/cjs/_chunks/B0pRAs4D.js.map +1 -1
- package/lib/cjs/_chunks/{C61-qTj5.js → BkoO2fb2.js} +7 -22
- package/lib/cjs/_chunks/BkoO2fb2.js.map +1 -0
- package/lib/cjs/_chunks/DHiiOK0R.js.map +1 -1
- package/lib/cjs/_chunks/DhVoC10x.js.map +1 -1
- package/lib/cjs/_chunks/{K-GkcnsQ.js → DtxkCz1y.js} +2 -1
- package/lib/cjs/_chunks/DtxkCz1y.js.map +1 -0
- package/lib/cjs/components/Alert/Alert.js +2 -2
- package/lib/cjs/components/Alert/index.js +2 -2
- package/lib/cjs/components/AvatarGroup/AvatarGroup.js +2 -2
- package/lib/cjs/components/AvatarGroup/index.js +2 -2
- package/lib/cjs/components/ConfigProvider/ConfigProvider.js +15 -14
- package/lib/cjs/components/ConfigProvider/ConfigProvider.js.map +1 -1
- package/lib/cjs/components/ConfigProvider/index.js +2 -2
- package/lib/cjs/components/ConfigProvider/interface/index.js +1 -1
- package/lib/cjs/components/Icon/Icon.js +8 -4
- package/lib/cjs/components/Icon/Icon.js.map +1 -1
- package/lib/cjs/components/Icon/index.js +5 -0
- package/lib/cjs/components/Icon/index.js.map +1 -1
- package/lib/cjs/components/ImagePreview/ImagePreview.js +2 -2
- package/lib/cjs/components/ImagePreview/index.js +2 -2
- package/lib/cjs/components/List/ListItem/ListItem.js +2 -2
- package/lib/cjs/components/List/index.js +2 -2
- package/lib/cjs/components/NavigationBar/NavigationBar.js +5 -0
- package/lib/cjs/components/NavigationBar/NavigationBar.js.map +1 -1
- package/lib/cjs/components/NavigationBar/index.js +5 -0
- package/lib/cjs/components/NavigationBar/index.js.map +1 -1
- package/lib/cjs/components/PullRefresh/PullRefresh.js +2 -2
- package/lib/cjs/components/PullRefresh/PullRefresh.js.map +1 -1
- package/lib/cjs/components/TabBar/TabBar.js +8 -5
- package/lib/cjs/components/TabBar/TabBar.js.map +1 -1
- package/lib/cjs/components/TabBar/index.js +5 -2
- package/lib/cjs/components/TabBar/index.js.map +1 -1
- package/lib/cjs/components/TabBar/interface/index.js +1 -1
- package/lib/cjs/components/Tabs/Tabs.js +5 -1
- package/lib/cjs/components/Tabs/Tabs.js.map +1 -1
- package/lib/cjs/components/Tabs/styles.js +1 -1
- package/lib/cjs/components/Tabs/styles.js.map +1 -1
- package/lib/cjs/components/Toast/Toast.js +2 -2
- package/lib/cjs/components/Toast/api.js +4 -4
- package/lib/cjs/components/Toast/index.js +4 -4
- package/lib/cjs/index.js +2 -2
- package/lib/esm/_chunks/{DKABHJAn.js → BefIgmcR.js} +7 -22
- package/lib/esm/_chunks/BefIgmcR.js.map +1 -0
- package/lib/esm/_chunks/CGzZESdM.js.map +1 -1
- package/lib/esm/_chunks/CZmJhm-r.js.map +1 -1
- package/lib/esm/_chunks/DkKS5ieS.js.map +1 -1
- package/lib/esm/_chunks/{DUTFT_ka.js → PrCkQ_W3.js} +2 -1
- package/lib/esm/_chunks/PrCkQ_W3.js.map +1 -0
- package/lib/esm/components/Alert/Alert.js +2 -2
- package/lib/esm/components/Alert/index.js +2 -2
- package/lib/esm/components/AvatarGroup/AvatarGroup.js +2 -2
- package/lib/esm/components/AvatarGroup/index.js +2 -2
- package/lib/esm/components/ConfigProvider/ConfigProvider.js +15 -14
- package/lib/esm/components/ConfigProvider/ConfigProvider.js.map +1 -1
- package/lib/esm/components/ConfigProvider/index.js +2 -2
- package/lib/esm/components/ConfigProvider/interface/index.js +1 -1
- package/lib/esm/components/Icon/Icon.js +8 -4
- package/lib/esm/components/Icon/Icon.js.map +1 -1
- package/lib/esm/components/Icon/index.js +5 -0
- package/lib/esm/components/Icon/index.js.map +1 -1
- package/lib/esm/components/ImagePreview/ImagePreview.js +2 -2
- package/lib/esm/components/ImagePreview/index.js +2 -2
- package/lib/esm/components/List/ListItem/ListItem.js +2 -2
- package/lib/esm/components/List/index.js +2 -2
- package/lib/esm/components/NavigationBar/NavigationBar.js +5 -0
- package/lib/esm/components/NavigationBar/NavigationBar.js.map +1 -1
- package/lib/esm/components/NavigationBar/index.js +5 -0
- package/lib/esm/components/NavigationBar/index.js.map +1 -1
- package/lib/esm/components/PullRefresh/PullRefresh.js +2 -2
- package/lib/esm/components/PullRefresh/PullRefresh.js.map +1 -1
- package/lib/esm/components/TabBar/TabBar.js +8 -5
- package/lib/esm/components/TabBar/TabBar.js.map +1 -1
- package/lib/esm/components/TabBar/index.js +5 -2
- package/lib/esm/components/TabBar/index.js.map +1 -1
- package/lib/esm/components/TabBar/interface/index.js +1 -1
- package/lib/esm/components/Tabs/Tabs.js +5 -1
- package/lib/esm/components/Tabs/Tabs.js.map +1 -1
- package/lib/esm/components/Tabs/styles.js +1 -1
- package/lib/esm/components/Tabs/styles.js.map +1 -1
- package/lib/esm/components/Toast/Toast.js +2 -2
- package/lib/esm/components/Toast/api.js +4 -4
- package/lib/esm/components/Toast/index.js +4 -4
- package/lib/esm/index.js +2 -2
- package/lib/types/components/ActionSheets/test/spectrum.bench.d.ts +1 -0
- package/lib/types/components/Avatar/test/spectrum.bench.d.ts +1 -0
- package/lib/types/components/AvatarGroup/test/spectrum.bench.d.ts +1 -0
- package/lib/types/components/Badge/test/spectrum.bench.d.ts +1 -0
- package/lib/types/components/BottomBar/test/spectrum.bench.d.ts +1 -0
- package/lib/types/components/Button/test/spectrum.bench.d.ts +1 -0
- package/lib/types/components/ConfigProvider/ConfigProvider.d.ts +2 -2
- package/lib/types/components/ConfigProvider/hooks/ConfigCache/ConfigCache.d.ts +1 -1
- package/lib/types/components/ConfigProvider/hooks/ConfigCache/interface.d.ts +1 -1
- package/lib/types/components/ConfigProvider/interface/index.d.ts +9 -13
- package/lib/types/components/Divider/test/spectrum.bench.d.ts +1 -0
- package/lib/types/components/Empty/test/spectrum.bench.d.ts +1 -0
- package/lib/types/components/Image/test/spectrum.bench.d.ts +1 -0
- package/lib/types/components/List/test/spectrum.bench.d.ts +1 -0
- package/lib/types/components/NavigationBar/test/spectrum.bench.d.ts +1 -0
- package/lib/types/components/Picker/test/spectrum.bench.d.ts +1 -0
- package/lib/types/components/ProgressIndicator/test/spectrum.bench.d.ts +1 -0
- package/lib/types/components/PullRefresh/interface/index.d.ts +2 -2
- package/lib/types/components/Sheets/test/spectrum.bench.d.ts +1 -0
- package/lib/types/components/Silder/test/spectrum.bench.d.ts +1 -0
- package/lib/types/components/Skeleton/test/spectrum.bench.d.ts +1 -0
- package/lib/types/components/Switch/test/spectrum.bench.d.ts +1 -0
- package/lib/types/components/TabBar/TabBar.d.ts +1 -0
- package/lib/types/components/TabBar/interface/index.d.ts +3 -1
- package/lib/types/components/Tag/test/spectrum.bench.d.ts +1 -0
- package/lib/types/components/Toast/test/spectrum.bench.d.ts +1 -0
- package/package.json +5 -4
- package/src/components/ActionSheets/doc/index.mdx +7 -5
- package/src/components/ActionSheets/test/spectrum.bench.tsx +15 -0
- package/src/components/Avatar/test/spectrum.bench.tsx +13 -0
- package/src/components/AvatarGroup/test/spectrum.bench.tsx +30 -0
- package/src/components/Badge/test/spectrum.bench.tsx +13 -0
- package/src/components/BottomBar/test/spectrum.bench.tsx +15 -0
- package/src/components/Button/test/spectrum.bench.tsx +13 -0
- package/src/components/ConfigProvider/ConfigProvider.tsx +10 -26
- package/src/components/ConfigProvider/demo/base.tsx +19 -28
- package/src/components/ConfigProvider/doc/index.mdx +8 -8
- package/src/components/ConfigProvider/hooks/ConfigCache/interface.ts +1 -1
- package/src/components/ConfigProvider/interface/index.ts +13 -21
- package/src/components/ConfigProvider/test/base.tsx +17 -25
- package/src/components/ConfigProvider/test/index.test.tsx +62 -74
- package/src/components/DatePicker/doc/index.mdx +1 -5
- package/src/components/DatePicker/interface/index.ts +1 -3
- package/src/components/Divider/test/spectrum.bench.tsx +13 -0
- package/src/components/DropDown/doc/index.mdx +39 -0
- package/src/components/Empty/test/spectrum.bench.tsx +19 -0
- package/src/components/Icon/Icon.tsx +4 -2
- package/src/components/Image/test/spectrum.bench.tsx +33 -0
- package/src/components/List/test/spectrum.bench.tsx +15 -0
- package/src/components/NavigationBar/test/spectrum.bench.tsx +13 -0
- package/src/components/Picker/test/spectrum.bench.tsx +10 -0
- package/src/components/ProgressIndicator/test/spectrum.bench.tsx +13 -0
- package/src/components/PullRefresh/PullRefresh.tsx +2 -2
- package/src/components/PullRefresh/demo/index.tsx +1 -1
- package/src/components/PullRefresh/doc/index.mdx +10 -10
- package/src/components/PullRefresh/interface/index.ts +2 -2
- package/src/components/Sheets/test/spectrum.bench.tsx +17 -0
- package/src/components/Silder/test/spectrum.bench.tsx +18 -0
- package/src/components/Skeleton/test/spectrum.bench.tsx +25 -0
- package/src/components/Switch/test/spectrum.bench.tsx +14 -0
- package/src/components/TabBar/TabBar.tsx +4 -4
- package/src/components/TabBar/demo/index.tsx +6 -6
- package/src/components/TabBar/doc/index.mdx +9 -8
- package/src/components/TabBar/interface/index.ts +3 -1
- package/src/components/TabBar/test/index.bench.tsx +1 -1
- package/src/components/TabBar/test/index.test.tsx +7 -7
- package/src/components/Tabs/Tabs.tsx +7 -1
- package/src/components/Tabs/demo/index.tsx +55 -19
- package/src/components/Tabs/interface/index.ts +0 -1
- package/src/components/Tabs/styles.ts +1 -1
- package/src/components/Tag/test/spectrum.bench.tsx +13 -0
- package/src/components/Toast/test/spectrum.bench.tsx +13 -0
- package/vitest.config.ts +5 -0
- package/lib/cjs/_chunks/C61-qTj5.js.map +0 -1
- package/lib/cjs/_chunks/K-GkcnsQ.js.map +0 -1
- package/lib/esm/_chunks/DKABHJAn.js.map +0 -1
- package/lib/esm/_chunks/DUTFT_ka.js.map +0 -1
|
@@ -33,10 +33,8 @@ describe("ConfigProvider", () => {
|
|
|
33
33
|
it(":themeChange", async () => {
|
|
34
34
|
const wrapper = render(
|
|
35
35
|
<TestConfigProvider
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
inherit: true,
|
|
39
|
-
}}
|
|
36
|
+
colorMode="light"
|
|
37
|
+
inherit={true}
|
|
40
38
|
id={"root"}
|
|
41
39
|
parentId={"root"}
|
|
42
40
|
children={"123"}
|
|
@@ -44,8 +42,8 @@ describe("ConfigProvider", () => {
|
|
|
44
42
|
);
|
|
45
43
|
expect(wrapper.UNSAFE_root.props.id).toBe("root");
|
|
46
44
|
expect(wrapper.UNSAFE_root.props.parentId).toBe("root");
|
|
47
|
-
expect(wrapper.UNSAFE_root.props.
|
|
48
|
-
expect(wrapper.UNSAFE_root.props.
|
|
45
|
+
expect(wrapper.UNSAFE_root.props.colorMode).toBe("light");
|
|
46
|
+
expect(wrapper.UNSAFE_root.props.inherit).toBe(true);
|
|
49
47
|
});
|
|
50
48
|
it(":useThemeColor", async () => {
|
|
51
49
|
const TextTest = () => {
|
|
@@ -59,14 +57,14 @@ describe("ConfigProvider", () => {
|
|
|
59
57
|
return <Text style={{ color: themeColor.Bg }}>123</Text>;
|
|
60
58
|
};
|
|
61
59
|
const wrapper = render(
|
|
62
|
-
<TestConfigProvider
|
|
60
|
+
<TestConfigProvider colorMode="light" id={"root"} parentId={"root"}>
|
|
63
61
|
<TextTest></TextTest>
|
|
64
62
|
</TestConfigProvider>,
|
|
65
63
|
);
|
|
66
64
|
const textTest = wrapper.getByText("123").props.style;
|
|
67
65
|
expect(textTest.color).toBe(lightColor.Info);
|
|
68
66
|
const darkwrapper = render(
|
|
69
|
-
<TestConfigProvider
|
|
67
|
+
<TestConfigProvider colorMode="dark" id={"root"} parentId={"root"}>
|
|
70
68
|
<TextTest></TextTest>
|
|
71
69
|
</TestConfigProvider>,
|
|
72
70
|
);
|
|
@@ -74,17 +72,15 @@ describe("ConfigProvider", () => {
|
|
|
74
72
|
expect(darkTextTest.color).toBe(darkColor.Info);
|
|
75
73
|
const darkwrapperText = render(
|
|
76
74
|
<TestConfigProvider
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
Info: "red",
|
|
87
|
-
},
|
|
75
|
+
colorMode="dark"
|
|
76
|
+
token={{
|
|
77
|
+
components: {
|
|
78
|
+
Button: {
|
|
79
|
+
lightColor: {
|
|
80
|
+
Info: "red",
|
|
81
|
+
},
|
|
82
|
+
darkColor: {
|
|
83
|
+
Info: "red",
|
|
88
84
|
},
|
|
89
85
|
},
|
|
90
86
|
},
|
|
@@ -99,17 +95,15 @@ describe("ConfigProvider", () => {
|
|
|
99
95
|
expect(darkTextTestText.color).toBe("red");
|
|
100
96
|
const lightwrapperText = render(
|
|
101
97
|
<TestConfigProvider
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
Info: "red",
|
|
112
|
-
},
|
|
98
|
+
colorMode="light"
|
|
99
|
+
token={{
|
|
100
|
+
components: {
|
|
101
|
+
Button: {
|
|
102
|
+
lightColor: {
|
|
103
|
+
Info: "red",
|
|
104
|
+
},
|
|
105
|
+
darkColor: {
|
|
106
|
+
Info: "red",
|
|
113
107
|
},
|
|
114
108
|
},
|
|
115
109
|
},
|
|
@@ -125,15 +119,13 @@ describe("ConfigProvider", () => {
|
|
|
125
119
|
|
|
126
120
|
const wrapperText = render(
|
|
127
121
|
<TestConfigProvider
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
Bg: "green",
|
|
136
|
-
},
|
|
122
|
+
colorMode="light"
|
|
123
|
+
token={{
|
|
124
|
+
lightColor: {
|
|
125
|
+
Bg: "blue",
|
|
126
|
+
},
|
|
127
|
+
darkColor: {
|
|
128
|
+
Bg: "green",
|
|
137
129
|
},
|
|
138
130
|
}}
|
|
139
131
|
>
|
|
@@ -152,15 +144,13 @@ describe("ConfigProvider", () => {
|
|
|
152
144
|
};
|
|
153
145
|
const wrapperText = render(
|
|
154
146
|
<TestConfigProvider
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
Bg: "green",
|
|
163
|
-
},
|
|
147
|
+
colorMode="dark"
|
|
148
|
+
token={{
|
|
149
|
+
lightColor: {
|
|
150
|
+
Bg: "blue",
|
|
151
|
+
},
|
|
152
|
+
darkColor: {
|
|
153
|
+
Bg: "green",
|
|
164
154
|
},
|
|
165
155
|
}}
|
|
166
156
|
>
|
|
@@ -181,36 +171,34 @@ describe("ConfigProvider", () => {
|
|
|
181
171
|
<TestConfigProvider
|
|
182
172
|
id="123"
|
|
183
173
|
parentId="456"
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
Bg: "red",
|
|
208
|
-
},
|
|
174
|
+
colorMode="dark"
|
|
175
|
+
token={{
|
|
176
|
+
lightColor: {
|
|
177
|
+
Bg: "blue",
|
|
178
|
+
Info: "red",
|
|
179
|
+
},
|
|
180
|
+
darkColor: {
|
|
181
|
+
Bg: "green",
|
|
182
|
+
Primary: "blue",
|
|
183
|
+
},
|
|
184
|
+
alwaysColor: {
|
|
185
|
+
Bg: "red",
|
|
186
|
+
},
|
|
187
|
+
components: {
|
|
188
|
+
Button: {
|
|
189
|
+
lightColor: {
|
|
190
|
+
Info: "red",
|
|
191
|
+
},
|
|
192
|
+
darkColor: {
|
|
193
|
+
Info: "red",
|
|
194
|
+
},
|
|
195
|
+
alwaysColor: {
|
|
196
|
+
Bg: "red",
|
|
209
197
|
},
|
|
210
198
|
},
|
|
211
199
|
},
|
|
212
|
-
inherit: false,
|
|
213
200
|
}}
|
|
201
|
+
inherit={false}
|
|
214
202
|
>
|
|
215
203
|
<TextTest2></TextTest2>
|
|
216
204
|
</TestConfigProvider>,
|
|
@@ -20,11 +20,7 @@ import BaseDemo from "!!raw-loader!../demo/index.tsx";
|
|
|
20
20
|
| startYear | 选择器的最小可选时间,默认为当前时间-10年 | number | |
|
|
21
21
|
| endYear | 选择器的最大可选时间,默认为当前时间+10年 | number | |
|
|
22
22
|
| title | 标题 | string | |
|
|
23
|
-
| formatter | 格式化时间格式 | (value: string) => any | (value: string) =>
|
|
24
|
-
|
|
25
|
-
return value;
|
|
26
|
-
|
|
27
|
-
} |
|
|
23
|
+
| formatter | 格式化时间格式 | (value: string) => any | (value: string) => value |
|
|
28
24
|
|
|
29
25
|
### Events
|
|
30
26
|
|
|
@@ -28,9 +28,7 @@ export interface RedsDatePickerEvent {}
|
|
|
28
28
|
export const DatePickerDefaultProps = {
|
|
29
29
|
visible: false,
|
|
30
30
|
mode: DatePickerMode.YearMonthDay,
|
|
31
|
-
formatter: (value: string) =>
|
|
32
|
-
return value;
|
|
33
|
-
},
|
|
31
|
+
formatter: (value: string) => value,
|
|
34
32
|
onChange: (value: string) => {},
|
|
35
33
|
onCancel: () => {},
|
|
36
34
|
onConfirm: (value: string) => {},
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { describe } from "vitest";
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import { redsBench } from "~root/utils/redsBench";
|
|
5
|
+
import { TextDivision } from "@xhs/spectrum";
|
|
6
|
+
import { render, fireEvent } from "@testing-library/react-native";
|
|
7
|
+
import { Text } from "react-native";
|
|
8
|
+
|
|
9
|
+
describe("render", () => {
|
|
10
|
+
redsBench("base", async () => {
|
|
11
|
+
render(<TextDivision type="Primary">无更多内容,猜你喜欢以下结果</TextDivision>);
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -1,5 +1,44 @@
|
|
|
1
1
|
import BaseDemo from "!!raw-loader!../demo/index.tsx";
|
|
2
2
|
|
|
3
|
+
### DropDownItem 属性用法
|
|
4
|
+
|
|
5
|
+
| 属性 | 描述 | 类型 | 默认值 |
|
|
6
|
+
| -------------- | ------------------ | ----------------------- | ------------------------ | -------- | --- |
|
|
7
|
+
| type | 下拉菜单类型 | DROPDOWNITEMTYPE | DROPDOWNITEMTYPE.RADIO |
|
|
8
|
+
| value | 选项 | string | string[] | number[] | - |
|
|
9
|
+
| defaultValue | 默认选项 | string | string[] | number[] | - |
|
|
10
|
+
| optionColumns | 多选项列数 | MULTIPLEOPTIONCOLUMN | MULTIPLEOPTIONCOLUMN.TWO |
|
|
11
|
+
| options | 列表数据 | SelectItem[] | [] |
|
|
12
|
+
| onChange | 当值发生变化时触发 | (value: string) => any; | - |
|
|
13
|
+
| label | 表单标签 | string | - |
|
|
14
|
+
| minPlaceHolder | 多选项列数 | string | "最小值" |
|
|
15
|
+
| maxPlaceHolder | 多选项列数 | string | "最大值" |
|
|
16
|
+
| onClose | 关闭弹窗 | () => void; | - |
|
|
17
|
+
|
|
18
|
+
### DROPDOWNITEMTYPE 用法
|
|
19
|
+
|
|
20
|
+
| 属性 | 描述 |
|
|
21
|
+
| ------------------------------ | ------------------------ |
|
|
22
|
+
| DROPDOWNITEMTYPE.RADIO | 单选类型 |
|
|
23
|
+
| DROPDOWNITEMTYPE.MULTIPLE | 多选类型 |
|
|
24
|
+
| DROPDOWNITEMTYPE.INPUT | 录入类型 |
|
|
25
|
+
| DROPDOWNITEMTYPE.MORE_MULTIPLE | 单选、多选、录入组合形式 |
|
|
26
|
+
|
|
27
|
+
### MULTIPLEOPTIONCOLUMN 用法
|
|
28
|
+
|
|
29
|
+
| 属性 | 描述 |
|
|
30
|
+
| -------------------------- | ---- |
|
|
31
|
+
| MULTIPLEOPTIONCOLUMN.TWO | 双列 |
|
|
32
|
+
| MULTIPLEOPTIONCOLUMN.THREE | 三列 |
|
|
33
|
+
| MULTIPLEOPTIONCOLUMN.FOUR | 四列 |
|
|
34
|
+
|
|
35
|
+
### SelectItem 用法
|
|
36
|
+
|
|
37
|
+
| 属性 | 描述 |
|
|
38
|
+
| ----- | ---- |
|
|
39
|
+
| value | 值 |
|
|
40
|
+
| key | 标识 |
|
|
41
|
+
|
|
3
42
|
## 演示
|
|
4
43
|
|
|
5
44
|
### 基础用法
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { describe } from "vitest";
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import { redsBench } from "~root/utils/redsBench";
|
|
5
|
+
import { EmptyStates, Button } from "@xhs/spectrum";
|
|
6
|
+
import { render, fireEvent } from "@testing-library/react-native";
|
|
7
|
+
import { Text } from "react-native";
|
|
8
|
+
|
|
9
|
+
describe("render", () => {
|
|
10
|
+
redsBench("base", async () => {
|
|
11
|
+
render(
|
|
12
|
+
<EmptyStates status="404">
|
|
13
|
+
<Button size="Large" type="Outlined">
|
|
14
|
+
点击刷新
|
|
15
|
+
</Button>
|
|
16
|
+
</EmptyStates>,
|
|
17
|
+
);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
@@ -2,10 +2,12 @@ import React, { useCallback, useMemo } from "react";
|
|
|
2
2
|
import { GestureResponderEvent, TouchableOpacity } from "react-native";
|
|
3
3
|
import { SvgXml } from "react-native-svg";
|
|
4
4
|
import { RedsIcon, IconDefaultProps } from "./interface/index";
|
|
5
|
-
|
|
5
|
+
import { useThemeColor } from "../ConfigProvider";
|
|
6
6
|
const Icon: React.FC<RedsIcon> = (props) => {
|
|
7
7
|
const { size, fill, onClick, icon } = props || {};
|
|
8
8
|
|
|
9
|
+
const themeColor = useThemeColor();
|
|
10
|
+
|
|
9
11
|
/** icon点击事件 */
|
|
10
12
|
const toggleIcon = useCallback(
|
|
11
13
|
(e: GestureResponderEvent) => {
|
|
@@ -16,7 +18,7 @@ const Icon: React.FC<RedsIcon> = (props) => {
|
|
|
16
18
|
|
|
17
19
|
/** icon svg 数据 */
|
|
18
20
|
const iconSvg = useMemo(() => {
|
|
19
|
-
return icon ?
|
|
21
|
+
return icon ? icon({ size: size!, fill: fill! || themeColor.Fill1 }) : "";
|
|
20
22
|
}, [icon, size, fill]);
|
|
21
23
|
|
|
22
24
|
return (
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { describe } from "vitest";
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import { redsBench } from "~root/utils/redsBench";
|
|
5
|
+
import { Image } from "@xhs/spectrum";
|
|
6
|
+
import { render, fireEvent } from "@testing-library/react-native";
|
|
7
|
+
import { Text, StyleSheet } from "react-native";
|
|
8
|
+
|
|
9
|
+
const styles = StyleSheet.create({
|
|
10
|
+
container: {
|
|
11
|
+
alignItems: "center",
|
|
12
|
+
backgroundColor: "#fff",
|
|
13
|
+
flex: 1,
|
|
14
|
+
},
|
|
15
|
+
image: {
|
|
16
|
+
width: 200,
|
|
17
|
+
height: 200,
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
describe("render", () => {
|
|
22
|
+
redsBench("base", async () => {
|
|
23
|
+
render(
|
|
24
|
+
<Image
|
|
25
|
+
style={styles.image}
|
|
26
|
+
source={{
|
|
27
|
+
uri: "https://growth-img.xhscdn.com/ditto/0202cs0o3t4t56f4817641363j5jt6t6122k0ojif30viggdc",
|
|
28
|
+
}}
|
|
29
|
+
enableFormat={false}
|
|
30
|
+
/>,
|
|
31
|
+
);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React, { useCallback } from "react";
|
|
2
|
+
import { describe } from "vitest";
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import { redsBench } from "~root/utils/redsBench";
|
|
5
|
+
import { List } from "@xhs/spectrum";
|
|
6
|
+
import { render, fireEvent } from "@testing-library/react-native";
|
|
7
|
+
import { Text, StyleSheet } from "react-native";
|
|
8
|
+
|
|
9
|
+
describe("render", () => {
|
|
10
|
+
redsBench("base", async () => {
|
|
11
|
+
const data = [] as any;
|
|
12
|
+
const renderItem = useCallback(() => null, []);
|
|
13
|
+
render(<List data={data} renderItem={renderItem} />);
|
|
14
|
+
});
|
|
15
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React, { useCallback } from "react";
|
|
2
|
+
import { describe } from "vitest";
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import { redsBench } from "~root/utils/redsBench";
|
|
5
|
+
import { NavigationBar } from "@xhs/spectrum";
|
|
6
|
+
import { render, fireEvent } from "@testing-library/react-native";
|
|
7
|
+
import { Text, StyleSheet } from "react-native";
|
|
8
|
+
|
|
9
|
+
describe("render", () => {
|
|
10
|
+
redsBench("base", async () => {
|
|
11
|
+
render(<NavigationBar title="标题" />);
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { describe } from "vitest";
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import { redsBench } from "~root/utils/redsBench";
|
|
5
|
+
import { render, fireEvent } from "@testing-library/react-native";
|
|
6
|
+
import { Text } from "react-native";
|
|
7
|
+
|
|
8
|
+
describe("render", () => {
|
|
9
|
+
redsBench("base", async () => {});
|
|
10
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React, { useCallback } from "react";
|
|
2
|
+
import { describe } from "vitest";
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import { redsBench } from "~root/utils/redsBench";
|
|
5
|
+
import { Spinner } from "@xhs/spectrum";
|
|
6
|
+
import { render, fireEvent } from "@testing-library/react-native";
|
|
7
|
+
import { Text, StyleSheet } from "react-native";
|
|
8
|
+
|
|
9
|
+
describe("render", () => {
|
|
10
|
+
redsBench("base", async () => {
|
|
11
|
+
render(<Spinner type="dashed" />);
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -249,7 +249,7 @@ export default function PullRefresh(props: RedsPullRefresh) {
|
|
|
249
249
|
}, [pan, scrollContent]);
|
|
250
250
|
|
|
251
251
|
return (
|
|
252
|
-
<View style={[styles.container, props.
|
|
252
|
+
<View style={[styles.container, props.style]} {...panResponder.panHandlers} testID="refresh-container">
|
|
253
253
|
<Animated.View
|
|
254
254
|
// @ts-expect-error
|
|
255
255
|
ref={animatedViewRef}
|
|
@@ -261,7 +261,7 @@ export default function PullRefresh(props: RedsPullRefresh) {
|
|
|
261
261
|
height: props.pullAnimHeight,
|
|
262
262
|
transform: [{ translateY: pan }],
|
|
263
263
|
},
|
|
264
|
-
props.
|
|
264
|
+
props.controlStyle,
|
|
265
265
|
]}
|
|
266
266
|
>
|
|
267
267
|
{/* @ts-ignore */}
|
|
@@ -15,7 +15,7 @@ export default function PullRefreshDemo() {
|
|
|
15
15
|
pullAnimHeight={40}
|
|
16
16
|
minPullDistance={50}
|
|
17
17
|
isRefreshing={isRefreshing}
|
|
18
|
-
|
|
18
|
+
style={{ height: 40, backgroundColor: "pink" }}
|
|
19
19
|
>
|
|
20
20
|
<ScrollView>
|
|
21
21
|
<View style={styles.container}>
|
|
@@ -10,15 +10,15 @@ import BaseDemo from "!!raw-loader!../demo/index.tsx";
|
|
|
10
10
|
|
|
11
11
|
### Props
|
|
12
12
|
|
|
13
|
-
| 属性
|
|
14
|
-
|
|
|
15
|
-
| children
|
|
16
|
-
| pullAnimHeight
|
|
17
|
-
| minPullDistance
|
|
18
|
-
| msHoldingTime
|
|
19
|
-
| onRequest
|
|
20
|
-
| isRefreshing
|
|
21
|
-
|
|
|
22
|
-
|
|
|
13
|
+
| 属性 | 描述 | 类型 | 默认值 |
|
|
14
|
+
| --------------- | ---------------------- | --------------- | --------- |
|
|
15
|
+
| children | 下拉刷新容器的内容 | React.ReactNode | undefined |
|
|
16
|
+
| pullAnimHeight | 下拉刷新组件高度 | number | 0 |
|
|
17
|
+
| minPullDistance | 触发下拉刷新的最小距离 | number | 20 |
|
|
18
|
+
| msHoldingTime | 下拉完成后的停留时间 | number | 1000 |
|
|
19
|
+
| onRequest | 下拉执行的请求函数 | () => void | |
|
|
20
|
+
| isRefreshing | 是否是加载数据中 | boolean | false |
|
|
21
|
+
| style | 容器样式 | ViewStyle | |
|
|
22
|
+
| controlStyle | refreshControl样式 | ViewStyle | |
|
|
23
23
|
|
|
24
24
|
### Events
|
|
@@ -6,8 +6,8 @@ export interface RedsPullRefresh {
|
|
|
6
6
|
msHoldingTime?: number;
|
|
7
7
|
onRequest?: () => void;
|
|
8
8
|
isRefreshing: boolean;
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
style?: ViewStyle;
|
|
10
|
+
controlStyle?: ViewStyle;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export interface RedsPullRefreshEvent {}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { describe } from "vitest";
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import { redsBench } from "~root/utils/redsBench";
|
|
5
|
+
import { Sheets } from "@xhs/spectrum";
|
|
6
|
+
import { render, fireEvent } from "@testing-library/react-native";
|
|
7
|
+
import { Text } from "react-native";
|
|
8
|
+
|
|
9
|
+
describe("render", () => {
|
|
10
|
+
redsBench("base", async () => {
|
|
11
|
+
render(
|
|
12
|
+
<Sheets visible>
|
|
13
|
+
<Text>内容</Text>
|
|
14
|
+
</Sheets>,
|
|
15
|
+
);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { describe } from "vitest";
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import { redsBench } from "~root/utils/redsBench";
|
|
5
|
+
import { Slider } from "@xhs/spectrum";
|
|
6
|
+
import { render, fireEvent } from "@testing-library/react-native";
|
|
7
|
+
import { Text } from "react-native";
|
|
8
|
+
|
|
9
|
+
describe("render", () => {
|
|
10
|
+
let value = 50;
|
|
11
|
+
|
|
12
|
+
const onChange = (newvalue: number) => {
|
|
13
|
+
value = newvalue;
|
|
14
|
+
};
|
|
15
|
+
redsBench("base", async () => {
|
|
16
|
+
render(<Slider value={value} onChange={onChange} />);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { describe } from "vitest";
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import { redsBench } from "~root/utils/redsBench";
|
|
5
|
+
import { Skeleton } from "@xhs/spectrum";
|
|
6
|
+
import { render, fireEvent } from "@testing-library/react-native";
|
|
7
|
+
import { Text, Dimensions } from "react-native";
|
|
8
|
+
|
|
9
|
+
const { width: deviceWidth } = Dimensions.get("window");
|
|
10
|
+
|
|
11
|
+
const cardWidth = (deviceWidth - 3 * 5) / 2;
|
|
12
|
+
const cardHeight = (cardWidth * 238) / 180;
|
|
13
|
+
|
|
14
|
+
describe("render", () => {
|
|
15
|
+
redsBench("base", async () => {
|
|
16
|
+
render(
|
|
17
|
+
<>
|
|
18
|
+
<Skeleton width={cardWidth} height={cardHeight} />
|
|
19
|
+
<Skeleton width={160} height={12} style={{ marginLeft: 10, marginTop: 10 }} />
|
|
20
|
+
<Skeleton width={160} height={12} style={{ marginLeft: 10, marginTop: 10 }} />
|
|
21
|
+
<Skeleton width={80} height={12} style={{ marginLeft: 10, marginTop: 36 }} />
|
|
22
|
+
</>,
|
|
23
|
+
);
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { describe } from "vitest";
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import { redsBench } from "~root/utils/redsBench";
|
|
5
|
+
import { Switch } from "@xhs/spectrum";
|
|
6
|
+
import { render, fireEvent } from "@testing-library/react-native";
|
|
7
|
+
import { Text, Dimensions } from "react-native";
|
|
8
|
+
|
|
9
|
+
describe("render", () => {
|
|
10
|
+
const switchValue = true;
|
|
11
|
+
redsBench("base", async () => {
|
|
12
|
+
render(<Switch value={switchValue} onChange={(value) => value} />);
|
|
13
|
+
});
|
|
14
|
+
});
|
|
@@ -34,10 +34,10 @@ const TabBar = (props: RedsTabBar) => {
|
|
|
34
34
|
*/
|
|
35
35
|
const getTextClass = (item: DataType) => {
|
|
36
36
|
return item?.iconProps?.icon
|
|
37
|
-
? props.
|
|
37
|
+
? props.active === item.key
|
|
38
38
|
? styles.activeIconText
|
|
39
39
|
: styles.iconText
|
|
40
|
-
: props.
|
|
40
|
+
: props.active === item.key
|
|
41
41
|
? styles.activeText
|
|
42
42
|
: styles.text;
|
|
43
43
|
};
|
|
@@ -48,7 +48,7 @@ const TabBar = (props: RedsTabBar) => {
|
|
|
48
48
|
*/
|
|
49
49
|
const getTextColor = (item: DataType) => {
|
|
50
50
|
return {
|
|
51
|
-
color: props.
|
|
51
|
+
color: props.active === item.key ? item.activeColor || "rgba(0,0,0)" : item.normalColor || "rgba(0,0,0,0.45)",
|
|
52
52
|
};
|
|
53
53
|
};
|
|
54
54
|
|
|
@@ -56,7 +56,7 @@ const TabBar = (props: RedsTabBar) => {
|
|
|
56
56
|
* 计算Icon颜色
|
|
57
57
|
*/
|
|
58
58
|
const getIconColor = (item: DataType) => {
|
|
59
|
-
return (props.
|
|
59
|
+
return (props.active === item.key ? item.activeColor : item.normalColor) || item?.iconProps?.fill;
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
/**
|
|
@@ -196,7 +196,7 @@ export default function App() {
|
|
|
196
196
|
<Desc>text类型</Desc>
|
|
197
197
|
<TabBar
|
|
198
198
|
list={data}
|
|
199
|
-
|
|
199
|
+
active={activeTab1}
|
|
200
200
|
onChange={(key) => {
|
|
201
201
|
setActiveTab1(key);
|
|
202
202
|
}}
|
|
@@ -207,7 +207,7 @@ export default function App() {
|
|
|
207
207
|
<Desc>icon类型</Desc>
|
|
208
208
|
<TabBar
|
|
209
209
|
list={iconData}
|
|
210
|
-
|
|
210
|
+
active={activeTab2}
|
|
211
211
|
onChange={(key) => {
|
|
212
212
|
setActiveTab2(key);
|
|
213
213
|
}}
|
|
@@ -218,7 +218,7 @@ export default function App() {
|
|
|
218
218
|
<Desc>text + badge 类型</Desc>
|
|
219
219
|
<TabBar
|
|
220
220
|
list={badgeData}
|
|
221
|
-
|
|
221
|
+
active={activeTab3}
|
|
222
222
|
onChange={(key) => {
|
|
223
223
|
setActiveTab3(key);
|
|
224
224
|
}}
|
|
@@ -230,7 +230,7 @@ export default function App() {
|
|
|
230
230
|
<Desc>icon + badge 类型</Desc>
|
|
231
231
|
<TabBar
|
|
232
232
|
list={badgeIconData}
|
|
233
|
-
|
|
233
|
+
active={activeTab4}
|
|
234
234
|
onChange={(key) => {
|
|
235
235
|
setActiveTab4(key);
|
|
236
236
|
}}
|
|
@@ -242,7 +242,7 @@ export default function App() {
|
|
|
242
242
|
<Desc>自定义类型</Desc>
|
|
243
243
|
<TabBar
|
|
244
244
|
list={iconData}
|
|
245
|
-
|
|
245
|
+
active={activeTab5}
|
|
246
246
|
onChange={(key) => {
|
|
247
247
|
setActiveTab5(key);
|
|
248
248
|
}}
|
|
@@ -262,7 +262,7 @@ export default function App() {
|
|
|
262
262
|
<Desc>自定义文字类型</Desc>
|
|
263
263
|
<TabBar
|
|
264
264
|
list={customTextData}
|
|
265
|
-
|
|
265
|
+
active={activeTab6}
|
|
266
266
|
onChange={(key) => {
|
|
267
267
|
setActiveTab6(key);
|
|
268
268
|
}}
|