Skip to content

Commit b97570b

Browse files
committed
chore: respect dimmed prop
1 parent 9dcc5ae commit b97570b

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

ios/TrueSheetView.swift

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -211,19 +211,22 @@ class TrueSheetView: UIView, RCTInvalidating, TrueSheetViewControllerDelegate {
211211
}
212212

213213
func viewControllerDidAppear() {
214-
// Add this sheet's opacity to the stack
215-
TrueSheetView.sheetOpacityStack.append(dimmedAlpha)
216-
217-
// Dim root view controller
218-
UIView.animate(withDuration: 0.3) {
219-
if let rootViewController = UIApplication.shared.windows.first?.rootViewController {
220-
rootViewController.view.alpha = self.dimmedAlpha
214+
// Only apply dimming if the sheet has dimmed property set to true
215+
if viewController.dimmed {
216+
// Add this sheet's opacity to the stack
217+
TrueSheetView.sheetOpacityStack.append(dimmedAlpha)
218+
219+
// Dim root view controller
220+
UIView.animate(withDuration: 0.3) {
221+
if let rootViewController = UIApplication.shared.windows.first?.rootViewController {
222+
rootViewController.view.alpha = self.dimmedAlpha
223+
}
221224
}
222225
}
223226
}
224227

225228
func viewControllerWillDisappear() {
226-
if viewController.isBeingDismissed {
229+
if viewController.isBeingDismissed && viewController.dimmed {
227230
// Remove the topmost opacity value (which should be this sheet's)
228231
if !TrueSheetView.sheetOpacityStack.isEmpty {
229232
TrueSheetView.sheetOpacityStack.removeLast()

0 commit comments

Comments
 (0)