When move movable content (`movableContentOf`) fro...
# compose
f
When move movable content (
movableContentOf
) from/to a
SubcomposeLayout
, the
AndroidView
within it will recreate its view.
Copy code
// When rotate screen, AndroidView recreate its view
val content = remember {
    movableContentOf { isLandscape: Boolean ->
        AndroidView(factory = { context ->
            Log.d("AndroidView", "create view")
            TextView(context).apply {
                layoutParams = ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT)
            }
        }) {
            it.text = if (isLandscape) "Landscape" else "Portrait"
        }
    }
}
val isLandscape =
    LocalConfiguration.current.orientation == Configuration.ORIENTATION_LANDSCAPE
BoxWithConstraints {
    if (!isLandscape) {
        content(false)
    }
}
if (isLandscape) {
    content(true)
}
Is this expected?
a
please file a bug, we will see what we can do
f