Skip to content

Commit

Permalink
fix: adjust native driver value based on the rn version (#4246)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukewalczak authored Dec 27, 2023
1 parent c190a95 commit 9def38b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
Animated,
ColorValue,
GestureResponderEvent,
Platform,
StyleProp,
StyleSheet,
TextStyle,
Expand Down Expand Up @@ -218,7 +219,7 @@ const Button = (
Animated.timing(elevation, {
toValue: activeElevation,
duration: 200 * scale,
useNativeDriver: true,
useNativeDriver: Platform.constants.reactNativeVersion.minor <= 72,
}).start();
}
};
Expand All @@ -230,7 +231,7 @@ const Button = (
Animated.timing(elevation, {
toValue: initialElevation,
duration: 150 * scale,
useNativeDriver: true,
useNativeDriver: Platform.constants.reactNativeVersion.minor <= 72,
}).start();
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/components/Chip/Chip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ const Chip = ({
Animated.timing(elevation, {
toValue: isV3 ? (elevated ? 2 : 0) : 4,
duration: 200 * scale,
useNativeDriver: true,
useNativeDriver: Platform.constants.reactNativeVersion.minor <= 72,
}).start();
});

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

Expand Down

0 comments on commit 9def38b

Please sign in to comment.