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.
@@ -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: [-shimmerWidth, typeof width === "number" ? width + shimmerWidth : 400 + shimmerWidth]
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,QAID,cAAc;AACrB,SAASC,cAAc,QAAQ,sBAAsB;AACrD,SAASC,QAAQ,QAAQ,sBAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAWvC,MAAMC,OAA+B,GAAGA,CAAC;EACvCC,QAAQ;EACRC,KAAK;EACLC,MAAM;EACNC,KAAK;EACLC,QAAQ,GAAG,IAAI;EACfC,YAAY,GAAG;AACjB,CAAC,KAAK;EACJ,MAAM;IAAEC;EAAM,CAAC,GAAGZ,QAAQ,CAAC,CAAC;EAE5B,MAAMa,aAAa,GAAGnB,MAAM,CAAC,IAAIG,QAAQ,CAACiB,KAAK,CAAC,CAAC,CAAC,CAAC,CAACC,OAAO;EAE3DtB,SAAS,CAAC,MAAM;IACd,MAAMuB,SAAS,GAAGnB,QAAQ,CAACoB,IAAI,CAC7BpB,QAAQ,CAACqB,MAAM,CAACL,aAAa,EAAE;MAC7BM,OAAO,EAAE,CAAC;MACVT,QAAQ,EAAEA,QAAQ;MAClBU,MAAM,EAAEtB,MAAM,CAACuB,MAAM;MACrBC,eAAe,EAAE;IACnB,CAAC,CACH,CAAC;IACDN,SAAS,CAACO,KAAK,CAAC,CAAC;IACjB,OAAO,MAAMP,SAAS,CAACQ,IAAI,CAAC,CAAC;EAC/B,CAAC,EAAE,CAACX,aAAa,EAAEH,QAAQ,CAAC,CAAC;EAE7B,MAAMe,UAAU,GAAGZ,aAAa,CAACa,WAAW,CAAC;IAC3CC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IAElBC,WAAW,EAAE,CACX,CAACjB,YAAY,EACb,OAAOJ,KAAK,KAAK,QAAQ,GAAGA,KAAK,GAAGI,YAAY,GAAG,GAAG,GAAGA,YAAY;EAEzE,CAAC,CAAC;EAEF,MAAMkB,aAAa,GAAG,CACpB,aAAa,EACbjB,KAAK,CAACkB,eAAe,EACrB,aAAa,CACd;EAED,oBACE1B,KAAA,CAACT,IAAI;IACHc,KAAK,EAAE,CACL;MAAEF,KAAK;MAAEC,MAAM;MAAEuB,QAAQ,EAAE,QAAQ;MAAEC,eAAe,EAAEpB,KAAK,CAACqB;IAAwB,CAAC,EACrFxB,KAAK,CACL;IAAAH,QAAA,GAEDA,QAAQ,eACTJ,IAAA,CAACL,QAAQ,CAACF,IAAI;MACZc,KAAK,EAAE;QACL,GAAGb,UAAU,CAACsC,kBAAkB;QAChCC,SAAS,EAAE,CAAC;UAAEV;QAAW,CAAC,CAAC;QAC3BW,MAAM,EAAE;MACV,CAAE;MAAA9B,QAAA,eAEFJ,IAAA,CAACH,cAAc;QACbsC,MAAM,EAAER,aAAqB;QAC7BpB,KAAK,EAAE;UAAE6B,IAAI,EAAE,CAAC;UAAE/B,KAAK,EAAEI;QAAa,CAAE;QACxCY,KAAK,EAAE;UAAEgB,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,eAAenC,OAAO","ignoreList":[]}
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":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAChD,SACEC,IAAI,EACJC,UAAU,EACVC,QAAQ,EACRC,MAAM,EAINC,WAAW,QACN,cAAc;AACrB,SAASC,cAAc,QAAQ,sBAAsB;AACrD,SAASC,QAAQ,QAAQ,sBAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAYvC,MAAMC,OAA+B,GAAGA,CAAC;EACvCC,QAAQ;EACRC,KAAK;EACLC,MAAM;EACNC,KAAK;EACLC,YAAY;EACZC,QAAQ,GAAG,IAAI;EACfC,YAAY,GAAG;AACjB,CAAC,KAAK;EACJ,MAAM;IAAEC;EAAM,CAAC,GAAGb,QAAQ,CAAC,CAAC;EAC5B,MAAMc,KAAK,GAAGhB,WAAW,CAACgB,KAAK;EAC/B,MAAMC,aAAa,GAAGtB,MAAM,CAAC,IAAIG,QAAQ,CAACoB,KAAK,CAAC,CAAC,CAAC,CAAC,CAACC,OAAO;EAE3DzB,SAAS,CAAC,MAAM;IACd,MAAM0B,SAAS,GAAGtB,QAAQ,CAACuB,IAAI,CAC7BvB,QAAQ,CAACwB,MAAM,CAACL,aAAa,EAAE;MAC7BM,OAAO,EAAE,CAAC;MACVV,QAAQ,EAAEA,QAAQ;MAClBW,MAAM,EAAEzB,MAAM,CAAC0B,MAAM;MACrBC,eAAe,EAAE;IACnB,CAAC,CACH,CAAC;IACDN,SAAS,CAACO,KAAK,CAAC,CAAC;IACjB,OAAO,MAAMP,SAAS,CAACQ,IAA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E;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: React.ReactNode;
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,EACV,MAAM,cAAc,CAAC;AAItB,UAAU,YAAY;IACpB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,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;CACvB;AAED,QAAA,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAgEnC,CAAC;AAEF,eAAe,OAAO,CAAC"}
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "related-ui-components",
3
- "version": "2.8.2",
3
+ "version": "2.8.3",
4
4
  "main": "./src/index.ts",
5
5
  "scripts": {
6
6
  "start": "expo start",
@@ -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: React.ReactNode;
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
- { width, height, overflow: "hidden", backgroundColor: theme.skeletonBackgroundColor },
70
+ {
71
+ width,
72
+ height,
73
+ overflow: "hidden",
74
+ backgroundColor: theme.skeletonBackgroundColor,
75
+ },
67
76
  style,
68
77
  ]}
69
78
  >