Scene does not work inside LazyColumn
dependenceis : "io.github.sceneview:sceneview:2.0.3"
exceptions:
java.lang.IllegalStateException: Calling method on destroyed View at com.google.android.filament
.View.getNativeObject(View.java:1229)
at com.google.android.filament.View.setScene(View.java:210)
at io.github.sceneview.SceneView.setScene(SceneView.kt:249)
at io.github.sceneview.SceneKt$Scene$4.invoke(Scene.kt:220)
at io.github.sceneview.SceneKt$Scene$4.invoke(Scene.kt:190)
The Scene Composable exists inside the LazyColumn, and after scrolling to the bottom, the following error occurs when you return to the item with Scene Composable. It seems to be a problem caused by the creation and destruction of items by necessity inside LazyColumn, but we can't control LazyColumn.
Therefore, it is being solved temporarily using the following method. But I don't think it's a good way
AndroidView(
modifier = Modifier,
factory = { context ->
object : FrameLayout(context).apply {
layoutParams = ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT
)
addView(
SceneView()
),
onRelease = { _ ->
sceneView?.destroy()
}
)
Is there a way to do it?
Very interresting subject. I have to admit that I never tested it.
Would you share your code somewhere on GitHub so we can check the destroying/dispose behaviour with LazyColumn?
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.