@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
|
@@ -10,14 +10,15 @@ import BaseDemo from "!!raw-loader!../demo/index.tsx";
|
|
|
10
10
|
|
|
11
11
|
### Props
|
|
12
12
|
|
|
13
|
-
| 属性 | 描述 | 类型 | 默认值
|
|
14
|
-
| --------------- | ---------------- | -------------------- |
|
|
15
|
-
| list | 底部导航数据列表 | DataType[] | `[]`
|
|
16
|
-
| customTabBar | 自定义tab | DataType |
|
|
17
|
-
| type | 类型 | "text" | "icon" | text
|
|
18
|
-
|
|
|
19
|
-
|
|
|
20
|
-
|
|
|
13
|
+
| 属性 | 描述 | 类型 | 默认值 |
|
|
14
|
+
| --------------- | ---------------- | -------------------- | --------- |
|
|
15
|
+
| list | 底部导航数据列表 | DataType[] | `[]` |
|
|
16
|
+
| customTabBar | 自定义tab | DataType | |
|
|
17
|
+
| type | 类型 | "text" | "icon" | text |
|
|
18
|
+
| active | active tab key | string | |
|
|
19
|
+
| value | 当前的状态 | boolean | undefined |
|
|
20
|
+
| badge | 是否需要badge | boolean | false |
|
|
21
|
+
| containerStyles | 容器样式 | any | |
|
|
21
22
|
|
|
22
23
|
### Events
|
|
23
24
|
|
|
@@ -5,7 +5,8 @@ export interface RedsTabBar {
|
|
|
5
5
|
list: DataType[];
|
|
6
6
|
customTabBar?: DataType;
|
|
7
7
|
type: "text" | "icon";
|
|
8
|
-
|
|
8
|
+
active: string;
|
|
9
|
+
value?: boolean;
|
|
9
10
|
badge?: boolean;
|
|
10
11
|
containerStyles?: any;
|
|
11
12
|
onChange?: (value: string) => any;
|
|
@@ -34,5 +35,6 @@ export interface RedsTabBarEvent {}
|
|
|
34
35
|
export const TabBarDefaultProps = {
|
|
35
36
|
list: [] as DataType[],
|
|
36
37
|
type: "text",
|
|
38
|
+
value: undefined,
|
|
37
39
|
badge: false,
|
|
38
40
|
};
|
|
@@ -29,7 +29,7 @@ const sampleListData = [
|
|
|
29
29
|
|
|
30
30
|
describe("TabBar", () => {
|
|
31
31
|
it("should render correctly with text tabs", () => {
|
|
32
|
-
const { getByText } = render(<TabBar list={sampleListData}
|
|
32
|
+
const { getByText } = render(<TabBar list={sampleListData} active="1" type="text" />);
|
|
33
33
|
|
|
34
34
|
// 检查渲染是否正确
|
|
35
35
|
expect(getByText("Tab 1")).toBeTruthy();
|
|
@@ -37,7 +37,7 @@ describe("TabBar", () => {
|
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
it("should render correctly with icon tabs", () => {
|
|
40
|
-
const { getByText } = render(<TabBar list={sampleListData}
|
|
40
|
+
const { getByText } = render(<TabBar list={sampleListData} active="1" type="icon" />);
|
|
41
41
|
|
|
42
42
|
// 检查渲染是否正确
|
|
43
43
|
expect(getByText("Tab 1")).toBeTruthy();
|
|
@@ -46,7 +46,7 @@ describe("TabBar", () => {
|
|
|
46
46
|
|
|
47
47
|
it("should call handleTabChange on tab click", () => {
|
|
48
48
|
const handleChange = vi.fn();
|
|
49
|
-
const { getByText } = render(<TabBar list={sampleListData}
|
|
49
|
+
const { getByText } = render(<TabBar list={sampleListData} active="1" type="icon" onChange={handleChange} />);
|
|
50
50
|
|
|
51
51
|
fireEvent.press(getByText("Tab 2"));
|
|
52
52
|
expect(handleChange).toHaveBeenCalledWith("2");
|
|
@@ -54,7 +54,7 @@ describe("TabBar", () => {
|
|
|
54
54
|
|
|
55
55
|
it("should calculate text class correctly", () => {
|
|
56
56
|
const { getByText } = render(
|
|
57
|
-
<TabBar list={sampleListData}
|
|
57
|
+
<TabBar list={sampleListData} active="1" type="text" containerStyles={tabBarContainer} />,
|
|
58
58
|
);
|
|
59
59
|
|
|
60
60
|
expect(getByText("Tab 1").props.style[0]).toBeTruthy();
|
|
@@ -62,14 +62,14 @@ describe("TabBar", () => {
|
|
|
62
62
|
});
|
|
63
63
|
|
|
64
64
|
it("should calculate text color correctly", () => {
|
|
65
|
-
const { getByText } = render(<TabBar list={sampleListData}
|
|
65
|
+
const { getByText } = render(<TabBar list={sampleListData} active="1" type="text" />);
|
|
66
66
|
|
|
67
67
|
expect(getByText("Tab 1").props.style[1]).toEqual({ color: "red" });
|
|
68
68
|
expect(getByText("Tab 2").props.style[1]).toEqual({ color: "gray" });
|
|
69
69
|
});
|
|
70
70
|
|
|
71
71
|
it("should calculate icon color correctly", () => {
|
|
72
|
-
const { getByText } = render(<TabBar list={sampleListData}
|
|
72
|
+
const { getByText } = render(<TabBar list={sampleListData} active="1" type="icon" />);
|
|
73
73
|
expect(getByText("Tab 1").props.style[1]?.color).toEqual("red");
|
|
74
74
|
});
|
|
75
75
|
|
|
@@ -77,7 +77,7 @@ describe("TabBar", () => {
|
|
|
77
77
|
const { getByText } = render(
|
|
78
78
|
<TabBar
|
|
79
79
|
list={sampleListData}
|
|
80
|
-
|
|
80
|
+
active="1"
|
|
81
81
|
customTabBar={{ text: "Custom", key: "custom", iconProps: { icon: Star } }}
|
|
82
82
|
type="icon"
|
|
83
83
|
/>,
|
|
@@ -115,7 +115,13 @@ const Tabs = (props: RedsTab) => {
|
|
|
115
115
|
*/
|
|
116
116
|
|
|
117
117
|
const BadgeContainer = (badgeProps: { badgeProps: BadgeType.RedsBadge; key: string; children: React.ReactNode }) => {
|
|
118
|
-
return props?.badge ?
|
|
118
|
+
return props?.badge ? (
|
|
119
|
+
<Badge {...badgeProps.badgeProps}>
|
|
120
|
+
<View style={[styles.flexCenter, { height: "100%" }]}>{badgeProps.children}</View>
|
|
121
|
+
</Badge>
|
|
122
|
+
) : (
|
|
123
|
+
badgeProps.children
|
|
124
|
+
);
|
|
119
125
|
};
|
|
120
126
|
|
|
121
127
|
useEffect(() => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
-
import { Text, StyleSheet, ScrollView } from "react-native";
|
|
2
|
+
import { Text, StyleSheet, ScrollView, View } from "react-native";
|
|
3
3
|
import { Tab, TabType, Tabs } from "@xhs/reds-rn-next";
|
|
4
4
|
import { Add } from "@xhs/reder-icon-svg";
|
|
5
5
|
|
|
@@ -207,7 +207,9 @@ export default function App() {
|
|
|
207
207
|
{data.map((item, index) => {
|
|
208
208
|
return (
|
|
209
209
|
<Tab name={item.name} value={item.key}>
|
|
210
|
-
<
|
|
210
|
+
<View style={{ backgroundColor: "pink", height: 100, width: "100%" }}>
|
|
211
|
+
<Text>内容{index}</Text>
|
|
212
|
+
</View>
|
|
211
213
|
</Tab>
|
|
212
214
|
);
|
|
213
215
|
})}
|
|
@@ -218,7 +220,9 @@ export default function App() {
|
|
|
218
220
|
{data.map((item, index) => {
|
|
219
221
|
return (
|
|
220
222
|
<Tab name={item.name} value={item.key}>
|
|
221
|
-
<
|
|
223
|
+
<View style={{ backgroundColor: "pink", height: 100, width: "100%" }}>
|
|
224
|
+
<Text>内容{index}</Text>
|
|
225
|
+
</View>
|
|
222
226
|
</Tab>
|
|
223
227
|
);
|
|
224
228
|
})}
|
|
@@ -229,7 +233,9 @@ export default function App() {
|
|
|
229
233
|
{data.map((item, index) => {
|
|
230
234
|
return (
|
|
231
235
|
<Tab name={item.name} value={item.key}>
|
|
232
|
-
<
|
|
236
|
+
<View style={{ backgroundColor: "pink", height: 100, width: "100%" }}>
|
|
237
|
+
<Text>内容{index}</Text>
|
|
238
|
+
</View>
|
|
233
239
|
</Tab>
|
|
234
240
|
);
|
|
235
241
|
})}
|
|
@@ -240,7 +246,9 @@ export default function App() {
|
|
|
240
246
|
{data.map((item, index) => {
|
|
241
247
|
return (
|
|
242
248
|
<Tab name={item.name} value={item.key}>
|
|
243
|
-
<
|
|
249
|
+
<View style={{ backgroundColor: "pink", height: 100, width: "100%" }}>
|
|
250
|
+
<Text>内容{index}</Text>
|
|
251
|
+
</View>
|
|
244
252
|
</Tab>
|
|
245
253
|
);
|
|
246
254
|
})}
|
|
@@ -257,7 +265,9 @@ export default function App() {
|
|
|
257
265
|
{iconData.map((item, index) => {
|
|
258
266
|
return (
|
|
259
267
|
<Tab name={item.name} value={item.key} iconProps={item.iconProps}>
|
|
260
|
-
<
|
|
268
|
+
<View style={{ backgroundColor: "pink", height: 100, width: "100%" }}>
|
|
269
|
+
<Text>内容{index}</Text>
|
|
270
|
+
</View>
|
|
261
271
|
</Tab>
|
|
262
272
|
);
|
|
263
273
|
})}
|
|
@@ -274,7 +284,9 @@ export default function App() {
|
|
|
274
284
|
{iconData.map((item, index) => {
|
|
275
285
|
return (
|
|
276
286
|
<Tab name={item.name} value={item.key} iconProps={item.iconProps}>
|
|
277
|
-
<
|
|
287
|
+
<View style={{ backgroundColor: "pink", height: 100, width: "100%" }}>
|
|
288
|
+
<Text>内容{index}</Text>
|
|
289
|
+
</View>
|
|
278
290
|
</Tab>
|
|
279
291
|
);
|
|
280
292
|
})}
|
|
@@ -291,7 +303,9 @@ export default function App() {
|
|
|
291
303
|
{numberData.map((item, index) => {
|
|
292
304
|
return (
|
|
293
305
|
<Tab name={item.name} value={item.key} labelNumber={item.labelNumber}>
|
|
294
|
-
<
|
|
306
|
+
<View style={{ backgroundColor: "pink", height: 100, width: "100%" }}>
|
|
307
|
+
<Text>内容{index}</Text>
|
|
308
|
+
</View>
|
|
295
309
|
</Tab>
|
|
296
310
|
);
|
|
297
311
|
})}
|
|
@@ -302,7 +316,9 @@ export default function App() {
|
|
|
302
316
|
{badgeData1.map((item, index) => {
|
|
303
317
|
return (
|
|
304
318
|
<Tab name={item.name} value={item.key} badgeProps={item.badgeProps}>
|
|
305
|
-
<
|
|
319
|
+
<View style={{ backgroundColor: "pink", height: 100, width: "100%" }}>
|
|
320
|
+
<Text>内容{index}</Text>
|
|
321
|
+
</View>
|
|
306
322
|
</Tab>
|
|
307
323
|
);
|
|
308
324
|
})}
|
|
@@ -313,7 +329,9 @@ export default function App() {
|
|
|
313
329
|
return (
|
|
314
330
|
// @ts-expect-error
|
|
315
331
|
<Tab name={item.name} value={item.key} badgeProps={item.badgeProps}>
|
|
316
|
-
<
|
|
332
|
+
<View style={{ backgroundColor: "pink", height: 100, width: "100%" }}>
|
|
333
|
+
<Text>内容{index}</Text>
|
|
334
|
+
</View>
|
|
317
335
|
</Tab>
|
|
318
336
|
);
|
|
319
337
|
})}
|
|
@@ -324,7 +342,9 @@ export default function App() {
|
|
|
324
342
|
{leftData.map((item, index) => {
|
|
325
343
|
return (
|
|
326
344
|
<Tab name={item.name} value={item.key}>
|
|
327
|
-
<
|
|
345
|
+
<View style={{ backgroundColor: "pink", height: 100, width: "100%" }}>
|
|
346
|
+
<Text>内容{index}</Text>
|
|
347
|
+
</View>
|
|
328
348
|
</Tab>
|
|
329
349
|
);
|
|
330
350
|
})}
|
|
@@ -341,7 +361,9 @@ export default function App() {
|
|
|
341
361
|
{leftData.map((item, index) => {
|
|
342
362
|
return (
|
|
343
363
|
<Tab name={item.name} value={item.key}>
|
|
344
|
-
<
|
|
364
|
+
<View style={{ backgroundColor: "pink", height: 100, width: "100%" }}>
|
|
365
|
+
<Text>内容{index}</Text>
|
|
366
|
+
</View>
|
|
345
367
|
</Tab>
|
|
346
368
|
);
|
|
347
369
|
})}
|
|
@@ -358,7 +380,9 @@ export default function App() {
|
|
|
358
380
|
{leftData.map((item, index) => {
|
|
359
381
|
return (
|
|
360
382
|
<Tab name={item.name} value={item.key}>
|
|
361
|
-
<
|
|
383
|
+
<View style={{ backgroundColor: "pink", height: 100, width: "100%" }}>
|
|
384
|
+
<Text>内容{index}</Text>
|
|
385
|
+
</View>
|
|
362
386
|
</Tab>
|
|
363
387
|
);
|
|
364
388
|
})}
|
|
@@ -369,7 +393,9 @@ export default function App() {
|
|
|
369
393
|
{data.map((item, index) => {
|
|
370
394
|
return (
|
|
371
395
|
<Tab name={item.name} value={item.key}>
|
|
372
|
-
<
|
|
396
|
+
<View style={{ backgroundColor: "pink", height: 100, width: "100%" }}>
|
|
397
|
+
<Text>内容{index}</Text>
|
|
398
|
+
</View>
|
|
373
399
|
</Tab>
|
|
374
400
|
);
|
|
375
401
|
})}
|
|
@@ -385,7 +411,9 @@ export default function App() {
|
|
|
385
411
|
{iconData.map((item, index) => {
|
|
386
412
|
return (
|
|
387
413
|
<Tab name={item.name} value={item.key} iconProps={item.iconProps}>
|
|
388
|
-
<
|
|
414
|
+
<View style={{ backgroundColor: "pink", height: 100, width: "100%" }}>
|
|
415
|
+
<Text>内容{index}</Text>
|
|
416
|
+
</View>
|
|
389
417
|
</Tab>
|
|
390
418
|
);
|
|
391
419
|
})}
|
|
@@ -395,7 +423,9 @@ export default function App() {
|
|
|
395
423
|
{badgeData1.map((item, index) => {
|
|
396
424
|
return (
|
|
397
425
|
<Tab name={item.name} value={item.key} badgeProps={item.badgeProps}>
|
|
398
|
-
<
|
|
426
|
+
<View style={{ backgroundColor: "pink", height: 100, width: "100%" }}>
|
|
427
|
+
<Text>内容{index}</Text>
|
|
428
|
+
</View>
|
|
399
429
|
</Tab>
|
|
400
430
|
);
|
|
401
431
|
})}
|
|
@@ -406,7 +436,9 @@ export default function App() {
|
|
|
406
436
|
{data.map((item, index) => {
|
|
407
437
|
return (
|
|
408
438
|
<Tab name={item.name} value={item.key}>
|
|
409
|
-
<
|
|
439
|
+
<View style={{ backgroundColor: "pink", height: 100, width: "100%" }}>
|
|
440
|
+
<Text>内容{index}</Text>
|
|
441
|
+
</View>
|
|
410
442
|
</Tab>
|
|
411
443
|
);
|
|
412
444
|
})}
|
|
@@ -422,7 +454,9 @@ export default function App() {
|
|
|
422
454
|
{iconData.map((item, index) => {
|
|
423
455
|
return (
|
|
424
456
|
<Tab name={item.name} value={item.key} iconProps={item.iconProps}>
|
|
425
|
-
<
|
|
457
|
+
<View style={{ backgroundColor: "pink", height: 100, width: "100%" }}>
|
|
458
|
+
<Text>内容{index}</Text>
|
|
459
|
+
</View>
|
|
426
460
|
</Tab>
|
|
427
461
|
);
|
|
428
462
|
})}
|
|
@@ -432,7 +466,9 @@ export default function App() {
|
|
|
432
466
|
{badgeData1.map((item, index) => {
|
|
433
467
|
return (
|
|
434
468
|
<Tab name={item.name} value={item.key} badgeProps={item.badgeProps}>
|
|
435
|
-
<
|
|
469
|
+
<View style={{ backgroundColor: "pink", height: 100, width: "100%" }}>
|
|
470
|
+
<Text>内容{index}</Text>
|
|
471
|
+
</View>
|
|
436
472
|
</Tab>
|
|
437
473
|
);
|
|
438
474
|
})}
|
|
@@ -122,7 +122,7 @@ export const getRedsDropDownVariantStyles = () => {
|
|
|
122
122
|
description: { color: themeColor.Description },
|
|
123
123
|
},
|
|
124
124
|
backgroundColor: {
|
|
125
|
-
bg: { backgroundColor: themeColor.
|
|
125
|
+
bg: { backgroundColor: themeColor.Fill1 },
|
|
126
126
|
description: { backgroundColor: themeColor.Description },
|
|
127
127
|
fill5: { backgroundColor: themeColor.Fill5 },
|
|
128
128
|
fill1: { backgroundColor: themeColor.Fill1 },
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { describe } from "vitest";
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import { redsBench } from "~root/utils/redsBench";
|
|
5
|
+
import { BaseTag } from "@xhs/spectrum";
|
|
6
|
+
import { render, fireEvent } from "@testing-library/react-native";
|
|
7
|
+
import { Text, Dimensions } from "react-native";
|
|
8
|
+
|
|
9
|
+
describe("render", () => {
|
|
10
|
+
redsBench("base", async () => {
|
|
11
|
+
render(<BaseTag type="Filled">主标签</BaseTag>);
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { describe } from "vitest";
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import { redsBench } from "~root/utils/redsBench";
|
|
5
|
+
import { Toast } from "@xhs/spectrum";
|
|
6
|
+
import { render, fireEvent } from "@testing-library/react-native";
|
|
7
|
+
import { Text, Dimensions } from "react-native";
|
|
8
|
+
|
|
9
|
+
describe("render", () => {
|
|
10
|
+
redsBench("base", async () => {
|
|
11
|
+
Toast.show({ message: "失败提示", type: "fail" });
|
|
12
|
+
});
|
|
13
|
+
});
|
package/vitest.config.ts
CHANGED
|
@@ -9,6 +9,7 @@ export default defineConfig({
|
|
|
9
9
|
watch: false,
|
|
10
10
|
exclude: [...configDefaults.exclude, "**/lib/**"],
|
|
11
11
|
alias: {
|
|
12
|
+
"@xhs/spectrum": path.join(__dirname, "./lib/esm/index.js"),
|
|
12
13
|
"@xhs/reds-rn-next": path.join(__dirname, "./lib/esm/index.js"),
|
|
13
14
|
"~root": path.join(__dirname, "../../"),
|
|
14
15
|
},
|
|
@@ -18,4 +19,8 @@ export default defineConfig({
|
|
|
18
19
|
exclude: [...configDefaults.exclude, "**/lib/**", "**/test/**", "**/demo/**", "**/doc/**"],
|
|
19
20
|
},
|
|
20
21
|
},
|
|
22
|
+
server: {
|
|
23
|
+
host: "0.0.0.0",
|
|
24
|
+
port: 3000,
|
|
25
|
+
},
|
|
21
26
|
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"C61-qTj5.js","sources":["../../../src/components/ConfigProvider/interface/index.ts"],"sourcesContent":["type ColorMode = \"light\" | \"dark\";\ntype Component = \"Button\" | \"Popover\" | \"Text\" | \"Tag\" | \"Switch\" | \"Toast\";\n\ntype ComponentsToken = {\n [K in Component]?: {\n lightColor?: Record<string, string>;\n darkColor?: Record<string, string>;\n alwaysColor?: Record<string, string>;\n };\n};\n\ninterface IThemeConfig {\n token?: {\n lightColor?: Record<string, string>;\n darkColor?: Record<string, string>;\n alwaysColor?: Record<string, string>;\n components?: ComponentsToken;\n };\n inherit?: boolean;\n colorMode?: ColorMode;\n}\n\nexport interface ConfigProviderProps {\n id?: string;\n children: React.ReactNode;\n theme?: IThemeConfig;\n parentId?: string;\n}\nexport interface RedsConfigProvider {\n id?: string;\n parentId?: string;\n theme?: IThemeConfig;\n colorMode?: string;\n inherit?: boolean;\n token: Object;\n}\n\nexport interface RedsConfigProviderEvent {}\nexport const defaultProps: RedsConfigProvider = {\n id: \"root\",\n parentId: \"root\",\n theme: {\n colorMode: \"light\",\n inherit: true,\n token: {\n lightColor: {},\n darkColor: {},\n alwaysColor: {},\n },\n },\n colorMode: \"light\",\n inherit: true,\n token: {},\n};\nexport const ConfigProviderDefaultProps = {\n id: \"root\",\n parentId: \"root\",\n theme: {\n colorMode: \"light\",\n inherit: true,\n token: {\n lightColor: {},\n darkColor: {},\n alwaysColor: {},\n },\n },\n colorMode: \"light\",\n inherit: true,\n token: {},\n};\n"],"names":["defaultProps","id","parentId","theme","colorMode","inherit","token","lightColor","darkColor","alwaysColor","ConfigProviderDefaultProps"],"mappings":";;AAsCO,IAAMA,YAAmC,GAAA;AAC9CC,EAAAA,EAAI,EAAA,MAAA;AACJC,EAAAA,QAAU,EAAA,MAAA;AACVC,EAAAA,KAAO,EAAA;AACLC,IAAAA,SAAW,EAAA,OAAA;AACXC,IAAAA,OAAS,EAAA,IAAA;AACTC,IAAAA,KAAO,EAAA;MACLC,YAAY,EAAC;MACbC,WAAW,EAAC;AACZC,MAAAA,aAAa,EAAC;AAChB,KAAA;GACF;AACAL,EAAAA,SAAW,EAAA,OAAA;AACXC,EAAAA,OAAS,EAAA,IAAA;AACTC,EAAAA,OAAO,EAAC;AACV,EAAA;AACO,IAAMI,0BAA6B,GAAA;AACxCT,EAAAA,EAAI,EAAA,MAAA;AACJC,EAAAA,QAAU,EAAA,MAAA;AACVC,EAAAA,KAAO,EAAA;AACLC,IAAAA,SAAW,EAAA,OAAA;AACXC,IAAAA,OAAS,EAAA,IAAA;AACTC,IAAAA,KAAO,EAAA;MACLC,YAAY,EAAC;MACbC,WAAW,EAAC;AACZC,MAAAA,aAAa,EAAC;AAChB,KAAA;GACF;AACAL,EAAAA,SAAW,EAAA,OAAA;AACXC,EAAAA,OAAS,EAAA,IAAA;AACTC,EAAAA,OAAO,EAAC;AACV;;;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"K-GkcnsQ.js","sources":["../../../src/components/TabBar/interface/index.ts"],"sourcesContent":["import { GestureResponderEvent } from \"react-native\";\nimport { lightColor } from \"@xhsreds/reds-token-next\";\nimport { RedsIcon } from \"../../Icon/interface\";\nexport interface RedsTabBar {\n list: DataType[];\n customTabBar?: DataType;\n type: \"text\" | \"icon\";\n activeTab: string;\n badge?: boolean;\n containerStyles?: any;\n onChange?: (value: string) => any;\n}\n\nexport interface RedsBadge {\n content?: number | string;\n color?: string;\n dot?: boolean;\n max?: number | string;\n offset?: [number | string, number | string];\n showZero?: boolean;\n position?: \"topLeft\" | \"centerLeft\" | \"centerRight\" | \"topCenter\" | \"centerCenter\";\n}\n\nexport interface DataType {\n text?: string;\n key: string;\n badgeProps?: RedsBadge;\n iconProps?: RedsIcon;\n activeColor?: string;\n normalColor?: string;\n}\n\nexport interface RedsTabBarEvent {}\nexport const TabBarDefaultProps = {\n list: [] as DataType[],\n type: \"text\",\n badge: false,\n};\n"],"names":["TabBarDefaultProps","list","type","badge"],"mappings":";;AAiCO,IAAMA,kBAAqB,GAAA;AAChCC,EAAAA,MAAM,EAAC;AACPC,EAAAA,IAAM,EAAA,MAAA;AACNC,EAAAA,KAAO,EAAA,KAAA;AACT;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DKABHJAn.js","sources":["../../../src/components/ConfigProvider/interface/index.ts"],"sourcesContent":["type ColorMode = \"light\" | \"dark\";\ntype Component = \"Button\" | \"Popover\" | \"Text\" | \"Tag\" | \"Switch\" | \"Toast\";\n\ntype ComponentsToken = {\n [K in Component]?: {\n lightColor?: Record<string, string>;\n darkColor?: Record<string, string>;\n alwaysColor?: Record<string, string>;\n };\n};\n\ninterface IThemeConfig {\n token?: {\n lightColor?: Record<string, string>;\n darkColor?: Record<string, string>;\n alwaysColor?: Record<string, string>;\n components?: ComponentsToken;\n };\n inherit?: boolean;\n colorMode?: ColorMode;\n}\n\nexport interface ConfigProviderProps {\n id?: string;\n children: React.ReactNode;\n theme?: IThemeConfig;\n parentId?: string;\n}\nexport interface RedsConfigProvider {\n id?: string;\n parentId?: string;\n theme?: IThemeConfig;\n colorMode?: string;\n inherit?: boolean;\n token: Object;\n}\n\nexport interface RedsConfigProviderEvent {}\nexport const defaultProps: RedsConfigProvider = {\n id: \"root\",\n parentId: \"root\",\n theme: {\n colorMode: \"light\",\n inherit: true,\n token: {\n lightColor: {},\n darkColor: {},\n alwaysColor: {},\n },\n },\n colorMode: \"light\",\n inherit: true,\n token: {},\n};\nexport const ConfigProviderDefaultProps = {\n id: \"root\",\n parentId: \"root\",\n theme: {\n colorMode: \"light\",\n inherit: true,\n token: {\n lightColor: {},\n darkColor: {},\n alwaysColor: {},\n },\n },\n colorMode: \"light\",\n inherit: true,\n token: {},\n};\n"],"names":["defaultProps","id","parentId","theme","colorMode","inherit","token","lightColor","darkColor","alwaysColor","ConfigProviderDefaultProps"],"mappings":"AAsCO,IAAMA,YAAmC,GAAA;AAC9CC,EAAAA,EAAI,EAAA,MAAA;AACJC,EAAAA,QAAU,EAAA,MAAA;AACVC,EAAAA,KAAO,EAAA;AACLC,IAAAA,SAAW,EAAA,OAAA;AACXC,IAAAA,OAAS,EAAA,IAAA;AACTC,IAAAA,KAAO,EAAA;MACLC,YAAY,EAAC;MACbC,WAAW,EAAC;AACZC,MAAAA,aAAa,EAAC;AAChB,KAAA;GACF;AACAL,EAAAA,SAAW,EAAA,OAAA;AACXC,EAAAA,OAAS,EAAA,IAAA;AACTC,EAAAA,OAAO,EAAC;AACV,EAAA;AACO,IAAMI,0BAA6B,GAAA;AACxCT,EAAAA,EAAI,EAAA,MAAA;AACJC,EAAAA,QAAU,EAAA,MAAA;AACVC,EAAAA,KAAO,EAAA;AACLC,IAAAA,SAAW,EAAA,OAAA;AACXC,IAAAA,OAAS,EAAA,IAAA;AACTC,IAAAA,KAAO,EAAA;MACLC,YAAY,EAAC;MACbC,WAAW,EAAC;AACZC,MAAAA,aAAa,EAAC;AAChB,KAAA;GACF;AACAL,EAAAA,SAAW,EAAA,OAAA;AACXC,EAAAA,OAAS,EAAA,IAAA;AACTC,EAAAA,OAAO,EAAC;AACV;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DUTFT_ka.js","sources":["../../../src/components/TabBar/interface/index.ts"],"sourcesContent":["import { GestureResponderEvent } from \"react-native\";\nimport { lightColor } from \"@xhsreds/reds-token-next\";\nimport { RedsIcon } from \"../../Icon/interface\";\nexport interface RedsTabBar {\n list: DataType[];\n customTabBar?: DataType;\n type: \"text\" | \"icon\";\n activeTab: string;\n badge?: boolean;\n containerStyles?: any;\n onChange?: (value: string) => any;\n}\n\nexport interface RedsBadge {\n content?: number | string;\n color?: string;\n dot?: boolean;\n max?: number | string;\n offset?: [number | string, number | string];\n showZero?: boolean;\n position?: \"topLeft\" | \"centerLeft\" | \"centerRight\" | \"topCenter\" | \"centerCenter\";\n}\n\nexport interface DataType {\n text?: string;\n key: string;\n badgeProps?: RedsBadge;\n iconProps?: RedsIcon;\n activeColor?: string;\n normalColor?: string;\n}\n\nexport interface RedsTabBarEvent {}\nexport const TabBarDefaultProps = {\n list: [] as DataType[],\n type: \"text\",\n badge: false,\n};\n"],"names":["TabBarDefaultProps","list","type","badge"],"mappings":"AAiCO,IAAMA,kBAAqB,GAAA;AAChCC,EAAAA,MAAM,EAAC;AACPC,EAAAA,IAAM,EAAA,MAAA;AACNC,EAAAA,KAAO,EAAA,KAAA;AACT;;;;;;;;;"}
|