Open OuSS-90 opened 3 months ago
How do you mean, that the header should be centered on screen when there's no content in the list?
There's nothing built-in for this, so I suggest perhaps switching between two views?
My scenario: header: is carousel of items content: is List of element
When user select item from carousel, I need to load list of element related to that item, sometimes there is no elements so I need to add empty placeholder with icon saying "There is no elements" centered inside content space
My issue: I added this placeholder but it's under header not centered
I see! In this case, can't you just add a centered overlay above the list?
It will not be centered cause my list its just lazyVstack inside ScrollViewWithStickyHeader. It don’t take full space under header
What if you apply .frame(maxHeight: .infinity)
to your stack, to make it take up all available height?
Regardless, I'd say that this is not a ScrollKit
-related issue, so I'm closing this.
It's related to ScrollKit, because content (my LazyVStack) is inside scrollView (ScrollViewWithStickyHeader), so .frame(maxHeight: .infinity)
don't work
I see, thank you for clarifying!
I'll reopen this so that we can keep track of it.
@OuSS-90 Can you wrap the scroll view in a geometry reader to get the total available height, then inject that height into the scroll view content, and reduce the current header height to determine how tall the content should be?
Regardless, you'd have the same challenge with any native scroll view, where .frame(maxHeight: .infinity)
doesn't work, since the scroll view itself isn't greedy.
I am using ScrollViewWithStickyHeader and want to center placeholder when list is empty. I tried to add empty placeholder with maxHeight infinity but still not centered. How can i do this ?