Skip to content

Commit

Permalink
fix: platform constants is undefined on web (#4257)
Browse files Browse the repository at this point in the history
  • Loading branch information
mnahkies authored Jan 8, 2024
1 parent d6b6b66 commit 46bd31b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,9 @@ const Button = (
Animated.timing(elevation, {
toValue: activeElevation,
duration: 200 * scale,
useNativeDriver: Platform.constants.reactNativeVersion.minor <= 72,
useNativeDriver:
Platform.OS === 'web' ||
Platform.constants.reactNativeVersion.minor <= 72,
}).start();
}
};
Expand All @@ -231,7 +233,9 @@ const Button = (
Animated.timing(elevation, {
toValue: initialElevation,
duration: 150 * scale,
useNativeDriver: Platform.constants.reactNativeVersion.minor <= 72,
useNativeDriver:
Platform.OS === 'web' ||
Platform.constants.reactNativeVersion.minor <= 72,
}).start();
}
};
Expand Down
8 changes: 6 additions & 2 deletions src/components/Chip/Chip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,9 @@ const Chip = ({
Animated.timing(elevation, {
toValue: isV3 ? (elevated ? 2 : 0) : 4,
duration: 200 * scale,
useNativeDriver: Platform.constants.reactNativeVersion.minor <= 72,
useNativeDriver:
Platform.OS === 'web' ||
Platform.constants.reactNativeVersion.minor <= 72,
}).start();
});

Expand All @@ -228,7 +230,9 @@ const Chip = ({
Animated.timing(elevation, {
toValue: isV3 && elevated ? 1 : 0,
duration: 150 * scale,
useNativeDriver: Platform.constants.reactNativeVersion.minor <= 72,
useNativeDriver:
Platform.OS === 'web' ||
Platform.constants.reactNativeVersion.minor <= 72,
}).start();
});

Expand Down

0 comments on commit 46bd31b

Please sign in to comment.