@momo-kits/step 0.112.1-beta.11 → 0.112.1-beta.13
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/StepsHorizontal.tsx +33 -16
- package/StepsVertical.tsx +1 -4
- package/package.json +18 -18
package/StepsHorizontal.tsx
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import {ApplicationContext, Colors, Spacing, Text} from '@momo-kits/foundation';
|
|
2
|
-
import React, {FC, useContext} from 'react';
|
|
3
|
-
import {
|
|
2
|
+
import React, {FC, useContext, useState} from 'react';
|
|
3
|
+
import {
|
|
4
|
+
FlexAlignType,
|
|
5
|
+
LayoutChangeEvent,
|
|
6
|
+
TouchableOpacity,
|
|
7
|
+
View,
|
|
8
|
+
} from 'react-native';
|
|
4
9
|
import StepIcon from './StepIcon';
|
|
5
10
|
import styles from './styles';
|
|
6
11
|
import {Step, StepsProps} from './types';
|
|
@@ -19,6 +24,8 @@ const StepsHorizontal: FC<StepsProps> = ({
|
|
|
19
24
|
disabled,
|
|
20
25
|
accessibilityLabel = 'steps-horizontal',
|
|
21
26
|
}) => {
|
|
27
|
+
const [timeHeight, setTimeHeight] = useState(0);
|
|
28
|
+
|
|
22
29
|
const renderStepItem = (item: Step, index: number) => {
|
|
23
30
|
const {title, description, error, time} = item;
|
|
24
31
|
let typoStyle = getStepTypo(activeIndex, index, error, size, 'horizontal');
|
|
@@ -42,6 +49,11 @@ const StepsHorizontal: FC<StepsProps> = ({
|
|
|
42
49
|
}
|
|
43
50
|
}
|
|
44
51
|
|
|
52
|
+
const onTimesLayout = (e: LayoutChangeEvent) => {
|
|
53
|
+
const {height} = e.nativeEvent.layout;
|
|
54
|
+
if (height != timeHeight && height > timeHeight) setTimeHeight(height);
|
|
55
|
+
};
|
|
56
|
+
|
|
45
57
|
const haveMarginRight =
|
|
46
58
|
index !== steps.length - 1 && align !== 'center' && align !== 'stretch';
|
|
47
59
|
|
|
@@ -55,20 +67,25 @@ const StepsHorizontal: FC<StepsProps> = ({
|
|
|
55
67
|
}}
|
|
56
68
|
disabled={disabled || !onPress}
|
|
57
69
|
onPress={() => onPress && onPress(item, index)}
|
|
58
|
-
accessibilityLabel={`${accessibilityLabel}-touch-${index}`}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
accessibilityLabel={`${accessibilityLabel}-touch-${index}`}>
|
|
71
|
+
<View
|
|
72
|
+
style={{
|
|
73
|
+
minHeight: timeHeight,
|
|
74
|
+
justifyContent: 'flex-end',
|
|
75
|
+
}}>
|
|
76
|
+
{!!time && (
|
|
77
|
+
<Text
|
|
78
|
+
onLayout={onTimesLayout}
|
|
79
|
+
style={{textAlign}}
|
|
80
|
+
color={
|
|
81
|
+
disabled ? theme.colors.text.disable : typoStyle.time.color
|
|
82
|
+
}
|
|
83
|
+
typography={typoStyle.time.typography}
|
|
84
|
+
accessibilityLabel={`${accessibilityLabel}-time-${index}`}>
|
|
85
|
+
{time}
|
|
86
|
+
</Text>
|
|
87
|
+
)}
|
|
88
|
+
</View>
|
|
72
89
|
{renderStepIcon(item, index, align, disabled)}
|
|
73
90
|
{!!title && (
|
|
74
91
|
<Text
|
package/StepsVertical.tsx
CHANGED
|
@@ -55,10 +55,7 @@ const StepsVertical: FC<StepsProps> = ({
|
|
|
55
55
|
}}
|
|
56
56
|
disabled={disabled || !onPress}
|
|
57
57
|
onPress={() => onPress && onPress(item, index)}
|
|
58
|
-
accessibilityLabel={`${accessibilityLabel}-touch-${index}`}
|
|
59
|
-
accessibilityState={{
|
|
60
|
-
disabled,
|
|
61
|
-
}}>
|
|
58
|
+
accessibilityLabel={`${accessibilityLabel}-touch-${index}`}>
|
|
62
59
|
<View
|
|
63
60
|
style={{
|
|
64
61
|
alignItems: 'center',
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
2
|
+
"name": "@momo-kits/step",
|
|
3
|
+
"version": "0.112.1-beta.13",
|
|
4
|
+
"private": false,
|
|
5
|
+
"main": "index.tsx",
|
|
6
|
+
"dependencies": {},
|
|
7
|
+
"peerDependencies": {
|
|
8
|
+
"@momo-kits/foundation": "latest",
|
|
9
|
+
"prop-types": "^15.7.2",
|
|
10
|
+
"react": "16.9.0",
|
|
11
|
+
"react-native": ">=0.55"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@momo-platform/versions": "4.1.11"
|
|
15
|
+
},
|
|
16
|
+
"license": "MoMo",
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"registry": "https://registry.npmjs.org/"
|
|
19
|
+
}
|
|
20
20
|
}
|