File tree Expand file tree Collapse file tree
searchable-dropdown/src/main/java/com/kanyidev/searchable_dropdown Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515 */
1616package com.kanyidev.searchable_dropdown
1717
18- import androidx.compose.foundation.clickable
1918import androidx.compose.foundation.interaction.MutableInteractionSource
2019import androidx.compose.foundation.interaction.PressInteraction
2120import androidx.compose.foundation.layout.Arrangement
@@ -191,10 +190,7 @@ fun <T> SearchableExpandedDropDownMenu(
191190 OutlinedTextField (
192191 modifier = modifier
193192 .fillMaxWidth()
194- .padding(16 .dp)
195- .clickable {
196- keyboardController?.show()
197- },
193+ .padding(16 .dp),
198194 value = searchedOption,
199195 onValueChange = { selectedSport ->
200196 searchedOption = selectedSport
@@ -211,6 +207,12 @@ fun <T> SearchableExpandedDropDownMenu(
211207 placeholder = {
212208 Text (text = " Search" )
213209 },
210+ interactionSource = remember { MutableInteractionSource () }
211+ .also { interactionSource ->
212+ LaunchedEffect (interactionSource) {
213+ keyboardController?.show()
214+ }
215+ },
214216 )
215217
216218 val items = if (filteredItems.isEmpty()) {
You can’t perform that action at this time.
0 commit comments