Skip to content

Commit 9b37692

Browse files
committed
fix: dynamic update of Button styles
1 parent f81eebc commit 9b37692

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/components/Button/Button.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,13 @@ const Button = (
227227
);
228228

229229
React.useEffect(() => {
230-
elevation.setValue(isElevationEntitled ? initialElevation : 0);
230+
// Workaround not to call setValue on Animated.Value, because it breaks styles.
231+
// https://github.com/callstack/react-native-paper/issues/4559
232+
Animated.timing(elevation, {
233+
toValue: isElevationEntitled ? initialElevation : 0,
234+
duration: 0,
235+
useNativeDriver: true,
236+
});
231237
}, [isElevationEntitled, elevation, initialElevation]);
232238

233239
const handlePressIn = (e: GestureResponderEvent) => {

0 commit comments

Comments
 (0)