TableView Content offset binding was fixed
This commit is contained in:
parent
971e495b6d
commit
d05b1b00c9
|
|
@ -34,10 +34,9 @@ open class BaseScrollContentController<ViewModel, View: ScrollViewHolderView>: B
|
|||
///
|
||||
/// - Parameter bottomInsetDriver: Driver that emits CGFloat bottom inset changes.
|
||||
public func bindBottomInsetBinding(from bottomInsetDriver: Driver<CGFloat>) {
|
||||
let contentInsetObservable = customView.scrollView.rx
|
||||
.observe(UIEdgeInsets.self, #keyPath(UIScrollView.contentInset))
|
||||
let contentInsetObservable = customView.scrollView.rx.contentOffset
|
||||
|
||||
let bottomInset = contentInsetObservable.map { $0?.bottom ?? 0 }
|
||||
let bottomInset = contentInsetObservable.map { $0.y }
|
||||
|
||||
bottomInsetDisposable = bottomInsetDriver.asObservable()
|
||||
.withLatestFrom(bottomInset) { $0 + $1 }
|
||||
|
|
|
|||
|
|
@ -28,12 +28,8 @@ public extension Reactive where Base: UIScrollView {
|
|||
/// Binder instance that updates contentInset bottom value.
|
||||
var bottomInsetBinder: Binder<CGFloat> {
|
||||
return Binder(base) { base, value in
|
||||
// Quick workaround.
|
||||
// For some reason code in closure won't work without async call.
|
||||
DispatchQueue.main.async {
|
||||
base.contentInset.bottom = value
|
||||
base.scrollIndicatorInsets.bottom = value
|
||||
}
|
||||
base.contentInset.bottom = value
|
||||
base.scrollIndicatorInsets.bottom = value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue