Skip to content

Commit

Permalink
add: [ANDROAPP-5467] state added
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidAparicioAlbaAsenjo committed Sep 28, 2023
1 parent 8940389 commit 6a4cbaf
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ package org.hisp.dhis.mobile.ui.designsystem.component
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import org.hisp.dhis.mobile.ui.designsystem.resource.provideStringResource
import org.hisp.dhis.mobile.ui.designsystem.theme.Shape
Expand Down Expand Up @@ -37,7 +41,11 @@ fun TimeUnitSelector(
val selectedItem = options.find {
it.selected
}
RadioButtonBlock(orientation, options, selectedItem ?: options[0]) {
var currentItem by remember {
mutableStateOf(selectedItem ?: options[0])
}
RadioButtonBlock(orientation, options, currentItem) {
currentItem = it
onClick.invoke(it)
}
}
Expand Down

0 comments on commit 6a4cbaf

Please sign in to comment.