Skip to content

Commit a5b53e1

Browse files
authored
Merge pull request #52 from cpwhidden/will-show
fixed willShowVisibleHeight called when hiding
2 parents be305c2 + 4b9cbe9 commit a5b53e1

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Sources/RxKeyboard/RxKeyboard.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,10 @@ public class RxKeyboard: NSObject, RxKeyboardType {
6262
self.visibleHeight = self.frame.map { UIScreen.main.bounds.height - $0.origin.y }
6363
self.willShowVisibleHeight = self.visibleHeight
6464
.scan((visibleHeight: 0, isShowing: false)) { lastState, newVisibleHeight in
65-
return (visibleHeight: newVisibleHeight, isShowing: lastState.visibleHeight == 0)
65+
return (visibleHeight: newVisibleHeight, isShowing: lastState.visibleHeight == 0 && newVisibleHeight > 0)
6666
}
6767
.filter { state in state.isShowing }
6868
.map { state in state.visibleHeight }
69-
.skip(1)
7069
self.isHidden = self.visibleHeight.map({ $0 == 0.0 }).distinctUntilChanged()
7170
super.init()
7271

0 commit comments

Comments
 (0)