DEV Community

Daniel Melo
Daniel Melo

Posted on

How to disable keyboard suggestions for Android in React Native

I encountered a problem with TextInput on my Samsung S21. If I set the keyboard type to numeric (and the same goes for number-pad/decimal-pad), it always displays phone number suggestions despite the autoComplete flag being set to off.

It was annoying to debug, for example, changing the value of importantForAutofill seemed to fix the problem, but it reappeared after reinstalling. I also found out it was happening only with the Google autofill service, while with Samsung Pass autofill, autoComplete seemed to behave as expected.

After more debugging, I figured out it is a bug that only happens with fields that have a placeholder. Therefore, the solution was a bit ugly, as I had to implement a custom placeholder for Android.

Custom Placeholder

Here is the Snack: Custom Placeholder

Top comments (0)