androidandroid-jetpack-composeandroid-jetpack-compose-material3

Jetpack Compose TextToolbar not showing for TextField in ModalBottomSheet


In Jetpack Compose I have a TextField in a Surface and it displays the TextToolbar (just for a Paste) without issues. If I put the same TextField into a (material3) ModalBottomSheet I do not see that toolbar? How can I show the toolbar for a ModalBottomSheet? What is causing the toolbar to stay hidden?

I've created a minimal demo here for others to reproduce the issue. All the important stuff is in the MainActivity here.

enter image description here

enter image description here


Solution

  • Updated Jetpack compose BOM to 2024.09.02 and material3 to 1.3.0 and the androidx.compose.material3.ModalBottomSheet now properly supports the TextToolbar with paste functionality etc.

    [versions]
    androidxComposeBom = "2024.09.02"
    androidxMaterial3 = "1.3.0"
    
    # [...]
    
    [libraries]
    androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "androidxComposeBom" }
    androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3", version.ref = "androidxMaterial3" }
    

    Can finally replace my home baked can of worms pie.