Skip to content

Commit

Permalink
fix: dynamic update of Button styles
Browse files Browse the repository at this point in the history
  • Loading branch information
BogiKay committed Dec 6, 2024
1 parent f81eebc commit 9b37692
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,13 @@ const Button = (
);

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

const handlePressIn = (e: GestureResponderEvent) => {
Expand Down

0 comments on commit 9b37692

Please sign in to comment.