@xhsreds/reds-rn-next 0.10.1-beta202512092141 → 0.10.1-beta202512111630
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-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-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-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-34.json +1 -1
- package/coverage/.tmp/coverage-35.json +1 -1
- package/coverage/.tmp/coverage-36.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-5.json +1 -1
- package/coverage/.tmp/coverage-6.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/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 +33 -12
- 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 +36 -30
- 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 +4 -2
- package/lib/cjs/components/List/ListItem/ListItem.js.map +1 -1
- package/lib/cjs/components/NoticeBar/NoticeBar.js +2 -1
- package/lib/cjs/components/NoticeBar/NoticeBar.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 +57 -16
- package/lib/cjs/components/PickerView/Wheel.js.map +1 -1
- package/lib/cjs/components/Portal/core/PortalHost.js +3 -1
- package/lib/cjs/components/Portal/core/PortalHost.js.map +1 -1
- package/lib/cjs/components/Radio/Radio.js +1 -1
- package/lib/cjs/components/Radio/index.js +1 -1
- package/lib/cjs/components/Sheets/AnimatedSheets.js +16 -11
- 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/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/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/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 +35 -14
- 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 +36 -30
- 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 +5 -3
- package/lib/esm/components/List/ListItem/ListItem.js.map +1 -1
- package/lib/esm/components/NoticeBar/NoticeBar.js +2 -1
- package/lib/esm/components/NoticeBar/NoticeBar.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 +57 -16
- package/lib/esm/components/PickerView/Wheel.js.map +1 -1
- package/lib/esm/components/Portal/core/PortalHost.js +3 -1
- package/lib/esm/components/Portal/core/PortalHost.js.map +1 -1
- package/lib/esm/components/Radio/Radio.js +1 -1
- package/lib/esm/components/Radio/index.js +1 -1
- package/lib/esm/components/Sheets/AnimatedSheets.js +16 -11
- 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/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/index.js +1 -1
- package/lib/src/components/BottomBar/styles.d.ts +1 -1
- package/lib/src/components/Divider/styles.d.ts +3 -2
- package/lib/src/components/List/ListItem/ListItem.d.ts +2 -0
- package/lib/src/components/Sheets/Sheets.d.ts +4 -3
- package/lib/src/components/Sheets/interface/index.d.ts +16 -0
- package/lib/src/components/Stepper/interface/index.d.ts +1 -0
- 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 +3 -2
- package/lib/types/components/List/ListItem/ListItem.d.ts +2 -0
- package/lib/types/components/Sheets/Sheets.d.ts +4 -3
- package/lib/types/components/Sheets/interface/index.d.ts +16 -0
- package/lib/types/components/Stepper/interface/index.d.ts +1 -0
- package/lib/types/components/Stepper/styles.d.ts +2 -2
- package/package.json +2 -2
- package/src/components/ActionablePopover/ActionablePopover.tsx +10 -1
- package/src/components/Alert/demo/index.tsx +2 -2
- package/src/components/BottomBar/styles.ts +1 -1
- package/src/components/Divider/Divider.tsx +29 -9
- package/src/components/Divider/demo/index.tsx +12 -6
- package/src/components/Divider/styles.ts +33 -30
- package/src/components/Image/Image.tsx +14 -9
- package/src/components/Image/demo/index.tsx +4 -5
- package/src/components/List/ListItem/ListItem.tsx +12 -1
- package/src/components/List/demo/index.tsx +2 -0
- package/src/components/NoticeBar/NoticeBar.tsx +3 -1
- package/src/components/PickerView/Wheel.tsx +59 -12
- package/src/components/Portal/core/PortalHost.tsx +2 -1
- package/src/components/Sheets/AnimatedSheets.tsx +10 -8
- package/src/components/Sheets/doc/index.mdx +10 -0
- package/src/components/Sheets/interface/index.ts +17 -0
- package/src/components/Stepper/Stepper.tsx +1 -1
- package/src/components/Stepper/demo/index.tsx +1 -1
- package/src/components/Stepper/doc/index.mdx +1 -0
- package/src/components/Stepper/interface/index.ts +1 -0
- package/src/components/Stepper/styles.ts +2 -2
- 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
|
@@ -27,6 +27,12 @@ export declare const enum AnimatedSheetsSize {
|
|
|
27
27
|
auto = "auto",
|
|
28
28
|
fixed = "fixed"
|
|
29
29
|
}
|
|
30
|
+
export interface SheetAnimationConfig {
|
|
31
|
+
/** Duration in milliseconds. Default: 150 */
|
|
32
|
+
duration?: number;
|
|
33
|
+
/** Easing function. Default: Easing.ease for sheet, Easing.linear for mask */
|
|
34
|
+
easing?: (value: number) => number;
|
|
35
|
+
}
|
|
30
36
|
export interface RedsSheets {
|
|
31
37
|
label?: string;
|
|
32
38
|
mask?: boolean;
|
|
@@ -57,6 +63,14 @@ export interface RedsSheets {
|
|
|
57
63
|
onImmediateConfirm?: () => void;
|
|
58
64
|
avoidSheetsMove?: boolean;
|
|
59
65
|
headlerLayout?: "center" | "left";
|
|
66
|
+
openAnimation?: {
|
|
67
|
+
duration?: number;
|
|
68
|
+
easing?: (value: number) => number;
|
|
69
|
+
};
|
|
70
|
+
closeAnimation?: {
|
|
71
|
+
duration?: number;
|
|
72
|
+
easing?: (value: number) => number;
|
|
73
|
+
};
|
|
60
74
|
}
|
|
61
75
|
export interface RedsSheetsEvent {
|
|
62
76
|
}
|
|
@@ -85,4 +99,6 @@ export declare const SheetsDefaultProps: {
|
|
|
85
99
|
onImmediateConfirm: () => void;
|
|
86
100
|
avoidSheetsMove: boolean;
|
|
87
101
|
headlerLayout: string;
|
|
102
|
+
openAnimation: {};
|
|
103
|
+
closeAnimation: {};
|
|
88
104
|
};
|
|
@@ -3,7 +3,8 @@ export declare const getStyles: (themeColor: any, typography: any) => {
|
|
|
3
3
|
display: "flex";
|
|
4
4
|
flexDirection: "row";
|
|
5
5
|
alignItems: "center";
|
|
6
|
-
justifyContent: "
|
|
6
|
+
justifyContent: "space-between";
|
|
7
|
+
width: number;
|
|
7
8
|
};
|
|
8
9
|
opacity: {
|
|
9
10
|
opacity: number;
|
|
@@ -19,7 +20,6 @@ export declare const getStyles: (themeColor: any, typography: any) => {
|
|
|
19
20
|
lineHeight: number;
|
|
20
21
|
};
|
|
21
22
|
text: {
|
|
22
|
-
paddingHorizontal: number;
|
|
23
23
|
fontWeight: any;
|
|
24
24
|
fontSize: any;
|
|
25
25
|
color: any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xhsreds/reds-rn-next",
|
|
3
|
-
"version": "0.10.1-
|
|
3
|
+
"version": "0.10.1-beta202512111630",
|
|
4
4
|
"author": "贾斌(呀哈) <jiabin@xiaohongshu.com>",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"dependencies": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"react-native-svg": "13.14.0",
|
|
28
28
|
"@xhs/react-native-harmony": "*",
|
|
29
29
|
"@xhs/reds-components": "*",
|
|
30
|
-
"@xhsreds/reds-token-next": "0.10.
|
|
30
|
+
"@xhsreds/reds-token-next": "0.10.1-beta202512111630"
|
|
31
31
|
},
|
|
32
32
|
"peerDependenciesMeta": {
|
|
33
33
|
"ozone-schema-web": {
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import React, { useState, useMemo, isValidElement, useEffect, useRef } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Text,
|
|
4
|
+
View,
|
|
5
|
+
TouchableWithoutFeedback,
|
|
6
|
+
GestureResponderEvent,
|
|
7
|
+
Animated,
|
|
8
|
+
Image,
|
|
9
|
+
Dimensions,
|
|
10
|
+
Platform,
|
|
11
|
+
} from "react-native";
|
|
3
12
|
import { RedsActionablePopover, ActionablePopoverData } from "./interface/index";
|
|
4
13
|
import { ModalWrapper } from "./component";
|
|
5
14
|
import useMounted from "../../pvCount/useUnmountedProcess";
|
|
@@ -106,12 +106,12 @@ export default function App() {
|
|
|
106
106
|
};
|
|
107
107
|
|
|
108
108
|
const handleConfirm = (e: GestureResponderEvent) => {
|
|
109
|
-
console.log("确认按钮点击", e);
|
|
109
|
+
console.log("确认按钮点击", e.target);
|
|
110
110
|
hideAlert();
|
|
111
111
|
};
|
|
112
112
|
|
|
113
113
|
const handleCancel = (e: GestureResponderEvent) => {
|
|
114
|
-
console.log("取消按钮点击", e);
|
|
114
|
+
console.log("取消按钮点击", e.target);
|
|
115
115
|
hideAlert();
|
|
116
116
|
};
|
|
117
117
|
|
|
@@ -1,28 +1,48 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useState, useMemo } 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";
|
|
6
7
|
|
|
7
8
|
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");
|
|
8
13
|
useMounted("Divider");
|
|
9
14
|
const finalProps: RedsDivider = {
|
|
10
15
|
...DividerDefaultProps,
|
|
11
16
|
...props,
|
|
12
|
-
direction: props.direction as RedsDivider["direction"],
|
|
13
|
-
orientation: props.orientation as RedsDivider["orientation"],
|
|
17
|
+
direction: (props.direction || DividerDefaultProps.direction) as RedsDivider["direction"],
|
|
18
|
+
orientation: (props.orientation || DividerDefaultProps.orientation) as RedsDivider["orientation"],
|
|
14
19
|
};
|
|
15
20
|
|
|
16
|
-
const styles =
|
|
17
|
-
|
|
21
|
+
const styles = useMemo(() => {
|
|
22
|
+
return getStyles(finalProps, textWidth, containerWidth, themeColor, typography);
|
|
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
|
+
};
|
|
18
32
|
|
|
19
33
|
return (
|
|
20
|
-
<View style={[styles.divider, styles[finalProps.direction!]]}>
|
|
34
|
+
<View style={[styles.divider, styles[finalProps.direction!]]} onLayout={handlerContainerWidth}>
|
|
21
35
|
{finalProps.orientation && finalProps.direction !== "vertical" && (
|
|
22
36
|
<View style={styles.textContainer}>
|
|
23
|
-
|
|
24
|
-
{props.children
|
|
25
|
-
|
|
37
|
+
<View style={styles.before} />
|
|
38
|
+
{props.children ? (
|
|
39
|
+
<Text style={styles.text} onLayout={handleLayout}>
|
|
40
|
+
{props.children}
|
|
41
|
+
</Text>
|
|
42
|
+
) : (
|
|
43
|
+
<Text style={styles.noTextBorderStyle}></Text>
|
|
44
|
+
)}
|
|
45
|
+
<View style={styles.after} />
|
|
26
46
|
</View>
|
|
27
47
|
)}
|
|
28
48
|
</View>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
-
import { View, Text, StyleSheet } from "react-native";
|
|
2
|
+
import { View, Text, StyleSheet, ScrollView } from "react-native";
|
|
3
3
|
import { Divider } from "@xhs/reds-rn-next";
|
|
4
4
|
|
|
5
5
|
const styles = StyleSheet.create({
|
|
@@ -21,23 +21,29 @@ const Br = (props: { height?: number }) => <View style={{ height: props.height |
|
|
|
21
21
|
|
|
22
22
|
export default function App() {
|
|
23
23
|
return (
|
|
24
|
-
<
|
|
24
|
+
<ScrollView>
|
|
25
|
+
<Br />
|
|
26
|
+
<Br />
|
|
25
27
|
<Desc>默认用法</Desc>
|
|
26
28
|
<Divider>测试</Divider>
|
|
27
29
|
<Br />
|
|
28
|
-
<Desc>direction
|
|
30
|
+
<Desc>direction="primary"</Desc>
|
|
29
31
|
<Divider direction="primary" orientation={"center"}>
|
|
30
32
|
测试
|
|
31
33
|
</Divider>
|
|
32
34
|
<Br />
|
|
33
|
-
<
|
|
35
|
+
<Desc>direction="secondary"</Desc>
|
|
36
|
+
<Divider direction="secondary" orientation={"center"}>
|
|
37
|
+
测试
|
|
38
|
+
</Divider>
|
|
34
39
|
<Br />
|
|
35
40
|
|
|
41
|
+
<Desc>direction="vertical"</Desc>
|
|
36
42
|
<View style={styles.itemBox}>
|
|
37
43
|
<Divider direction="vertical">测试</Divider>
|
|
38
44
|
</View>
|
|
45
|
+
<Desc>direction="horizontal"</Desc>
|
|
39
46
|
<Divider direction="horizontal">测试</Divider>
|
|
40
|
-
<Divider direction="horizontal"></Divider>
|
|
41
47
|
<Br />
|
|
42
48
|
<Br />
|
|
43
49
|
|
|
@@ -67,6 +73,6 @@ export default function App() {
|
|
|
67
73
|
<Desc>margin 数组:horizontal / [上下,左右] vertical / [左右]</Desc>
|
|
68
74
|
<Divider margin={[10, 20]} stroke={2} direction="horizontal" />
|
|
69
75
|
<Divider margin={[10, 0]} stroke={2} direction="vertical" />
|
|
70
|
-
</
|
|
76
|
+
</ScrollView>
|
|
71
77
|
);
|
|
72
78
|
}
|
|
@@ -1,38 +1,30 @@
|
|
|
1
1
|
import { StyleSheet, ViewStyle, TextStyle, DimensionValue } from "react-native";
|
|
2
2
|
import { RedsDivider, DividerDefaultProps } from "./interface";
|
|
3
|
-
import { useThemeColor, useThemeTypography } from "../ConfigProvider";
|
|
4
3
|
|
|
5
4
|
const baseDivider: ViewStyle = {
|
|
6
5
|
position: "relative",
|
|
7
6
|
};
|
|
8
7
|
|
|
9
|
-
const
|
|
10
|
-
paddingVertical: 0,
|
|
11
|
-
paddingHorizontal: 16,
|
|
12
|
-
position: "absolute",
|
|
13
|
-
backgroundColor: "#fff",
|
|
14
|
-
lineHeight: 18,
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const getStyles = (p: RedsDivider) => {
|
|
8
|
+
const getStyles = (p: RedsDivider, textWidth: number, containerWidth: number, themeColor: any, typography: any) => {
|
|
18
9
|
const props = { ...DividerDefaultProps, ...p };
|
|
19
|
-
const themeColor = useThemeColor("Divider");
|
|
20
|
-
const typography = useThemeTypography("Divider");
|
|
21
10
|
const isHorizontal = props.direction === "horizontal";
|
|
11
|
+
const hasTextContent = p.children;
|
|
12
|
+
|
|
13
|
+
const remainingWidth = containerWidth - textWidth;
|
|
14
|
+
|
|
22
15
|
const beforeAfterCommon: ViewStyle = {
|
|
23
16
|
borderStyle: "solid",
|
|
24
|
-
borderTopWidth: 0.5,
|
|
17
|
+
borderTopWidth: props.stroke || 0.5,
|
|
25
18
|
borderColor: props.color || themeColor.Separator2,
|
|
26
|
-
width: 8,
|
|
27
19
|
};
|
|
28
20
|
|
|
29
21
|
const dividerStyle: ViewStyle = {
|
|
30
22
|
...baseDivider,
|
|
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",
|
|
23
|
+
// borderBottomWidth: isHorizontal && hasTextContent ? 0 : (isHorizontal ? (props.stroke ? props.stroke : StyleSheet.hairlineWidth) : 0),
|
|
24
|
+
// borderLeftWidth: isHorizontal ? 0 : props.stroke ? props.stroke : StyleSheet.hairlineWidth,
|
|
25
|
+
// borderBottomColor: isHorizontal && !hasTextContent ? props.color || themeColor.Separator2 : undefined,
|
|
26
|
+
// borderLeftColor: isHorizontal ? undefined : props.color || themeColor.Separator2,
|
|
27
|
+
// borderStyle: "solid",
|
|
36
28
|
marginVertical: (props.margin && props.margin[0] && Number(props.margin[0])) || (isHorizontal ? 20 : 0),
|
|
37
29
|
marginHorizontal: (props.margin && props.margin[1] && Number(props.margin[1])) || (isHorizontal ? 0 : 12),
|
|
38
30
|
marginLeft:
|
|
@@ -47,17 +39,11 @@ const getStyles = (p: RedsDivider) => {
|
|
|
47
39
|
width: (isHorizontal ? props.size : "auto") as DimensionValue,
|
|
48
40
|
};
|
|
49
41
|
|
|
50
|
-
const textContainer:
|
|
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,
|
|
42
|
+
const textContainer: ViewStyle = {
|
|
58
43
|
flexDirection: "row",
|
|
59
44
|
alignItems: "center",
|
|
60
|
-
|
|
45
|
+
width: "100%",
|
|
46
|
+
// 移除 position absolute,改为正常布局
|
|
61
47
|
};
|
|
62
48
|
|
|
63
49
|
const textStyle: TextStyle = {
|
|
@@ -78,13 +64,29 @@ const getStyles = (p: RedsDivider) => {
|
|
|
78
64
|
|
|
79
65
|
const beforeStyle: ViewStyle = {
|
|
80
66
|
...beforeAfterCommon,
|
|
81
|
-
marginRight: 8,
|
|
67
|
+
marginRight: props.children ? 8 : 0,
|
|
68
|
+
...(isHorizontal
|
|
69
|
+
? props.orientation === "center"
|
|
70
|
+
? { flex: 1 }
|
|
71
|
+
: { width: props.orientation === "left" ? remainingWidth * 0.15 : remainingWidth * 0.85 }
|
|
72
|
+
: { width: 8 }),
|
|
82
73
|
borderColor: props.direction === "secondary" ? "rgba(51, 51, 51, .3)" : props.color || themeColor.Separator2,
|
|
83
74
|
};
|
|
84
75
|
|
|
85
76
|
const afterStyle: ViewStyle = {
|
|
86
77
|
...beforeAfterCommon,
|
|
87
|
-
marginLeft: 8,
|
|
78
|
+
marginLeft: props.children ? 8 : 0,
|
|
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",
|
|
88
90
|
borderColor: props.direction === "secondary" ? "rgba(51, 51, 51, .3)" : props.color || themeColor.Separator2,
|
|
89
91
|
};
|
|
90
92
|
|
|
@@ -104,6 +106,7 @@ const getStyles = (p: RedsDivider) => {
|
|
|
104
106
|
text: textStyle,
|
|
105
107
|
before: beforeStyle,
|
|
106
108
|
after: afterStyle,
|
|
109
|
+
noTextBorderStyle: noTextBorderStyle,
|
|
107
110
|
});
|
|
108
111
|
};
|
|
109
112
|
|
|
@@ -206,9 +206,15 @@ const Image = ({
|
|
|
206
206
|
};
|
|
207
207
|
|
|
208
208
|
const colorMode = useColorMode();
|
|
209
|
-
|
|
210
209
|
return (
|
|
211
|
-
<View
|
|
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
|
+
>
|
|
212
218
|
{imageStatus !== IMAGE_STATUS.HIDE && (
|
|
213
219
|
<RNImage
|
|
214
220
|
{...props}
|
|
@@ -225,7 +231,7 @@ const Image = ({
|
|
|
225
231
|
style={{
|
|
226
232
|
width: width || style?.width,
|
|
227
233
|
height: height || style?.height,
|
|
228
|
-
borderRadius,
|
|
234
|
+
borderRadius: borderRadius || style?.borderRadius,
|
|
229
235
|
// opacity: imageStatus === IMAGE_STATUS.LOADED ? 1 : 0,
|
|
230
236
|
}}
|
|
231
237
|
// @ts-ignore
|
|
@@ -235,12 +241,11 @@ const Image = ({
|
|
|
235
241
|
{imageStatus === IMAGE_STATUS.LOADING && loadStyle !== TLoadStyle.NONE && (
|
|
236
242
|
<View
|
|
237
243
|
style={{
|
|
238
|
-
width,
|
|
239
|
-
height,
|
|
240
|
-
borderRadius,
|
|
244
|
+
width: width || style?.width,
|
|
245
|
+
height: height || style?.height,
|
|
246
|
+
borderRadius: borderRadius || style?.borderRadius,
|
|
241
247
|
...styles.loadingContainer,
|
|
242
248
|
backgroundColor: loadStyle === TLoadStyle.AVE ? aveColor : styles.loadingContainer.backgroundColor,
|
|
243
|
-
...style,
|
|
244
249
|
}}
|
|
245
250
|
>
|
|
246
251
|
{loadStyle === TLoadStyle.BLUR && (
|
|
@@ -249,7 +254,7 @@ const Image = ({
|
|
|
249
254
|
style={{
|
|
250
255
|
width: width || style?.width,
|
|
251
256
|
height: height || style?.height,
|
|
252
|
-
borderRadius,
|
|
257
|
+
borderRadius: borderRadius || style?.borderRadius,
|
|
253
258
|
}}
|
|
254
259
|
// @ts-ignore
|
|
255
260
|
apmBiz={props.apmBiz}
|
|
@@ -265,7 +270,7 @@ const Image = ({
|
|
|
265
270
|
onPress={(e) => {
|
|
266
271
|
onReload(e);
|
|
267
272
|
}}
|
|
268
|
-
style={{ width, height,
|
|
273
|
+
style={{ width, height, ...styles.loadingContainer }}
|
|
269
274
|
>
|
|
270
275
|
<RNImage
|
|
271
276
|
style={{ width: 40, height: 40 }}
|
|
@@ -16,24 +16,23 @@ export default function App() {
|
|
|
16
16
|
return (
|
|
17
17
|
<View style={{ display: "flex", flexDirection: "row" }}>
|
|
18
18
|
<ScrollView style={{ backgroundColor: "#50796633" }}>
|
|
19
|
-
<Desc>基础用法</Desc>
|
|
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}
|
|
30
29
|
source={{ uri: imageUrl }}
|
|
31
30
|
abortApmCollection={true}
|
|
32
31
|
style={{ borderWidth: 1, borderStyle: "solid", borderColor: "red", borderRadius: 50 }}
|
|
33
32
|
></Image>
|
|
34
33
|
<Br />
|
|
35
34
|
|
|
36
|
-
<Desc>加载时显示主要色</Desc>
|
|
35
|
+
{/* <Desc>加载时显示主要色</Desc>
|
|
37
36
|
<Image loadStyle={TLoadStyle.AVE} width={150} height={150} borderRadius={30} src={imageUrl}></Image>
|
|
38
37
|
|
|
39
38
|
<Br />
|
|
@@ -94,7 +93,7 @@ export default function App() {
|
|
|
94
93
|
onReload={() => {
|
|
95
94
|
setImageUrl2(imageUrl);
|
|
96
95
|
}}
|
|
97
|
-
></Image>
|
|
96
|
+
></Image> */}
|
|
98
97
|
</ScrollView>
|
|
99
98
|
</View>
|
|
100
99
|
);
|
|
@@ -21,6 +21,8 @@ export interface RedsListItem {
|
|
|
21
21
|
contentStyle?: ViewStyle;
|
|
22
22
|
badgeActionContent?: string;
|
|
23
23
|
badgeTitleContent?: string;
|
|
24
|
+
style?: any;
|
|
25
|
+
lineStyle?: any;
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
const ListItem: React.FC<RedsListItem> = ({
|
|
@@ -38,6 +40,8 @@ const ListItem: React.FC<RedsListItem> = ({
|
|
|
38
40
|
children,
|
|
39
41
|
badgeActionContent,
|
|
40
42
|
badgeTitleContent,
|
|
43
|
+
style,
|
|
44
|
+
lineStyle,
|
|
41
45
|
}) => {
|
|
42
46
|
useMounted("ListItem");
|
|
43
47
|
const styles = createStyles();
|
|
@@ -66,6 +70,7 @@ const ListItem: React.FC<RedsListItem> = ({
|
|
|
66
70
|
styles.listItem,
|
|
67
71
|
children ? {} : { height: listItemSizeToHeight[size] },
|
|
68
72
|
size === "expand" && styles.expand,
|
|
73
|
+
style,
|
|
69
74
|
]}
|
|
70
75
|
>
|
|
71
76
|
{children ? (
|
|
@@ -75,7 +80,13 @@ const ListItem: React.FC<RedsListItem> = ({
|
|
|
75
80
|
{prefix && (
|
|
76
81
|
<View style={[styles.prefix, { height: listItemSizeToHeight[size] }, prefixStyle]}>{prefix}</View>
|
|
77
82
|
)}
|
|
78
|
-
<View
|
|
83
|
+
<View
|
|
84
|
+
style={[
|
|
85
|
+
styles.contentBox,
|
|
86
|
+
lineItem ? { ...styles.hr, ...lineStyle } : {},
|
|
87
|
+
{ height: listItemSizeToHeight[size] },
|
|
88
|
+
]}
|
|
89
|
+
>
|
|
79
90
|
<View
|
|
80
91
|
style={[styles.contentContainer, { marginBottom: 12, marginTop: 12 }, prefix ? { height: 48 } : {}]}
|
|
81
92
|
>
|
|
@@ -122,7 +122,9 @@ const NoticeBar = (props: RedsNoticeBar) => {
|
|
|
122
122
|
)}
|
|
123
123
|
</View>
|
|
124
124
|
{props.actionType === NoticeBarActionType.TEXTACTION ? (
|
|
125
|
-
<Text style={styles.linkText}
|
|
125
|
+
<Text style={styles.linkText} onPress={handleLink}>
|
|
126
|
+
{props.actionText || jumpKey}
|
|
127
|
+
</Text>
|
|
126
128
|
) : (
|
|
127
129
|
<></>
|
|
128
130
|
)}
|
|
@@ -15,31 +15,71 @@ const Wheel = (props: RedsWheel) => {
|
|
|
15
15
|
*/
|
|
16
16
|
const scrollerRef = useRef();
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const themeColor = useThemeColor();
|
|
18
|
+
const [scrollEnded, setScrollEnded] = useState(false);
|
|
19
|
+
|
|
20
|
+
const [scrollHeight, setScrollHeight] = useState(0);
|
|
22
21
|
|
|
23
22
|
const [lastValue, setLastValue] = useState(value);
|
|
24
23
|
|
|
24
|
+
const onScrollEndDrag = () => {
|
|
25
|
+
setScrollEnded(true);
|
|
26
|
+
};
|
|
27
|
+
|
|
25
28
|
/**
|
|
26
29
|
* 初始化滚动高度
|
|
27
30
|
*/
|
|
28
31
|
useEffect(() => {
|
|
29
32
|
if (value !== lastValue) {
|
|
30
33
|
const idx = getSelectIndex(column, value);
|
|
31
|
-
|
|
34
|
+
setIndex(idx);
|
|
32
35
|
}
|
|
33
36
|
}, [column, value]);
|
|
34
37
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
/**
|
|
39
|
+
* themeColor
|
|
40
|
+
*/
|
|
41
|
+
const themeColor = useThemeColor();
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* index
|
|
45
|
+
*/
|
|
46
|
+
const [index, setIndex] = useState<any>();
|
|
47
|
+
|
|
48
|
+
const timer = useRef<any>();
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* 初始化滚动高度
|
|
52
|
+
*/
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
value && setIndex(getSelectIndex(column, value));
|
|
55
|
+
}, [column, value]);
|
|
56
|
+
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
const newVal = column?.[index]?.value;
|
|
59
|
+
scrollTo(index * itemHeight);
|
|
38
60
|
if (newVal) {
|
|
39
|
-
setLastValue(newVal);
|
|
40
61
|
onSelect(newVal, props.index);
|
|
62
|
+
setLastValue(newVal);
|
|
41
63
|
}
|
|
42
|
-
};
|
|
64
|
+
}, [index, props.index]);
|
|
65
|
+
|
|
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]);
|
|
43
83
|
|
|
44
84
|
/**
|
|
45
85
|
* 滚动ScrollView
|
|
@@ -84,13 +124,17 @@ const Wheel = (props: RedsWheel) => {
|
|
|
84
124
|
e.persist?.();
|
|
85
125
|
let contentOffset = e.nativeEvent.contentOffset;
|
|
86
126
|
const selectIndex = Math.round(contentOffset.y / itemHeight);
|
|
127
|
+
setIndex(selectIndex);
|
|
87
128
|
const newVal = column?.[selectIndex]?.value;
|
|
88
129
|
setLastValue(newVal);
|
|
89
|
-
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const onScroll = (e: NativeSyntheticEvent<NativeScrollEvent>) => {
|
|
133
|
+
setScrollHeight(e.nativeEvent.contentOffset.y);
|
|
90
134
|
};
|
|
91
135
|
|
|
92
136
|
const handleClick = (index: number) => {
|
|
93
|
-
|
|
137
|
+
setIndex(index);
|
|
94
138
|
};
|
|
95
139
|
|
|
96
140
|
/**
|
|
@@ -127,6 +171,9 @@ const Wheel = (props: RedsWheel) => {
|
|
|
127
171
|
decelerationRate="fast"
|
|
128
172
|
snapToInterval={itemHeight}
|
|
129
173
|
onMomentumScrollEnd={onMomentumScrollEnd}
|
|
174
|
+
onScrollEndDrag={onScrollEndDrag}
|
|
175
|
+
onScroll={onScroll}
|
|
176
|
+
scrollEventThrottle={16}
|
|
130
177
|
testID={`wheel${props.index}`}
|
|
131
178
|
{...accessibility}
|
|
132
179
|
>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { memo, useEffect } from "react";
|
|
2
|
+
import { View } from "react-native";
|
|
2
3
|
import { usePortalState } from "./hooks/usePortalState";
|
|
3
4
|
import { usePortal } from "./hooks/usePortal";
|
|
4
5
|
import { PortalHostProps } from "../interface";
|
|
@@ -16,7 +17,7 @@ const PortalHostComponent = ({ name }: PortalHostProps) => {
|
|
|
16
17
|
return (
|
|
17
18
|
<>
|
|
18
19
|
{state.map((item, index) => {
|
|
19
|
-
return item.node
|
|
20
|
+
return <React.Fragment key={`protal-key-${item.name}`}>{item.node}</React.Fragment>;
|
|
20
21
|
})}
|
|
21
22
|
</>
|
|
22
23
|
);
|