We've implemented a custom keyboard showing throug...
# compose
c
We've implemented a custom keyboard showing through providing a
TextInputService
as a
CompositionLocalProvider
but now that is deprecated in Compose 1.7.0 and says "Use PlatformTextInputModifierNode instead". I'm lost as how that should be used, does anyone know of any guides?
a
Is InterceptPlatformTextInput what you want?
c
I suppose that allows for intercepting whatever is coming from the input, and where I would inject events from my custom keyboard. Is this where I should also declare my custom keyboard composable to show instead of the regular one?
a
I haven't tried myself but it seems so.
c
ok I will give it a go, thanks!
I see now that CoreTextField has been changed to creating its own legacyTextInputService which is why suppressing the deprecation has no effect. So to bypass the normal keyboard showing, I will have to implement my own TextField basically?
or just not call
nextHandler.startInputMethod
but handle it here 🤔 like the disable keyboard example
z
If you want to prevent the system IME from starting up and instead use your own thing to show a keyboard UI, you don’t need to build your own TextField, just intercept the platform text input and implement the IME contract like you would with any custom keyboard (except you’re working directly with the actual client InputConnection here, not going through an IPC boundary).
thank you color 1
To start, if you want, you could copy the LegacyTextInputService stuff from CoreTextField to make your existing code work with the new system.