CLOVIS
10/16/2024, 1:35 PMDaniel Weidensdörfer
10/16/2024, 2:37 PMCLOVIS
10/16/2024, 2:39 PMgetBoundingRect
on pure HTML elements. Compose HTML lets you access the ref, but:
• When ref {}
is called, the element is not yet in the DOM, so the size is unknown.
• When ref.dispose {}
is called, the element has already been removed from the DOM, so the size is unknown.David Herman
10/16/2024, 9:40 PMref { rawElement ->
setTimeout({
// rawElement should be in the DOM at this point?
})
}
Maybe also try a pattern like:
var rawElement by remember { mutableStateOf<HTMLElement?>(null }
Div(attrs = {
ref { e ->
rawElement = e as HTMLElement
}
}
if (rawElement != null) {
// rawElement should be in the DOM at this point?
}