Sfoglia il codice sorgente

fix DecimalField autofocus

Ivan Valkou 5 anni fa
parent
commit
987a1efc96
1 ha cambiato i file con 3 aggiunte e 1 eliminazioni
  1. 3 1
      FreeAPS/Sources/Views/DecimalTextField.swift

+ 3 - 1
FreeAPS/Sources/Views/DecimalTextField.swift

@@ -55,7 +55,9 @@ struct DecimalTextField: UIViewRepresentable {
         toolBar.setItems([clearButton, space, doneButton], animated: true)
         toolBar.setItems([clearButton, space, doneButton], animated: true)
         textfield.inputAccessoryView = toolBar
         textfield.inputAccessoryView = toolBar
         if autofocus {
         if autofocus {
-            textfield.becomeFirstResponder()
+            DispatchQueue.main.async {
+                textfield.becomeFirstResponder()
+            }
         }
         }
         return textfield
         return textfield
     }
     }