Skip to content
Snippets Groups Projects
Commit ab1e6079 authored by Bruno Muniz's avatar Bruno Muniz :apple:
Browse files

Fixes bug on scroll view reseting offset

parent 86a23f4f
No related branches found
No related tags found
2 merge requests!54Releasing 1.1.4,!50Search UI 2.0
...@@ -12,6 +12,7 @@ public final class SearchContainerController: UIViewController { ...@@ -12,6 +12,7 @@ public final class SearchContainerController: UIViewController {
lazy private var screenView = SearchContainerView() lazy private var screenView = SearchContainerView()
private var contentOffset: CGPoint?
private var cancellables = Set<AnyCancellable>() private var cancellables = Set<AnyCancellable>()
private let viewModel = SearchContainerViewModel() private let viewModel = SearchContainerViewModel()
private let leftController = SearchLeftController() private let leftController = SearchLeftController()
...@@ -29,11 +30,21 @@ public final class SearchContainerController: UIViewController { ...@@ -29,11 +30,21 @@ public final class SearchContainerController: UIViewController {
navigationController?.navigationBar.customize( navigationController?.navigationBar.customize(
backgroundColor: Asset.neutralWhite.color backgroundColor: Asset.neutralWhite.color
) )
if let contentOffset = self.contentOffset {
screenView.scrollView.setContentOffset(contentOffset, animated: true)
}
}
public override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
contentOffset = screenView.scrollView.contentOffset
} }
public override func viewDidAppear(_ animated: Bool) { public override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated) super.viewDidAppear(animated)
viewModel.didAppear() viewModel.didAppear()
rightController.viewModel.viewWillAppear()
} }
public override func viewDidLoad() { public override func viewDidLoad() {
...@@ -68,7 +79,6 @@ public final class SearchContainerController: UIViewController { ...@@ -68,7 +79,6 @@ public final class SearchContainerController: UIViewController {
let point = CGPoint(x: screenView.frame.width, y: 0.0) let point = CGPoint(x: screenView.frame.width, y: 0.0)
screenView.scrollView.setContentOffset(point, animated: true) screenView.scrollView.setContentOffset(point, animated: true)
leftController.endEditing() leftController.endEditing()
rightController.viewModel.viewWillAppear()
} else { } else {
screenView.scrollView.setContentOffset(.zero, animated: true) screenView.scrollView.setContentOffset(.zero, animated: true)
leftController.viewModel.didSelectItem($0) leftController.viewModel.didSelectItem($0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment