14.9 C
Canberra
Saturday, January 3, 2026

Content material of TabView goes past secure areas within the NavigationStack


import SwiftUI
struct OnboardingView: View {        
    @ObservedObject var viewModel: OnboardingViewModel        
    var physique: some View {        
        TabView(choice: $viewModel.currentPage) {           
            ForEach(OnboardingPages.allCases, id: .rawValue) { web page in                
                getPageView(for: web page)                    
                    .tag(web page.rawValue)            
                }        
            }        
            .tabViewStyle(PageTabViewStyle(indexDisplayMode: .by no means))            
}        

@ViewBuilder    
personal func getPageView(for web page: OnboardingPages) -> some View {        
    VStack(spacing: 32) {                       
        Spacer()                        
        VStack(alignment: .middle, spacing: 8) {                
            Textual content(web page.title)                    
                .font(.urb(.semiBold, measurement: 32))                    
                .foregroundStyle(.white)                                
            Textual content(web page.description)                    
                .font(.urb(.common, measurement: 16))                    
                .foregroundStyle(.white)                    
                .multilineTextAlignment(.middle)            
        }                        
        
        continueButton                        
           
        dots        
    }        
    .padding(.horizontal, 16)        
    .padding(.backside, 35)        
    .ignoresSafeArea()        
    .background(            
        Picture(web page.picture)                
            .resizable()                
            .scaledToFill()                
            .ignoresSafeArea()        
    )    
}

The issue is:

  1. Even with out NavigationStack, ignoresSafeArea stretches TabView out of secure space
  2. If ignoresSafeArea modifier is used with TabView, then content material is transcend secure space
  3. If ignoresSafeAre modifier isn’t used with TabView, then the picture doesn’t cowl full display screen
VStack and no secure space: Vstack and secure space:
Content material of TabView goes past secure areas within the NavigationStack Vstack and safe area

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

[td_block_social_counter facebook="tagdiv" twitter="tagdivofficial" youtube="tagdiv" style="style8 td-social-boxed td-social-font-icons" tdc_css="eyJhbGwiOnsibWFyZ2luLWJvdHRvbSI6IjM4IiwiZGlzcGxheSI6IiJ9LCJwb3J0cmFpdCI6eyJtYXJnaW4tYm90dG9tIjoiMzAiLCJkaXNwbGF5IjoiIn0sInBvcnRyYWl0X21heF93aWR0aCI6MTAxOCwicG9ydHJhaXRfbWluX3dpZHRoIjo3Njh9" custom_title="Stay Connected" block_template_id="td_block_template_8" f_header_font_family="712" f_header_font_transform="uppercase" f_header_font_weight="500" f_header_font_size="17" border_color="#dd3333"]
- Advertisement -spot_img

Latest Articles