fix: pick server table margin not works issue
This commit is contained in:
parent
35d572660b
commit
66d23432c1
|
@ -92,7 +92,7 @@ extension MastodonPickServerViewController {
|
||||||
tableView.topAnchor.constraint(equalTo: view.topAnchor),
|
tableView.topAnchor.constraint(equalTo: view.topAnchor),
|
||||||
tableView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
|
tableView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
|
||||||
tableView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
|
tableView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
|
||||||
tableView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
|
tableView.bottomAnchor.constraint(equalTo: view.layoutMarginsGuide.bottomAnchor),
|
||||||
])
|
])
|
||||||
|
|
||||||
navigationActionView.translatesAutoresizingMaskIntoConstraints = false
|
navigationActionView.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
@ -107,10 +107,10 @@ extension MastodonPickServerViewController {
|
||||||
])
|
])
|
||||||
|
|
||||||
navigationActionView
|
navigationActionView
|
||||||
.observe(\.bounds, options: [.initial, .new]) { [weak self] navigationActionView, _ in
|
.observe(\.bounds, options: [.initial, .new]) { [weak self] _, _ in
|
||||||
guard let self = self else { return }
|
guard let self = self else { return }
|
||||||
let inset = navigationActionView.frame.height
|
let inset = self.navigationActionView.frame.height
|
||||||
self.tableView.contentInset.bottom = inset
|
self.viewModel.additionalTableViewInsets.bottom = inset
|
||||||
}
|
}
|
||||||
.store(in: &observations)
|
.store(in: &observations)
|
||||||
|
|
||||||
|
@ -149,7 +149,8 @@ extension MastodonPickServerViewController {
|
||||||
KeyboardResponderService
|
KeyboardResponderService
|
||||||
.configure(
|
.configure(
|
||||||
scrollView: tableView,
|
scrollView: tableView,
|
||||||
layoutNeedsUpdate: viewModel.viewDidAppear.eraseToAnyPublisher()
|
layoutNeedsUpdate: viewModel.viewDidAppear.eraseToAnyPublisher(),
|
||||||
|
additionalSafeAreaInsets: viewModel.$additionalTableViewInsets.eraseToAnyPublisher()
|
||||||
)
|
)
|
||||||
.store(in: &disposeBag)
|
.store(in: &disposeBag)
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,7 @@ class MastodonPickServerViewModel: NSObject {
|
||||||
let unindexedServers = CurrentValueSubject<[Mastodon.Entity.Server]?, Never>([]) // set nil when loading
|
let unindexedServers = CurrentValueSubject<[Mastodon.Entity.Server]?, Never>([]) // set nil when loading
|
||||||
let viewWillAppear = PassthroughSubject<Void, Never>()
|
let viewWillAppear = PassthroughSubject<Void, Never>()
|
||||||
let viewDidAppear = CurrentValueSubject<Void, Never>(Void())
|
let viewDidAppear = CurrentValueSubject<Void, Never>(Void())
|
||||||
|
@Published var additionalTableViewInsets: UIEdgeInsets = .zero
|
||||||
|
|
||||||
// output
|
// output
|
||||||
var diffableDataSource: UITableViewDiffableDataSource<PickServerSection, PickServerItem>?
|
var diffableDataSource: UITableViewDiffableDataSource<PickServerSection, PickServerItem>?
|
||||||
|
|
Loading…
Reference in New Issue