Is LocalSoftwareKeyboardController.current Supposed to return a new instance every time it's calle...
f
Is LocalSoftwareKeyboardController.current Supposed to return a new instance every time it's called? Cause currently it does return a new instance every single time I call it
f
Looking at the implementation it should return the same value everytime it's called because it either uses
compositionLocal
or
remembers
DelegatingSoftwareKeyboardController
. Can you show how do you use it?
f
I wrote an extension to not use the LocalSoftwareKeyboardController.current all the time https://github.com/FunkyMuse/Composed/blob/main/core/src/androidTest/java/com/funkymuse/composed/core/GetterExtensionsKtTest.kt#L236 It fails on API 29 and 30 the
keyboardController
is actually
LocalSoftwareKeyboardController.current
f
I am really just guessing here but I think it's because if it remembers the
DelegatingSoftwareKeyboardController
, it's valid only for that Composable "scope". So when you access
LocalSoftwareKeyboardController.current
again in different composable, it create new instance. And it only happens if there is no
LocalSoftwareKeyboardController
composition local provided in the current context.
Because
LocalSoftwareKeyboardController
is not a simple
compositionLocal