@xhsreds/reds-rn-next 0.10.1-beta202512022142 → 0.10.1-feat-sheets-anim202512041203
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/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-2.json +1 -1
- package/coverage/.tmp/coverage-20.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-32.json +1 -1
- package/coverage/.tmp/coverage-33.json +1 -1
- package/coverage/.tmp/coverage-34.json +1 -1
- package/coverage/.tmp/coverage-35.json +1 -1
- package/coverage/.tmp/coverage-36.json +1 -1
- package/coverage/.tmp/coverage-37.json +1 -1
- package/coverage/.tmp/coverage-38.json +1 -1
- package/coverage/.tmp/coverage-39.json +1 -1
- package/coverage/.tmp/coverage-4.json +1 -1
- package/coverage/.tmp/coverage-40.json +1 -1
- package/coverage/.tmp/coverage-41.json +1 -1
- package/coverage/.tmp/coverage-42.json +1 -1
- package/coverage/.tmp/coverage-43.json +1 -1
- package/coverage/.tmp/coverage-5.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/{DVfoVjpR.js → 47jfgoRG.js} +4 -2
- package/lib/cjs/_chunks/47jfgoRG.js.map +1 -0
- package/lib/cjs/_chunks/hA3qoGpS.js.map +1 -1
- package/lib/cjs/components/ActionSheets/ActionSheets.js +1 -1
- package/lib/cjs/components/ActionSheets/api.js +1 -1
- package/lib/cjs/components/ActionSheets/hooks.js +1 -1
- package/lib/cjs/components/ActionSheets/index.js +1 -1
- package/lib/cjs/components/ActionablePopover/ActionablePopover.js +2 -2
- package/lib/cjs/components/ActionablePopover/ActionablePopover.js.map +1 -1
- package/lib/cjs/components/Avatar/styles.js +5 -5
- package/lib/cjs/components/Avatar/styles.js.map +1 -1
- package/lib/cjs/components/AvatarGroup/AvatarGroup.js +1 -1
- package/lib/cjs/components/BottomBar/styles.js +1 -1
- package/lib/cjs/components/BottomBar/styles.js.map +1 -1
- package/lib/cjs/components/DatePicker/DatePicker.js +1 -1
- package/lib/cjs/components/DatePicker/api.js +1 -1
- package/lib/cjs/components/DatePicker/index.js +1 -1
- package/lib/cjs/components/Divider/Divider.js +12 -33
- package/lib/cjs/components/Divider/Divider.js.map +1 -1
- package/lib/cjs/components/Divider/index.js +3 -3
- package/lib/cjs/components/Divider/styles.js +30 -36
- package/lib/cjs/components/Divider/styles.js.map +1 -1
- package/lib/cjs/components/Image/Image.js +13 -13
- package/lib/cjs/components/Image/Image.js.map +1 -1
- package/lib/cjs/components/List/ListItem/ListItem.js +2 -4
- package/lib/cjs/components/List/ListItem/ListItem.js.map +1 -1
- package/lib/cjs/components/Picker/Picker.js +1 -1
- package/lib/cjs/components/Picker/api.js +1 -1
- package/lib/cjs/components/Picker/index.js +1 -1
- package/lib/cjs/components/PickerView/Wheel.js +5 -52
- package/lib/cjs/components/PickerView/Wheel.js.map +1 -1
- package/lib/cjs/components/Portal/core/PortalHost.js +1 -3
- package/lib/cjs/components/Portal/core/PortalHost.js.map +1 -1
- package/lib/cjs/components/Radio/Radio.js +4 -4
- package/lib/cjs/components/Radio/Radio.js.map +1 -1
- package/lib/cjs/components/Radio/index.js +1 -1
- package/lib/cjs/components/Radio/styles.js +7 -5
- package/lib/cjs/components/Radio/styles.js.map +1 -1
- package/lib/cjs/components/Sheets/AnimatedSheets.js +14 -8
- package/lib/cjs/components/Sheets/AnimatedSheets.js.map +1 -1
- package/lib/cjs/components/Sheets/Sheets.js +1 -1
- package/lib/cjs/components/Sheets/api.js +1 -1
- package/lib/cjs/components/Sheets/index.js +1 -1
- package/lib/cjs/components/Sheets/interface/index.js +1 -1
- package/lib/cjs/components/Slider/Slider.js +34 -74
- package/lib/cjs/components/Slider/Slider.js.map +1 -1
- package/lib/cjs/components/Stepper/Stepper.js +1 -1
- package/lib/cjs/components/Stepper/Stepper.js.map +1 -1
- package/lib/cjs/components/Stepper/styles.js +2 -2
- package/lib/cjs/components/Stepper/styles.js.map +1 -1
- package/lib/cjs/components/TextView/TextView.js +3 -6
- package/lib/cjs/components/TextView/TextView.js.map +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/esm/_chunks/C0MWVrjO.js.map +1 -1
- package/lib/esm/_chunks/{C4jyXYEi.js → DMjPllnU.js} +4 -2
- package/lib/esm/_chunks/DMjPllnU.js.map +1 -0
- package/lib/esm/components/ActionSheets/ActionSheets.js +1 -1
- package/lib/esm/components/ActionSheets/api.js +1 -1
- package/lib/esm/components/ActionSheets/hooks.js +1 -1
- package/lib/esm/components/ActionSheets/index.js +1 -1
- package/lib/esm/components/ActionablePopover/ActionablePopover.js +1 -1
- package/lib/esm/components/ActionablePopover/ActionablePopover.js.map +1 -1
- package/lib/esm/components/Avatar/styles.js +5 -5
- package/lib/esm/components/Avatar/styles.js.map +1 -1
- package/lib/esm/components/AvatarGroup/AvatarGroup.js +1 -1
- package/lib/esm/components/BottomBar/styles.js +1 -1
- package/lib/esm/components/BottomBar/styles.js.map +1 -1
- package/lib/esm/components/DatePicker/DatePicker.js +1 -1
- package/lib/esm/components/DatePicker/api.js +1 -1
- package/lib/esm/components/DatePicker/index.js +1 -1
- package/lib/esm/components/Divider/Divider.js +14 -35
- package/lib/esm/components/Divider/Divider.js.map +1 -1
- package/lib/esm/components/Divider/index.js +3 -3
- package/lib/esm/components/Divider/styles.js +30 -36
- package/lib/esm/components/Divider/styles.js.map +1 -1
- package/lib/esm/components/Image/Image.js +13 -13
- package/lib/esm/components/Image/Image.js.map +1 -1
- package/lib/esm/components/List/ListItem/ListItem.js +3 -5
- package/lib/esm/components/List/ListItem/ListItem.js.map +1 -1
- package/lib/esm/components/Picker/Picker.js +1 -1
- package/lib/esm/components/Picker/api.js +1 -1
- package/lib/esm/components/Picker/index.js +1 -1
- package/lib/esm/components/PickerView/Wheel.js +5 -52
- package/lib/esm/components/PickerView/Wheel.js.map +1 -1
- package/lib/esm/components/Portal/core/PortalHost.js +1 -3
- package/lib/esm/components/Portal/core/PortalHost.js.map +1 -1
- package/lib/esm/components/Radio/Radio.js +4 -4
- package/lib/esm/components/Radio/Radio.js.map +1 -1
- package/lib/esm/components/Radio/index.js +1 -1
- package/lib/esm/components/Radio/styles.js +7 -5
- package/lib/esm/components/Radio/styles.js.map +1 -1
- package/lib/esm/components/Sheets/AnimatedSheets.js +14 -8
- package/lib/esm/components/Sheets/AnimatedSheets.js.map +1 -1
- package/lib/esm/components/Sheets/Sheets.js +1 -1
- package/lib/esm/components/Sheets/api.js +1 -1
- package/lib/esm/components/Sheets/index.js +1 -1
- package/lib/esm/components/Sheets/interface/index.js +1 -1
- package/lib/esm/components/Slider/Slider.js +36 -76
- package/lib/esm/components/Slider/Slider.js.map +1 -1
- package/lib/esm/components/Stepper/Stepper.js +1 -1
- package/lib/esm/components/Stepper/Stepper.js.map +1 -1
- package/lib/esm/components/Stepper/styles.js +2 -2
- package/lib/esm/components/Stepper/styles.js.map +1 -1
- package/lib/esm/components/TextView/TextView.js +3 -6
- package/lib/esm/components/TextView/TextView.js.map +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/src/components/BottomBar/styles.d.ts +1 -1
- package/lib/src/components/Divider/styles.d.ts +2 -3
- package/lib/src/components/List/ListItem/ListItem.d.ts +0 -2
- package/lib/src/components/Sheets/Sheets.d.ts +3 -3
- package/lib/src/components/Sheets/interface/index.d.ts +12 -0
- package/lib/src/components/Slider/Slider.d.ts +1 -1
- package/lib/src/components/Stepper/interface/index.d.ts +0 -1
- package/lib/src/components/Stepper/styles.d.ts +2 -2
- package/lib/types/components/BottomBar/styles.d.ts +1 -1
- package/lib/types/components/Divider/styles.d.ts +2 -3
- package/lib/types/components/List/ListItem/ListItem.d.ts +0 -2
- package/lib/types/components/Sheets/Sheets.d.ts +3 -3
- package/lib/types/components/Sheets/interface/index.d.ts +12 -0
- package/lib/types/components/Slider/Slider.d.ts +1 -1
- package/lib/types/components/Stepper/interface/index.d.ts +0 -1
- package/lib/types/components/Stepper/styles.d.ts +2 -2
- package/package.json +2 -2
- package/src/components/ActionablePopover/ActionablePopover.tsx +1 -10
- package/src/components/Avatar/styles.ts +4 -5
- package/src/components/BottomBar/styles.ts +1 -1
- package/src/components/DatePicker/demo/index.tsx +0 -26
- package/src/components/Divider/Divider.tsx +9 -29
- package/src/components/Divider/demo/index.tsx +6 -12
- package/src/components/Divider/styles.ts +30 -33
- package/src/components/Image/Image.tsx +9 -14
- package/src/components/Image/demo/index.tsx +5 -4
- package/src/components/List/ListItem/ListItem.tsx +1 -12
- package/src/components/List/demo/index.tsx +0 -2
- package/src/components/PickerView/Wheel.tsx +0 -50
- package/src/components/Portal/core/PortalHost.tsx +1 -4
- package/src/components/Radio/Radio.tsx +3 -3
- package/src/components/Radio/styles.ts +5 -3
- package/src/components/Sheets/AnimatedSheets.tsx +118 -120
- package/src/components/Sheets/doc/index.mdx +8 -0
- package/src/components/Sheets/interface/index.ts +13 -0
- package/src/components/Slider/Slider.tsx +37 -103
- package/src/components/Slider/demo/index.tsx +0 -18
- package/src/components/Stepper/Stepper.tsx +1 -1
- package/src/components/Stepper/demo/index.tsx +1 -1
- package/src/components/Stepper/doc/index.mdx +0 -1
- package/src/components/Stepper/interface/index.ts +0 -1
- package/src/components/Stepper/styles.ts +2 -2
- package/src/components/TextView/TextView.tsx +3 -6
- package/src/components/TextView/demo/index.tsx +1 -1
- package/src/i18n/@types/resources.d.ts +27 -27
- package/src/i18n/index.json +31 -31
- package/lib/cjs/_chunks/DVfoVjpR.js.map +0 -1
- package/lib/esm/_chunks/C4jyXYEi.js.map +0 -1
|
@@ -37,7 +37,6 @@ export default function App() {
|
|
|
37
37
|
const [value14, setValue14] = useState("2023-10-05-12");
|
|
38
38
|
const [value16, setValue16] = useState("2023-10-05-12-10");
|
|
39
39
|
const [value17, setValue17] = useState("2025-9-15-14-25");
|
|
40
|
-
const [value18, setValue18] = useState("2025-11-20");
|
|
41
40
|
|
|
42
41
|
const [visible1, setVisible1] = useState(false);
|
|
43
42
|
const [visible2, setVisible2] = useState(false);
|
|
@@ -55,7 +54,6 @@ export default function App() {
|
|
|
55
54
|
const [visible14, setVisible14] = useState(false);
|
|
56
55
|
const [visible16, setVisible16] = useState(false);
|
|
57
56
|
const [visible17, setVisible17] = useState(false);
|
|
58
|
-
const [visible18, setVisible18] = useState(false);
|
|
59
57
|
|
|
60
58
|
const { show, remove } = useDatePicker();
|
|
61
59
|
return (
|
|
@@ -331,30 +329,6 @@ export default function App() {
|
|
|
331
329
|
>
|
|
332
330
|
函数式调用
|
|
333
331
|
</Button>
|
|
334
|
-
|
|
335
|
-
<Button
|
|
336
|
-
onClick={() => {
|
|
337
|
-
setVisible18(true);
|
|
338
|
-
}}
|
|
339
|
-
>
|
|
340
|
-
跳动bug
|
|
341
|
-
</Button>
|
|
342
|
-
<DatePicker
|
|
343
|
-
visible={visible18}
|
|
344
|
-
value={value18}
|
|
345
|
-
label={"跳动bug"}
|
|
346
|
-
startTime={"1900-01-01"}
|
|
347
|
-
endTime={"2200-12-31"}
|
|
348
|
-
onConfirm={(val: string) => {
|
|
349
|
-
console.log("onConfirm18", val);
|
|
350
|
-
setValue18(val);
|
|
351
|
-
setVisible18(false);
|
|
352
|
-
}}
|
|
353
|
-
onChange={(val: string) => {
|
|
354
|
-
console.log("onChange18", val);
|
|
355
|
-
}}
|
|
356
|
-
onCancel={() => setVisible18(false)}
|
|
357
|
-
/>
|
|
358
332
|
<View style={{ height: 200 }}></View>
|
|
359
333
|
</ScrollView>
|
|
360
334
|
);
|
|
@@ -1,48 +1,28 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "react";
|
|
2
2
|
import { View, Text } from "react-native";
|
|
3
3
|
import { RedsDivider, DividerDefaultProps } from "./interface";
|
|
4
4
|
import { getStyles } from "./styles";
|
|
5
5
|
import useMounted from "../../pvCount/useUnmountedProcess";
|
|
6
|
-
import { useThemeColor, useThemeTypography } from "../ConfigProvider";
|
|
7
6
|
|
|
8
7
|
const Divider = (props: RedsDivider) => {
|
|
9
|
-
const [textWidth, setTextWidth] = useState(0);
|
|
10
|
-
const [containerWidth, setContainerWidth] = useState(0);
|
|
11
|
-
const themeColor = useThemeColor("Divider");
|
|
12
|
-
const typography = useThemeTypography("Divider");
|
|
13
8
|
useMounted("Divider");
|
|
14
9
|
const finalProps: RedsDivider = {
|
|
15
10
|
...DividerDefaultProps,
|
|
16
11
|
...props,
|
|
17
|
-
direction:
|
|
18
|
-
orientation:
|
|
12
|
+
direction: props.direction as RedsDivider["direction"],
|
|
13
|
+
orientation: props.orientation as RedsDivider["orientation"],
|
|
19
14
|
};
|
|
20
15
|
|
|
21
|
-
const styles =
|
|
22
|
-
|
|
23
|
-
}, [textWidth, containerWidth, themeColor, typography]);
|
|
24
|
-
|
|
25
|
-
const handleLayout = (e: any) => {
|
|
26
|
-
setTextWidth(e.nativeEvent.layout.width);
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const handlerContainerWidth = (e: any) => {
|
|
30
|
-
setContainerWidth(e.nativeEvent.layout.width);
|
|
31
|
-
};
|
|
16
|
+
const styles = getStyles(finalProps);
|
|
17
|
+
const isPrimary = finalProps.direction === "primary" || finalProps.direction === "secondary";
|
|
32
18
|
|
|
33
19
|
return (
|
|
34
|
-
<View style={[styles.divider, styles[finalProps.direction!]]}
|
|
20
|
+
<View style={[styles.divider, styles[finalProps.direction!]]}>
|
|
35
21
|
{finalProps.orientation && finalProps.direction !== "vertical" && (
|
|
36
22
|
<View style={styles.textContainer}>
|
|
37
|
-
<View style={styles.before} />
|
|
38
|
-
{props.children
|
|
39
|
-
|
|
40
|
-
{props.children}
|
|
41
|
-
</Text>
|
|
42
|
-
) : (
|
|
43
|
-
<Text style={styles.noTextBorderStyle}></Text>
|
|
44
|
-
)}
|
|
45
|
-
<View style={styles.after} />
|
|
23
|
+
{isPrimary && <View style={styles.before} />}
|
|
24
|
+
{props.children && <Text style={styles.text}>{props.children}</Text>}
|
|
25
|
+
{isPrimary && <View style={styles.after} />}
|
|
46
26
|
</View>
|
|
47
27
|
)}
|
|
48
28
|
</View>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
-
import { View, Text, StyleSheet
|
|
2
|
+
import { View, Text, StyleSheet } from "react-native";
|
|
3
3
|
import { Divider } from "@xhs/reds-rn-next";
|
|
4
4
|
|
|
5
5
|
const styles = StyleSheet.create({
|
|
@@ -21,29 +21,23 @@ const Br = (props: { height?: number }) => <View style={{ height: props.height |
|
|
|
21
21
|
|
|
22
22
|
export default function App() {
|
|
23
23
|
return (
|
|
24
|
-
<
|
|
25
|
-
<Br />
|
|
26
|
-
<Br />
|
|
24
|
+
<View>
|
|
27
25
|
<Desc>默认用法</Desc>
|
|
28
26
|
<Divider>测试</Divider>
|
|
29
27
|
<Br />
|
|
30
|
-
<Desc>direction
|
|
28
|
+
<Desc>direction 类型用法</Desc>
|
|
31
29
|
<Divider direction="primary" orientation={"center"}>
|
|
32
30
|
测试
|
|
33
31
|
</Divider>
|
|
34
32
|
<Br />
|
|
35
|
-
<
|
|
36
|
-
<Divider direction="secondary" orientation={"center"}>
|
|
37
|
-
测试
|
|
38
|
-
</Divider>
|
|
33
|
+
<Divider direction="secondary">测试 </Divider>
|
|
39
34
|
<Br />
|
|
40
35
|
|
|
41
|
-
<Desc>direction="vertical"</Desc>
|
|
42
36
|
<View style={styles.itemBox}>
|
|
43
37
|
<Divider direction="vertical">测试</Divider>
|
|
44
38
|
</View>
|
|
45
|
-
<Desc>direction="horizontal"</Desc>
|
|
46
39
|
<Divider direction="horizontal">测试</Divider>
|
|
40
|
+
<Divider direction="horizontal"></Divider>
|
|
47
41
|
<Br />
|
|
48
42
|
<Br />
|
|
49
43
|
|
|
@@ -73,6 +67,6 @@ export default function App() {
|
|
|
73
67
|
<Desc>margin 数组:horizontal / [上下,左右] vertical / [左右]</Desc>
|
|
74
68
|
<Divider margin={[10, 20]} stroke={2} direction="horizontal" />
|
|
75
69
|
<Divider margin={[10, 0]} stroke={2} direction="vertical" />
|
|
76
|
-
</
|
|
70
|
+
</View>
|
|
77
71
|
);
|
|
78
72
|
}
|
|
@@ -1,30 +1,38 @@
|
|
|
1
1
|
import { StyleSheet, ViewStyle, TextStyle, DimensionValue } from "react-native";
|
|
2
2
|
import { RedsDivider, DividerDefaultProps } from "./interface";
|
|
3
|
+
import { useThemeColor, useThemeTypography } from "../ConfigProvider";
|
|
3
4
|
|
|
4
5
|
const baseDivider: ViewStyle = {
|
|
5
6
|
position: "relative",
|
|
6
7
|
};
|
|
7
8
|
|
|
8
|
-
const
|
|
9
|
+
const baseText: TextStyle = {
|
|
10
|
+
paddingVertical: 0,
|
|
11
|
+
paddingHorizontal: 16,
|
|
12
|
+
position: "absolute",
|
|
13
|
+
backgroundColor: "#fff",
|
|
14
|
+
lineHeight: 18,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const getStyles = (p: RedsDivider) => {
|
|
9
18
|
const props = { ...DividerDefaultProps, ...p };
|
|
19
|
+
const themeColor = useThemeColor("Divider");
|
|
20
|
+
const typography = useThemeTypography("Divider");
|
|
10
21
|
const isHorizontal = props.direction === "horizontal";
|
|
11
|
-
const hasTextContent = p.children;
|
|
12
|
-
|
|
13
|
-
const remainingWidth = containerWidth - textWidth;
|
|
14
|
-
|
|
15
22
|
const beforeAfterCommon: ViewStyle = {
|
|
16
23
|
borderStyle: "solid",
|
|
17
|
-
borderTopWidth:
|
|
24
|
+
borderTopWidth: 0.5,
|
|
18
25
|
borderColor: props.color || themeColor.Separator2,
|
|
26
|
+
width: 8,
|
|
19
27
|
};
|
|
20
28
|
|
|
21
29
|
const dividerStyle: ViewStyle = {
|
|
22
30
|
...baseDivider,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
31
|
+
borderBottomWidth: isHorizontal ? (props.stroke ? props.stroke : StyleSheet.hairlineWidth) : 0,
|
|
32
|
+
borderLeftWidth: isHorizontal ? 0 : props.stroke ? props.stroke : StyleSheet.hairlineWidth,
|
|
33
|
+
borderBottomColor: isHorizontal ? props.color || themeColor.Separator2 : undefined,
|
|
34
|
+
borderLeftColor: isHorizontal ? undefined : props.color || themeColor.Separator2,
|
|
35
|
+
borderStyle: "solid",
|
|
28
36
|
marginVertical: (props.margin && props.margin[0] && Number(props.margin[0])) || (isHorizontal ? 20 : 0),
|
|
29
37
|
marginHorizontal: (props.margin && props.margin[1] && Number(props.margin[1])) || (isHorizontal ? 0 : 12),
|
|
30
38
|
marginLeft:
|
|
@@ -39,11 +47,17 @@ const getStyles = (p: RedsDivider, textWidth: number, containerWidth: number, th
|
|
|
39
47
|
width: (isHorizontal ? props.size : "auto") as DimensionValue,
|
|
40
48
|
};
|
|
41
49
|
|
|
42
|
-
const textContainer:
|
|
50
|
+
const textContainer: TextStyle = {
|
|
51
|
+
paddingVertical: 0,
|
|
52
|
+
paddingHorizontal: 16,
|
|
53
|
+
position: "absolute",
|
|
54
|
+
lineHeight: 18,
|
|
55
|
+
left: props.orientation === "left" ? 24 : undefined,
|
|
56
|
+
right: props.orientation === "right" ? 24 : undefined,
|
|
57
|
+
alignSelf: props.orientation === "center" ? "center" : undefined,
|
|
43
58
|
flexDirection: "row",
|
|
44
59
|
alignItems: "center",
|
|
45
|
-
|
|
46
|
-
// 移除 position absolute,改为正常布局
|
|
60
|
+
top: (isHorizontal && -9) || 0,
|
|
47
61
|
};
|
|
48
62
|
|
|
49
63
|
const textStyle: TextStyle = {
|
|
@@ -64,29 +78,13 @@ const getStyles = (p: RedsDivider, textWidth: number, containerWidth: number, th
|
|
|
64
78
|
|
|
65
79
|
const beforeStyle: ViewStyle = {
|
|
66
80
|
...beforeAfterCommon,
|
|
67
|
-
marginRight:
|
|
68
|
-
...(isHorizontal
|
|
69
|
-
? props.orientation === "center"
|
|
70
|
-
? { flex: 1 }
|
|
71
|
-
: { width: props.orientation === "left" ? remainingWidth * 0.15 : remainingWidth * 0.85 }
|
|
72
|
-
: { width: 8 }),
|
|
81
|
+
marginRight: 8,
|
|
73
82
|
borderColor: props.direction === "secondary" ? "rgba(51, 51, 51, .3)" : props.color || themeColor.Separator2,
|
|
74
83
|
};
|
|
75
84
|
|
|
76
85
|
const afterStyle: ViewStyle = {
|
|
77
86
|
...beforeAfterCommon,
|
|
78
|
-
marginLeft:
|
|
79
|
-
...(isHorizontal
|
|
80
|
-
? props.orientation === "center"
|
|
81
|
-
? { flex: 1 }
|
|
82
|
-
: { width: props.orientation === "right" ? remainingWidth * 0.15 : remainingWidth * 0.85 }
|
|
83
|
-
: { width: 8 }),
|
|
84
|
-
borderColor: props.direction === "secondary" ? "rgba(51, 51, 51, .3)" : props.color || themeColor.Separator2,
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
const noTextBorderStyle: ViewStyle = {
|
|
88
|
-
...beforeAfterCommon,
|
|
89
|
-
width: "auto",
|
|
87
|
+
marginLeft: 8,
|
|
90
88
|
borderColor: props.direction === "secondary" ? "rgba(51, 51, 51, .3)" : props.color || themeColor.Separator2,
|
|
91
89
|
};
|
|
92
90
|
|
|
@@ -106,7 +104,6 @@ const getStyles = (p: RedsDivider, textWidth: number, containerWidth: number, th
|
|
|
106
104
|
text: textStyle,
|
|
107
105
|
before: beforeStyle,
|
|
108
106
|
after: afterStyle,
|
|
109
|
-
noTextBorderStyle: noTextBorderStyle,
|
|
110
107
|
});
|
|
111
108
|
};
|
|
112
109
|
|
|
@@ -206,15 +206,9 @@ const Image = ({
|
|
|
206
206
|
};
|
|
207
207
|
|
|
208
208
|
const colorMode = useColorMode();
|
|
209
|
+
|
|
209
210
|
return (
|
|
210
|
-
<View
|
|
211
|
-
style={{
|
|
212
|
-
borderRadius: borderRadius || style?.borderRadius,
|
|
213
|
-
...(style as {}),
|
|
214
|
-
height: ((height || style?.height || 0) as number) + (style?.borderWidth || 0) * 2,
|
|
215
|
-
width: ((width || style?.width || 0) as number) + (style?.borderWidth || 0) * 2,
|
|
216
|
-
}}
|
|
217
|
-
>
|
|
211
|
+
<View style={{ borderRadius, height, width, ...(style as {}) }}>
|
|
218
212
|
{imageStatus !== IMAGE_STATUS.HIDE && (
|
|
219
213
|
<RNImage
|
|
220
214
|
{...props}
|
|
@@ -231,7 +225,7 @@ const Image = ({
|
|
|
231
225
|
style={{
|
|
232
226
|
width: width || style?.width,
|
|
233
227
|
height: height || style?.height,
|
|
234
|
-
borderRadius
|
|
228
|
+
borderRadius,
|
|
235
229
|
// opacity: imageStatus === IMAGE_STATUS.LOADED ? 1 : 0,
|
|
236
230
|
}}
|
|
237
231
|
// @ts-ignore
|
|
@@ -241,11 +235,12 @@ const Image = ({
|
|
|
241
235
|
{imageStatus === IMAGE_STATUS.LOADING && loadStyle !== TLoadStyle.NONE && (
|
|
242
236
|
<View
|
|
243
237
|
style={{
|
|
244
|
-
width
|
|
245
|
-
height
|
|
246
|
-
borderRadius
|
|
238
|
+
width,
|
|
239
|
+
height,
|
|
240
|
+
borderRadius,
|
|
247
241
|
...styles.loadingContainer,
|
|
248
242
|
backgroundColor: loadStyle === TLoadStyle.AVE ? aveColor : styles.loadingContainer.backgroundColor,
|
|
243
|
+
...style,
|
|
249
244
|
}}
|
|
250
245
|
>
|
|
251
246
|
{loadStyle === TLoadStyle.BLUR && (
|
|
@@ -254,7 +249,7 @@ const Image = ({
|
|
|
254
249
|
style={{
|
|
255
250
|
width: width || style?.width,
|
|
256
251
|
height: height || style?.height,
|
|
257
|
-
borderRadius
|
|
252
|
+
borderRadius,
|
|
258
253
|
}}
|
|
259
254
|
// @ts-ignore
|
|
260
255
|
apmBiz={props.apmBiz}
|
|
@@ -270,7 +265,7 @@ const Image = ({
|
|
|
270
265
|
onPress={(e) => {
|
|
271
266
|
onReload(e);
|
|
272
267
|
}}
|
|
273
|
-
style={{ width, height, ...styles.loadingContainer }}
|
|
268
|
+
style={{ width, height, borderRadius, ...styles.loadingContainer }}
|
|
274
269
|
>
|
|
275
270
|
<RNImage
|
|
276
271
|
style={{ width: 40, height: 40 }}
|
|
@@ -16,23 +16,24 @@ export default function App() {
|
|
|
16
16
|
return (
|
|
17
17
|
<View style={{ display: "flex", flexDirection: "row" }}>
|
|
18
18
|
<ScrollView style={{ backgroundColor: "#50796633" }}>
|
|
19
|
-
|
|
19
|
+
<Desc>基础用法</Desc>
|
|
20
20
|
|
|
21
21
|
<Image width={150} height={150} borderRadius={30} source={{ uri: imageUrl }} abortApmCollection={true}></Image>
|
|
22
22
|
<Br />
|
|
23
23
|
|
|
24
|
-
<Desc>Image组件加边框</Desc>
|
|
24
|
+
<Desc>Image组件加边框</Desc>
|
|
25
25
|
|
|
26
26
|
<Image
|
|
27
27
|
width={150}
|
|
28
28
|
height={150}
|
|
29
|
+
borderRadius={30}
|
|
29
30
|
source={{ uri: imageUrl }}
|
|
30
31
|
abortApmCollection={true}
|
|
31
32
|
style={{ borderWidth: 1, borderStyle: "solid", borderColor: "red", borderRadius: 50 }}
|
|
32
33
|
></Image>
|
|
33
34
|
<Br />
|
|
34
35
|
|
|
35
|
-
|
|
36
|
+
<Desc>加载时显示主要色</Desc>
|
|
36
37
|
<Image loadStyle={TLoadStyle.AVE} width={150} height={150} borderRadius={30} src={imageUrl}></Image>
|
|
37
38
|
|
|
38
39
|
<Br />
|
|
@@ -93,7 +94,7 @@ export default function App() {
|
|
|
93
94
|
onReload={() => {
|
|
94
95
|
setImageUrl2(imageUrl);
|
|
95
96
|
}}
|
|
96
|
-
></Image>
|
|
97
|
+
></Image>
|
|
97
98
|
</ScrollView>
|
|
98
99
|
</View>
|
|
99
100
|
);
|
|
@@ -21,8 +21,6 @@ export interface RedsListItem {
|
|
|
21
21
|
contentStyle?: ViewStyle;
|
|
22
22
|
badgeActionContent?: string;
|
|
23
23
|
badgeTitleContent?: string;
|
|
24
|
-
style?: any;
|
|
25
|
-
lineStyle?: any;
|
|
26
24
|
}
|
|
27
25
|
|
|
28
26
|
const ListItem: React.FC<RedsListItem> = ({
|
|
@@ -40,8 +38,6 @@ const ListItem: React.FC<RedsListItem> = ({
|
|
|
40
38
|
children,
|
|
41
39
|
badgeActionContent,
|
|
42
40
|
badgeTitleContent,
|
|
43
|
-
style,
|
|
44
|
-
lineStyle,
|
|
45
41
|
}) => {
|
|
46
42
|
useMounted("ListItem");
|
|
47
43
|
const styles = createStyles();
|
|
@@ -70,7 +66,6 @@ const ListItem: React.FC<RedsListItem> = ({
|
|
|
70
66
|
styles.listItem,
|
|
71
67
|
children ? {} : { height: listItemSizeToHeight[size] },
|
|
72
68
|
size === "expand" && styles.expand,
|
|
73
|
-
style,
|
|
74
69
|
]}
|
|
75
70
|
>
|
|
76
71
|
{children ? (
|
|
@@ -80,13 +75,7 @@ const ListItem: React.FC<RedsListItem> = ({
|
|
|
80
75
|
{prefix && (
|
|
81
76
|
<View style={[styles.prefix, { height: listItemSizeToHeight[size] }, prefixStyle]}>{prefix}</View>
|
|
82
77
|
)}
|
|
83
|
-
<View
|
|
84
|
-
style={[
|
|
85
|
-
styles.contentBox,
|
|
86
|
-
lineItem ? { ...styles.hr, ...lineStyle } : {},
|
|
87
|
-
{ height: listItemSizeToHeight[size] },
|
|
88
|
-
]}
|
|
89
|
-
>
|
|
78
|
+
<View style={[styles.contentBox, lineItem ? styles.hr : {}, { height: listItemSizeToHeight[size] }]}>
|
|
90
79
|
<View
|
|
91
80
|
style={[styles.contentContainer, { marginBottom: 12, marginTop: 12 }, prefix ? { height: 48 } : {}]}
|
|
92
81
|
>
|
|
@@ -15,26 +15,6 @@ const Wheel = (props: RedsWheel) => {
|
|
|
15
15
|
*/
|
|
16
16
|
const scrollerRef = useRef();
|
|
17
17
|
|
|
18
|
-
const [scrollEnded, setScrollEnded] = useState(false);
|
|
19
|
-
|
|
20
|
-
const [scrollHeight, setScrollHeight] = useState(0);
|
|
21
|
-
|
|
22
|
-
const [lastValue, setLastValue] = useState(value);
|
|
23
|
-
|
|
24
|
-
const onScrollEndDrag = () => {
|
|
25
|
-
setScrollEnded(true);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* 初始化滚动高度
|
|
30
|
-
*/
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
if (value !== lastValue) {
|
|
33
|
-
const idx = getSelectIndex(column, value);
|
|
34
|
-
setIndex(idx);
|
|
35
|
-
}
|
|
36
|
-
}, [column, value]);
|
|
37
|
-
|
|
38
18
|
/**
|
|
39
19
|
* themeColor
|
|
40
20
|
*/
|
|
@@ -45,8 +25,6 @@ const Wheel = (props: RedsWheel) => {
|
|
|
45
25
|
*/
|
|
46
26
|
const [index, setIndex] = useState<any>();
|
|
47
27
|
|
|
48
|
-
const timer = useRef<any>();
|
|
49
|
-
|
|
50
28
|
/**
|
|
51
29
|
* 初始化滚动高度
|
|
52
30
|
*/
|
|
@@ -59,28 +37,9 @@ const Wheel = (props: RedsWheel) => {
|
|
|
59
37
|
scrollTo(index * itemHeight);
|
|
60
38
|
if (newVal) {
|
|
61
39
|
onSelect(newVal, props.index);
|
|
62
|
-
setLastValue(newVal);
|
|
63
40
|
}
|
|
64
41
|
}, [index, props.index]);
|
|
65
42
|
|
|
66
|
-
useEffect(() => {
|
|
67
|
-
if (scrollEnded) {
|
|
68
|
-
// @ts-ignore
|
|
69
|
-
if (scrollHeight != null) {
|
|
70
|
-
timer.current = setTimeout(() => {
|
|
71
|
-
const selectIndex = Math.round(scrollHeight / itemHeight);
|
|
72
|
-
if (selectIndex >= 0 && selectIndex < column.length) {
|
|
73
|
-
setIndex(selectIndex);
|
|
74
|
-
}
|
|
75
|
-
}, 0);
|
|
76
|
-
}
|
|
77
|
-
setScrollEnded(false);
|
|
78
|
-
}
|
|
79
|
-
return () => {
|
|
80
|
-
timer.current && clearTimeout(timer.current);
|
|
81
|
-
};
|
|
82
|
-
}, [scrollEnded]);
|
|
83
|
-
|
|
84
43
|
/**
|
|
85
44
|
* 滚动ScrollView
|
|
86
45
|
* @param y 滚动距离
|
|
@@ -125,12 +84,6 @@ const Wheel = (props: RedsWheel) => {
|
|
|
125
84
|
let contentOffset = e.nativeEvent.contentOffset;
|
|
126
85
|
const selectIndex = Math.round(contentOffset.y / itemHeight);
|
|
127
86
|
setIndex(selectIndex);
|
|
128
|
-
const newVal = column?.[selectIndex]?.value;
|
|
129
|
-
setLastValue(newVal);
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
const onScroll = (e: NativeSyntheticEvent<NativeScrollEvent>) => {
|
|
133
|
-
setScrollHeight(e.nativeEvent.contentOffset.y);
|
|
134
87
|
};
|
|
135
88
|
|
|
136
89
|
const handleClick = (index: number) => {
|
|
@@ -171,9 +124,6 @@ const Wheel = (props: RedsWheel) => {
|
|
|
171
124
|
decelerationRate="fast"
|
|
172
125
|
snapToInterval={itemHeight}
|
|
173
126
|
onMomentumScrollEnd={onMomentumScrollEnd}
|
|
174
|
-
onScrollEndDrag={onScrollEndDrag}
|
|
175
|
-
onScroll={onScroll}
|
|
176
|
-
scrollEventThrottle={16}
|
|
177
127
|
testID={`wheel${props.index}`}
|
|
178
128
|
{...accessibility}
|
|
179
129
|
>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { memo, useEffect } from "react";
|
|
2
|
-
import { View } from "react-native";
|
|
3
2
|
import { usePortalState } from "./hooks/usePortalState";
|
|
4
3
|
import { usePortal } from "./hooks/usePortal";
|
|
5
4
|
import { PortalHostProps } from "../interface";
|
|
@@ -17,9 +16,7 @@ const PortalHostComponent = ({ name }: PortalHostProps) => {
|
|
|
17
16
|
return (
|
|
18
17
|
<>
|
|
19
18
|
{state.map((item, index) => {
|
|
20
|
-
return
|
|
21
|
-
key: index,
|
|
22
|
-
});
|
|
19
|
+
return item.node;
|
|
23
20
|
})}
|
|
24
21
|
</>
|
|
25
22
|
);
|
|
@@ -64,9 +64,9 @@ const Radio = (props: RedsRadio) => {
|
|
|
64
64
|
const labelStyle = getLabelStyle(disabled || parent?.disabled, size, parent?.direction);
|
|
65
65
|
|
|
66
66
|
const iconSizeMap: Record<"small" | "medium" | "large", number> = {
|
|
67
|
-
small:
|
|
68
|
-
medium:
|
|
69
|
-
large:
|
|
67
|
+
small: 16,
|
|
68
|
+
medium: 20,
|
|
69
|
+
large: 24,
|
|
70
70
|
};
|
|
71
71
|
|
|
72
72
|
const rightStyle = getRightIconStyle(size);
|
|
@@ -2,9 +2,9 @@ import { StyleSheet, ViewStyle, TextStyle, DimensionValue } from "react-native";
|
|
|
2
2
|
import { useThemeColor } from "../ConfigProvider";
|
|
3
3
|
import { typography } from "@xhs/reds-token-next";
|
|
4
4
|
const iconSizeMap: Record<"small" | "medium" | "large" | string, number> = {
|
|
5
|
-
small:
|
|
6
|
-
medium:
|
|
7
|
-
large:
|
|
5
|
+
small: typography.B1FontSize,
|
|
6
|
+
medium: typography.H3FontSize,
|
|
7
|
+
large: typography.H2FontSize,
|
|
8
8
|
};
|
|
9
9
|
const fontSizeMap: Record<"small" | "medium" | "large", number> = {
|
|
10
10
|
small: 12,
|
|
@@ -43,6 +43,7 @@ export const getContainerStyle = (direction?: string | undefined, position?: "le
|
|
|
43
43
|
alignItems: "center",
|
|
44
44
|
justifyContent: "flex-start",
|
|
45
45
|
backgroundColor: direction === "vertical" ? themeColor.Bg : undefined,
|
|
46
|
+
paddingHorizontal: 16,
|
|
46
47
|
};
|
|
47
48
|
};
|
|
48
49
|
|
|
@@ -98,6 +99,7 @@ export const getLabelStyle = (
|
|
|
98
99
|
|
|
99
100
|
return {
|
|
100
101
|
color: disabled ? themeColor.Disabled : themeColor.Title,
|
|
102
|
+
lineHeight: iconSizeMap[size],
|
|
101
103
|
fontSize: fontSizeMap[size],
|
|
102
104
|
marginRight: direction === "horizontal" ? 8 : 0,
|
|
103
105
|
};
|