@hero-design/rn 8.30.2 → 8.30.4
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/.turbo/turbo-build.log +1 -1
- package/es/index.js +21 -22
- package/lib/index.js +21 -22
- package/package.json +5 -5
- package/src/components/Carousel/__tests__/__snapshots__/index.spec.tsx.snap +3 -33
- package/src/components/Carousel/index.tsx +18 -5
- package/src/components/Skeleton/__tests__/__snapshots__/index.spec.tsx.snap +14 -14
- package/src/components/Skeleton/index.tsx +3 -7
package/.turbo/turbo-build.log
CHANGED
|
@@ -4,5 +4,5 @@ $ rollup -c
|
|
|
4
4
|
[1msrc/index.ts[22m → [1mlib/index.js, es/index.js[22m...[39m
|
|
5
5
|
[1m[33m(!) Plugin replace: @rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`.[39m[22m
|
|
6
6
|
[1m[33m(!) Plugin node-resolve: preferring built-in module 'events' over local alternative at '/root/hero-design/node_modules/events/events.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning[39m[22m
|
|
7
|
-
[32mcreated [1mlib/index.js, es/index.js[22m in [
|
|
7
|
+
[32mcreated [1mlib/index.js, es/index.js[22m in [1m27.5s[22m[39m
|
|
8
8
|
$ tsc --noEmit false --emitDeclarationOnly --project tsconfig.prod.json
|
package/es/index.js
CHANGED
|
@@ -11558,12 +11558,18 @@ var Carousel = function Carousel(_ref) {
|
|
|
11558
11558
|
clearTimeout(handle);
|
|
11559
11559
|
};
|
|
11560
11560
|
}, [currentSlideIndex, carouselRef]);
|
|
11561
|
-
var
|
|
11562
|
-
|
|
11563
|
-
|
|
11564
|
-
var
|
|
11561
|
+
var handleMomentumScrollEnd = function handleMomentumScrollEnd(event) {
|
|
11562
|
+
// Calculate the current index based on the scroll position and container width
|
|
11563
|
+
var containerWidth = event.nativeEvent.layoutMeasurement.width;
|
|
11564
|
+
var scrollPosition = event.nativeEvent.contentOffset.x;
|
|
11565
|
+
/**
|
|
11566
|
+
* By rounding down, we ensure that any partial visibility of the next item does not affect the index value
|
|
11567
|
+
* This helps maintain consistent behavior and aligns with the desired functionality of considering the left-most visible item as the current item.
|
|
11568
|
+
*/
|
|
11569
|
+
var index = Math.floor(scrollPosition / containerWidth);
|
|
11570
|
+
// Call the callback function with the current index
|
|
11565
11571
|
internalOnItemIndexChange(index);
|
|
11566
|
-
}
|
|
11572
|
+
};
|
|
11567
11573
|
var viewConfig = useRef({
|
|
11568
11574
|
viewAreaCoveragePercentThreshold: 50
|
|
11569
11575
|
}).current;
|
|
@@ -11580,7 +11586,7 @@ var Carousel = function Carousel(_ref) {
|
|
|
11580
11586
|
pagingEnabled: true,
|
|
11581
11587
|
bounces: false,
|
|
11582
11588
|
data: items,
|
|
11583
|
-
|
|
11589
|
+
onMomentumScrollEnd: handleMomentumScrollEnd,
|
|
11584
11590
|
viewabilityConfig: viewConfig,
|
|
11585
11591
|
scrollEventThrottle: 32,
|
|
11586
11592
|
ref: carouselRef,
|
|
@@ -11593,8 +11599,8 @@ var Carousel = function Carousel(_ref) {
|
|
|
11593
11599
|
}], {
|
|
11594
11600
|
useNativeDriver: false
|
|
11595
11601
|
}),
|
|
11596
|
-
renderItem: function renderItem(
|
|
11597
|
-
var item =
|
|
11602
|
+
renderItem: function renderItem(_ref2) {
|
|
11603
|
+
var item = _ref2.item;
|
|
11598
11604
|
if (!item) return null;
|
|
11599
11605
|
var image = item.image,
|
|
11600
11606
|
heading = item.heading,
|
|
@@ -14901,7 +14907,7 @@ var getGradientColors = function getGradientColors(theme, intent) {
|
|
|
14901
14907
|
}
|
|
14902
14908
|
};
|
|
14903
14909
|
var Skeleton = function Skeleton(_ref) {
|
|
14904
|
-
var _StyleSheet$flatten
|
|
14910
|
+
var _StyleSheet$flatten;
|
|
14905
14911
|
var _ref$intent = _ref.intent,
|
|
14906
14912
|
intent = _ref$intent === void 0 ? 'light' : _ref$intent,
|
|
14907
14913
|
_ref$variant = _ref.variant,
|
|
@@ -14917,14 +14923,10 @@ var Skeleton = function Skeleton(_ref) {
|
|
|
14917
14923
|
_useState2 = _slicedToArray(_useState, 2),
|
|
14918
14924
|
containerWidth = _useState2[0],
|
|
14919
14925
|
setContainerWidth = _useState2[1];
|
|
14920
|
-
var _useState3 = useState(
|
|
14926
|
+
var _useState3 = useState(false),
|
|
14921
14927
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
14922
|
-
|
|
14923
|
-
|
|
14924
|
-
var _useState5 = useState(false),
|
|
14925
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
14926
|
-
shouldStartAnimation = _useState6[0],
|
|
14927
|
-
setShouldStartAnimation = _useState6[1];
|
|
14928
|
+
shouldStartAnimation = _useState4[0],
|
|
14929
|
+
setShouldStartAnimation = _useState4[1];
|
|
14928
14930
|
var animatedValue = useRef(new Animated.Value(0)).current;
|
|
14929
14931
|
useEffect(function () {
|
|
14930
14932
|
if (shouldStartAnimation) {
|
|
@@ -14941,10 +14943,7 @@ var Skeleton = function Skeleton(_ref) {
|
|
|
14941
14943
|
outputRange: [-containerWidth, containerWidth]
|
|
14942
14944
|
});
|
|
14943
14945
|
var onContainerLayout = useCallback(function (e) {
|
|
14944
|
-
var
|
|
14945
|
-
width = _e$nativeEvent$layout.width,
|
|
14946
|
-
height = _e$nativeEvent$layout.height;
|
|
14947
|
-
setContainerHeight(height);
|
|
14946
|
+
var width = e.nativeEvent.layout.width;
|
|
14948
14947
|
setContainerWidth(width);
|
|
14949
14948
|
if (!shouldStartAnimation) {
|
|
14950
14949
|
setShouldStartAnimation(true);
|
|
@@ -14962,8 +14961,8 @@ var Skeleton = function Skeleton(_ref) {
|
|
|
14962
14961
|
start: gradientPositions.start,
|
|
14963
14962
|
end: gradientPositions.end,
|
|
14964
14963
|
style: {
|
|
14965
|
-
width:
|
|
14966
|
-
height:
|
|
14964
|
+
width: '100%',
|
|
14965
|
+
height: '100%',
|
|
14967
14966
|
transform: [{
|
|
14968
14967
|
translateX: translateX
|
|
14969
14968
|
}]
|
package/lib/index.js
CHANGED
|
@@ -11588,12 +11588,18 @@ var Carousel = function Carousel(_ref) {
|
|
|
11588
11588
|
clearTimeout(handle);
|
|
11589
11589
|
};
|
|
11590
11590
|
}, [currentSlideIndex, carouselRef]);
|
|
11591
|
-
var
|
|
11592
|
-
|
|
11593
|
-
|
|
11594
|
-
var
|
|
11591
|
+
var handleMomentumScrollEnd = function handleMomentumScrollEnd(event) {
|
|
11592
|
+
// Calculate the current index based on the scroll position and container width
|
|
11593
|
+
var containerWidth = event.nativeEvent.layoutMeasurement.width;
|
|
11594
|
+
var scrollPosition = event.nativeEvent.contentOffset.x;
|
|
11595
|
+
/**
|
|
11596
|
+
* By rounding down, we ensure that any partial visibility of the next item does not affect the index value
|
|
11597
|
+
* This helps maintain consistent behavior and aligns with the desired functionality of considering the left-most visible item as the current item.
|
|
11598
|
+
*/
|
|
11599
|
+
var index = Math.floor(scrollPosition / containerWidth);
|
|
11600
|
+
// Call the callback function with the current index
|
|
11595
11601
|
internalOnItemIndexChange(index);
|
|
11596
|
-
}
|
|
11602
|
+
};
|
|
11597
11603
|
var viewConfig = React.useRef({
|
|
11598
11604
|
viewAreaCoveragePercentThreshold: 50
|
|
11599
11605
|
}).current;
|
|
@@ -11610,7 +11616,7 @@ var Carousel = function Carousel(_ref) {
|
|
|
11610
11616
|
pagingEnabled: true,
|
|
11611
11617
|
bounces: false,
|
|
11612
11618
|
data: items,
|
|
11613
|
-
|
|
11619
|
+
onMomentumScrollEnd: handleMomentumScrollEnd,
|
|
11614
11620
|
viewabilityConfig: viewConfig,
|
|
11615
11621
|
scrollEventThrottle: 32,
|
|
11616
11622
|
ref: carouselRef,
|
|
@@ -11623,8 +11629,8 @@ var Carousel = function Carousel(_ref) {
|
|
|
11623
11629
|
}], {
|
|
11624
11630
|
useNativeDriver: false
|
|
11625
11631
|
}),
|
|
11626
|
-
renderItem: function renderItem(
|
|
11627
|
-
var item =
|
|
11632
|
+
renderItem: function renderItem(_ref2) {
|
|
11633
|
+
var item = _ref2.item;
|
|
11628
11634
|
if (!item) return null;
|
|
11629
11635
|
var image = item.image,
|
|
11630
11636
|
heading = item.heading,
|
|
@@ -14931,7 +14937,7 @@ var getGradientColors = function getGradientColors(theme, intent) {
|
|
|
14931
14937
|
}
|
|
14932
14938
|
};
|
|
14933
14939
|
var Skeleton = function Skeleton(_ref) {
|
|
14934
|
-
var _StyleSheet$flatten
|
|
14940
|
+
var _StyleSheet$flatten;
|
|
14935
14941
|
var _ref$intent = _ref.intent,
|
|
14936
14942
|
intent = _ref$intent === void 0 ? 'light' : _ref$intent,
|
|
14937
14943
|
_ref$variant = _ref.variant,
|
|
@@ -14947,14 +14953,10 @@ var Skeleton = function Skeleton(_ref) {
|
|
|
14947
14953
|
_useState2 = _slicedToArray(_useState, 2),
|
|
14948
14954
|
containerWidth = _useState2[0],
|
|
14949
14955
|
setContainerWidth = _useState2[1];
|
|
14950
|
-
var _useState3 = React.useState(
|
|
14956
|
+
var _useState3 = React.useState(false),
|
|
14951
14957
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
14952
|
-
|
|
14953
|
-
|
|
14954
|
-
var _useState5 = React.useState(false),
|
|
14955
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
14956
|
-
shouldStartAnimation = _useState6[0],
|
|
14957
|
-
setShouldStartAnimation = _useState6[1];
|
|
14958
|
+
shouldStartAnimation = _useState4[0],
|
|
14959
|
+
setShouldStartAnimation = _useState4[1];
|
|
14958
14960
|
var animatedValue = React.useRef(new reactNative.Animated.Value(0)).current;
|
|
14959
14961
|
React.useEffect(function () {
|
|
14960
14962
|
if (shouldStartAnimation) {
|
|
@@ -14971,10 +14973,7 @@ var Skeleton = function Skeleton(_ref) {
|
|
|
14971
14973
|
outputRange: [-containerWidth, containerWidth]
|
|
14972
14974
|
});
|
|
14973
14975
|
var onContainerLayout = React.useCallback(function (e) {
|
|
14974
|
-
var
|
|
14975
|
-
width = _e$nativeEvent$layout.width,
|
|
14976
|
-
height = _e$nativeEvent$layout.height;
|
|
14977
|
-
setContainerHeight(height);
|
|
14976
|
+
var width = e.nativeEvent.layout.width;
|
|
14978
14977
|
setContainerWidth(width);
|
|
14979
14978
|
if (!shouldStartAnimation) {
|
|
14980
14979
|
setShouldStartAnimation(true);
|
|
@@ -14992,8 +14991,8 @@ var Skeleton = function Skeleton(_ref) {
|
|
|
14992
14991
|
start: gradientPositions.start,
|
|
14993
14992
|
end: gradientPositions.end,
|
|
14994
14993
|
style: {
|
|
14995
|
-
width:
|
|
14996
|
-
height:
|
|
14994
|
+
width: '100%',
|
|
14995
|
+
height: '100%',
|
|
14997
14996
|
transform: [{
|
|
14998
14997
|
translateX: translateX
|
|
14999
14998
|
}]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hero-design/rn",
|
|
3
|
-
"version": "8.30.
|
|
3
|
+
"version": "8.30.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@emotion/native": "^11.9.3",
|
|
23
23
|
"@emotion/react": "^11.9.3",
|
|
24
|
-
"@hero-design/colors": "8.30.
|
|
24
|
+
"@hero-design/colors": "8.30.4",
|
|
25
25
|
"date-fns": "^2.16.1",
|
|
26
26
|
"events": "^3.2.0",
|
|
27
27
|
"hero-editor": "^1.9.21"
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@babel/preset-typescript": "^7.17.12",
|
|
46
46
|
"@babel/runtime": "^7.18.9",
|
|
47
47
|
"@emotion/jest": "^11.9.3",
|
|
48
|
-
"@hero-design/eslint-plugin": "8.30.
|
|
48
|
+
"@hero-design/eslint-plugin": "8.30.4",
|
|
49
49
|
"@react-native-community/datetimepicker": "^3.5.2",
|
|
50
50
|
"@react-native-community/slider": "4.1.12",
|
|
51
51
|
"@rollup/plugin-babel": "^5.3.1",
|
|
@@ -61,10 +61,10 @@
|
|
|
61
61
|
"@types/react-native": "^0.67.7",
|
|
62
62
|
"@types/react-native-vector-icons": "^6.4.10",
|
|
63
63
|
"babel-plugin-inline-import": "^3.0.0",
|
|
64
|
-
"eslint-config-hd": "8.30.
|
|
64
|
+
"eslint-config-hd": "8.30.4",
|
|
65
65
|
"eslint-plugin-import": "^2.27.5",
|
|
66
66
|
"jest": "^27.3.1",
|
|
67
|
-
"prettier-config-hd": "8.30.
|
|
67
|
+
"prettier-config-hd": "8.30.4",
|
|
68
68
|
"react": "18.0.0",
|
|
69
69
|
"react-native": "0.69.7",
|
|
70
70
|
"react-native-gesture-handler": "~2.1.0",
|
|
@@ -99,7 +99,6 @@ exports[`Carousel renders correctly with pageControlPosition bottom 1`] = `
|
|
|
99
99
|
onScroll={[Function]}
|
|
100
100
|
onScrollBeginDrag={[Function]}
|
|
101
101
|
onScrollEndDrag={[Function]}
|
|
102
|
-
onViewableItemsChanged={[Function]}
|
|
103
102
|
pagingEnabled={true}
|
|
104
103
|
removeClippedSubviews={false}
|
|
105
104
|
renderItem={[Function]}
|
|
@@ -111,16 +110,7 @@ exports[`Carousel renders correctly with pageControlPosition bottom 1`] = `
|
|
|
111
110
|
"viewAreaCoveragePercentThreshold": 50,
|
|
112
111
|
}
|
|
113
112
|
}
|
|
114
|
-
viewabilityConfigCallbackPairs={
|
|
115
|
-
Array [
|
|
116
|
-
Object {
|
|
117
|
-
"onViewableItemsChanged": [Function],
|
|
118
|
-
"viewabilityConfig": Object {
|
|
119
|
-
"viewAreaCoveragePercentThreshold": 50,
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
]
|
|
123
|
-
}
|
|
113
|
+
viewabilityConfigCallbackPairs={Array []}
|
|
124
114
|
>
|
|
125
115
|
<View>
|
|
126
116
|
<View
|
|
@@ -933,7 +923,6 @@ exports[`Carousel renders correctly with pageControlPosition top 1`] = `
|
|
|
933
923
|
onScroll={[Function]}
|
|
934
924
|
onScrollBeginDrag={[Function]}
|
|
935
925
|
onScrollEndDrag={[Function]}
|
|
936
|
-
onViewableItemsChanged={[Function]}
|
|
937
926
|
pagingEnabled={true}
|
|
938
927
|
removeClippedSubviews={false}
|
|
939
928
|
renderItem={[Function]}
|
|
@@ -945,16 +934,7 @@ exports[`Carousel renders correctly with pageControlPosition top 1`] = `
|
|
|
945
934
|
"viewAreaCoveragePercentThreshold": 50,
|
|
946
935
|
}
|
|
947
936
|
}
|
|
948
|
-
viewabilityConfigCallbackPairs={
|
|
949
|
-
Array [
|
|
950
|
-
Object {
|
|
951
|
-
"onViewableItemsChanged": [Function],
|
|
952
|
-
"viewabilityConfig": Object {
|
|
953
|
-
"viewAreaCoveragePercentThreshold": 50,
|
|
954
|
-
},
|
|
955
|
-
},
|
|
956
|
-
]
|
|
957
|
-
}
|
|
937
|
+
viewabilityConfigCallbackPairs={Array []}
|
|
958
938
|
>
|
|
959
939
|
<View>
|
|
960
940
|
<View
|
|
@@ -1620,7 +1600,6 @@ exports[`Carousel should call skip call back when press skip 1`] = `
|
|
|
1620
1600
|
onScroll={[Function]}
|
|
1621
1601
|
onScrollBeginDrag={[Function]}
|
|
1622
1602
|
onScrollEndDrag={[Function]}
|
|
1623
|
-
onViewableItemsChanged={[Function]}
|
|
1624
1603
|
pagingEnabled={true}
|
|
1625
1604
|
removeClippedSubviews={false}
|
|
1626
1605
|
renderItem={[Function]}
|
|
@@ -1632,16 +1611,7 @@ exports[`Carousel should call skip call back when press skip 1`] = `
|
|
|
1632
1611
|
"viewAreaCoveragePercentThreshold": 50,
|
|
1633
1612
|
}
|
|
1634
1613
|
}
|
|
1635
|
-
viewabilityConfigCallbackPairs={
|
|
1636
|
-
Array [
|
|
1637
|
-
Object {
|
|
1638
|
-
"onViewableItemsChanged": [Function],
|
|
1639
|
-
"viewabilityConfig": Object {
|
|
1640
|
-
"viewAreaCoveragePercentThreshold": 50,
|
|
1641
|
-
},
|
|
1642
|
-
},
|
|
1643
|
-
]
|
|
1644
|
-
}
|
|
1614
|
+
viewabilityConfigCallbackPairs={Array []}
|
|
1645
1615
|
>
|
|
1646
1616
|
<View>
|
|
1647
1617
|
<View
|
|
@@ -9,6 +9,8 @@ import React, {
|
|
|
9
9
|
import {
|
|
10
10
|
Animated,
|
|
11
11
|
FlatList,
|
|
12
|
+
NativeScrollEvent,
|
|
13
|
+
NativeSyntheticEvent,
|
|
12
14
|
StyleProp,
|
|
13
15
|
useWindowDimensions,
|
|
14
16
|
View,
|
|
@@ -127,11 +129,22 @@ const Carousel = ({
|
|
|
127
129
|
};
|
|
128
130
|
}, [currentSlideIndex, carouselRef]);
|
|
129
131
|
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
132
|
+
const handleMomentumScrollEnd = (
|
|
133
|
+
event: NativeSyntheticEvent<NativeScrollEvent>
|
|
134
|
+
) => {
|
|
135
|
+
// Calculate the current index based on the scroll position and container width
|
|
136
|
+
const containerWidth = event.nativeEvent.layoutMeasurement.width;
|
|
137
|
+
const scrollPosition = event.nativeEvent.contentOffset.x;
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* By rounding down, we ensure that any partial visibility of the next item does not affect the index value
|
|
141
|
+
* This helps maintain consistent behavior and aligns with the desired functionality of considering the left-most visible item as the current item.
|
|
142
|
+
*/
|
|
143
|
+
const index = Math.floor(scrollPosition / containerWidth);
|
|
144
|
+
|
|
145
|
+
// Call the callback function with the current index
|
|
133
146
|
internalOnItemIndexChange(index);
|
|
134
|
-
}
|
|
147
|
+
};
|
|
135
148
|
|
|
136
149
|
const viewConfig = useRef({ viewAreaCoveragePercentThreshold: 50 }).current;
|
|
137
150
|
|
|
@@ -158,7 +171,7 @@ const Carousel = ({
|
|
|
158
171
|
pagingEnabled
|
|
159
172
|
bounces={false}
|
|
160
173
|
data={items}
|
|
161
|
-
|
|
174
|
+
onMomentumScrollEnd={handleMomentumScrollEnd}
|
|
162
175
|
viewabilityConfig={viewConfig}
|
|
163
176
|
scrollEventThrottle={32}
|
|
164
177
|
ref={carouselRef}
|
|
@@ -57,13 +57,13 @@ exports[`Skeleton renders correctly by default 1`] = `
|
|
|
57
57
|
}
|
|
58
58
|
style={
|
|
59
59
|
Object {
|
|
60
|
-
"height":
|
|
60
|
+
"height": "100%",
|
|
61
61
|
"transform": Array [
|
|
62
62
|
Object {
|
|
63
63
|
"translateX": -0,
|
|
64
64
|
},
|
|
65
65
|
],
|
|
66
|
-
"width":
|
|
66
|
+
"width": "100%",
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
/>
|
|
@@ -128,13 +128,13 @@ exports[`Skeleton renders correctly when intent is dark and variant is circular
|
|
|
128
128
|
}
|
|
129
129
|
style={
|
|
130
130
|
Object {
|
|
131
|
-
"height":
|
|
131
|
+
"height": "100%",
|
|
132
132
|
"transform": Array [
|
|
133
133
|
Object {
|
|
134
134
|
"translateX": -0,
|
|
135
135
|
},
|
|
136
136
|
],
|
|
137
|
-
"width":
|
|
137
|
+
"width": "100%",
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
/>
|
|
@@ -199,13 +199,13 @@ exports[`Skeleton renders correctly when intent is dark and variant is rectangul
|
|
|
199
199
|
}
|
|
200
200
|
style={
|
|
201
201
|
Object {
|
|
202
|
-
"height":
|
|
202
|
+
"height": "100%",
|
|
203
203
|
"transform": Array [
|
|
204
204
|
Object {
|
|
205
205
|
"translateX": -0,
|
|
206
206
|
},
|
|
207
207
|
],
|
|
208
|
-
"width":
|
|
208
|
+
"width": "100%",
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
211
|
/>
|
|
@@ -270,13 +270,13 @@ exports[`Skeleton renders correctly when intent is dark and variant is rounded 1
|
|
|
270
270
|
}
|
|
271
271
|
style={
|
|
272
272
|
Object {
|
|
273
|
-
"height":
|
|
273
|
+
"height": "100%",
|
|
274
274
|
"transform": Array [
|
|
275
275
|
Object {
|
|
276
276
|
"translateX": -0,
|
|
277
277
|
},
|
|
278
278
|
],
|
|
279
|
-
"width":
|
|
279
|
+
"width": "100%",
|
|
280
280
|
}
|
|
281
281
|
}
|
|
282
282
|
/>
|
|
@@ -341,13 +341,13 @@ exports[`Skeleton renders correctly when intent is light and variant is circular
|
|
|
341
341
|
}
|
|
342
342
|
style={
|
|
343
343
|
Object {
|
|
344
|
-
"height":
|
|
344
|
+
"height": "100%",
|
|
345
345
|
"transform": Array [
|
|
346
346
|
Object {
|
|
347
347
|
"translateX": -0,
|
|
348
348
|
},
|
|
349
349
|
],
|
|
350
|
-
"width":
|
|
350
|
+
"width": "100%",
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
353
|
/>
|
|
@@ -412,13 +412,13 @@ exports[`Skeleton renders correctly when intent is light and variant is rectangu
|
|
|
412
412
|
}
|
|
413
413
|
style={
|
|
414
414
|
Object {
|
|
415
|
-
"height":
|
|
415
|
+
"height": "100%",
|
|
416
416
|
"transform": Array [
|
|
417
417
|
Object {
|
|
418
418
|
"translateX": -0,
|
|
419
419
|
},
|
|
420
420
|
],
|
|
421
|
-
"width":
|
|
421
|
+
"width": "100%",
|
|
422
422
|
}
|
|
423
423
|
}
|
|
424
424
|
/>
|
|
@@ -483,13 +483,13 @@ exports[`Skeleton renders correctly when intent is light and variant is rounded
|
|
|
483
483
|
}
|
|
484
484
|
style={
|
|
485
485
|
Object {
|
|
486
|
-
"height":
|
|
486
|
+
"height": "100%",
|
|
487
487
|
"transform": Array [
|
|
488
488
|
Object {
|
|
489
489
|
"translateX": -0,
|
|
490
490
|
},
|
|
491
491
|
],
|
|
492
|
-
"width":
|
|
492
|
+
"width": "100%",
|
|
493
493
|
}
|
|
494
494
|
}
|
|
495
495
|
/>
|
|
@@ -69,9 +69,6 @@ const Skeleton = ({
|
|
|
69
69
|
const [containerWidth, setContainerWidth] = useState(
|
|
70
70
|
Number(StyleSheet.flatten(style)?.width) || 0
|
|
71
71
|
);
|
|
72
|
-
const [containerHeight, setContainerHeight] = useState(
|
|
73
|
-
Number(StyleSheet.flatten(style)?.height) || 0
|
|
74
|
-
);
|
|
75
72
|
|
|
76
73
|
const [shouldStartAnimation, setShouldStartAnimation] = useState(false);
|
|
77
74
|
|
|
@@ -96,8 +93,7 @@ const Skeleton = ({
|
|
|
96
93
|
});
|
|
97
94
|
|
|
98
95
|
const onContainerLayout = useCallback((e: LayoutChangeEvent) => {
|
|
99
|
-
const { width
|
|
100
|
-
setContainerHeight(height);
|
|
96
|
+
const { width } = e.nativeEvent.layout;
|
|
101
97
|
setContainerWidth(width);
|
|
102
98
|
|
|
103
99
|
if (!shouldStartAnimation) {
|
|
@@ -120,8 +116,8 @@ const Skeleton = ({
|
|
|
120
116
|
start={gradientPositions.start}
|
|
121
117
|
end={gradientPositions.end}
|
|
122
118
|
style={{
|
|
123
|
-
width:
|
|
124
|
-
height:
|
|
119
|
+
width: '100%',
|
|
120
|
+
height: '100%',
|
|
125
121
|
transform: [{ translateX }],
|
|
126
122
|
}}
|
|
127
123
|
colors={colors}
|