@reown/appkit-ui-react-native 0.0.0-feat-deeplink-provider-20250812191340 → 0.0.0-feat-multichain-20250813172441
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/commonjs/components/wui-shimmer/index.js +86 -28
- package/lib/commonjs/components/wui-shimmer/index.js.map +1 -1
- package/lib/module/components/wui-shimmer/index.js +87 -29
- package/lib/module/components/wui-shimmer/index.js.map +1 -1
- package/lib/typescript/components/wui-shimmer/index.d.ts +9 -3
- package/lib/typescript/components/wui-shimmer/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/wui-shimmer/index.tsx +97 -36
|
@@ -4,11 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.Shimmer = void 0;
|
|
7
|
-
var _reactNativeSvg = require("react-native-svg");
|
|
8
7
|
var _reactNative = require("react-native");
|
|
8
|
+
var _react = require("react");
|
|
9
9
|
var _useTheme = require("../../hooks/useTheme");
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
const AnimatedRect = _reactNative.Animated.createAnimatedComponent(_reactNativeSvg.Rect);
|
|
12
11
|
const Shimmer = ({
|
|
13
12
|
width = 200,
|
|
14
13
|
height = 200,
|
|
@@ -16,38 +15,97 @@ const Shimmer = ({
|
|
|
16
15
|
borderRadius = 0,
|
|
17
16
|
backgroundColor,
|
|
18
17
|
foregroundColor,
|
|
18
|
+
highlightWidthRatio = 0.3,
|
|
19
|
+
highlightOpacity = 0.5,
|
|
20
|
+
angle = 20,
|
|
19
21
|
style
|
|
20
22
|
}) => {
|
|
21
|
-
const animatedValue = new _reactNative.Animated.Value(0);
|
|
22
23
|
const Theme = (0, _useTheme.useTheme)();
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
const [measuredWidth, setMeasuredWidth] = (0, _react.useState)(null);
|
|
25
|
+
const [measuredHeight, setMeasuredHeight] = (0, _react.useState)(null);
|
|
26
|
+
const translateRef = (0, _react.useRef)(new _reactNative.Animated.Value(0));
|
|
27
|
+
const loopRef = (0, _react.useRef)(null);
|
|
28
|
+
(0, _react.useEffect)(() => {
|
|
29
|
+
if (!measuredWidth) {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
const translateX = translateRef.current;
|
|
33
|
+
translateX.setValue(0);
|
|
34
|
+
const timing = _reactNative.Animated.timing(translateX, {
|
|
35
|
+
toValue: 1,
|
|
36
|
+
duration,
|
|
37
|
+
useNativeDriver: true
|
|
38
|
+
});
|
|
39
|
+
const loop = _reactNative.Animated.loop(timing);
|
|
40
|
+
loopRef.current = loop;
|
|
41
|
+
loop.start();
|
|
42
|
+
return () => {
|
|
43
|
+
loop.stop();
|
|
44
|
+
if (loopRef.current === loop) {
|
|
45
|
+
loopRef.current = null;
|
|
46
|
+
}
|
|
47
|
+
translateX.stopAnimation(() => {
|
|
48
|
+
translateX.setValue(0);
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
}, [duration, measuredWidth]);
|
|
52
|
+
const baseColor = backgroundColor ?? Theme['bg-200'];
|
|
53
|
+
const highlightColor = foregroundColor ?? Theme['bg-300'];
|
|
54
|
+
const onLayout = event => {
|
|
55
|
+
const {
|
|
56
|
+
width: w,
|
|
57
|
+
height: h
|
|
58
|
+
} = event.nativeEvent.layout;
|
|
59
|
+
// Update measurements whenever they change to adapt to dynamic layout/orientation
|
|
60
|
+
if (measuredWidth == null || Math.abs(w - measuredWidth) > 0.5) {
|
|
61
|
+
setMeasuredWidth(w);
|
|
62
|
+
}
|
|
63
|
+
if (measuredHeight == null || Math.abs(h - measuredHeight) > 0.5) {
|
|
64
|
+
setMeasuredHeight(h);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// Compute animated translateX only if we have width
|
|
69
|
+
let animatedTranslateX = 0;
|
|
70
|
+
let bandWidth = 0;
|
|
71
|
+
if (measuredWidth) {
|
|
72
|
+
bandWidth = Math.max(8, measuredWidth * highlightWidthRatio);
|
|
73
|
+
const travel = measuredWidth + bandWidth * 2;
|
|
74
|
+
animatedTranslateX = translateRef.current.interpolate({
|
|
75
|
+
inputRange: [0, 1],
|
|
76
|
+
outputRange: [-bandWidth, travel - bandWidth]
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
const containerStyle = {
|
|
28
80
|
width,
|
|
29
81
|
height,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
82
|
+
borderRadius,
|
|
83
|
+
overflow: 'hidden',
|
|
84
|
+
borderWidth: _reactNative.StyleSheet.hairlineWidth,
|
|
85
|
+
borderColor: Theme['bg-300'],
|
|
86
|
+
backgroundColor: baseColor
|
|
87
|
+
};
|
|
88
|
+
const bandStyle = {
|
|
89
|
+
position: 'absolute',
|
|
90
|
+
top: measuredHeight ? -measuredHeight * 0.25 : 0,
|
|
91
|
+
bottom: measuredHeight ? -measuredHeight * 0.25 : 0,
|
|
92
|
+
width: bandWidth,
|
|
93
|
+
backgroundColor: highlightColor,
|
|
94
|
+
opacity: highlightOpacity
|
|
34
95
|
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(AnimatedRect, {
|
|
49
|
-
...animatedProps
|
|
50
|
-
})
|
|
96
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
97
|
+
onLayout: onLayout,
|
|
98
|
+
style: [containerStyle, style],
|
|
99
|
+
children: measuredWidth && measuredHeight ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
|
|
100
|
+
pointerEvents: "none",
|
|
101
|
+
style: [bandStyle, {
|
|
102
|
+
transform: [{
|
|
103
|
+
translateX: animatedTranslateX
|
|
104
|
+
}, {
|
|
105
|
+
rotate: `${angle}deg`
|
|
106
|
+
}]
|
|
107
|
+
}]
|
|
108
|
+
}) : null
|
|
51
109
|
});
|
|
52
110
|
};
|
|
53
111
|
exports.Shimmer = Shimmer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_react","_useTheme","_jsxRuntime","Shimmer","width","height","duration","borderRadius","backgroundColor","foregroundColor","highlightWidthRatio","highlightOpacity","angle","style","Theme","useTheme","measuredWidth","setMeasuredWidth","useState","measuredHeight","setMeasuredHeight","translateRef","useRef","Animated","Value","loopRef","useEffect","undefined","translateX","current","setValue","timing","toValue","useNativeDriver","loop","start","stop","stopAnimation","baseColor","highlightColor","onLayout","event","w","h","nativeEvent","layout","Math","abs","animatedTranslateX","bandWidth","max","travel","interpolate","inputRange","outputRange","containerStyle","overflow","borderWidth","StyleSheet","hairlineWidth","borderColor","bandStyle","position","top","bottom","opacity","jsx","View","children","pointerEvents","transform","rotate","exports"],"sourceRoot":"../../../../src","sources":["components/wui-shimmer/index.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAAgD,IAAAG,WAAA,GAAAH,OAAA;AAkBzC,MAAMI,OAAO,GAAGA,CAAC;EACtBC,KAAK,GAAG,GAAG;EACXC,MAAM,GAAG,GAAG;EACZC,QAAQ,GAAG,IAAI;EACfC,YAAY,GAAG,CAAC;EAChBC,eAAe;EACfC,eAAe;EACfC,mBAAmB,GAAG,GAAG;EACzBC,gBAAgB,GAAG,GAAG;EACtBC,KAAK,GAAG,EAAE;EACVC;AACY,CAAC,KAAK;EAClB,MAAMC,KAAK,GAAG,IAAAC,kBAAQ,EAAC,CAAC;EAExB,MAAM,CAACC,aA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,GAAG,CAAC;IAChD6C,MAAM,EAAE7C,cAAc,GAAG,CAACA,cAAc,GAAG,IAAI,GAAG,CAAC;IACnDf,KAAK,EAAE6C,SAAS;IAChBzC,eAAe,EAAE+B,cAAc;IAC/B0B,OAAO,EAAEtD;EACX,CAAC;EAED,oBACE,IAAAT,WAAA,CAAAgE,GAAA,EAACpE,YAAA,CAAAqE,IAAI;IAAC3B,QAAQ,EAAEA,QAAS;IAAC3B,KAAK,EAAE,CAAC0C,cAAc,EAAE1C,KAAK,CAAE;IAAAuD,QAAA,EACtDpD,aAAa,IAAIG,cAAc,gBAC9B,IAAAjB,WAAA,CAAAgE,GAAA,EAACpE,YAAA,CAAAyB,QAAQ,CAAC4C,IAAI;MACZE,aAAa,EAAC,MAAM;MACpBxD,KAAK,EAAE,CACLgD,SAAS,EACT;QACES,SAAS,EAAE,CAAC;UAAE1C,UAAU,EAAEoB;QAAmB,CAAC,EAAE;UAAEuB,MAAM,EAAE,GAAG3D,KAAK;QAAM,CAAC;MAC3E,CAAC;IACD,CACH,CAAC,GACA;EAAI,CACJ,CAAC;AAEX,CAAC;AAAC4D,OAAA,CAAArE,OAAA,GAAAA,OAAA","ignoreList":[]}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { Animated, StyleSheet, View } from 'react-native';
|
|
4
|
+
import { useEffect, useRef, useState } from 'react';
|
|
5
5
|
import { useTheme } from '../../hooks/useTheme';
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
const AnimatedRect = Animated.createAnimatedComponent(Rect);
|
|
8
7
|
export const Shimmer = ({
|
|
9
8
|
width = 200,
|
|
10
9
|
height = 200,
|
|
@@ -12,38 +11,97 @@ export const Shimmer = ({
|
|
|
12
11
|
borderRadius = 0,
|
|
13
12
|
backgroundColor,
|
|
14
13
|
foregroundColor,
|
|
14
|
+
highlightWidthRatio = 0.3,
|
|
15
|
+
highlightOpacity = 0.5,
|
|
16
|
+
angle = 20,
|
|
15
17
|
style
|
|
16
18
|
}) => {
|
|
17
|
-
const animatedValue = new Animated.Value(0);
|
|
18
19
|
const Theme = useTheme();
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
const [measuredWidth, setMeasuredWidth] = useState(null);
|
|
21
|
+
const [measuredHeight, setMeasuredHeight] = useState(null);
|
|
22
|
+
const translateRef = useRef(new Animated.Value(0));
|
|
23
|
+
const loopRef = useRef(null);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (!measuredWidth) {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
const translateX = translateRef.current;
|
|
29
|
+
translateX.setValue(0);
|
|
30
|
+
const timing = Animated.timing(translateX, {
|
|
31
|
+
toValue: 1,
|
|
32
|
+
duration,
|
|
33
|
+
useNativeDriver: true
|
|
34
|
+
});
|
|
35
|
+
const loop = Animated.loop(timing);
|
|
36
|
+
loopRef.current = loop;
|
|
37
|
+
loop.start();
|
|
38
|
+
return () => {
|
|
39
|
+
loop.stop();
|
|
40
|
+
if (loopRef.current === loop) {
|
|
41
|
+
loopRef.current = null;
|
|
42
|
+
}
|
|
43
|
+
translateX.stopAnimation(() => {
|
|
44
|
+
translateX.setValue(0);
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
}, [duration, measuredWidth]);
|
|
48
|
+
const baseColor = backgroundColor ?? Theme['bg-200'];
|
|
49
|
+
const highlightColor = foregroundColor ?? Theme['bg-300'];
|
|
50
|
+
const onLayout = event => {
|
|
51
|
+
const {
|
|
52
|
+
width: w,
|
|
53
|
+
height: h
|
|
54
|
+
} = event.nativeEvent.layout;
|
|
55
|
+
// Update measurements whenever they change to adapt to dynamic layout/orientation
|
|
56
|
+
if (measuredWidth == null || Math.abs(w - measuredWidth) > 0.5) {
|
|
57
|
+
setMeasuredWidth(w);
|
|
58
|
+
}
|
|
59
|
+
if (measuredHeight == null || Math.abs(h - measuredHeight) > 0.5) {
|
|
60
|
+
setMeasuredHeight(h);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
// Compute animated translateX only if we have width
|
|
65
|
+
let animatedTranslateX = 0;
|
|
66
|
+
let bandWidth = 0;
|
|
67
|
+
if (measuredWidth) {
|
|
68
|
+
bandWidth = Math.max(8, measuredWidth * highlightWidthRatio);
|
|
69
|
+
const travel = measuredWidth + bandWidth * 2;
|
|
70
|
+
animatedTranslateX = translateRef.current.interpolate({
|
|
71
|
+
inputRange: [0, 1],
|
|
72
|
+
outputRange: [-bandWidth, travel - bandWidth]
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
const containerStyle = {
|
|
24
76
|
width,
|
|
25
77
|
height,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
78
|
+
borderRadius,
|
|
79
|
+
overflow: 'hidden',
|
|
80
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
81
|
+
borderColor: Theme['bg-300'],
|
|
82
|
+
backgroundColor: baseColor
|
|
83
|
+
};
|
|
84
|
+
const bandStyle = {
|
|
85
|
+
position: 'absolute',
|
|
86
|
+
top: measuredHeight ? -measuredHeight * 0.25 : 0,
|
|
87
|
+
bottom: measuredHeight ? -measuredHeight * 0.25 : 0,
|
|
88
|
+
width: bandWidth,
|
|
89
|
+
backgroundColor: highlightColor,
|
|
90
|
+
opacity: highlightOpacity
|
|
30
91
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
children: /*#__PURE__*/_jsx(AnimatedRect, {
|
|
45
|
-
...animatedProps
|
|
46
|
-
})
|
|
92
|
+
return /*#__PURE__*/_jsx(View, {
|
|
93
|
+
onLayout: onLayout,
|
|
94
|
+
style: [containerStyle, style],
|
|
95
|
+
children: measuredWidth && measuredHeight ? /*#__PURE__*/_jsx(Animated.View, {
|
|
96
|
+
pointerEvents: "none",
|
|
97
|
+
style: [bandStyle, {
|
|
98
|
+
transform: [{
|
|
99
|
+
translateX: animatedTranslateX
|
|
100
|
+
}, {
|
|
101
|
+
rotate: `${angle}deg`
|
|
102
|
+
}]
|
|
103
|
+
}]
|
|
104
|
+
}) : null
|
|
47
105
|
});
|
|
48
106
|
};
|
|
49
107
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["Animated","StyleSheet","View","useEffect","useRef","useState","useTheme","jsx","_jsx","Shimmer","width","height","duration","borderRadius","backgroundColor","foregroundColor","highlightWidthRatio","highlightOpacity","angle","style","Theme","measuredWidth","setMeasuredWidth","measuredHeight","setMeasuredHeight","translateRef","Value","loopRef","undefined","translateX","current","setValue","timing","toValue","useNativeDriver","loop","start","stop","stopAnimation","baseColor","highlightColor","onLayout","event","w","h","nativeEvent","layout","Math","abs","animatedTranslateX","bandWidth","max","travel","interpolate","inputRange","outputRange","containerStyle","overflow","borderWidth","hairlineWidth","borderColor","bandStyle","position","top","bottom","opacity","children","pointerEvents","transform","rotate"],"sourceRoot":"../../../../src","sources":["components/wui-shimmer/index.tsx"],"mappings":";;AAAA,SAASA,QAAQ,EAAEC,UAAU,EAAEC,IAAI,QAAwC,cAAc;AACzF,SAASC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACnD,SAASC,QAAQ,QAAQ,sBAAsB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAkBhD,OAAO,MAAMC,OAAO,GAAGA,CAAC;EACtBC,KAAK,GAAG,GAAG;EACXC,MAAM,GAAG,GAAG;EACZC,QAAQ,GAAG,IAAI;EACfC,YAAY,GAAG,CAAC;EAChBC,eAAe;EACfC,eAAe;EACfC,mBAAmB,GAAG,GA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AEyB;EACnB,CAAC;EAED,MAAMsB,SAAoB,GAAG;IAC3BC,QAAQ,EAAE,UAAU;IACpBC,GAAG,EAAExC,cAAc,GAAG,CAACA,cAAc,GAAG,IAAI,GAAG,CAAC;IAChDyC,MAAM,EAAEzC,cAAc,GAAG,CAACA,cAAc,GAAG,IAAI,GAAG,CAAC;IACnDb,KAAK,EAAEwC,SAAS;IAChBpC,eAAe,EAAE0B,cAAc;IAC/ByB,OAAO,EAAEhD;EACX,CAAC;EAED,oBACET,IAAA,CAACN,IAAI;IAACuC,QAAQ,EAAEA,QAAS;IAACtB,KAAK,EAAE,CAACqC,cAAc,EAAErC,KAAK,CAAE;IAAA+C,QAAA,EACtD7C,aAAa,IAAIE,cAAc,gBAC9Bf,IAAA,CAACR,QAAQ,CAACE,IAAI;MACZiE,aAAa,EAAC,MAAM;MACpBhD,KAAK,EAAE,CACL0C,SAAS,EACT;QACEO,SAAS,EAAE,CAAC;UAAEvC,UAAU,EAAEoB;QAAmB,CAAC,EAAE;UAAEoB,MAAM,EAAE,GAAGnD,KAAK;QAAM,CAAC;MAC3E,CAAC;IACD,CACH,CAAC,GACA;EAAI,CACJ,CAAC;AAEX,CAAC","ignoreList":[]}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
2
|
+
type PercentString = `${number}%`;
|
|
3
|
+
type ShimmerDimension = number | PercentString;
|
|
2
4
|
export interface ShimmerProps {
|
|
3
|
-
width?:
|
|
4
|
-
height?:
|
|
5
|
+
width?: ShimmerDimension;
|
|
6
|
+
height?: ShimmerDimension;
|
|
5
7
|
duration?: number;
|
|
6
8
|
borderRadius?: number;
|
|
7
9
|
backgroundColor?: string;
|
|
8
10
|
foregroundColor?: string;
|
|
11
|
+
highlightWidthRatio?: number;
|
|
12
|
+
highlightOpacity?: number;
|
|
13
|
+
angle?: number;
|
|
9
14
|
style?: StyleProp<ViewStyle>;
|
|
10
15
|
}
|
|
11
|
-
export declare const Shimmer: ({ width, height, duration, borderRadius, backgroundColor, foregroundColor, style }: ShimmerProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare const Shimmer: ({ width, height, duration, borderRadius, backgroundColor, foregroundColor, highlightWidthRatio, highlightOpacity, angle, style }: ShimmerProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export {};
|
|
12
18
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/wui-shimmer/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/wui-shimmer/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA8B,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAI1F,KAAK,aAAa,GAAG,GAAG,MAAM,GAAG,CAAC;AAClC,KAAK,gBAAgB,GAAG,MAAM,GAAG,aAAa,CAAC;AAE/C,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,eAAO,MAAM,OAAO,qIAWjB,YAAY,4CA+Fd,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reown/appkit-ui-react-native",
|
|
3
|
-
"version": "0.0.0-feat-
|
|
3
|
+
"version": "0.0.0-feat-multichain-20250813172441",
|
|
4
4
|
"main": "lib/commonjs/index.js",
|
|
5
5
|
"types": "lib/typescript/index.d.ts",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@reown/appkit-common-react-native": "0.0.0-feat-
|
|
42
|
+
"@reown/appkit-common-react-native": "0.0.0-feat-multichain-20250813172441",
|
|
43
43
|
"polished": "4.3.1",
|
|
44
44
|
"qrcode": "1.5.3"
|
|
45
45
|
},
|
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Animated, StyleSheet, View, type StyleProp, type ViewStyle } from 'react-native';
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
3
|
import { useTheme } from '../../hooks/useTheme';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
type PercentString = `${number}%`;
|
|
6
|
+
type ShimmerDimension = number | PercentString;
|
|
6
7
|
|
|
7
8
|
export interface ShimmerProps {
|
|
8
|
-
width?:
|
|
9
|
-
height?:
|
|
9
|
+
width?: ShimmerDimension;
|
|
10
|
+
height?: ShimmerDimension;
|
|
10
11
|
duration?: number;
|
|
11
12
|
borderRadius?: number;
|
|
12
13
|
backgroundColor?: string;
|
|
13
14
|
foregroundColor?: string;
|
|
15
|
+
highlightWidthRatio?: number;
|
|
16
|
+
highlightOpacity?: number;
|
|
17
|
+
angle?: number; // in degrees
|
|
14
18
|
style?: StyleProp<ViewStyle>;
|
|
15
19
|
}
|
|
16
20
|
|
|
@@ -21,46 +25,103 @@ export const Shimmer = ({
|
|
|
21
25
|
borderRadius = 0,
|
|
22
26
|
backgroundColor,
|
|
23
27
|
foregroundColor,
|
|
28
|
+
highlightWidthRatio = 0.3,
|
|
29
|
+
highlightOpacity = 0.5,
|
|
30
|
+
angle = 20,
|
|
24
31
|
style
|
|
25
32
|
}: ShimmerProps) => {
|
|
26
|
-
const animatedValue = new Animated.Value(0);
|
|
27
33
|
const Theme = useTheme();
|
|
28
34
|
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
const [measuredWidth, setMeasuredWidth] = useState<number | null>(null);
|
|
36
|
+
const [measuredHeight, setMeasuredHeight] = useState<number | null>(null);
|
|
37
|
+
|
|
38
|
+
const translateRef = useRef(new Animated.Value(0));
|
|
39
|
+
const loopRef = useRef<Animated.CompositeAnimation | null>(null);
|
|
40
|
+
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
if (!measuredWidth) {
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
const translateX = translateRef.current;
|
|
46
|
+
translateX.setValue(0);
|
|
47
|
+
const timing = Animated.timing(translateX, {
|
|
48
|
+
toValue: 1,
|
|
49
|
+
duration,
|
|
50
|
+
useNativeDriver: true
|
|
51
|
+
});
|
|
52
|
+
const loop = Animated.loop(timing);
|
|
53
|
+
loopRef.current = loop;
|
|
54
|
+
loop.start();
|
|
55
|
+
|
|
56
|
+
return () => {
|
|
57
|
+
loop.stop();
|
|
58
|
+
if (loopRef.current === loop) {
|
|
59
|
+
loopRef.current = null;
|
|
60
|
+
}
|
|
61
|
+
translateX.stopAnimation(() => {
|
|
62
|
+
translateX.setValue(0);
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
}, [duration, measuredWidth]);
|
|
66
|
+
|
|
67
|
+
const baseColor = backgroundColor ?? Theme['bg-200'];
|
|
68
|
+
const highlightColor = foregroundColor ?? Theme['bg-300'];
|
|
69
|
+
|
|
70
|
+
const onLayout = (event: any) => {
|
|
71
|
+
const { width: w, height: h } = event.nativeEvent.layout;
|
|
72
|
+
// Update measurements whenever they change to adapt to dynamic layout/orientation
|
|
73
|
+
if (measuredWidth == null || Math.abs(w - measuredWidth) > 0.5) {
|
|
74
|
+
setMeasuredWidth(w);
|
|
75
|
+
}
|
|
76
|
+
if (measuredHeight == null || Math.abs(h - measuredHeight) > 0.5) {
|
|
77
|
+
setMeasuredHeight(h);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
// Compute animated translateX only if we have width
|
|
82
|
+
let animatedTranslateX: any = 0;
|
|
83
|
+
let bandWidth = 0;
|
|
84
|
+
if (measuredWidth) {
|
|
85
|
+
bandWidth = Math.max(8, measuredWidth * highlightWidthRatio);
|
|
86
|
+
const travel = measuredWidth + bandWidth * 2;
|
|
87
|
+
animatedTranslateX = translateRef.current.interpolate({
|
|
88
|
+
inputRange: [0, 1],
|
|
89
|
+
outputRange: [-bandWidth, travel - bandWidth]
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const containerStyle: ViewStyle = {
|
|
38
94
|
width,
|
|
39
95
|
height,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
96
|
+
borderRadius,
|
|
97
|
+
overflow: 'hidden',
|
|
98
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
99
|
+
borderColor: Theme['bg-300'],
|
|
100
|
+
backgroundColor: baseColor
|
|
44
101
|
};
|
|
45
102
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
103
|
+
const bandStyle: ViewStyle = {
|
|
104
|
+
position: 'absolute',
|
|
105
|
+
top: measuredHeight ? -measuredHeight * 0.25 : 0,
|
|
106
|
+
bottom: measuredHeight ? -measuredHeight * 0.25 : 0,
|
|
107
|
+
width: bandWidth,
|
|
108
|
+
backgroundColor: highlightColor,
|
|
109
|
+
opacity: highlightOpacity
|
|
110
|
+
};
|
|
53
111
|
|
|
54
112
|
return (
|
|
55
|
-
<
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
113
|
+
<View onLayout={onLayout} style={[containerStyle, style]}>
|
|
114
|
+
{measuredWidth && measuredHeight ? (
|
|
115
|
+
<Animated.View
|
|
116
|
+
pointerEvents="none"
|
|
117
|
+
style={[
|
|
118
|
+
bandStyle,
|
|
119
|
+
{
|
|
120
|
+
transform: [{ translateX: animatedTranslateX }, { rotate: `${angle}deg` }]
|
|
121
|
+
}
|
|
122
|
+
]}
|
|
123
|
+
/>
|
|
124
|
+
) : null}
|
|
125
|
+
</View>
|
|
65
126
|
);
|
|
66
127
|
};
|