@artsy/palette-mobile 19.7.0 → 19.8.0
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect } from "react";
|
|
3
|
-
import
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
import { Animated } from "react-native";
|
|
4
4
|
import { useColor } from "../../utils/hooks";
|
|
5
5
|
import { Flex } from "../Flex";
|
|
6
6
|
import { Text } from "../Text";
|
|
@@ -15,14 +15,17 @@ import { Text } from "../Text";
|
|
|
15
15
|
* </Skeleton>
|
|
16
16
|
*/
|
|
17
17
|
export const Skeleton = ({ children }) => {
|
|
18
|
-
const opacity =
|
|
18
|
+
const opacity = useRef(new Animated.Value(0.5));
|
|
19
19
|
useEffect(() => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
Animated.loop(Animated.timing(opacity.current, {
|
|
21
|
+
toValue: 1,
|
|
22
|
+
duration: 1000,
|
|
23
|
+
useNativeDriver: true,
|
|
24
|
+
})).start();
|
|
24
25
|
}, []);
|
|
25
|
-
return _jsx(Animated.View, { style:
|
|
26
|
+
return (_jsx(Animated.View, { style: {
|
|
27
|
+
opacity: opacity.current,
|
|
28
|
+
}, children: children }));
|
|
26
29
|
};
|
|
27
30
|
export const SkeletonText = ({ children, ...rest }) => {
|
|
28
31
|
const color = useColor();
|