From 8b9a3a821789164ddcb93417b31bbd7620db06b0 Mon Sep 17 00:00:00 2001 From: xiarunmin Date: Thu, 3 Sep 2026 18:29:57 +0800 Subject: [PATCH] fix(ios): keep pages out of the safe area again #1085 dropped `ignoreSafeArea: true` from the hosting controller when it added `propagateSafeArea()`. The two solve different problems: the flag keeps SwiftUI from laying the pages out inside the safe area, while `propagateSafeArea()` hands child UIKit views their insets back. With the flag gone, `PagerView`'s `GeometryReader` is measured inside the safe area and every page is framed to that measurement, so the pages shrink and shift while React Native's layout still has them at full size. Co-authored-by: Cursor --- ios/PagerViewProvider.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ios/PagerViewProvider.swift b/ios/PagerViewProvider.swift index aa9c374f..452962d6 100644 --- a/ios/PagerViewProvider.swift +++ b/ios/PagerViewProvider.swift @@ -222,8 +222,14 @@ import UIKit return } + // The hosting view must not carry a safe area: `PagerView`'s `GeometryReader` + // is measured inside it, and every page is framed to that measurement, so the + // pages end up inset by the safe area while React Native's own layout still + // has them at full size. `propagateSafeArea()` on `PageChildViewController` + // is what gives child UIKit views their insets back; the two are independent. let hostingController = UIHostingController( - rootView: PagerView(props: props, delegate: delegate) + rootView: PagerView(props: props, delegate: delegate), + ignoreSafeArea: true ) self.hostingController = hostingController