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

Fix scrolling of drawers

parent b6db0f19
No related branches found
No related tags found
1 merge request!101Fix scrolling of drawers
import UIKit
import ScrollViewController
/// Opens up `Drawer` on a given parent view controller
public struct PresentDrawer: Action {
......@@ -35,7 +36,7 @@ public struct PresentDrawer: Action {
/// Performs `PresentDrawer` action
public struct PresentDrawerNavigator: TypedNavigator {
/// Custom transitioning delegate
let transitioningDelegate = BottomTransitioningDelegate()
let transitioningDelegate = FullscreenTransitioningDelegate()
/// View controller which should be opened up
var viewController: ([Any]) -> UIViewController
......@@ -47,13 +48,19 @@ public struct PresentDrawerNavigator: TypedNavigator {
}
public func perform(_ action: PresentDrawer, completion: @escaping () -> Void) {
transitioningDelegate.isDismissableOnBackgroundTouch = action.isDismissable
let scrollViewController = ScrollViewController()
let controller = viewController(action.items)
controller.transitioningDelegate = transitioningDelegate
controller.modalPresentationStyle = .overFullScreen
scrollViewController.addChild(controller)
scrollViewController.contentView = controller.view
scrollViewController.wrapperView.handlesTouchesOutsideContent = !action.isDismissable
scrollViewController.wrapperView.alignContentToBottom = true
scrollViewController.scrollView.bounces = false
controller.didMove(toParent: scrollViewController)
scrollViewController.transitioningDelegate = transitioningDelegate
scrollViewController.modalPresentationStyle = .overFullScreen
action.parent.present(
controller,
scrollViewController,
animated: action.animated,
completion: completion
)
......
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