Skip to content

Commit 51d43ae

Browse files
author
Rick Pasetto
authored
LOOP-1963: Make glucose entry first responder after the keyboard opens (#260)
1 parent db4328f commit 51d43ae

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Loop/Views/BolusEntryView.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,11 @@ struct BolusEntryView: View, HorizontalSizeClassOverride {
201201
.foregroundColor(Color(.secondaryLabel))
202202
}
203203
}
204-
.onAppear {
205-
// After the row is first made visible, make the text field the first responder
206-
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(10)) {
207-
self.isManualGlucoseEntryRowVisible = true
204+
.onKeyboardStateChange { state in
205+
if state.animationDuration > 0 {
206+
DispatchQueue.main.asyncAfter(deadline: .now() + state.animationDuration) {
207+
self.isManualGlucoseEntryRowVisible = true
208+
}
208209
}
209210
}
210211
}

0 commit comments

Comments
 (0)