Anyone knowing better than me, whats standard on i...
# compose-ios
j
Anyone knowing better than me, whats standard on iOS for the keyboard to have in apps? Seems like its different from app to app. When using CMP I experience an issue where you cant as user dismiss keyboard in iOS ๐Ÿ˜„ In those cases if click outside usually dismisses keyboard but in CMP it does not. In Android can close keyboard. Do you need to control some flags or something to make it focusable on other compose elements outside of the keyboard? As I am not an iPhone user myself, very hard to know whats "expected" ๐Ÿ˜„
a
You can use this to hide keyboard on click outside
j
Wtf really, but why doesnt TextField having this default in CMP? But is that standard behaviour in iOS apps?
a
But is that standard behaviour in iOS apps
No it's not
j
Then I dont want it ๐Ÿ˜„
What should it be in iOS to make it native?
I checked SPotify app, and there they using keyboard overlay in iOS, but felt like maybe not best app compare with?
Very confusing as I am in Android expect to have something else, so I need to have if else checks per platform ๐Ÿ˜„
In my case I have a Bottomsheet, with x amount of text input fields with questions coming from BE, so its dynamic. And then in bottom of bottomsheet having save button. How should ime surfaces for keyboard behave in iOS?
a
> What should it be in iOS to make it native Click outside is fine. Most of native apps do the same.
j
Copy code
But is that standard behaviour in iOS apps
No it's not
What did you mean by this then? :S
a
As far as i remember if you just place a text field inside empty swiftui page then click outside will not dismiss the keyboard. You need to resignFirstReponder manually what ios devs do
You can check it to be sure
j
Any example from compose perspective how to achieve that, and not destory how my code works in Android? ๐Ÿ˜› I would love to avoid having expect/actual override Jetbrains override in iOS ๐Ÿ˜„
a
ClearFocusBox will be fine both for Android and iOS
j
Not really nice to have that behaviour in Andorid apps, as it will in many cases dismiss keyboard when not want to. But where to put ClearFocuxBox, around the input field or around the entire screen?
a
Wherever you want keyboard to be closed
j
Yeah but in my case I guess I wrap entire bottomsheet?
Doesnt work for me, now keyboard closed all the time instead. I have code like:
Copy code
ModalBottomSheet {
 ClearFocusBox(Modifier.fillMaxSize()) {

            Column(
                modifier = modifier.fillMaxSize()
            ) {
                ... input fields here
}}
@Alexander Zhirkevich Anyway thanks for pointers in this ๐Ÿ™‚ TO bad it doesnt work. I realized another problem when having multiple input fields, and one focuses and click on another it will be closed and then opened again I think or collide doing both counter action. So have to be click outside IME keyboard but not if click on input field I guess?