@momo-kits/foundation 0.161.2-beta.8 → 0.161.2-test.1
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/Application/BottomSheet.tsx +7 -4
- package/Application/BottomTab/BottomTabBar.tsx +15 -15
- package/Application/BottomTab/index.tsx +34 -56
- package/Application/Components/BackgroundImageView.tsx +22 -6
- package/Application/Components/HeaderAnimated.tsx +32 -29
- package/Application/Components/HeaderBackground.tsx +20 -26
- package/Application/Components/HeaderExtendHeader.tsx +114 -94
- package/Application/Components/HeaderTitle.tsx +39 -10
- package/Application/Components/SearchHeader.tsx +16 -21
- package/Application/types.ts +4 -4
- package/Application/utils.tsx +4 -3
- package/Badge/BadgeDotAnimation.tsx +53 -71
- package/Button/index.tsx +1 -4
- package/Input/InputOTP.tsx +38 -23
- package/Layout/FloatingButton.tsx +59 -59
- package/Layout/Screen.tsx +71 -61
- package/Loader/ProgressBar.tsx +20 -18
- package/Pagination/Dot.tsx +2 -2
- package/Pagination/PaginationScroll.tsx +31 -27
- package/Skeleton/index.tsx +32 -24
- package/package.json +1 -1
package/Skeleton/index.tsx
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
|
-
import React, { useContext, useEffect,
|
|
1
|
+
import React, { useContext, useEffect, useState } from 'react';
|
|
2
2
|
import {
|
|
3
|
-
Animated,
|
|
4
|
-
Easing,
|
|
5
3
|
LayoutAnimation,
|
|
6
4
|
Platform,
|
|
7
5
|
StyleSheet,
|
|
8
6
|
UIManager,
|
|
9
7
|
View,
|
|
10
8
|
} from 'react-native';
|
|
9
|
+
import Animated, {
|
|
10
|
+
cancelAnimation,
|
|
11
|
+
Easing,
|
|
12
|
+
interpolate,
|
|
13
|
+
useAnimatedStyle,
|
|
14
|
+
useSharedValue,
|
|
15
|
+
withRepeat,
|
|
16
|
+
withTiming,
|
|
17
|
+
} from 'react-native-reanimated';
|
|
11
18
|
import LinearGradient from 'react-native-linear-gradient';
|
|
12
19
|
import { SkeletonTypes } from './types';
|
|
13
20
|
import { Colors, Styles } from '../Consts';
|
|
@@ -20,32 +27,31 @@ const Skeleton: React.FC<SkeletonTypes> = ({ style }) => {
|
|
|
20
27
|
const PRIMARY_COLOR = Colors.black_05;
|
|
21
28
|
const HIGHLIGHT_COLOR1 = Colors.black_05;
|
|
22
29
|
const HIGHLIGHT_COLOR2 = Colors.black_03;
|
|
23
|
-
const
|
|
30
|
+
const progress = useSharedValue(0);
|
|
24
31
|
|
|
25
32
|
const shimmerColors = [HIGHLIGHT_COLOR1, HIGHLIGHT_COLOR2, HIGHLIGHT_COLOR1];
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return Animated.loop(
|
|
32
|
-
Animated.timing(beginShimmerPosition, {
|
|
33
|
-
toValue: 1,
|
|
33
|
+
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
progress.value = 0;
|
|
36
|
+
progress.value = withRepeat(
|
|
37
|
+
withTiming(1, {
|
|
34
38
|
duration: 1000,
|
|
35
39
|
easing: Easing.linear,
|
|
36
|
-
useNativeDriver: Platform.OS !== 'web',
|
|
37
40
|
}),
|
|
41
|
+
-1,
|
|
42
|
+
false,
|
|
38
43
|
);
|
|
39
|
-
}, [beginShimmerPosition]);
|
|
40
|
-
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
animatedValue.start();
|
|
43
44
|
screen?.onLoading?.(true);
|
|
44
45
|
return () => {
|
|
45
|
-
|
|
46
|
+
cancelAnimation(progress);
|
|
46
47
|
screen?.onLoading?.(false);
|
|
47
48
|
};
|
|
48
|
-
}, [
|
|
49
|
+
}, [progress, screen]);
|
|
50
|
+
|
|
51
|
+
const shimmerStyle = useAnimatedStyle(() => {
|
|
52
|
+
const translateX = interpolate(progress.value, [0, 1], [-width, width]);
|
|
53
|
+
return { transform: [{ translateX }] };
|
|
54
|
+
});
|
|
49
55
|
|
|
50
56
|
const onLayout = (newWidth: number) => {
|
|
51
57
|
if (newWidth !== width) {
|
|
@@ -60,11 +66,13 @@ const Skeleton: React.FC<SkeletonTypes> = ({ style }) => {
|
|
|
60
66
|
style={[Styles.flex, { backgroundColor: PRIMARY_COLOR }]}
|
|
61
67
|
>
|
|
62
68
|
<Animated.View
|
|
63
|
-
style={
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
69
|
+
style={[
|
|
70
|
+
{
|
|
71
|
+
width: '60%',
|
|
72
|
+
height: '100%',
|
|
73
|
+
},
|
|
74
|
+
shimmerStyle,
|
|
75
|
+
]}
|
|
68
76
|
>
|
|
69
77
|
<LinearGradient
|
|
70
78
|
style={[StyleSheet.absoluteFill]}
|