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 UIKit
import ScrollViewController
/// Opens up `Drawer` on a given parent view controller /// Opens up `Drawer` on a given parent view controller
public struct PresentDrawer: Action { public struct PresentDrawer: Action {
...@@ -35,7 +36,7 @@ public struct PresentDrawer: Action { ...@@ -35,7 +36,7 @@ public struct PresentDrawer: Action {
/// Performs `PresentDrawer` action /// Performs `PresentDrawer` action
public struct PresentDrawerNavigator: TypedNavigator { public struct PresentDrawerNavigator: TypedNavigator {
/// Custom transitioning delegate /// Custom transitioning delegate
let transitioningDelegate = BottomTransitioningDelegate() let transitioningDelegate = FullscreenTransitioningDelegate()
/// View controller which should be opened up /// View controller which should be opened up
var viewController: ([Any]) -> UIViewController var viewController: ([Any]) -> UIViewController
...@@ -47,13 +48,19 @@ public struct PresentDrawerNavigator: TypedNavigator { ...@@ -47,13 +48,19 @@ public struct PresentDrawerNavigator: TypedNavigator {
} }
public func perform(_ action: PresentDrawer, completion: @escaping () -> Void) { public func perform(_ action: PresentDrawer, completion: @escaping () -> Void) {
transitioningDelegate.isDismissableOnBackgroundTouch = action.isDismissable let scrollViewController = ScrollViewController()
let controller = viewController(action.items) let controller = viewController(action.items)
controller.transitioningDelegate = transitioningDelegate scrollViewController.addChild(controller)
controller.modalPresentationStyle = .overFullScreen 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( action.parent.present(
controller, scrollViewController,
animated: action.animated, animated: action.animated,
completion: completion 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