Skip to content

Commit b1400c5

Browse files
author
Kamal0078k
committed
Toaster zIndex Fixed
1 parent cce2742 commit b1400c5

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/toaster/src/ToastManager.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const hasCustomId = settings => Object.hasOwnProperty.call(settings, 'id')
88

99
const ToastManager = memo(function ToastManager(props) {
1010
const { bindCloseAll, bindGetToasts, bindNotify, bindRemove } = props
11-
11+
const [zindex, setZindex] = useState(100)
1212
const [toasts, setToasts] = useState([])
1313
const [idCounter, setIdCounter] = useState(0)
1414

@@ -63,11 +63,19 @@ const ToastManager = memo(function ToastManager(props) {
6363
hasCloseButton: settings.hasCloseButton ?? true,
6464
duration: settings.duration || 5,
6565
close: () => safeCloseToast(id),
66-
intent: settings.intent
66+
intent: settings.intent,
67+
zIndex: settings.zIndex
6768
}
6869
}
6970

7071
const notify = (title, settings) => {
72+
setZindex(settings.zIndex)
73+
if (settings.zIndex != undefined) {
74+
setZindex(settings.zIndex)
75+
} else {
76+
setZindex(100)
77+
}
78+
7179
let tempToasts = toasts
7280
if (hasCustomId(settings)) {
7381
tempToasts = removeToast(settings.id)
@@ -92,7 +100,7 @@ const ToastManager = memo(function ToastManager(props) {
92100
left={0}
93101
right={0}
94102
position="fixed"
95-
zIndex={StackingOrder.TOASTER}
103+
zIndex={zindex}
96104
pointerEvents="none"
97105
>
98106
{toasts.map(({ description, id, ...rest }) => {

0 commit comments

Comments
 (0)