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
Fixes #1896
  • Loading branch information
andydotxyz committed Feb 7, 2021
1 parent a52cc4a commit e0d7211
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 e0d7211

Please sign in to comment.