related-ui-components 2.8.2 → 2.8.3
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/lib/module/components/Skeleton/Shimmer.js +8 -3
- package/lib/module/components/Skeleton/Shimmer.js.map +1 -1
- package/lib/typescript/src/components/Skeleton/Shimmer.d.ts +2 -1
- package/lib/typescript/src/components/Skeleton/Shimmer.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Skeleton/Shimmer.tsx +18 -9
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import React, { useEffect, useRef } from "react";
|
|
4
|
-
import { View, StyleSheet, Animated, Easing } from "react-native";
|
|
4
|
+
import { View, StyleSheet, Animated, Easing, I18nManager } from "react-native";
|
|
5
5
|
import { LinearGradient } from "expo-linear-gradient";
|
|
6
6
|
import { useTheme } from "../../theme/index.js";
|
|
7
7
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -10,12 +10,14 @@ const Shimmer = ({
|
|
|
10
10
|
width,
|
|
11
11
|
height,
|
|
12
12
|
style,
|
|
13
|
+
shimmerColor,
|
|
13
14
|
duration = 1500,
|
|
14
15
|
shimmerWidth = 150
|
|
15
16
|
}) => {
|
|
16
17
|
const {
|
|
17
18
|
theme
|
|
18
19
|
} = useTheme();
|
|
20
|
+
const isRTL = I18nManager.isRTL;
|
|
19
21
|
const animatedValue = useRef(new Animated.Value(0)).current;
|
|
20
22
|
useEffect(() => {
|
|
21
23
|
const animation = Animated.loop(Animated.timing(animatedValue, {
|
|
@@ -27,11 +29,14 @@ const Shimmer = ({
|
|
|
27
29
|
animation.start();
|
|
28
30
|
return () => animation.stop();
|
|
29
31
|
}, [animatedValue, duration]);
|
|
32
|
+
const numericWidth = typeof width === "number" ? width : 400;
|
|
33
|
+
const ltrOutputRange = [-shimmerWidth, numericWidth + shimmerWidth];
|
|
34
|
+
const rtlOutputRange = [numericWidth + shimmerWidth, -shimmerWidth];
|
|
30
35
|
const translateX = animatedValue.interpolate({
|
|
31
36
|
inputRange: [0, 1],
|
|
32
|
-
outputRange:
|
|
37
|
+
outputRange: isRTL ? rtlOutputRange : ltrOutputRange
|
|
33
38
|
});
|
|
34
|
-
const shimmerColors = ["transparent", theme.skeletonShimmer, "transparent"];
|
|
39
|
+
const shimmerColors = ["transparent", shimmerColor || theme.skeletonShimmer, "transparent"];
|
|
35
40
|
return /*#__PURE__*/_jsxs(View, {
|
|
36
41
|
style: [{
|
|
37
42
|
width,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useEffect","useRef","View","StyleSheet","Animated","Easing","LinearGradient","useTheme","jsx","_jsx","jsxs","_jsxs","Shimmer","children","width","height","style","duration","shimmerWidth","theme","animatedValue","Value","current","animation","loop","timing","toValue","easing","linear","useNativeDriver","start","stop","translateX","interpolate","inputRange","outputRange","shimmerColors","skeletonShimmer","overflow","backgroundColor","skeletonBackgroundColor","absoluteFillObject","transform","zIndex","colors","flex","x","y","end"],"sourceRoot":"..\\..\\..\\..\\src","sources":["components/Skeleton/Shimmer.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAChD,SACEC,IAAI,EACJC,UAAU,EACVC,QAAQ,EACRC,MAAM,
|
|
1
|
+
{"version":3,"names":["React","useEffect","useRef","View","StyleSheet","Animated","Easing","I18nManager","LinearGradient","useTheme","jsx","_jsx","jsxs","_jsxs","Shimmer","children","width","height","style","shimmerColor","duration","shimmerWidth","theme","isRTL","animatedValue","Value","current","animation","loop","timing","toValue","easing","linear","useNativeDriver","start","stop","numericWidth","ltrOutputRange","rtlOutputRange","translateX","interpolate","inputRange","outputRange","shimmerColors","skeletonShimmer","overflow","backgroundColor","skeletonBackgroundColor","absoluteFillObject","transform","zIndex","colors","flex","x","y","end"],"sourceRoot":"..\\..\\..\\..\\src","sources":["components/Skeleton/Shimmer.tsx"],"mappings":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ACF,YAAY,GAAGf,YAAY,EAAE,CAACA,YAAY,CAAC;EAEnE,MAAMkB,UAAU,GAAGf,aAAa,CAACgB,WAAW,CAAC;IAC3CC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IAClBC,WAAW,EAAEnB,KAAK,GAAGe,cAAc,GAAGD;EACxC,CAAC,CAAC;EAEF,MAAMM,aAAa,GAAG,CACpB,aAAa,EACbxB,YAAY,IAAIG,KAAK,CAACsB,eAAe,EACrC,aAAa,CACd;EAED,oBACE/B,KAAA,CAACV,IAAI;IACHe,KAAK,EAAE,CACL;MACEF,KAAK;MACLC,MAAM;MACN4B,QAAQ,EAAE,QAAQ;MAClBC,eAAe,EAAExB,KAAK,CAACyB;IACzB,CAAC,EACD7B,KAAK,CACL;IAAAH,QAAA,GAEDA,QAAQ,eACTJ,IAAA,CAACN,QAAQ,CAACF,IAAI;MACZe,KAAK,EAAE;QACL,GAAGd,UAAU,CAAC4C,kBAAkB;QAChCC,SAAS,EAAE,CAAC;UAAEV;QAAW,CAAC,CAAC;QAC3BW,MAAM,EAAE;MACV,CAAE;MAAAnC,QAAA,eAEFJ,IAAA,CAACH,cAAc;QACb2C,MAAM,EAAER,aAAqB;QAC7BzB,KAAK,EAAE;UAAEkC,IAAI,EAAE,CAAC;UAAEpC,KAAK,EAAEK;QAAa,CAAE;QACxCa,KAAK,EAAE;UAAEmB,CAAC,EAAE,CAAC;UAAEC,CAAC,EAAE;QAAI,CAAE;QACxBC,GAAG,EAAE;UAAEF,CAAC,EAAE,CAAC;UAAEC,CAAC,EAAE;QAAI;MAAE,CACvB;IAAC,CACW,CAAC;EAAA,CACZ,CAAC;AAEX,CAAC;AAED,eAAexC,OAAO","ignoreList":[]}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ViewStyle, DimensionValue, StyleProp } from "react-native";
|
|
3
3
|
interface ShimmerProps {
|
|
4
|
-
children
|
|
4
|
+
children?: React.ReactNode;
|
|
5
5
|
width: DimensionValue;
|
|
6
6
|
height: DimensionValue;
|
|
7
7
|
style?: StyleProp<ViewStyle>;
|
|
8
8
|
duration?: number;
|
|
9
9
|
shimmerWidth?: number;
|
|
10
|
+
shimmerColor?: string;
|
|
10
11
|
}
|
|
11
12
|
declare const Shimmer: React.FC<ShimmerProps>;
|
|
12
13
|
export default Shimmer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Shimmer.d.ts","sourceRoot":"","sources":["../../../../../src/components/Skeleton/Shimmer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AACjD,OAAO,EAKL,SAAS,EACT,cAAc,EACd,SAAS,
|
|
1
|
+
{"version":3,"file":"Shimmer.d.ts","sourceRoot":"","sources":["../../../../../src/components/Skeleton/Shimmer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AACjD,OAAO,EAKL,SAAS,EACT,cAAc,EACd,SAAS,EAEV,MAAM,cAAc,CAAC;AAItB,UAAU,YAAY;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,KAAK,EAAE,cAAc,CAAC;IACtB,MAAM,EAAE,cAAc,CAAC;IACvB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,QAAA,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAuEnC,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
package/package.json
CHANGED
|
@@ -7,17 +7,19 @@ import {
|
|
|
7
7
|
ViewStyle,
|
|
8
8
|
DimensionValue,
|
|
9
9
|
StyleProp,
|
|
10
|
+
I18nManager,
|
|
10
11
|
} from "react-native";
|
|
11
12
|
import { LinearGradient } from "expo-linear-gradient";
|
|
12
13
|
import { useTheme } from "../../theme";
|
|
13
14
|
|
|
14
15
|
interface ShimmerProps {
|
|
15
|
-
children
|
|
16
|
+
children?: React.ReactNode;
|
|
16
17
|
width: DimensionValue;
|
|
17
18
|
height: DimensionValue;
|
|
18
19
|
style?: StyleProp<ViewStyle>;
|
|
19
20
|
duration?: number;
|
|
20
21
|
shimmerWidth?: number;
|
|
22
|
+
shimmerColor?: string;
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
const Shimmer: React.FC<ShimmerProps> = ({
|
|
@@ -25,11 +27,12 @@ const Shimmer: React.FC<ShimmerProps> = ({
|
|
|
25
27
|
width,
|
|
26
28
|
height,
|
|
27
29
|
style,
|
|
30
|
+
shimmerColor,
|
|
28
31
|
duration = 1500,
|
|
29
32
|
shimmerWidth = 150,
|
|
30
33
|
}) => {
|
|
31
34
|
const { theme } = useTheme();
|
|
32
|
-
|
|
35
|
+
const isRTL = I18nManager.isRTL;
|
|
33
36
|
const animatedValue = useRef(new Animated.Value(0)).current;
|
|
34
37
|
|
|
35
38
|
useEffect(() => {
|
|
@@ -45,25 +48,31 @@ const Shimmer: React.FC<ShimmerProps> = ({
|
|
|
45
48
|
return () => animation.stop();
|
|
46
49
|
}, [animatedValue, duration]);
|
|
47
50
|
|
|
51
|
+
const numericWidth = typeof width === "number" ? width : 400;
|
|
52
|
+
|
|
53
|
+
const ltrOutputRange = [-shimmerWidth, numericWidth + shimmerWidth];
|
|
54
|
+
const rtlOutputRange = [numericWidth + shimmerWidth, -shimmerWidth];
|
|
55
|
+
|
|
48
56
|
const translateX = animatedValue.interpolate({
|
|
49
57
|
inputRange: [0, 1],
|
|
50
|
-
|
|
51
|
-
outputRange: [
|
|
52
|
-
-shimmerWidth,
|
|
53
|
-
typeof width === "number" ? width + shimmerWidth : 400 + shimmerWidth,
|
|
54
|
-
],
|
|
58
|
+
outputRange: isRTL ? rtlOutputRange : ltrOutputRange,
|
|
55
59
|
});
|
|
56
60
|
|
|
57
61
|
const shimmerColors = [
|
|
58
62
|
"transparent",
|
|
59
|
-
theme.skeletonShimmer,
|
|
63
|
+
shimmerColor || theme.skeletonShimmer,
|
|
60
64
|
"transparent",
|
|
61
65
|
];
|
|
62
66
|
|
|
63
67
|
return (
|
|
64
68
|
<View
|
|
65
69
|
style={[
|
|
66
|
-
{
|
|
70
|
+
{
|
|
71
|
+
width,
|
|
72
|
+
height,
|
|
73
|
+
overflow: "hidden",
|
|
74
|
+
backgroundColor: theme.skeletonBackgroundColor,
|
|
75
|
+
},
|
|
67
76
|
style,
|
|
68
77
|
]}
|
|
69
78
|
>
|