File tree Expand file tree Collapse file tree
Android/APIExample-Compose
app/src/main/java/io/agora/api/example/compose/ui/common Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313.externalNativeBuild
1414.cxx
1515local.properties
16+ /.idea
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ import androidx.compose.material3.Text
3030import androidx.compose.material3.TextField
3131import androidx.compose.material3.TextFieldDefaults
3232import androidx.compose.runtime.Composable
33+ import androidx.compose.runtime.LaunchedEffect
3334import androidx.compose.runtime.getValue
3435import androidx.compose.runtime.mutableFloatStateOf
3536import androidx.compose.runtime.mutableIntStateOf
@@ -323,10 +324,11 @@ fun <T> DropdownMenuRaw(
323324 onSelected : (Int , Pair <String , T >) -> Unit = { _, _ -> }
324325) {
325326 var expanded by remember { mutableStateOf(false ) }
326- var text by remember {
327- mutableStateOf(
328- options.find { it.second == selectedValue }?.first ? : options.first().first
329- )
327+ var text by remember { mutableStateOf(options.find { it.second == selectedValue }?.first ? : options.first().first) }
328+
329+ // Update text when selectedValue changes
330+ LaunchedEffect (selectedValue) {
331+ text = options.find { it.second == selectedValue }?.first ? : options.first().first
330332 }
331333
332334 Row (verticalAlignment = Alignment .CenterVertically ) {
You can’t perform that action at this time.
0 commit comments