Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Commit a692574

Browse files
committed
fix views visibility in state binding for android StatefulViewFactory
1 parent fcdd65a commit a692574

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

widgets/src/androidMain/kotlin/dev/icerock/moko/widgets/core/factory/StatefulViewFactory.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,13 @@ actual class StatefulViewFactory actual constructor(
6969
is State.Error -> errorView
7070
}
7171

72-
views.forEach { it.view.visibility = View.GONE }
73-
currentView.view.visibility = View.VISIBLE
72+
views.asSequence()
73+
.filter { it.view.visibility != View.GONE && it.view.id != currentView.view.id }
74+
.forEach { it.view.visibility = View.GONE }
75+
76+
if (currentView.view.visibility != View.VISIBLE) {
77+
currentView.view.visibility = View.VISIBLE
78+
}
7479
}
7580

7681
return ViewBundle(

0 commit comments

Comments
 (0)