@xhsreds/reds-rn-next 0.2.2 → 0.2.3-beta202411091721
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-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-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-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-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-34.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-5.json +1 -1
- package/coverage/.tmp/coverage-8.json +1 -1
- package/coverage/.tmp/coverage-9.json +1 -1
- package/lib/cjs/_chunks/1m42z2Mz.js.map +1 -1
- package/lib/cjs/_chunks/{BZY8fLHP.js → BRcYv_kj.js} +3 -2
- package/lib/cjs/_chunks/BRcYv_kj.js.map +1 -0
- package/lib/cjs/_chunks/{G5T1hGVo.js → BmmacXcR.js} +4 -2
- package/lib/cjs/_chunks/BmmacXcR.js.map +1 -0
- package/lib/cjs/_chunks/{ZbRoGP_k.js → DY75DWu0.js} +4 -2
- package/lib/cjs/_chunks/DY75DWu0.js.map +1 -0
- package/lib/cjs/_chunks/{CnvQUDZP.js → SPLAvS-C.js} +3 -2
- package/lib/cjs/_chunks/SPLAvS-C.js.map +1 -0
- package/lib/cjs/_chunks/{SEcsCrAk.js → aU6iuR1W.js} +2 -2
- package/lib/cjs/_chunks/aU6iuR1W.js.map +1 -0
- package/lib/cjs/_chunks/{CbnkUMH9.js → dM-QhrnE.js} +11 -9
- package/lib/cjs/_chunks/dM-QhrnE.js.map +1 -0
- package/lib/cjs/components/ActionSheets/ActionSheets.js +13 -7
- package/lib/cjs/components/ActionSheets/ActionSheets.js.map +1 -1
- package/lib/cjs/components/ActionSheets/index.js +1 -1
- package/lib/cjs/components/ActionSheets/styles.js +6 -3
- package/lib/cjs/components/ActionSheets/styles.js.map +1 -1
- package/lib/cjs/components/Alert/Alert.js +6 -6
- package/lib/cjs/components/Alert/hooks/alert.js +6 -6
- package/lib/cjs/components/Alert/index.js +6 -6
- package/lib/cjs/components/AvatarGroup/AvatarGroup.js +6 -6
- package/lib/cjs/components/AvatarGroup/index.js +6 -6
- package/lib/cjs/components/CheckBoxGroup/CheckBox.js +5 -1
- package/lib/cjs/components/CheckBoxGroup/CheckBox.js.map +1 -1
- package/lib/cjs/components/CheckBoxGroup/CheckBoxGroup.js +2 -1
- package/lib/cjs/components/CheckBoxGroup/CheckBoxGroup.js.map +1 -1
- package/lib/cjs/components/DatePicker/DatePicker.js +1 -1
- package/lib/cjs/components/DatePicker/index.js +1 -1
- package/lib/cjs/components/Form/Form.js +21 -17
- package/lib/cjs/components/Form/Form.js.map +1 -1
- package/lib/cjs/components/Form/FormItem.js +4 -4
- package/lib/cjs/components/Form/FormItem.js.map +1 -1
- package/lib/cjs/components/Form/index.js +2 -2
- package/lib/cjs/components/Form/interface/index.js +1 -1
- package/lib/cjs/components/Form/styles.js +1 -1
- package/lib/cjs/components/Icon/Icon.js +3 -1
- package/lib/cjs/components/Icon/Icon.js.map +1 -1
- package/lib/cjs/components/ImagePreview/ImagePreview.js +6 -6
- package/lib/cjs/components/ImagePreview/index.js +6 -6
- package/lib/cjs/components/List/ListItem/ListItem.js +6 -6
- package/lib/cjs/components/List/index.js +6 -6
- package/lib/cjs/components/Picker/Picker.js +1 -1
- package/lib/cjs/components/Picker/index.js +1 -1
- package/lib/cjs/components/Radio/Radio.js +6 -6
- package/lib/cjs/components/Radio/RadioGroup.js +4 -2
- package/lib/cjs/components/Radio/RadioGroup.js.map +1 -1
- package/lib/cjs/components/Radio/index.js +6 -6
- package/lib/cjs/components/Radio/interface/index.js +1 -1
- package/lib/cjs/components/Rate/Rate.js +2 -2
- package/lib/cjs/components/Rate/Rate.js.map +1 -1
- package/lib/cjs/components/Rate/index.js +1 -1
- package/lib/cjs/components/Rate/interface/index.js +1 -1
- package/lib/cjs/components/Sheets/AnimatedSheets.js +4 -2
- package/lib/cjs/components/Sheets/AnimatedSheets.js.map +1 -1
- package/lib/cjs/components/Sheets/Sheets.js +22 -13
- package/lib/cjs/components/Sheets/Sheets.js.map +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 +4 -2
- package/lib/cjs/components/Stepper/Stepper.js.map +1 -1
- package/lib/cjs/components/Stepper/index.js +1 -1
- package/lib/cjs/components/Stepper/interface/index.js +1 -1
- package/lib/cjs/components/Tab/Tabs.js +98 -35
- package/lib/cjs/components/Tab/Tabs.js.map +1 -1
- package/lib/cjs/components/Tab/styles.js +11 -10
- package/lib/cjs/components/Tab/styles.js.map +1 -1
- package/lib/cjs/components/Uploader/Uploader.js +6 -6
- package/lib/cjs/components/Uploader/Uploader.js.map +1 -1
- package/lib/cjs/components/Uploader/styles.js +8 -5
- package/lib/cjs/components/Uploader/styles.js.map +1 -1
- package/lib/cjs/index.js +6 -6
- package/lib/esm/_chunks/{BKfYslcc.js → B92MXD-p.js} +3 -2
- package/lib/esm/_chunks/B92MXD-p.js.map +1 -0
- package/lib/esm/_chunks/{DIXhEK8L.js → B_rJA32w.js} +11 -9
- package/lib/esm/_chunks/B_rJA32w.js.map +1 -0
- package/lib/esm/_chunks/{DGYdiQBr.js → BaWeXDzj.js} +4 -2
- package/lib/esm/_chunks/BaWeXDzj.js.map +1 -0
- package/lib/esm/_chunks/CC8nLpzS.js.map +1 -1
- package/lib/esm/_chunks/{ClyMQ8-p.js → CQDVLUyF.js} +3 -3
- package/lib/esm/_chunks/CQDVLUyF.js.map +1 -0
- package/lib/esm/_chunks/{CQokOKfj.js → CqcNLT67.js} +4 -2
- package/lib/esm/_chunks/CqcNLT67.js.map +1 -0
- package/lib/esm/_chunks/{DR1NAacd.js → DGI1A77J.js} +3 -2
- package/lib/esm/_chunks/DGI1A77J.js.map +1 -0
- package/lib/esm/components/ActionSheets/ActionSheets.js +13 -7
- package/lib/esm/components/ActionSheets/ActionSheets.js.map +1 -1
- package/lib/esm/components/ActionSheets/index.js +1 -1
- package/lib/esm/components/ActionSheets/styles.js +6 -3
- package/lib/esm/components/ActionSheets/styles.js.map +1 -1
- package/lib/esm/components/Alert/Alert.js +6 -6
- package/lib/esm/components/Alert/hooks/alert.js +6 -6
- package/lib/esm/components/Alert/index.js +7 -7
- package/lib/esm/components/AvatarGroup/AvatarGroup.js +6 -6
- package/lib/esm/components/AvatarGroup/index.js +6 -6
- package/lib/esm/components/CheckBoxGroup/CheckBox.js +5 -1
- package/lib/esm/components/CheckBoxGroup/CheckBox.js.map +1 -1
- package/lib/esm/components/CheckBoxGroup/CheckBoxGroup.js +2 -1
- package/lib/esm/components/CheckBoxGroup/CheckBoxGroup.js.map +1 -1
- package/lib/esm/components/DatePicker/DatePicker.js +1 -1
- package/lib/esm/components/DatePicker/index.js +1 -1
- package/lib/esm/components/Form/Form.js +22 -18
- package/lib/esm/components/Form/Form.js.map +1 -1
- package/lib/esm/components/Form/FormItem.js +4 -4
- package/lib/esm/components/Form/FormItem.js.map +1 -1
- package/lib/esm/components/Form/index.js +2 -2
- package/lib/esm/components/Form/interface/index.js +1 -1
- package/lib/esm/components/Form/styles.js +1 -1
- package/lib/esm/components/Icon/Icon.js +4 -2
- package/lib/esm/components/Icon/Icon.js.map +1 -1
- package/lib/esm/components/ImagePreview/ImagePreview.js +6 -6
- package/lib/esm/components/ImagePreview/index.js +6 -6
- package/lib/esm/components/List/ListItem/ListItem.js +6 -6
- package/lib/esm/components/List/index.js +6 -6
- package/lib/esm/components/Picker/Picker.js +1 -1
- package/lib/esm/components/Picker/index.js +1 -1
- package/lib/esm/components/Radio/Radio.js +6 -6
- package/lib/esm/components/Radio/RadioGroup.js +4 -2
- package/lib/esm/components/Radio/RadioGroup.js.map +1 -1
- package/lib/esm/components/Radio/index.js +6 -6
- package/lib/esm/components/Radio/interface/index.js +1 -1
- package/lib/esm/components/Rate/Rate.js +2 -2
- package/lib/esm/components/Rate/Rate.js.map +1 -1
- package/lib/esm/components/Rate/index.js +1 -1
- package/lib/esm/components/Rate/interface/index.js +1 -1
- package/lib/esm/components/Sheets/AnimatedSheets.js +4 -2
- package/lib/esm/components/Sheets/AnimatedSheets.js.map +1 -1
- package/lib/esm/components/Sheets/Sheets.js +22 -13
- package/lib/esm/components/Sheets/Sheets.js.map +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 +4 -2
- package/lib/esm/components/Stepper/Stepper.js.map +1 -1
- package/lib/esm/components/Stepper/index.js +1 -1
- package/lib/esm/components/Stepper/interface/index.js +1 -1
- package/lib/esm/components/Tab/Tabs.js +100 -37
- package/lib/esm/components/Tab/Tabs.js.map +1 -1
- package/lib/esm/components/Tab/styles.js +11 -10
- package/lib/esm/components/Tab/styles.js.map +1 -1
- package/lib/esm/components/Uploader/Uploader.js +6 -6
- package/lib/esm/components/Uploader/Uploader.js.map +1 -1
- package/lib/esm/components/Uploader/styles.js +8 -5
- package/lib/esm/components/Uploader/styles.js.map +1 -1
- package/lib/esm/index.js +6 -6
- package/lib/types/components/ActionSheets/styles.d.ts +4 -1
- package/lib/types/components/CheckBoxGroup/interface/index.d.ts +1 -0
- package/lib/types/components/Form/Form.d.ts +1 -7
- package/lib/types/components/Form/interface/index.d.ts +15 -3
- package/lib/types/components/Radio/interface/index.d.ts +7 -0
- package/lib/types/components/Rate/Rate.d.ts +1 -0
- package/lib/types/components/Rate/interface/index.d.ts +2 -0
- package/lib/types/components/Sheets/AnimatedSheets.d.ts +2 -4
- package/lib/types/components/Sheets/Sheets.d.ts +1 -1
- package/lib/types/components/Sheets/interface/index.d.ts +2 -2
- package/lib/types/components/Stepper/Stepper.d.ts +1 -0
- package/lib/types/components/Stepper/interface/index.d.ts +2 -0
- package/lib/types/components/Tab/styles.d.ts +7 -6
- package/lib/types/components/Uploader/styles.d.ts +5 -2
- package/package.json +1 -1
- package/src/components/ActionSheets/ActionSheets.tsx +12 -9
- package/src/components/ActionSheets/demo/index.tsx +27 -1
- package/src/components/ActionSheets/styles.ts +4 -1
- package/src/components/CheckBoxGroup/CheckBox.tsx +5 -1
- package/src/components/CheckBoxGroup/CheckBoxGroup.tsx +1 -0
- package/src/components/CheckBoxGroup/interface/index.ts +1 -0
- package/src/components/Form/Form.tsx +24 -13
- package/src/components/Form/FormItem.tsx +8 -3
- package/src/components/Form/demo/index.tsx +63 -7
- package/src/components/Form/doc/index.mdx +9 -7
- package/src/components/Form/interface/index.ts +15 -3
- package/src/components/Icon/Icon.tsx +5 -3
- package/src/components/Icon/demo/index.tsx +0 -1
- package/src/components/Radio/Radio.tsx +8 -2
- package/src/components/Radio/RadioGroup.tsx +2 -1
- package/src/components/Radio/doc/index.mdx +11 -8
- package/src/components/Radio/interface/index.ts +7 -0
- package/src/components/Rate/Rate.tsx +1 -1
- package/src/components/Rate/doc/index.mdx +10 -9
- package/src/components/Rate/interface/index.ts +2 -0
- package/src/components/Sheets/AnimatedSheets.tsx +1 -1
- package/src/components/Sheets/Sheets.tsx +27 -13
- package/src/components/Sheets/demo/index.tsx +23 -0
- package/src/components/Sheets/doc/index.mdx +1 -1
- package/src/components/Sheets/interface/index.ts +2 -2
- package/src/components/Stepper/Stepper.tsx +11 -9
- package/src/components/Stepper/doc/index.mdx +7 -6
- package/src/components/Stepper/interface/index.ts +2 -0
- package/src/components/Tab/Tabs.tsx +147 -88
- package/src/components/Tab/demo/index.tsx +33 -11
- package/src/components/Tab/styles.ts +8 -6
- package/src/components/Uploader/Uploader.tsx +6 -6
- package/src/components/Uploader/styles.ts +5 -2
- package/types/src/components/ActionSheets/styles.d.ts +4 -1
- package/types/src/components/CheckBoxGroup/interface/index.d.ts +1 -0
- package/types/src/components/Form/Form.d.ts +1 -7
- package/types/src/components/Form/interface/index.d.ts +15 -3
- package/types/src/components/Radio/interface/index.d.ts +7 -0
- package/types/src/components/Rate/Rate.d.ts +1 -0
- package/types/src/components/Rate/interface/index.d.ts +2 -0
- package/types/src/components/Sheets/AnimatedSheets.d.ts +2 -4
- package/types/src/components/Sheets/Sheets.d.ts +1 -1
- package/types/src/components/Sheets/interface/index.d.ts +2 -2
- package/types/src/components/Stepper/Stepper.d.ts +1 -0
- package/types/src/components/Stepper/interface/index.d.ts +2 -0
- package/types/src/components/Tab/styles.d.ts +7 -6
- package/types/src/components/Uploader/styles.d.ts +5 -2
- package/lib/cjs/_chunks/BZY8fLHP.js.map +0 -1
- package/lib/cjs/_chunks/CbnkUMH9.js.map +0 -1
- package/lib/cjs/_chunks/CnvQUDZP.js.map +0 -1
- package/lib/cjs/_chunks/G5T1hGVo.js.map +0 -1
- package/lib/cjs/_chunks/SEcsCrAk.js.map +0 -1
- package/lib/cjs/_chunks/ZbRoGP_k.js.map +0 -1
- package/lib/esm/_chunks/BKfYslcc.js.map +0 -1
- package/lib/esm/_chunks/CQokOKfj.js.map +0 -1
- package/lib/esm/_chunks/ClyMQ8-p.js.map +0 -1
- package/lib/esm/_chunks/DGYdiQBr.js.map +0 -1
- package/lib/esm/_chunks/DIXhEK8L.js.map +0 -1
- package/lib/esm/_chunks/DR1NAacd.js.map +0 -1
|
@@ -27,15 +27,19 @@ export interface RedsForm {
|
|
|
27
27
|
data: FormData;
|
|
28
28
|
rules: FormRules;
|
|
29
29
|
onSubmit?: (value: FormData) => any;
|
|
30
|
-
children: ReactNode[];
|
|
30
|
+
children: ReactNode[] | ReactNode;
|
|
31
31
|
layout?: LAYOUT;
|
|
32
32
|
align?: ALIGN;
|
|
33
|
+
showSubmit?: boolean;
|
|
34
|
+
submitText?: string;
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
export interface RedsFormEvent {}
|
|
36
38
|
export const FormDefaultProps = {
|
|
37
39
|
layout: LAYOUT.HORIZONTAL,
|
|
38
40
|
align: ALIGN.LEFT,
|
|
41
|
+
showSubmit: true,
|
|
42
|
+
submitText: "提交",
|
|
39
43
|
};
|
|
40
44
|
|
|
41
45
|
export interface RedsFormItem {
|
|
@@ -58,7 +62,7 @@ export interface RedsFormItem {
|
|
|
58
62
|
/**
|
|
59
63
|
* label
|
|
60
64
|
*/
|
|
61
|
-
label
|
|
65
|
+
label?: string;
|
|
62
66
|
/**
|
|
63
67
|
* value
|
|
64
68
|
*/
|
|
@@ -82,11 +86,19 @@ export interface RedsFormItem {
|
|
|
82
86
|
/**
|
|
83
87
|
* label styles
|
|
84
88
|
*/
|
|
85
|
-
labelStyle?:
|
|
89
|
+
labelStyle?: ViewStyle;
|
|
90
|
+
/**
|
|
91
|
+
* label text styles
|
|
92
|
+
*/
|
|
93
|
+
labelTextStyle?: TextStyle;
|
|
86
94
|
/**
|
|
87
95
|
* formItem slot styles
|
|
88
96
|
*/
|
|
89
97
|
formItemSlotStyles?: ViewStyle;
|
|
98
|
+
/**
|
|
99
|
+
* label slot
|
|
100
|
+
*/
|
|
101
|
+
LabelComponent?: ReactNode;
|
|
90
102
|
}
|
|
91
103
|
|
|
92
104
|
export interface RedsFormItemEvent {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useCallback, useMemo } from "react";
|
|
2
|
-
import { GestureResponderEvent,
|
|
2
|
+
import { GestureResponderEvent, TouchableWithoutFeedback, Image } from "react-native";
|
|
3
3
|
import { SvgXml } from "react-native-svg";
|
|
4
4
|
import { RedsIcon, IconDefaultProps, iconType } from "./interface/index";
|
|
5
5
|
import { useThemeColor } from "../ConfigProvider";
|
|
@@ -24,6 +24,8 @@ const Icon: React.FC<RedsIcon> = (props) => {
|
|
|
24
24
|
} else {
|
|
25
25
|
return icon ?? "";
|
|
26
26
|
}
|
|
27
|
+
} else {
|
|
28
|
+
return "";
|
|
27
29
|
}
|
|
28
30
|
}, [icon, size, fill]);
|
|
29
31
|
|
|
@@ -32,7 +34,7 @@ const Icon: React.FC<RedsIcon> = (props) => {
|
|
|
32
34
|
}, [props.type, icon]);
|
|
33
35
|
|
|
34
36
|
return (
|
|
35
|
-
<
|
|
37
|
+
<TouchableWithoutFeedback testID="touchable-element" onPress={toggleIcon}>
|
|
36
38
|
{isImage ? (
|
|
37
39
|
<TouchableWithoutFeedback onPress={toggleIcon}>
|
|
38
40
|
<Image
|
|
@@ -44,7 +46,7 @@ const Icon: React.FC<RedsIcon> = (props) => {
|
|
|
44
46
|
) : (
|
|
45
47
|
<SvgXml testID="svg-element" xml={iconSvg || ""} />
|
|
46
48
|
)}
|
|
47
|
-
</
|
|
49
|
+
</TouchableWithoutFeedback>
|
|
48
50
|
);
|
|
49
51
|
};
|
|
50
52
|
|
|
@@ -60,17 +60,23 @@ const Radio = forwardRef<View, RedsRadio>((props, ref) => {
|
|
|
60
60
|
<View style={[iconStyleClass, parent?.position === "right" && iconRight, type === "line" && hiddenBgStyle()]}>
|
|
61
61
|
{checked && type === "line" ? (
|
|
62
62
|
<Icon
|
|
63
|
-
icon={
|
|
63
|
+
icon={
|
|
64
|
+
props.customIcon ||
|
|
65
|
+
"https://picasso-static.xiaohongshu.com/fe-platform/8f401b554b1f9a8be17dc1e8696254b41ab5a439.png"
|
|
66
|
+
}
|
|
64
67
|
size={iconSizeMap[size]}
|
|
68
|
+
styles={props.customIconStyle}
|
|
65
69
|
type={IconType.iconType.image}
|
|
66
70
|
/>
|
|
67
71
|
) : (
|
|
68
72
|
checked && (
|
|
69
73
|
<Icon
|
|
70
74
|
icon={
|
|
75
|
+
props.customIcon ||
|
|
71
76
|
"https://picasso-static.xiaohongshu.com/fe-platform/8f401b554b1f9a8be17dc1e8696254b41ab5a439.png"
|
|
72
77
|
}
|
|
73
78
|
size={iconSizeMap[size]}
|
|
79
|
+
styles={props.customIconStyle}
|
|
74
80
|
type={IconType.iconType.image}
|
|
75
81
|
/>
|
|
76
82
|
)
|
|
@@ -79,7 +85,7 @@ const Radio = forwardRef<View, RedsRadio>((props, ref) => {
|
|
|
79
85
|
|
|
80
86
|
{children && (
|
|
81
87
|
<View style={[parent?.direction === "vertical" && freestyle]}>
|
|
82
|
-
<Text style={labelStyle}>{children}</Text>
|
|
88
|
+
<Text style={[labelStyle, props.textStyle]}>{children}</Text>
|
|
83
89
|
{!isLast && parent?.direction === "vertical" && <View style={getDividerStyle()} />}
|
|
84
90
|
</View>
|
|
85
91
|
)}
|
|
@@ -15,6 +15,7 @@ const RadioGroup: FC<RedsRadioGroup> = ({
|
|
|
15
15
|
children,
|
|
16
16
|
onChange,
|
|
17
17
|
type,
|
|
18
|
+
style = {},
|
|
18
19
|
}) => {
|
|
19
20
|
const updateValue = (value: string | number) => {
|
|
20
21
|
onChange?.(value);
|
|
@@ -37,7 +38,7 @@ const RadioGroup: FC<RedsRadioGroup> = ({
|
|
|
37
38
|
|
|
38
39
|
return (
|
|
39
40
|
<RadioGroupContext.Provider value={contextValue}>
|
|
40
|
-
<View style={getRadioGroupStyle(direction)}>
|
|
41
|
+
<View style={[getRadioGroupStyle(direction), style]}>
|
|
41
42
|
{childArray.map((child: React.ReactElement, index: number) => {
|
|
42
43
|
return React.cloneElement(child, {
|
|
43
44
|
isLast: index === childArray.length - 1,
|
|
@@ -10,14 +10,17 @@ import BaseDemo from "!!raw-loader!../demo/index.tsx";
|
|
|
10
10
|
|
|
11
11
|
### Props
|
|
12
12
|
|
|
13
|
-
| 属性
|
|
14
|
-
|
|
|
15
|
-
| name
|
|
16
|
-
| size
|
|
17
|
-
| disabled
|
|
18
|
-
| checkedColor
|
|
19
|
-
| type
|
|
20
|
-
|
|
|
13
|
+
| 属性 | 描述 | 类型 | 默认值 |
|
|
14
|
+
| --------------- | ---------------------- | -------------------------------------- | ------ |
|
|
15
|
+
| name | name | string | |
|
|
16
|
+
| size | 大小 | "small" | "medium" | "large" | |
|
|
17
|
+
| disabled | 是否禁用 | boolean | false |
|
|
18
|
+
| checkedColor | 选中颜色 | string | |
|
|
19
|
+
| type | 选中icon类型 | "default" | "line" | |
|
|
20
|
+
| customIcon | 自定义选中icon图片url | string | |
|
|
21
|
+
| customIconStyle | 自定义选中icon图片样式 | ViewStyle | `{}` |
|
|
22
|
+
| children | 单选文本 | React.ReactNode | |
|
|
23
|
+
| textStyle | radio样式 | ViewStyle | `{}` |
|
|
21
24
|
|
|
22
25
|
### Events
|
|
23
26
|
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
|
+
import { ViewStyle } from "react-native";
|
|
2
3
|
export interface RedsRadio {
|
|
3
4
|
name?: string;
|
|
4
5
|
size?: "small" | "medium" | "large";
|
|
5
6
|
disabled?: boolean;
|
|
6
7
|
checkedColor?: string;
|
|
7
8
|
type?: "default" | "line";
|
|
9
|
+
customIcon?: string;
|
|
10
|
+
customIconStyle?: ViewStyle;
|
|
8
11
|
children?: React.ReactNode;
|
|
9
12
|
onClick?: (value: string) => void;
|
|
13
|
+
textStyle?: ViewStyle;
|
|
10
14
|
}
|
|
11
15
|
|
|
12
16
|
export const RadioDefaultProps = {
|
|
13
17
|
disabled: false,
|
|
18
|
+
customIconStyle: {},
|
|
19
|
+
textStyle: {},
|
|
14
20
|
};
|
|
15
21
|
|
|
16
22
|
export interface RedsRadioGroup {
|
|
@@ -23,6 +29,7 @@ export interface RedsRadioGroup {
|
|
|
23
29
|
type?: "default" | "line";
|
|
24
30
|
children?: ReactNode;
|
|
25
31
|
onChange?: (value: string | number) => void;
|
|
32
|
+
style?: ViewStyle;
|
|
26
33
|
}
|
|
27
34
|
|
|
28
35
|
export interface RadioGroupContextProps {
|
|
@@ -10,15 +10,16 @@ import BaseDemo from "!!raw-loader!../demo/index.tsx";
|
|
|
10
10
|
|
|
11
11
|
### Props
|
|
12
12
|
|
|
13
|
-
| 属性
|
|
14
|
-
|
|
|
15
|
-
| type
|
|
16
|
-
| disabled
|
|
17
|
-
| size
|
|
18
|
-
| descType
|
|
19
|
-
| pattern
|
|
20
|
-
| texts
|
|
21
|
-
| value
|
|
13
|
+
| 属性 | 描述 | 类型 | 默认值 |
|
|
14
|
+
| --------- | ---------------------------------------------------------------------------------- | ------------ | -------------------------------------- |
|
|
15
|
+
| type | 默认展示评分组件的样式 | RateType | RateType.OUTLINED |
|
|
16
|
+
| disabled | 是否禁用评分 | boolean | false |
|
|
17
|
+
| size | 图标尺寸 | RateSize | RateSize.MEDIUM |
|
|
18
|
+
| descType | 评分描述类型 | RateDescType | RateDescType.NUMBER |
|
|
19
|
+
| pattern | 评分组件类型 | RatePattern | RatePattern.Star |
|
|
20
|
+
| texts | 评分等级对应的辅助文字。组件内置默认值为:['极差', '失望', '一般', '满意', '惊喜'] | string[] | `["极差","失望","一般","满意","惊喜"]` |
|
|
21
|
+
| value | 选中的值 | number | |
|
|
22
|
+
| isControl | 是否受控 | boolean | false |
|
|
22
23
|
|
|
23
24
|
### Events
|
|
24
25
|
|
|
@@ -33,6 +33,7 @@ export interface RedsRate {
|
|
|
33
33
|
texts?: string[];
|
|
34
34
|
value?: number;
|
|
35
35
|
onChange?: (value: number) => void;
|
|
36
|
+
isControl?: boolean;
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
export interface RedsRateEvent {}
|
|
@@ -43,4 +44,5 @@ export const RateDefaultProps = {
|
|
|
43
44
|
descType: RateDescType.NUMBER,
|
|
44
45
|
pattern: RatePattern.Star,
|
|
45
46
|
texts: ["极差", "失望", "一般", "满意", "惊喜"],
|
|
47
|
+
isControl: false,
|
|
46
48
|
};
|
|
@@ -242,7 +242,7 @@ const Sheets = (props: RedsSheets) => {
|
|
|
242
242
|
}, [colorMode]);
|
|
243
243
|
|
|
244
244
|
return visible ? (
|
|
245
|
-
<View style={styles.wrapper} testID="Sheets">
|
|
245
|
+
<View style={[styles.wrapper, { zIndex: props.zIndex }]} testID="Sheets">
|
|
246
246
|
{mask ? (
|
|
247
247
|
<TouchableWithoutFeedback onPress={handleMask}>
|
|
248
248
|
<View
|
|
@@ -91,7 +91,14 @@ const Sheets = (props: RedsSheets) => {
|
|
|
91
91
|
<TouchableWithoutFeedback onPress={handleCancel}>
|
|
92
92
|
<View style={[styles.iconBg, { backgroundColor: themeColor.Fill1 }]}>
|
|
93
93
|
{type === "confirm" ? (
|
|
94
|
-
<Icon
|
|
94
|
+
<Icon
|
|
95
|
+
icon={Close}
|
|
96
|
+
fill={themeColor.Bg}
|
|
97
|
+
size={20}
|
|
98
|
+
onClick={handleCancel}
|
|
99
|
+
type={IconType.iconType.image}
|
|
100
|
+
styles={{ borderRadius: 10 }}
|
|
101
|
+
/>
|
|
95
102
|
) : (
|
|
96
103
|
<Icon
|
|
97
104
|
icon={ArrowLeft}
|
|
@@ -99,14 +106,29 @@ const Sheets = (props: RedsSheets) => {
|
|
|
99
106
|
size={20}
|
|
100
107
|
onClick={handleCancel}
|
|
101
108
|
type={IconType.iconType.image}
|
|
109
|
+
styles={{ borderRadius: 10 }}
|
|
102
110
|
/>
|
|
103
111
|
)}
|
|
104
112
|
</View>
|
|
105
113
|
</TouchableWithoutFeedback>
|
|
106
114
|
) : type === "confirm" ? (
|
|
107
|
-
<Icon
|
|
115
|
+
<Icon
|
|
116
|
+
icon={Close}
|
|
117
|
+
fill={themeColor.Title}
|
|
118
|
+
size={20}
|
|
119
|
+
onClick={handleCancel}
|
|
120
|
+
type={IconType.iconType.image}
|
|
121
|
+
styles={{ borderRadius: 10 }}
|
|
122
|
+
/>
|
|
108
123
|
) : (
|
|
109
|
-
<Icon
|
|
124
|
+
<Icon
|
|
125
|
+
icon={ArrowLeft}
|
|
126
|
+
fill={themeColor.Title}
|
|
127
|
+
size={20}
|
|
128
|
+
onClick={handleCancel}
|
|
129
|
+
type={IconType.iconType.image}
|
|
130
|
+
styles={{ borderRadius: 10 }}
|
|
131
|
+
/>
|
|
110
132
|
);
|
|
111
133
|
};
|
|
112
134
|
|
|
@@ -146,7 +168,7 @@ const Sheets = (props: RedsSheets) => {
|
|
|
146
168
|
}, [props.size]);
|
|
147
169
|
|
|
148
170
|
return visible ? (
|
|
149
|
-
<View style={styles.wrapper} testID="Sheets">
|
|
171
|
+
<View style={[styles.wrapper, { zIndex: props.zIndex }]} testID="Sheets">
|
|
150
172
|
{mask ? (
|
|
151
173
|
<TouchableWithoutFeedback onPress={handleMask}>
|
|
152
174
|
<View
|
|
@@ -200,15 +222,7 @@ const Sheets = (props: RedsSheets) => {
|
|
|
200
222
|
) : (
|
|
201
223
|
<></>
|
|
202
224
|
)}
|
|
203
|
-
|
|
204
|
-
<View
|
|
205
|
-
onLayout={(e) => {
|
|
206
|
-
console.log("e.nativeEvent.layout.height", e.nativeEvent.layout.height);
|
|
207
|
-
setChildHeight(e.nativeEvent.layout.height);
|
|
208
|
-
}}
|
|
209
|
-
>
|
|
210
|
-
{children}
|
|
211
|
-
</View>
|
|
225
|
+
{children}
|
|
212
226
|
|
|
213
227
|
{/** action */}
|
|
214
228
|
{showAction ? (
|
|
@@ -69,6 +69,8 @@ export default function App() {
|
|
|
69
69
|
const [visible10, setVisible10] = useState(false);
|
|
70
70
|
const [visible11, setVisible11] = useState(false);
|
|
71
71
|
const [visible12, setVisible12] = useState(false);
|
|
72
|
+
const [visible13, setVisible13] = useState(false);
|
|
73
|
+
const [showView, setShowView] = useState(false);
|
|
72
74
|
|
|
73
75
|
const { show: showAnimatedSheets, remove: removeAnimatedSheets } = useAnimatedSheets();
|
|
74
76
|
|
|
@@ -90,6 +92,8 @@ export default function App() {
|
|
|
90
92
|
maskMode={SheetsType.SheetsMaskMode.dark}
|
|
91
93
|
>
|
|
92
94
|
<Children />
|
|
95
|
+
<Button onClick={() => setShowView((val) => !val)}>测试弹窗高度变化</Button>
|
|
96
|
+
{showView ? <Text style={{ width: "100%", height: 200, backgroundColor: "#f00" }}>xxxxxxx</Text> : <></>}
|
|
93
97
|
</AnimatedSheets>
|
|
94
98
|
</Portal>
|
|
95
99
|
|
|
@@ -318,6 +322,25 @@ export default function App() {
|
|
|
318
322
|
>
|
|
319
323
|
<ScrollChildren />
|
|
320
324
|
</Sheets>
|
|
325
|
+
|
|
326
|
+
<Button onClick={() => setVisible13(true)}>无动画sheets, 高度变化</Button>
|
|
327
|
+
<Sheets
|
|
328
|
+
visible={visible13}
|
|
329
|
+
label={"标题"}
|
|
330
|
+
onCancel={() => setVisible13(false)}
|
|
331
|
+
onConfirm={() => setVisible13(false)}
|
|
332
|
+
cancel={false}
|
|
333
|
+
close={true}
|
|
334
|
+
size={SheetsType.SheetsSize.auto}
|
|
335
|
+
closeType={SheetsType.SheetsActionType.icon}
|
|
336
|
+
mask={true}
|
|
337
|
+
zIndex={1}
|
|
338
|
+
maskMode={SheetsType.SheetsMaskMode.dark}
|
|
339
|
+
>
|
|
340
|
+
<Children />
|
|
341
|
+
<Button onClick={() => setShowView((val) => !val)}>测试弹窗高度变化</Button>
|
|
342
|
+
{showView ? <Text style={{ width: "100%", height: 200, backgroundColor: "#f00" }}>xxxxxxx</Text> : <></>}
|
|
343
|
+
</Sheets>
|
|
321
344
|
</View>
|
|
322
345
|
);
|
|
323
346
|
}
|
|
@@ -18,7 +18,7 @@ import BaseDemo from "!!raw-loader!../demo/index.tsx";
|
|
|
18
18
|
| sheetsType | sheets类型 | SheetsType | SheetsType.normal |
|
|
19
19
|
| cancel | 返回按钮 | boolean | true |
|
|
20
20
|
| close | 关闭按钮 | boolean | true |
|
|
21
|
-
| zIndex | 容器层级 |
|
|
21
|
+
| zIndex | 容器层级 | number | 0 |
|
|
22
22
|
| cancelType | 返回按钮类型 | SheetsActionType | SheetsActionType.icon |
|
|
23
23
|
| closeType | 确定按钮类型 | SheetsActionType | SheetsActionType.icon |
|
|
24
24
|
| cancelText | 取消操作文案 | string | 取消 |
|
|
@@ -34,7 +34,7 @@ export interface RedsSheets {
|
|
|
34
34
|
sheetsType?: SheetsType;
|
|
35
35
|
cancel?: boolean;
|
|
36
36
|
close?: boolean;
|
|
37
|
-
zIndex?:
|
|
37
|
+
zIndex?: number;
|
|
38
38
|
cancelType?: SheetsActionType;
|
|
39
39
|
closeType?: SheetsActionType;
|
|
40
40
|
cancelText?: string;
|
|
@@ -55,7 +55,7 @@ export const SheetsDefaultProps = {
|
|
|
55
55
|
sheetsType: SheetsType.normal,
|
|
56
56
|
cancel: true,
|
|
57
57
|
close: true,
|
|
58
|
-
zIndex:
|
|
58
|
+
zIndex: 0,
|
|
59
59
|
cancelType: SheetsActionType.icon,
|
|
60
60
|
closeType: SheetsActionType.icon,
|
|
61
61
|
cancelText: "取消",
|
|
@@ -48,15 +48,17 @@ const Stepper = (props: RedsStepper) => {
|
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
useEffect(() => {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
51
|
+
if (props.isControl) {
|
|
52
|
+
setValue(
|
|
53
|
+
props.value! >= props.min! && props.value! <= props.max!
|
|
54
|
+
? props.value!
|
|
55
|
+
: props.value! < props.min!
|
|
56
|
+
? props.min!
|
|
57
|
+
: props.value! > props.max!
|
|
58
|
+
? props.max!
|
|
59
|
+
: props.value!,
|
|
60
|
+
);
|
|
61
|
+
}
|
|
60
62
|
}, [props.value, props.max, props.min]);
|
|
61
63
|
|
|
62
64
|
return (
|
|
@@ -10,12 +10,13 @@ import BaseDemo from "!!raw-loader!../demo/index.tsx";
|
|
|
10
10
|
|
|
11
11
|
### Props
|
|
12
12
|
|
|
13
|
-
| 属性
|
|
14
|
-
|
|
|
15
|
-
| value
|
|
16
|
-
| max
|
|
17
|
-
| min
|
|
18
|
-
| disable
|
|
13
|
+
| 属性 | 描述 | 类型 | 默认值 |
|
|
14
|
+
| --------- | ---------- | ------- | ------ |
|
|
15
|
+
| value | 当前的状态 | number | |
|
|
16
|
+
| max | 最大值 | number | |
|
|
17
|
+
| min | 最小值 | number | |
|
|
18
|
+
| disable | disable | boolean | false |
|
|
19
|
+
| isControl | 是否受控 | boolean | false |
|
|
19
20
|
|
|
20
21
|
### Events
|
|
21
22
|
|
|
@@ -6,9 +6,11 @@ export interface RedsStepper {
|
|
|
6
6
|
min?: number;
|
|
7
7
|
disable?: boolean;
|
|
8
8
|
onChange?: (value: number) => any;
|
|
9
|
+
isControl?: boolean;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export interface RedsStepperEvent {}
|
|
12
13
|
export const StepperDefaultProps = {
|
|
13
14
|
disable: false,
|
|
15
|
+
isControl: false,
|
|
14
16
|
};
|