     }
   }
   
+  public override func viewWillLayoutSubviews() {
+    super.viewWillLayoutSubviews()
+    scrollView.frame = view.bounds
+  }
+
   func layoutViews(for viewControllers: [UIViewController], keepContentOffset: Bool) {
     let viewControllers = isRightToLeft ? viewControllers.reversed() : viewControllers
+
+    // Need to trigger a layout here to ensure that the scroll view
+    // bounds is updated before we use its frame for calculations.
+    view.layoutIfNeeded()
 
     for (index, viewController) in viewControllers.enumerated() {
       switch options.contentNavigationOrientation {

  override public func viewDidLoad() {
    super.viewDidLoad()
    view.addSubview(scrollView)
    view.constrainToEdges(scrollView)
    scrollView.delegate = self
    
    if #available(iOS 11.0, *) {

  public private(set) lazy var scrollView: UIScrollView = {
    let scrollView = UIScrollView()
    scrollView.isPagingEnabled = true
    scrollView.autoresizingMask = [
      .flexibleTopMargin,
      .flexibleRightMargin,
      .flexibleBottomMargin,
      .flexibleLeftMargin
    ]
    scrollView.scrollsToTop = false
    scrollView.bounces = true
    scrollView.translatesAutoresizingMaskIntoConstraints = true
    scrollView.showsHorizontalScrollIndicator = false
    scrollView.showsVerticalScrollIndicator = false
    return scrollView
