mijick / popupview Goto Github PK
View Code? Open in Web Editor NEWPopups presentation made simple (SwiftUI)
License: MIT License
Popups presentation made simple (SwiftUI)
License: MIT License
It seems like there is a bug with scrolling quickly that causes the full screen bottom sheet to change height: https://share.cleanshot.com/Hlcr715R
Congratulations on this awesome library! The only thing missing is to dismiss the popup when touching outside. Would be great if this feature can be added.
Popup seems to follow the component with the biggest width in the view?
it works as expected when content overflows to the next line
Code:
`
import MijickPopupView
import SwiftUI
struct BottomCustomPopup: BottomPopup {
func createContent() -> some View {
HStack(spacing: 0) {
Text("Witaj okrutny świecie")
Spacer()
Button(action: dismiss) { Text("Dismiss") }
}
.padding(.vertical, 20)
.padding(.leading, 24)
.padding(.trailing, 16)
}
func configurePopup(popup: BottomPopupConfig) -> BottomPopupConfig {
popup
.horizontalPadding(20)
.bottomPadding(42)
.cornerRadius(16)
.tapOutsideToDismiss(true)
.dragGestureEnabled(true)
.contentIgnoresSafeArea(true)
}
}
`
Manually computing the screen width limits the usage of the library only for the iPhone and it's not the ideal way for SwiftUI. On iPad, in split screen or with stage manager, UIScreen.main.bounds gives the width of the entire screen, not the width of the app's window.
The fix is actually quite simple, mostly removing some .frame modifiers, like in this example
And now it looks good everywhere.
The background view has the same problem, more apparent on the Mac.
But this too can be fixed quite easily
I can open a pull request with these changes if that's ok for you
Steps to reproduce:
1, Start the app when the phone is in portrait mode.
2, Rotate the phone to landscape mode.
3, Open the bottom PopupView.
The bottom PopupView doesn't span the full screen width. Instead, it displays a shadow strip in the center of the screen with full height.
Hello,
Thank you for the great package. Would it be possible to add an option to not gray the background (on top or bottom popup) so that they can be use as toast.
When attempting to .showAndStack()
two separate center popups with custom views at the same time, the background view always adopts a gray color. This behavior occurs despite different configurations intended for the popups. Additionally, an issue with tap gestures is present when a bottom sheet with a TabView
is used; the button tap does not work upon the first appearance.
.showAndStack()
with two separate center popups with custom views.TabView
.TabView
does not work on the first appearance.The background view should not default to gray when stacking popups, and all user interactions, such as tap gestures on buttons within a TabView
, should be responsive upon the first appearance.
struct BreakDownBottomSheetView: BottomPopup {
func configurePopup(popup: BottomPopupConfig) -> BottomPopupConfig {
popup
.tapOutsideToDismiss(true)
.dragGestureEnabled(true)
.contentIgnoresSafeArea(true)
}
func createContent() -> some View {
VStack(spacing: 15){
TabView(selection: $index) {
ForEach(yourDataArray, id: \.self) { item in
Button(action: {
// Button action here
// Doesn't work on first appearance
}) {
Text("Button for \(item)")
}
.tabItem {
Image(systemName: "some-system-image")
Text("Tab \(item)")
}
.tag(item)
}
}
.tabViewStyle(.page(indexDisplayMode: .never))
.indexViewStyle(PageIndexViewStyle(backgroundDisplayMode: .never))
}
}
}
BreakDownBottomSheetView()
.showAndStack()
If I have a TextEditor on the bottom popup, and the TextEditor is focused, the keyboard doesn't open. I think this is because the bottom PopupView doesn't shift up. Can we make the screen shift up when the keyboard is opened? Thanks.
iOS14 CenterPopupView do not display
When I wrap using GeometryReader ,I got results like below image
'struct BottomPopup_NoCornerRadius: BottomPopup {
func configurePopup(popup: BottomPopupConfig) -> BottomPopupConfig { popup.cornerRadius(0) }
func createContent() -> some View {
GeometryReader{ geo in
VStack(alignment: .leading, spacing: 0) {
Text("Test")
createTitle()
Spacer.height(16)
createDescription()
Spacer.height(36)
createButtons()
}
.padding(.top, 32)
.padding(.bottom, 12)
.padding(.horizontal, 28)
}
}
}
@FulcrumOne
Hi, i am very like popupView, but when use it in our macOS app, it's muti windows, when i pop it, it's show on every window, Do you have any advice
If in popup view there is scrollable content and it's value bigger than screen's height - we can't scroll it to the bottom
Problem cam be solved with setting view's configuration to
contentFillsWholeHeigh(true)
or contentFillsEntireScreen(true)
Attempting to display a center popup from a view presented using .fullScreenCover results in the popup not being shown.
Hi, thanks for this amazing library. When I present popup view, I get below log in Xcode.
Automatically falling back to Main Thread rendering engine. This fallback comes with some additional performance
overhead, which can be reduced by manually specifying that this animation should always use the Main Thread engine.
Hi, very nice work!
I only have one issue, the BottomPopup is placed under other sheets.
So if I show a sheet, then present a BottomPopup, I have to dismiss the sheet for the BottomPopup to be visible.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.