Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra space at the bottom on ios18 #10

Closed
chichkanov opened this issue Sep 10, 2024 · 5 comments
Closed

Extra space at the bottom on ios18 #10

chichkanov opened this issue Sep 10, 2024 · 5 comments

Comments

@chichkanov
Copy link

I am observing some weird behavior with this library on ios18.
Having two tabs with LazyVStack causes the list to extra space at the bottom equal to the screen height.

MaterialTabs(
                // A binding to the currently selected tab.
                selectedTab: $selectedTab,
                // A view builder for the header title that takes a `MaterialTabsContext`. This can be anything.
                headerTitle: { context in
                    VStack {
                        Text("Header Title")
                        Text("Header Title2")
                        Text("Header Title3")
                        Text("Header Title4")
                        Color.purple
                            .frame(height: 100)
                    }
                    .padding()
                },
                // A view builder for the tab bar that takes a `MaterialTabsContext`.
                headerTabBar: { context in
                    // Use the `MaterialTabBar` or provide your own implementation.
                    MaterialTabBar(selectedTab: $selectedTab, sizing: .equalWidth, context: context)
                },
                headerBackground: { context in
                    // The background can be anything, but is typically a `Color`, `Gradient` or scalable `Image`.
                    // The background spans the entire header and top safe area.
                    Color.clear
                },
                // The tab contents.
                content: {
                    MaterialTabsScroll(tab: Tab.first) { _ in
                        LazyVStack {
                            Text("FIRST TAB")
                                .padding()
                                .background(Color.blue)
                                .frame(height: 100)
                            
                            ForEach(0..<100, id: \.self) { num in
                                Text("\(num)")
                            }
                        }
                        .scrollTargetLayout()
                    }
                    .materialTabItem(tab: Tab.first, label: .secondary("First"))
                    
                    MaterialTabsScroll(tab: Tab.second) { _ in
                        LazyVStack {
                            Text("SECOND TAB")
                                .padding()
                                .background(Color.red)
                                .frame(height: 100)
                            
                            ForEach(0..<100, id: \.self) { num in
                                Text("\(num)")
                            }
                        }
                        .scrollTargetLayout()
                    }
                    .materialTabItem(tab: Tab.second, label: .secondary("Second"))
                }
            )
Simulator.Screen.Recording.-.iPhone.16.Pro.Max.-.2024-09-10.at.13.43.41.mp4
@wtmoose
Copy link
Member

wtmoose commented Sep 10, 2024

The extra space is only supposed to be applied when there's not enough content to fill the screen. I'll take a look.

@chichkanov
Copy link
Author

Hey. Did you have a chance to look into it?

@wtmoose
Copy link
Member

wtmoose commented Sep 16, 2024

Yesh. A preference key broke on iOS 18 and I had to be more careful in the reduce() function.

If you don't mind, try out the head of master and letting me know if it's working for you.

@chichkanov
Copy link
Author

chichkanov commented Sep 17, 2024

Thanks, I believe it's working fine now!
However, I found another issue with scrolling #12

@wtmoose wtmoose closed this as completed Sep 22, 2024
@wtmoose
Copy link
Member

wtmoose commented Sep 22, 2024

2.0.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants