Skip to content

Commit

Permalink
Don't crash if keyboard controls are invoked too soon
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed Feb 7, 2021
1 parent bed0e15 commit 0df584d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions internal/driver/gomobile/keyboard.go
Expand Up @@ -8,12 +8,21 @@ import (

func showVirtualKeyboard(keyboard mobile.KeyboardType) {
if driver, ok := fyne.CurrentApp().Driver().(*mobileDriver); ok {
if driver.app == nil { // not yet running
fyne.LogError("Cannot show keyboard before app is running", nil)
return
}

driver.app.ShowVirtualKeyboard(app.KeyboardType(keyboard))
}
}

func hideVirtualKeyboard() {
if driver, ok := fyne.CurrentApp().Driver().(*mobileDriver); ok {
if driver.app == nil { // not yet running
return
}

driver.app.HideVirtualKeyboard()
}
}

0 comments on commit 0df584d

Please sign in to comment.