Something went wrong. Try again.
Mirror — see github.com/blacksky-algorithms/blacksky.community
Something went wrong. Try again.
2.9 kB · 62 lines
at main
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263diff --git a/ios/PagerView.swift b/ios/PagerView.swiftindex 56ec98a3be31a328d320dfde3237cb4a058af1f6..015bebfbf0bea5a6eefc4357984e1697fbf055e6 100644--- a/ios/PagerView.swift+++ b/ios/PagerView.swift@@ -61,17 +61,13 @@ struct PagerView: View { collectionView.showsVerticalScrollIndicator = false collectionView.showsHorizontalScrollIndicator = false - if #available(iOS 26.0, *) {- // The top edge effect can obscure pages beneath transparent headers.+ // The vertical pager rotates this horizontal scroll view by 90 degrees.+ // Native edge effects would rotate with it and cover the page sideways.+ if isVertical, #available(iOS 26.0, *) { collectionView.topEdgeEffect.isHidden = true-- // The vertical pager rotates this horizontal scroll view by 90 degrees.- // Native edge effects would rotate with it and cover the page sideways.- if isVertical {- collectionView.bottomEdgeEffect.isHidden = true- collectionView.leftEdgeEffect.isHidden = true- collectionView.rightEdgeEffect.isHidden = true- }+ collectionView.bottomEdgeEffect.isHidden = true+ collectionView.leftEdgeEffect.isHidden = true+ collectionView.rightEdgeEffect.isHidden = true } if scrollDelegate.originalDelegate == nil {diff --git a/ios/PagerViewProvider.swift b/ios/PagerViewProvider.swiftindex 87def2acf1bfb83fa79ff34a1537cac6afee3752..1e97045531befc80114f7c6f5959a99cbcd05ebd 100644--- a/ios/PagerViewProvider.swift+++ b/ios/PagerViewProvider.swift@@ -74,6 +74,8 @@ final class PagerViewProvider: UIView, RNCPagerViewProviding { super.didMoveToWindow() if window != nil { setupView()+ } else {+ detachFromParentViewController() } } @@ -240,6 +242,20 @@ final class PagerViewProvider: UIView, RNCPagerViewProviding { hostingController.didMove(toParent: parentViewController) } + /// Off-window, the hosting controller must not stay a child of the view+ /// controller it was attached to. Otherwise an unmounted (or recycled) pager+ /// leaves it behind, often on the root view controller, which changes what+ /// UIKit and libraries that inspect `children` see (for example the status+ /// bar delegation in react-native-screens). It is re-attached by+ /// `willMove(toWindow:)` / `setupView()` when the pager is back in a window.+ private func detachFromParentViewController() {+ guard let hostingController, hostingController.parent != nil else {+ return+ }+ hostingController.willMove(toParent: nil)+ hostingController.removeFromParent()+ }+ /// SwiftUI can recreate the page controller around this React view while /// preserving the view itself. Keep the hosting controller attached to the /// current page controller so UIKit's view-controller hierarchy stays valid.