We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f079360 commit 36455a6Copy full SHA for 36455a6
src/Shimmer.tsx
@@ -5,7 +5,6 @@ import {
5
type ViewStyle,
6
Dimensions,
7
type LayoutChangeEvent,
8
- Platform,
9
} from 'react-native';
10
import Animated, {
11
Easing,
@@ -52,14 +51,9 @@ export const Shimmer = ({
52
51
const measure = useCallback(
53
(event: LayoutChangeEvent) => {
54
if (componentWidth === 0) {
55
- const measureInWindowFn =
56
- Platform.OS === 'web'
57
- ? event.nativeEvent.target.measureInWindow
58
- : event.target.measureInWindow;
59
- measureInWindowFn((x, _y, width) => {
60
- setComponentWidth(width);
61
- setOffset(x);
62
- });
+ const { width, x } = event.nativeEvent.layout;
+ setComponentWidth(width);
+ setOffset(x);
63
}
64
},
65
[componentWidth]
0 commit comments