@momo-kits/foundation 0.92.6-rc.28 → 0.92.6-rc.29
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.
|
@@ -84,7 +84,7 @@ const BottomTab: React.FC<BottomTabProps> = ({
|
|
|
84
84
|
},
|
|
85
85
|
tabStyle: {
|
|
86
86
|
height: 68,
|
|
87
|
-
paddingVertical:
|
|
87
|
+
paddingVertical: 10,
|
|
88
88
|
},
|
|
89
89
|
}}>
|
|
90
90
|
{tabs.map(item => {
|
|
@@ -122,7 +122,7 @@ const BottomTab: React.FC<BottomTabProps> = ({
|
|
|
122
122
|
fontFamily: `${theme.font}-Bold`,
|
|
123
123
|
left: isDot ? 8 : 4,
|
|
124
124
|
top: isDot ? -2 : -6,
|
|
125
|
-
backgroundColor: isNum ? Colors.
|
|
125
|
+
backgroundColor: isNum ? Colors.red_03 : Colors.orange_03,
|
|
126
126
|
},
|
|
127
127
|
tabBarIcon: ({color}) => (
|
|
128
128
|
<Icon source={item.icon} color={color} size={28} />
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
} from 'react-native';
|
|
9
9
|
import {ApplicationContext} from '../Application';
|
|
10
10
|
import {Icon} from '../Icon';
|
|
11
|
-
import {Text} from '../Text';
|
|
12
11
|
|
|
13
12
|
export interface FloatingButtonProps {
|
|
14
13
|
label?: string;
|
|
@@ -36,6 +35,7 @@ export const FloatingButton: React.FC<FloatingButtonProps> = ({
|
|
|
36
35
|
const {theme} = useContext(ApplicationContext);
|
|
37
36
|
const maxWidth = useRef(0);
|
|
38
37
|
const minWidth = size == 'small' ? 36 : 48;
|
|
38
|
+
const [opacityAnimated] = useState(new Animated.Value(0)); // Initial opacity set to 0
|
|
39
39
|
const [widthAnimated, setWidthAnimated] = useState<Animated.Value>();
|
|
40
40
|
const lastOffset = useRef(0);
|
|
41
41
|
const lastDirection = useRef<string>();
|
|
@@ -44,6 +44,12 @@ export const FloatingButton: React.FC<FloatingButtonProps> = ({
|
|
|
44
44
|
useEffect(() => {
|
|
45
45
|
if (!label) return;
|
|
46
46
|
|
|
47
|
+
Animated.timing(opacityAnimated, {
|
|
48
|
+
toValue: 1,
|
|
49
|
+
duration: 100,
|
|
50
|
+
useNativeDriver: true,
|
|
51
|
+
}).start();
|
|
52
|
+
|
|
47
53
|
const listener = animatedValue?.addListener(({value}) => {
|
|
48
54
|
if (value !== lastOffset.current && value > 0) {
|
|
49
55
|
const direction = value > lastOffset.current ? 'down' : 'up';
|
|
@@ -51,15 +57,25 @@ export const FloatingButton: React.FC<FloatingButtonProps> = ({
|
|
|
51
57
|
if (lastDirection.current !== direction) {
|
|
52
58
|
lastDirection.current = direction;
|
|
53
59
|
if (direction === 'down') {
|
|
60
|
+
Animated.timing(opacityAnimated, {
|
|
61
|
+
toValue: 0,
|
|
62
|
+
duration: 100,
|
|
63
|
+
useNativeDriver: true,
|
|
64
|
+
}).start();
|
|
54
65
|
Animated.timing(widthAnimated!, {
|
|
55
66
|
toValue: minWidth,
|
|
56
|
-
duration:
|
|
67
|
+
duration: 100,
|
|
57
68
|
useNativeDriver: false,
|
|
58
69
|
}).start(() => setShowText(false));
|
|
59
70
|
} else {
|
|
71
|
+
Animated.timing(opacityAnimated, {
|
|
72
|
+
toValue: 1,
|
|
73
|
+
duration: 100,
|
|
74
|
+
useNativeDriver: true,
|
|
75
|
+
}).start();
|
|
60
76
|
Animated.timing(widthAnimated!, {
|
|
61
77
|
toValue: maxWidth.current,
|
|
62
|
-
duration:
|
|
78
|
+
duration: 100,
|
|
63
79
|
useNativeDriver: false,
|
|
64
80
|
}).start(() => setShowText(true));
|
|
65
81
|
}
|
|
@@ -121,13 +137,11 @@ export const FloatingButton: React.FC<FloatingButtonProps> = ({
|
|
|
121
137
|
color={iconColor}
|
|
122
138
|
/>
|
|
123
139
|
{showText && !!label && (
|
|
124
|
-
<Text
|
|
125
|
-
style={styles.label}
|
|
126
|
-
|
|
127
|
-
numberOfLines={1}
|
|
128
|
-
typography="action_default_bold">
|
|
140
|
+
<Animated.Text
|
|
141
|
+
style={[styles.label, {opacity: opacityAnimated, color: 'white'}]}
|
|
142
|
+
numberOfLines={1}>
|
|
129
143
|
{label}
|
|
130
|
-
</Text>
|
|
144
|
+
</Animated.Text>
|
|
131
145
|
)}
|
|
132
146
|
</TouchableOpacity>
|
|
133
147
|
</Animated.View>
|
|
@@ -147,5 +161,8 @@ const styles = StyleSheet.create({
|
|
|
147
161
|
},
|
|
148
162
|
label: {
|
|
149
163
|
marginLeft: 8,
|
|
164
|
+
fontSize: 16,
|
|
165
|
+
lineHeight: 22,
|
|
166
|
+
fontWeight: '700',
|
|
150
167
|
},
|
|
151
168
|
});
|