Skip to content

Commit 5724e89

Browse files
committed
Remove connection between isOpaque and closeOnTapOutside
Fix
1 parent da417a1 commit 5724e89

File tree

4 files changed

+11
-16
lines changed

4 files changed

+11
-16
lines changed

ExytePopupView.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "ExytePopupView"
3-
s.version = "2.6.2"
3+
s.version = "2.6.3"
44
s.summary = "SwiftUI library for toasts, alerts and popups"
55
s.homepage = 'https://github.com/exyte/PopupView.git'
66
s.license = 'MIT'

README.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,8 @@ use `customize` closure in popup modifier:
127127
`closeOnTapOutside` - false by default: enable/disable closing on tap on outside of popup
128128
`backgroundColor` - Color.clear by default: change background color of outside area
129129
`backgroundView` - custom background builder for outside area (if this one is set `backgroundColor` is ignored)
130-
`isOpaque` - false by default: if true taps do not pass through popup's background and the popup is displayed on top of navbar. Always opaque if
131-
`useKeyboardSafeArea` - false by default: if true popup goes up for keyboardHeight when kyeboard is displayed
132-
`closeOnTapOutside` is true. For more see section "Show over navbar"
130+
`isOpaque` - false by default: if true taps do not pass through popup's background and the popup is displayed on top of navbar. For more see section "Show over navbar"
131+
`useKeyboardSafeArea` - false by default: if true popup goes up for keyboardHeight when keyboard is displayed
133132
`dismissCallback` - custom callback to call once the popup is dismissed
134133

135134
### Draggable card - sheet

Source/FullscreenPopup.swift

+2-6
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public struct FullscreenPopup<Item: Equatable, PopupContent: View>: ViewModifier
3535
/// Custom background view for outside area
3636
var backgroundView: AnyView?
3737

38-
/// If opaque taps do not pass through popup's background color. Always opaque if closeOnTapOutside is true
38+
/// If opaque - taps do not pass through popup's background color
3939
var isOpaque: Bool
4040

4141
/// Is called on any close action
@@ -76,10 +76,6 @@ public struct FullscreenPopup<Item: Equatable, PopupContent: View>: ViewModifier
7676

7777
/// Set dismiss souce to pass to dismiss callback
7878
@State private var dismissSource: DismissSource?
79-
80-
var opaqueBackground: Bool {
81-
isOpaque || closeOnTapOutside
82-
}
8379

8480
init(isPresented: Binding<Bool> = .constant(false),
8581
item: Binding<Item?> = .constant(nil),
@@ -146,7 +142,7 @@ public struct FullscreenPopup<Item: Equatable, PopupContent: View>: ViewModifier
146142

147143
@ViewBuilder
148144
public func main(content: Content) -> some View {
149-
if opaqueBackground {
145+
if isOpaque {
150146
#if os(iOS)
151147
content.transparentNonAnimatingFullScreenCover(isPresented: $showSheet) {
152148
constructPopup()

Source/PopupView.swift

+6-6
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public struct Popup<PopupContent: View>: ViewModifier {
3535
self.animation = params.animation
3636
self.dragToDismiss = params.dragToDismiss
3737
self.closeOnTap = params.closeOnTap
38-
self.opaqueBackground = params.isOpaque || params.closeOnTapOutside
38+
self.isOpaque = params.isOpaque
3939

4040
self.view = view
4141

@@ -152,7 +152,7 @@ public struct Popup<PopupContent: View>: ViewModifier {
152152
/// Custom background view for outside area
153153
var backgroundView: AnyView?
154154

155-
/// If true taps do not pass through popup's background and the popup is displayed on top of navbar. Always opaque if closeOnTapOutside is true
155+
/// If true - taps do not pass through popup's background and the popup is displayed on top of navbar
156156
var isOpaque: Bool = false
157157

158158
/// move up for keyboardHeight when it is displayed
@@ -287,8 +287,8 @@ public struct Popup<PopupContent: View>: ViewModifier {
287287
/// Should allow dismiss by dragging
288288
var dragToDismiss: Bool
289289

290-
/// If opaque taps do not pass through popup's background color. True if either closeOnTapOutside or isOpaque is true
291-
var opaqueBackground: Bool
290+
/// If opaque - taps do not pass through popup's background color
291+
var isOpaque: Bool
292292

293293
/// Trigger popup showing/hiding animations and...
294294
var shouldShowContent: Bool
@@ -330,7 +330,7 @@ public struct Popup<PopupContent: View>: ViewModifier {
330330

331331
/// The offset when the popup is displayed
332332
private var displayedOffsetY: CGFloat {
333-
if opaqueBackground {
333+
if isOpaque {
334334
if position.isTop {
335335
return verticalPadding + (useSafeAreaInset ? 0 : -safeAreaInsets.top)
336336
}
@@ -364,7 +364,7 @@ public struct Popup<PopupContent: View>: ViewModifier {
364364
}
365365

366366
private var displayedOffsetX: CGFloat {
367-
if opaqueBackground {
367+
if isOpaque {
368368
if position.isLeading {
369369
return horizontalPadding + (useSafeAreaInset ? safeAreaInsets.leading : 0)
370370
}

0 commit comments

Comments
 (0)