Skip to content

Commit

Permalink
Scroll to top when loading the market for the first time (#227)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruixhuang authored Sep 19, 2024
1 parent 50aceb7 commit c238892
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ fun Preview_DydxMarketAssetListView() {
}

object DydxMarketAssetListView : DydxComponent {

private var firstTime = true

data class ViewState(
val localizer: LocalizerProtocol,
val items: List<DydxMarketAssetItemView.ViewState>,
Expand Down Expand Up @@ -139,7 +142,10 @@ object DydxMarketAssetListView : DydxComponent {
)
}

if (state.scrollToTop) {
if (state.scrollToTop || firstTime) {
if (firstTime) {
firstTime = false
}
scope.launch {
listState.animateScrollToItem(0)
}
Expand Down

0 comments on commit c238892

Please sign in to comment.