         addGesture(UIPanGestureRecognizer(target: self, action: #selector(onDragView)))
     }
 
-    private func initConstraint() {
-        guard let superview = view.superview else { return }
-
-        topDistanceFromBottom = view.topAnchor.constraint(equalTo: superview.bottomAnchor, constant: 0)
-        specifiedHeightConstraint = view.heightAnchor.constraint(equalToConstant: height)
-        maxHeightConstraint = view.heightAnchor.constraint(equalTo: superview.heightAnchor, multiplier: 0.5)
+    override open func render() {
+        super.render()
+        setupConstraints()
     }
 
-    override open func render() {
-        super.render()
+    private func setupConstraints() {
+        view.translatesAutoresizingMaskIntoConstraints = false
+        guard let superview = view.superview else { return }
+        view.widthAnchor.constraint(equalTo: superview.widthAnchor, constant: 0).isActive = true
 
-        adjustSize()
-        adjustPosition()
-    }
+        drawerTopConstraint = view.topAnchor.constraint(equalTo: superview.bottomAnchor, constant: hintPosition)
+        drawerTopConstraint.isActive = true
 
-    private func adjustSize() {
-        view.translatesAutoresizingMaskIntoConstraints = false
+        desiredHeightConstraint = view.heightAnchor.constraint(equalToConstant: desiredHeight)
+        maxHeightConstraint = view.heightAnchor.constraint(equalTo: superview.heightAnchor, multiplier: 0.5)
 
-        addWidthConstraint()
-        addHeightConstraint()
         adjustHeightConstraint()
     }
 
-    private func addWidthConstraint() {
-        guard let superview = view.superview else { return }
-
-        let widthConstraint = view.widthAnchor.constraint(equalTo: superview.widthAnchor, constant: 0)
-        widthConstraint.isActive = true
-    }
-
-    private func addHeightConstraint() {
-        guard let superview = view.superview else { return }
-        specifiedHeightConstraint = view.heightAnchor.constraint(equalToConstant: height)
-        maxHeightConstraint = view.heightAnchor.constraint(equalTo: superview.heightAnchor, multiplier: 0.5)
-    }
-    
     private func adjustHeightConstraint() {
-        if height < maxHeight {
+        if desiredHeight < maxHeight {
             maxHeightConstraint.isActive = false
-            specifiedHeightConstraint.isActive = true
+            desiredHeightConstraint.isActive = true
         } else {
-            specifiedHeightConstraint.isActive = false
+            desiredHeightConstraint.isActive = false
             maxHeightConstraint.isActive = true
         }
-    }
-
-    private func adjustPosition() {
-        guard let superview = view.superview else { return }
-
-        topDistanceFromBottom = view.topAnchor.constraint(equalTo: superview.bottomAnchor, constant: placeholder * -1)
-        topDistanceFromBottom.isActive = true
     }
 
     override open func onDrawerShow() {

open class BottomDrawerPlugin: DrawerPlugin {
    private var maxHeight: CGFloat {
        return overlayViewFrame.height/2
    }

    open var height: CGFloat {
        return maxHeight
    }

    override open var position: DrawerPlugin.Position {
        return .bottom
    }
    
    private var closedYPosition: CGFloat {
        return placeholder * -1
    }
    
    private var openedYPosition: CGFloat {
        return min(height, maxHeight) * -1
    }

    private var topDistanceFromBottom: NSLayoutConstraint!
    private var maxHeightConstraint: NSLayoutConstraint!
    private var specifiedHeightConstraint: NSLayoutConstraint!

    required public init(context: UIObject) {
        super.init(context: context)

        addGestures()
        initConstraint()
        bindEvents()
    }
    


    private func moveUp(with duration: TimeInterval = ClapprAnimationDuration.mediaControlShow) {
        toggleContentInteraction(enabled: true)
        drawerTopConstraint.constant = openedYPosition
        refreshSuperviewLayout(with: duration)
    }

    private func moveDown(with duration: TimeInterval = ClapprAnimationDuration.mediaControlHide) {
        toggleContentInteraction(enabled: false)
        drawerTopConstraint.constant = hintPosition
        refreshSuperviewLayout(with: duration)
    }

