Hide onscreen buttons of back, home & recent apps in Keyboard apps on Moto G5 Plus
Or go to settings > display > expanded desktop and hide the navbar for your keyboard apps.

If that doesn't work, use tasker to hide the navbar when a keyboard is open.