Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix searchbar hide issue #6703

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,14 @@ class WebsiteDataManagementViewController: UIViewController, UITableViewDataSour
searchController.searchBar.barStyle = .black
}
navigationItem.searchController = searchController
navigationItem.hidesSearchBarWhenScrolling = false
self.searchController = searchController

definesPresentationContext = true
}

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)

// Allows the search bar to be scrolled away even though we initially show it.
navigationItem.hidesSearchBarWhenScrolling = true
unfoldSearchbar()
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
Expand Down Expand Up @@ -247,4 +244,9 @@ class WebsiteDataManagementViewController: UIViewController, UITableViewDataSour
showMoreButtonEnabled = false
tableView.reloadData()
}

private func unfoldSearchbar() {
guard let searchBarHeight = navigationItem.searchController?.searchBar.intrinsicContentSize.height else { return }
tableView.setContentOffset(CGPoint(x: 0, y: -searchBarHeight + tableView.contentOffset.y), animated: true)
}
}