Skip to content

Commit 129b33b

Browse files
authored
fix/connent duration prop (#1228)
* connent duration prop * set default props
1 parent 0bfdbc5 commit 129b33b

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/components/floatingButton/index.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ const gradientImage = () => require('./gradient.png');
5454
class FloatingButton extends PureComponent<FloatingButtonProps> {
5555
static displayName = 'FloatingButton';
5656

57+
static defaultProps = {
58+
duration: 300
59+
};
60+
5761
initialVisibility?: boolean;
5862
firstLoad: boolean;
5963
visibleAnimated: Animated.Value;
@@ -67,10 +71,12 @@ class FloatingButton extends PureComponent<FloatingButtonProps> {
6771
}
6872

6973
componentDidUpdate(prevProps: FloatingButtonProps) {
70-
if (prevProps.visible !== this.props.visible) {
74+
const {visible, duration} = this.props;
75+
76+
if (prevProps.visible !== visible) {
7177
Animated.timing(this.visibleAnimated, {
72-
toValue: Number(!!this.props.visible),
73-
duration: 300,
78+
toValue: Number(!!visible),
79+
duration,
7480
useNativeDriver: true
7581
}).start();
7682
}

0 commit comments

Comments
 (0)