Skip to content

Commit

Permalink
Toast: fixed animation restart on close
Browse files Browse the repository at this point in the history
  • Loading branch information
alansouzati committed Mar 23, 2017
1 parent 6e35a69 commit f4552b1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/js/components/Toast.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ class ToastContents extends Component {
clearTimeout(this._timer);
this._timer = undefined;
this.setState({ closing: true });
setTimeout(onClose, ANIMATION_DURATION);
if (onClose) {
setTimeout(onClose, ANIMATION_DURATION);
}
}

render () {
Expand Down
1 change: 1 addition & 0 deletions src/scss/grommet-core/_objects.toast.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

.#{$grommet-namespace}toast--closing {
@include animation('toast-raise #{$animation-duration}');
animation-fill-mode: forwards;
}

.#{$grommet-namespace}toast__closer {
Expand Down

0 comments on commit f4552b1

Please sign in to comment.