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 a2186ba commit f079360Copy full SHA for f079360
src/Shimmer.tsx
@@ -5,6 +5,7 @@ import {
5
type ViewStyle,
6
Dimensions,
7
type LayoutChangeEvent,
8
+ Platform,
9
} from 'react-native';
10
import Animated, {
11
Easing,
@@ -51,7 +52,11 @@ export const Shimmer = ({
51
52
const measure = useCallback(
53
(event: LayoutChangeEvent) => {
54
if (componentWidth === 0) {
- event.target.measureInWindow((x, _y, width) => {
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
});
0 commit comments