Closed jkanalakis closed 3 months ago
Hey @jkanalakis, thank you for bringing this to our attention, could you please check out version 2.9.1 and see if this fixed the problem. Have a wonderful day!
There seems to be a different behavior now. With only changing the length of the Constants text in the 2.9.1 sample code - no other changes - the scroll view anchors to the top of the screen. I tried adding a Spacer() above the VStack in ActionSheetSecond, but it had no effect. Same with adding a Spacer() above the ActionSheetSecond in the ContentView. Here's a link to a video: https://drive.google.com/file/d/1YiawWpRmvfwaJqbpRBD4j1KM99NiAjFF/view?usp=sharing
This is still broken. Just changing Utils.swift to the following reveals the problem in the example app Action Sheets Version 2.
`class Constants { static let privacyPolicy = """ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam consectetur orci eget rutrum dignissim. Vivamus aliquam a massa a scelerisque. Integer eleifend lectus non blandit ultricies. Maecenas volutpat neque ut elit facilisis sodales. Mauris et iaculis tellus. Etiam nec mi consequat, ornare quam in, ornare magna. Donec quis egestas nunc. Morbi vel orci leo. Suspendisse eget lectus a erat dignissim interdum et quis neque. Fusce dapibus rhoncus nulla. Cras sed ipsum congue, tempus mi nec, vestibulum lorem.
""" }`
having spent some time on this project sadly i discovered swift ui modal presentation guide . i wish i had started with official documentation first :) . sorry guys. i like your site https://exyte.com/ very much . it is awesome stylish and pure javascript implementation. Thank you!
@izinin Is your comment intended to be related to my issue submission? My originally posted issue is still open and unresolved and not related to the modal presentation guide.
@jkanalakis: yes my comment is related to the issue. It is a customer feedback. For my case SwiftUI View.sheet is enough to show modal dialog. For toast i use View.popover. My target is macos.
Great. Thank you for clarifying. I'll look into that more closely and post my findings. Thank you for replying.
Hey @jkanalakis
The view properly anchors to the bottom, but then looses the nice rounded header
This header is added manually inside the ActionSheetSecond popup creation code, the library itself doesn't add it anyway
Is it possible to change the PopupView.swift code from:
var defaultPosition: Position { if case .default = self { return .center } return .bottom }
to something more like this:
var defaultPosition: Position { switch self { case .default: return .center case .toast, .scroll: return .bottom case .floater: return .bottom } }
These two pieces of code are equal semantically
No such module 'SwiftUIIntrospect' - but I don't know if I should pull in this package: https://github.com/siteline/SwiftUI-Introspect.git
Yes, PopupView uses Introspect
package, so you should indeed pull it, but it should have done so automatically...
In any case, if your popup's content is smaller than the screen, then a toast with the header from example - is the way to go, you don't need the .scroll
type, which comes with built-in ScrollView
, which brings unnecessary complexity for your case.
Also, please keep in mind that if the height of the popup's body is manually set to be 6/7 of the screen (which often happens with big content sheet style scrolls) - then it's likely won't be able to align to the bottom.
With this out of the way, I think I fixed the example case you described, please check out version 2.9.2. Have a great day.
The .scroll type of view is not anchoring to the bottom of the screen. This can be seen in the PopupExample code ContentView.swift within the ActionSheetSecond() by simply changing the very long "Lorem ipsum dolor" text from 8 paragraphs long to only 1 or 2 paragraphs long. By changing this line:
.type(.scroll(headerView: AnyView(scrollViewHeader())))
to this:.type(.toast)
The view properly anchors to the bottom, but then looses the nice rounded header. Is it possible to change the PopupView.swift code from:to something more like this:
I tried making some of the code changes and quickly ran into compile issues around No such module 'SwiftUIIntrospect' - but I don't know if I should pull in this package: https://github.com/siteline/SwiftUI-Introspect.git Set as .scroll Set as .toast