mirror of
https://github.com/InsanusMokrassar/JSUIKitKBindings.git
synced 2024-11-23 10:38:45 +00:00
potential fix of modals composition cancelling
This commit is contained in:
parent
7c5a9ecc3d
commit
c483bb67d8
@ -8,8 +8,6 @@ import dev.inmo.jsuikit.modifiers.*
|
|||||||
import org.jetbrains.compose.web.dom.*
|
import org.jetbrains.compose.web.dom.*
|
||||||
import org.jetbrains.compose.web.renderComposableInBody
|
import org.jetbrains.compose.web.renderComposableInBody
|
||||||
import org.w3c.dom.HTMLDivElement
|
import org.w3c.dom.HTMLDivElement
|
||||||
import org.w3c.dom.MutationObserver
|
|
||||||
import org.w3c.dom.MutationObserverInit
|
|
||||||
import kotlin.random.Random
|
import kotlin.random.Random
|
||||||
import kotlin.random.nextUInt
|
import kotlin.random.nextUInt
|
||||||
|
|
||||||
@ -31,9 +29,11 @@ fun Dialog(
|
|||||||
removeOnHide: Boolean = true,
|
removeOnHide: Boolean = true,
|
||||||
bodyBuilder: ContentBuilder<HTMLDivElement> = {}
|
bodyBuilder: ContentBuilder<HTMLDivElement> = {}
|
||||||
) {
|
) {
|
||||||
val drawDiv = remember { mutableStateOf(true) }
|
val draw = remember { mutableStateOf(true) }
|
||||||
val composition = remember {
|
|
||||||
|
remember {
|
||||||
renderComposableInBody {
|
renderComposableInBody {
|
||||||
|
if (draw.value) {
|
||||||
Div(
|
Div(
|
||||||
{
|
{
|
||||||
if (modifiers.none { it is UIKitModal.WithCustomAttributes }) {
|
if (modifiers.none { it is UIKitModal.WithCustomAttributes }) {
|
||||||
@ -70,7 +70,7 @@ fun Dialog(
|
|||||||
|
|
||||||
|
|
||||||
onDispose {
|
onDispose {
|
||||||
drawDiv.value = false
|
draw.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,19 +114,16 @@ fun Dialog(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (drawDiv.value) {
|
|
||||||
Div({
|
Div({
|
||||||
hidden()
|
hidden()
|
||||||
ref {
|
ref {
|
||||||
onDispose {
|
onDispose {
|
||||||
composition.dispose()
|
draw.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
|
||||||
runCatching { composition.dispose() }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
Loading…
Reference in New Issue
Block a user