Hi guys, I am solving my friend problem. I made a ...
# compose
k
Hi guys, I am solving my friend problem. I made a simple logic to show filter list in Popup. When item is not in the list Popup is still showing the previous item. I don't understand what is the problem in here.
Copy code
@Preview(showBackground = true)
@Composable
fun PopupFilterItem() {
    var textValue by remember { mutableStateOf("") }
    val oldList by remember {
        mutableStateOf((1..10).map { it.toString() })
    }
    val newSearchList by remember {
        derivedStateOf { oldList.filter { it.contains(textValue) } }
    }
    Column(Modifier.fillMaxSize()) {
        TextField(
            value = textValue,
            onValueChange = { textValue = it }
        )
        Box(Modifier.wrapContentSize()) {
            Popup {
                Column {
                    newSearchList.forEach { Text(text = it) }
                }
            }
        }
    }
}