From 42627d96f03c17244397f54f71fde4c8f3f73538 Mon Sep 17 00:00:00 2001 From: mertsincan Date: Sun, 6 Jun 2021 13:51:41 +0300 Subject: [PATCH] Fixed #2089 - Add 'toast' key to ZIndex option on PrimeReact api --- src/components/toast/Toast.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/toast/Toast.js b/src/components/toast/Toast.js index 7010a8c3b1..9d0e36d289 100644 --- a/src/components/toast/Toast.js +++ b/src/components/toast/Toast.js @@ -63,11 +63,11 @@ export class Toast extends Component { newMessages = this.state.messages ? [...this.state.messages, value] : [value]; } + this.state.messages.length === 0 && ZIndexUtils.set('toast', this.container, this.props.baseZIndex); + this.setState({ messages: newMessages }); - - ZIndexUtils.set('toast', this.container, this.props.baseZIndex); } } @@ -95,6 +95,8 @@ export class Toast extends Component { } onExited() { + this.state.messages.length === 0 && ZIndexUtils.clear(this.container); + this.props.onHide && this.props.onHide(); }