title: onValueChange of textfield is not triggered when selecting an option from exposed dropdownMenu composable, jetpack compose
body: <p>I am trying to implement an exposed dropdown composable which I can use in multiple parts of my android jetpack compose app. Whenever I select an item from the dropdownMenu the selectedOption is set in the composable and assigned to the textfield value displaying the correct item. However the onValueChange event of the Textfield displaying the result is not fired. This causes the state not being updated in the viewmodel layer of my app. Following my code of my composable.</p>
  <pre><code>// ExposedDropdownComposable.kt    
  @OptIn(ExperimentalMaterialApi::class)
  @Composable
  fun PlantExposedSelect(
    options: List&lt;String&gt;,
    optionSelected: String,
    label: String,
    onOptionSelected: (String) -&gt; Unit,
    onFocusChange: (FocusState) -&gt; Unit,
  ) {
    var expanded by remember { mutableStateOf(false) }
    var selectedOption by remember { mutableStateOf(optionSelected) }
    ExposedDropdownMenuBox(
      expanded = expanded,
      onExpandedChange = {
        expanded = !expanded
      }
  
    ) {
      TextField(
        readOnly = true,
          value = selectedOption,
        onValueChange = onOptionSelected
        label = { Text(label) },
        trailingIcon = {
          ExposedDropdownMenuDefaults.TrailingIcon(
            expanded = expanded
          )
        },
        colors = ExposedDropdownMenuDefaults.textFieldColors(),
        modifier = Modifier
          .fillMaxWidth()
          .onFocusChanged {
            onFocusChange(it)
          },
      )
      ExposedDropdownMenu(
        expanded = expanded,
        onDismissRequest = {
          expanded = false
        }
      ) {
        options.forEach { selectOption -&gt;
          DropdownMenuItem(
            onClick = {
              selectedOption = selectOption
              expanded = false
              Log.e(&quot;selectEdoption&quot;, selectedOption)
            }
          ) {
            Text(text = selectOption)
          }
        }
      }
    }
  }
  </code></pre>
  <p>This is my code where I use the composable in my AddPlantsScreen</p>
  <pre><code>PlantExposedSelect(
    options = options,
    optionSelected = lightState.text,
    label = lightState.hint,
    onOptionSelected = {
      Log.e(&quot;eventValue&quot;, it)
      viewModel.onEvent(AddEditPlantEvent.EnteredLight(it))
    },
    onFocusChange = {
      viewModel.onEvent(AddEditPlantEvent.ChangedLightFocus(it))
    },
  )
  </code></pre>
  <p>How do I make the  onClick event of the dropdownItem, trigger the onValueChange event of the Textfield dislaying the selectedOption.</p>