Fix crash when TextField with focus is scaled to 0

This commit is contained in:
FooIbar committed 2023-11-27 21:18:03 +08:00
1 parent 050b5c0451
commit 85bb9b9f97
1 file changed
+8
@@ -78,6 +78,7 @@ import androidx.compose.ui.input.nestedscroll.NestedScrollSource
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.platform.LocalView
import androidx.compose.ui.res.dimensionResource
@@ -222,6 +223,13 @@ fun GalleryListScreen(lub: ListUrlBuilder, navigator: DestinationsNavigator) {
}
}
val focusManager = LocalFocusManager.current
LaunchedEffect(showSearchLayout) {
if (!showSearchLayout) {
focusManager.clearFocus()
}
}
val animatedSearchLayout by animateFloatMergePredictiveBackAsState(
enable = showSearchLayout,
animationSpec = tween(FAB_ANIMATE_TIME * 2),