Exception in ShowcaseContent
Hello. I am getting the following exception:
java.lang.IllegalStateException: LayoutCoordinate operations are only valid when isAttached is true
at androidx.compose.ui.node.NodeCoordinator.getParentLayoutCoordinates(NodeCoordinator.kt:256)
at androidx.compose.ui.layout.LayoutCoordinatesKt.findRootCoordinates(LayoutCoordinates.kt:180)
at androidx.compose.ui.layout.LayoutCoordinatesKt.boundsInWindow(LayoutCoordinates.kt:134)
at com.canopas.lib.showcase.component.ShowcaseContentKt.ShowcaseContent(ShowcaseContent.kt:76)
at com.canopas.lib.showcase.component.ShowcaseContentKt$ShowcasePopup$1$1.invoke(ShowcaseContent.kt:55)
at com.canopas.lib.showcase.component.ShowcaseContentKt$ShowcasePopup$1$1.invoke(ShowcaseContent.kt:54)
If I debug into the code I can confirm that the 'targetCords.isAttached' is false and the call of 'targetCords.boundsInWindow()' leads to the exception.
My guess is it has something to do with the fact that I am using a LazyColum. But anyway.. It might be better to handle the 'isAttached == false' case in the library than letting the app crash?
Okey this also happens in other situations for example if I want to target a Composable in a 'trailingIcon' of a TextField
- my sc implementation goes through three different views.
- the first passthrough is always correct,
- but at the end of the whole sequence, if I reset the showcase state and jump to the beginning - every transition between already composed views - results in this exception. In general - every time the showcase increments to the target already composed element on a separate view - the application crashes.
I think instead of trying to consume the coordinates of a composable that was previously drawn, it should force a re-composition or something like that.