Skip to content

Commit 9def38b

Browse files
authored
fix: adjust native driver value based on the rn version (#4246)
1 parent c190a95 commit 9def38b

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/components/Button/Button.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
Animated,
44
ColorValue,
55
GestureResponderEvent,
6+
Platform,
67
StyleProp,
78
StyleSheet,
89
TextStyle,
@@ -218,7 +219,7 @@ const Button = (
218219
Animated.timing(elevation, {
219220
toValue: activeElevation,
220221
duration: 200 * scale,
221-
useNativeDriver: true,
222+
useNativeDriver: Platform.constants.reactNativeVersion.minor <= 72,
222223
}).start();
223224
}
224225
};
@@ -230,7 +231,7 @@ const Button = (
230231
Animated.timing(elevation, {
231232
toValue: initialElevation,
232233
duration: 150 * scale,
233-
useNativeDriver: true,
234+
useNativeDriver: Platform.constants.reactNativeVersion.minor <= 72,
234235
}).start();
235236
}
236237
};

src/components/Chip/Chip.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ const Chip = ({
218218
Animated.timing(elevation, {
219219
toValue: isV3 ? (elevated ? 2 : 0) : 4,
220220
duration: 200 * scale,
221-
useNativeDriver: true,
221+
useNativeDriver: Platform.constants.reactNativeVersion.minor <= 72,
222222
}).start();
223223
});
224224

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

0 commit comments

Comments
 (0)