When I switched from M2 to M3 in Compose multi pla...
# compose
j
When I switched from M2 to M3 in Compose multi platform the component
Copy code
ExposedDropdownMenuBox
is not working in either iOS or Android with focus vs show the dropdown popup. Is this a known bug? In general all input fields not working in emulator in Android or iOS simulator. Keyboard input not even working at all, which usually does in native Android development of compose. Also would like to inject my own iOS implementation when needed. I guess compose foundation of textfield is not KMP supported?
k
could you check the component here? https://terrakok.github.io/compose-material-3-gallery/ it seems to work
j
What you mean? I use that one and it doesnt work.
k
I mean in the sample it works fine on all platforms. you could find differences between this and your project
j
Really where is source code?
k
on the top of the page
j
The web page doesnt work, cant scroll
k
The web page doesnt work, cant scroll
I guess you opened it in a mobile browser
Compose for web is experimantal and doesn't work well in modile browsers
j
Yes I did
@Konstantin Tskhovrebov TextField( modifier = Modifier.width(180.dp).menuAnchor(), This is only thing differ for me. Whats menu anchor?
This otherwise a copy of M3 compose sample from Google and same I use.
Will try run this project on my machine tomorrow
👍 1
z
AFAIK there’s nothing platform specific about text fields in Material. All the material text fields, for both 2 and 3, are built on BasicTextField. KMP does not consumers of a library swap out arbitrary actuals defined in that library. If compose for iOS wants to allow pluggable implementations of things it would have to be designed for that.
j
@Zach Klippenstein (he/him) [MOD] Yeah well not really. In CMP M3 1.5.0 release they did actual imp for iOS tweaked to fit in iOS with fast typing and such. Thats not in basicTextfield so cant use that. Basically need to implement my own hacked variant in iOS if want fix this. I dont mind material 3 but dont like being stuck on weird implementation in both Android and iOS. Would prefer using actual on Android with M3 1.2.0 Alpha 12 and something else for iOS. There is some existing bugs in 1.1.2 release in general for keyboard and input. To me feels easier do your own custom design system based on foundation but cant say use CMP for iOS and real compose on Android as not work in common main. Then need do same thing Jetbrains doing now myself. This becomes a mess quick. Can use uikit wrappers for iOS instead. But then burden using CMP becomes so hard easier go with swiftui for iOS and back again on regular cross platform problem.
@Konstantin Tskhovrebov Just FYI it works if I adding Modifier.menuAnchor into the TextField. Wow Google is so horrible in provide documentation about these hidden things, which in this case hidden interface in scope ExposedDropdownMenuBoxScope 😄
However keyboard never appear in iOS simulator when focus on textfield, but the exposed dropdown thing works in both Android and iOS now at last 🙂
j
Thanks @Joel Denke, I ran into the same thing 😅 Without that
menuAnchor
nothing was happening
😁 1
j
Noticed Google updated their M3 code sample now with menuAnchor recently as well 😁
Also missing out close keyboard when select item or if nothing typed initially want dropdown appear. Can do ofc myself but a lot of annoying things.
j
Yeah and when you set the text, the cursor stays at position 0 also
But should be doable to make something pretty in an afternoon
j
Hehe yeah fixed it decent myself now. Not perfect but weird not default.
1