mobile/UI: trigger position check on focus

Doing this check every time we get a 'pressed' signal for the input
field seems excessive. We really only need to check when the input field
gets focus - that's when the OS virtual keyboard might open and hide the
field the user wants to edit.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2020-12-30 16:39:16 -08:00
parent bb1fb86f20
commit d5a7ceb433

View file

@ -20,9 +20,10 @@ Controls.TextField {
firstTime = true
}
// that's when a user taps on the field to start entering text
onPressed: {
if (flickable !== undefined) {
// once a text input has focus, make sure it is visible
// we do this via a timer to give the OS time to show a virtual keyboard
onFocusChanged: {
if (focus && flickable !== undefined) {
waitForKeyboard.start()
}
}