@@ -52,12 +52,13 @@ struct ContentView: View {
5252 }
5353
5454 var body : some View {
55- GeometryReader { proxy in
56- VStack {
57- contents
58- }
59- . onAppear { contentHeight = proxy. size. height }
60- . onChange ( of: proxy. size. height) { contentHeight = $0 }
55+ VStack {
56+ contents
57+ }
58+ . onGeometryChange ( for: CGFloat . self) { proxy in
59+ proxy. frame ( in: . global) . height
60+ } action: { height in
61+ contentHeight = height
6162 }
6263 . onReceive ( inspection. notice) { inspection. visit ( self , $0) }
6364 . onAppear {
@@ -336,8 +337,8 @@ struct ContentView: View {
336337 )
337338 . toolbar ( . hidden, for: . tabBar)
338339 }
339- // Set id per trip so that transitioning from one trip to another is handled by removing
340- // the existing trip view & creating a new one
340+ // Set id per trip so that transitioning from one trip to another is handled
341+ // by removing the existing trip view & creating a new one
341342 . id ( filter. tripId)
342343 . transition ( transition)
343344 . animation ( . easeOut, value: filter. tripId)
@@ -519,37 +520,38 @@ struct ContentView: View {
519520 && contentVM. onboardingScreensPending != nil
520521 ) ,
521522 content: {
522- GeometryReader { proxy in
523- VStack {
524- navSheetContents
525- . presentationDetents ( [ . small, . medium, . almostFull] , selection: $selectedDetent)
526- . interactiveDismissDisabled ( )
527- . modifier ( AllowsBackgroundInteraction ( ) )
528- }
529- // within the sheet to prevent issues on iOS 16 with two modal views open at once
530- . fullScreenCover (
531- item: . constant( nav. coverItemIdentifiable ( ) ) ,
532- onDismiss: {
533- // Don't navigate back if hideMaps has been changed and the cover is being switched over
534- if hideMaps { return }
535- switch nearbyVM. navigationStack. last {
536- case . alertDetails, . more, . saveFavorite: nearbyVM. goBack ( )
537- default : break
538- }
539- } ,
540- content: coverContents
541- )
542- . onChange ( of: sheetRoute) { [ oldSheetRoute = sheetRoute] newSheetRoute in
543- if let oldSheetRoute,
544- let newSheetRoute,
545- SheetRoutes . companion. shouldResetSheetHeight ( first: oldSheetRoute,
546- second: newSheetRoute) {
547- selectedDetent = . medium
523+ VStack {
524+ navSheetContents
525+ . presentationDetents ( [ . small, . medium, . almostFull] , selection: $selectedDetent)
526+ . interactiveDismissDisabled ( )
527+ . modifier ( AllowsBackgroundInteraction ( ) )
528+ }
529+ // within the sheet to prevent issues on iOS 16 with two modal views open at once
530+ . fullScreenCover (
531+ item: . constant( nav. coverItemIdentifiable ( ) ) ,
532+ onDismiss: {
533+ // Don't navigate back if hideMaps has been changed and the cover is being switched over
534+ if hideMaps { return }
535+ switch nearbyVM. navigationStack. last {
536+ case . alertDetails, . more, . saveFavorite: nearbyVM. goBack ( )
537+ default : break
548538 }
549- errorBannerVM. setSheetRoute ( sheetRoute: newSheetRoute)
539+ } ,
540+ content: coverContents
541+ )
542+ . onChange ( of: sheetRoute) { [ oldSheetRoute = sheetRoute] newSheetRoute in
543+ if let oldSheetRoute,
544+ let newSheetRoute,
545+ SheetRoutes . companion. shouldResetSheetHeight ( first: oldSheetRoute,
546+ second: newSheetRoute) {
547+ selectedDetent = . medium
550548 }
551- . onAppear { recordSheetHeight ( proxy. size. height) }
552- . onChange ( of: proxy. size. height) { newValue in recordSheetHeight ( newValue) }
549+ errorBannerVM. setSheetRoute ( sheetRoute: newSheetRoute)
550+ }
551+ . onGeometryChange ( for: CGFloat . self) { proxy in
552+ proxy. frame ( in: . global) . height
553+ } action: { height in
554+ recordSheetHeight ( height)
553555 }
554556 }
555557 )
@@ -682,7 +684,13 @@ struct ContentView: View {
682684 Only update this if we're less than half way up the users screen. Otherwise,
683685 the entire map is blocked by the sheet anyway, so it doesn't need to respond to height changes
684686 */
685- guard newSheetHeight < ( ( contentHeight - 8 ) * PresentationDetent. mediumDetentFraction) else { return }
687+
688+ let mediumSheetHeight = if #available( iOS 26 , * ) {
689+ ( contentHeight * PresentationDetent. mediumDetentFraction) - 17
690+ } else {
691+ ( contentHeight * PresentationDetent. mediumDetentFraction) - 5
692+ }
693+ guard newSheetHeight < mediumSheetHeight else { return }
686694 sheetHeight = newSheetHeight
687695 }
688696
0 commit comments