Skip to content

Commit

Permalink
Toaster zIndex Fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamal0078k committed Aug 26, 2023
1 parent cce2742 commit b1400c5
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/toaster/src/ToastManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const hasCustomId = settings => Object.hasOwnProperty.call(settings, 'id')

const ToastManager = memo(function ToastManager(props) {
const { bindCloseAll, bindGetToasts, bindNotify, bindRemove } = props

const [zindex, setZindex] = useState(100)
const [toasts, setToasts] = useState([])
const [idCounter, setIdCounter] = useState(0)

Expand Down Expand Up @@ -63,11 +63,19 @@ const ToastManager = memo(function ToastManager(props) {
hasCloseButton: settings.hasCloseButton ?? true,
duration: settings.duration || 5,
close: () => safeCloseToast(id),
intent: settings.intent
intent: settings.intent,
zIndex: settings.zIndex
}
}

const notify = (title, settings) => {
setZindex(settings.zIndex)
if (settings.zIndex != undefined) {
setZindex(settings.zIndex)
} else {
setZindex(100)
}

let tempToasts = toasts
if (hasCustomId(settings)) {
tempToasts = removeToast(settings.id)
Expand All @@ -92,7 +100,7 @@ const ToastManager = memo(function ToastManager(props) {
left={0}
right={0}
position="fixed"
zIndex={StackingOrder.TOASTER}
zIndex={zindex}
pointerEvents="none"
>
{toasts.map(({ description, id, ...rest }) => {
Expand Down

0 comments on commit b1400c5

Please sign in to comment.