Skip to content

Commit

Permalink
Refactor: wrap the content in it's own column to prevent tab jumping
Browse files Browse the repository at this point in the history
  • Loading branch information
zwarm committed Jan 31, 2024
1 parent cfb9132 commit 8aa801b
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material.Button
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Scaffold
Expand Down Expand Up @@ -214,12 +215,15 @@ class SiteMonitorParentActivity : AppCompatActivity(), SiteMonitorWebViewClient.
val uiState by remember(key1 = tabType) {
siteMonitorParentViewModel.getUiState(tabType)
}
when (uiState) {
is SiteMonitorUiState.Preparing -> LoadingState(modifier)
is SiteMonitorUiState.Prepared, is SiteMonitorUiState.Loaded ->
SiteMonitorWebView(uiState, tabType, modifier)

is SiteMonitorUiState.Error -> SiteMonitorError(uiState as SiteMonitorUiState.Error, modifier)
LazyColumn {
item {
when (uiState) {
is SiteMonitorUiState.Preparing -> LoadingState(modifier)
is SiteMonitorUiState.Prepared, is SiteMonitorUiState.Loaded ->
SiteMonitorWebView(uiState, tabType, modifier)
is SiteMonitorUiState.Error -> SiteMonitorError(uiState as SiteMonitorUiState.Error, modifier)
}
}
}
}
@Composable
Expand Down

0 comments on commit 8aa801b

Please sign in to comment.