I am using an iMac Pro with Teamviewer 13.2.14328. I can remote control the iMac just fine as long as the display is turned on.
However, as soon as my iMac screen turns off I can no longer control the iMac remotely. I can still connect to the Mac through Teamviewer and I even see the macOS password prompt, but my Teamviewer keyboard entries are ignored. As soon as I turn the screen back on (by moving the mouse around) the previous keyboard entries are entered and my Mac unlocks.
I want to point out that the iMac is NOT sleeping. It is set to prevent itself from ever going to sleep. The iMac is always on. It is just the display that turns off after a certain amount of inactivity. And as soon as the display turns off I can no longer control the iMac remotely via mouse or keyboard inputs. I either just see a black screen or the macOS loging screen.
This makes Teamviewer basiclay useless since there is no way anyone would want their display to be turned on at all times. I really hope someone can shine some light on this problem.