From 9ee661158521bbcdb3571ed668e56b7395beaf36 Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 16 Jan 2026 09:03:49 +0100 Subject: [PATCH] Updated on 2026-08-14 --- .../list/DefaultMarketsTokenListComponent.kt | 3 ++- .../features/feed/ui/market/list/MarketsList.kt | 14 +++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/features/feed/impl/src/main/kotlin/com/tangem/features/feed/components/market/list/DefaultMarketsTokenListComponent.kt b/features/feed/impl/src/main/kotlin/com/tangem/features/feed/components/market/list/DefaultMarketsTokenListComponent.kt index b459f3e7d8..c4c3190a5a 100644 --- a/features/feed/impl/src/main/kotlin/com/tangem/features/feed/components/market/list/DefaultMarketsTokenListComponent.kt +++ b/features/feed/impl/src/main/kotlin/com/tangem/features/feed/components/market/list/DefaultMarketsTokenListComponent.kt @@ -29,11 +29,12 @@ internal class DefaultMarketsTokenListComponent( @Composable override fun Title(bottomSheetState: State) { val state by model.state.collectAsStateWithLifecycle() + val bsState by bottomSheetState TopBarWithSearch( onBackClick = params.onBackClicked, onSearchClick = state.onSearchClicked, marketsSearchBar = state.marketsSearchBar, - buttonsEnabled = bottomSheetState.value == BottomSheetState.EXPANDED, + bottomSheetState = bsState, ) } diff --git a/features/feed/impl/src/main/kotlin/com/tangem/features/feed/ui/market/list/MarketsList.kt b/features/feed/impl/src/main/kotlin/com/tangem/features/feed/ui/market/list/MarketsList.kt index ea208ba663..d9194f707f 100644 --- a/features/feed/impl/src/main/kotlin/com/tangem/features/feed/ui/market/list/MarketsList.kt +++ b/features/feed/impl/src/main/kotlin/com/tangem/features/feed/ui/market/list/MarketsList.kt @@ -23,6 +23,7 @@ import com.tangem.core.ui.components.SpacerH12 import com.tangem.core.ui.components.SpacerH8 import com.tangem.core.ui.components.appbar.AppBarWithBackButtonAndIcon import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig +import com.tangem.core.ui.components.bottomsheets.state.BottomSheetState import com.tangem.core.ui.components.buttons.SecondarySmallButton import com.tangem.core.ui.components.buttons.SmallButtonConfig import com.tangem.core.ui.components.buttons.common.TangemButtonIconPosition @@ -51,10 +52,10 @@ private const val DELAY_FOR_FOCUS_REQUEST = 200L @Composable internal fun TopBarWithSearch( - buttonsEnabled: Boolean, onBackClick: () -> Unit, onSearchClick: () -> Unit, marketsSearchBar: MarketsSearchBar, + bottomSheetState: BottomSheetState = BottomSheetState.EXPANDED, ) { val background = LocalMainBottomSheetColor.current.value val focusRequester = remember { FocusRequester() } @@ -70,8 +71,8 @@ internal fun TopBarWithSearch( if (showAppBar) { AppBarWithBackButtonAndIcon( onBackClick = onBackClick, - backButtonEnabled = buttonsEnabled, - endButtonEnabled = buttonsEnabled, + backButtonEnabled = bottomSheetState == BottomSheetState.EXPANDED, + endButtonEnabled = bottomSheetState == BottomSheetState.EXPANDED, text = stringResourceSafe(R.string.markets_common_title), iconRes = R.drawable.ic_search_24, onIconClick = onSearchClick, @@ -91,8 +92,11 @@ internal fun TopBarWithSearch( focusRequester = focusRequester, ) - if (marketsSearchBar.shouldAlwaysShowSearchBar || marketsSearchBar.searchBarUM.isActive) { - LaunchedEffect(Unit) { + val shouldRequestFocus = + (marketsSearchBar.shouldAlwaysShowSearchBar || marketsSearchBar.searchBarUM.isActive) && + bottomSheetState == BottomSheetState.EXPANDED + if (shouldRequestFocus) { + LaunchedEffect(bottomSheetState) { delay(DELAY_FOR_FOCUS_REQUEST) focusRequester.requestFocus() }