Skip to content

Commit a0a72f7

Browse files
authored
fix: measureInWindow on web platform (#4)
* fix: measureInWindow on web platform * fix: simplify measureInWindow logic for Shimmer component
1 parent aebff14 commit a0a72f7

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/Shimmer.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,9 @@ export const Shimmer = ({
5151
const measure = useCallback(
5252
(event: LayoutChangeEvent) => {
5353
if (componentWidth === 0) {
54-
event.target.measureInWindow((x, _y, width) => {
55-
setComponentWidth(width);
56-
setOffset(x);
57-
});
54+
const { width, x } = event.nativeEvent.layout;
55+
setComponentWidth(width);
56+
setOffset(x);
5857
}
5958
},
6059
[componentWidth]

0 commit comments

Comments
 (0)