Skip to content

Commit 9c72dc3

Browse files
committed
Use intersection instead of origin for calculating visible height.
1 parent 085fd99 commit 9c72dc3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Sources/RxKeyboard/RxKeyboard.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public class RxKeyboard: NSObject, RxKeyboardType {
6363
)
6464
let frameVariable = BehaviorRelay<CGRect>(value: defaultFrame)
6565
self.frame = frameVariable.asDriver().distinctUntilChanged()
66-
self.visibleHeight = self.frame.map { UIScreen.main.bounds.height - $0.origin.y }
66+
self.visibleHeight = self.frame.map { UIScreen.main.bounds.intersection($0).height }
6767
self.willShowVisibleHeight = self.visibleHeight
6868
.scan((visibleHeight: 0, isShowing: false)) { lastState, newVisibleHeight in
6969
return (visibleHeight: newVisibleHeight, isShowing: lastState.visibleHeight == 0 && newVisibleHeight > 0)

0 commit comments

Comments
 (0)