Skip to content

Commit 08db3f7

Browse files
authored
fix firstLoad logic in floatingButton (#1021)
1 parent 90da8c3 commit 08db3f7

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/components/floatingButton/index.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,6 @@ class FloatingButton extends PureComponent<FloatingButtonProps> {
6464
this.firstLoad = true;
6565
}
6666

67-
componentDidMount() {
68-
this.firstLoad = false;
69-
}
70-
7167
onAnimationEnd = () => {
7268
this.setState({animating: false});
7369
};
@@ -117,6 +113,9 @@ class FloatingButton extends PureComponent<FloatingButtonProps> {
117113
const {withoutAnimation, secondaryButton, visible} = this.props;
118114
const Container = !withoutAnimation ? AnimatableView : View;
119115

116+
// NOTE: keep this.firstLoad as true as long as the visibility changed to true
117+
this.firstLoad && !visible ? this.firstLoad = true : this.firstLoad = false;
118+
120119
// NOTE: On first load, don't show if it should not be visible
121120
if (this.firstLoad === true && !this.initialVisibility) {
122121
return false;

0 commit comments

Comments
 (0)