Closed digitalheir closed 3 years ago
Digging deeper, it's not particular to TabView but more apparent.
Trying to manipulate BottomSheet
directly:
I guess it's a SwiftUI thing, but still kind of curious how to solve it.
This question on StackOverflow suggests there's no real concept of content inset yet in SwiftUI, because the answers all suggest adding a bottom padding with a magical number of 300.
I guess a thorough solution would attempt to measure the inset of the safe areas, but maybe that's beyond the scope of my question.
It seems the bottom sheet doesn't get the edge insets from GeometryReader as it would have as a top-level view because of the modifier .edgesIgnoringSafeArea(.bottom)
.
Instead of using the modifier, I've tried to use frame height geo.size.height + geo.safeAreaInsets.bottom
, and padding(.bottom, geo.safeAreaInsets.bottom)
on the sheet content.
This seems to work for both List
and ScrollView
. I'll make a pull request tomorrow, sleep now.
Thanks for testing this out! I have yet to use this library in one of my apps, so there may very well be cases where the current implementation doesn't behave that well.
Let me look at the problem you describe and try to adjust the demo so that it occurs there as well, then try your fix. I'm quite busy atm, but I will try to get around to it soon 👍
I've added previews in 66401a5 so it's easier to verify!
@digitalheir I merged your PR, thanks! Can you verify that master behaves as you expect it to, and I'll close this and push a new release.
Works well for me!
I've adapted the demo view with a TabView, and in the bottom sheet a ScrollView instead of List. When using List, the scroll element pushes the bottom of the list upwards to account for the tab selection bar. But when I use a ScrollView, like below, the last item is obscured by the tab selection bar. Do you know how to account for this? Is it a SwiftUI issue?