iZettle/Form

UIScrollView `embedPinned(...)` method uses `minHeight` as fixed height before iOS 11

nataliq opened this issue · 1 comments

Expected Behavior

As the name and the docs suggest minHeight should be used as "The minimum height of the view" and not as exact height.

Current Behavior

On iOS 9 and 10, the view gets constrained with ==, not >= to the provided minHeight.

Steps to Reproduce

Present (or snapshot) this window:

let bag = DisposeBag()

let container = UIScrollView()
container.backgroundColor = .white

let viewToEmbed = UIView()
viewToEmbed.backgroundColor = .red
viewToEmbed.translatesAutoresizingMaskIntoConstraints = false
activate(viewToEmbed.heightAnchor >= 200)

let window = UIWindow(frame: CGRect(origin: .zero, size: CGSize(width: 375, height: 667)))
window.addSubview(container)
window.isHidden = false
container.frame = window.bounds

bag += container.embedPinned(viewToEmbed, edge: .bottom, minHeight: 10)

On iOS 10 I get a red view with height 10 and on iOS 11 I get a red view with height 200.

Context

Some time ago we updated the iOS 11+ implementation to use a minimum height instead of fixed but looks like we haven't updated the legacy version.

  • Operating Version: 9, 10
  • Swift version: Swift 4 (but not relevant)

Failure Logs

Please include any relevant log snippets or files here.

Thank you for looking into this, Nataliya.