From 5fd513047566c54f3484e7b3c86fbad6f71ac162 Mon Sep 17 00:00:00 2001 From: Vladimir Kharlampidi Date: Fri, 14 Oct 2022 15:32:23 +0300 Subject: [PATCH] feat(sheet): use `push` effect even if no safe areas detected --- src/core/components/sheet/sheet-class.js | 25 ++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/core/components/sheet/sheet-class.js b/src/core/components/sheet/sheet-class.js index b6d98e2470..0a5a469bcd 100644 --- a/src/core/components/sheet/sheet-class.js +++ b/src/core/components/sheet/sheet-class.js @@ -466,18 +466,18 @@ class Sheet extends Modal { if (sheet.push) { pushOffset = parseInt($el.css('--f7-sheet-push-offset'), 10); if (Number.isNaN(pushOffset)) pushOffset = 0; - if (pushOffset) { - $el.addClass('sheet-modal-push'); - sheet.$htmlEl.addClass('with-modal-sheet-push'); - if (!sheet.params.swipeToStep) { - sheet.$htmlEl[0].style.setProperty('--f7-sheet-push-scale', pushViewScale(pushOffset)); - } else { - $pushViewEl = app.$el.children('.view, .views'); - pushBorderRadius = parseFloat( - $el.css(`border-${isTopSheetModal ? 'bottom' : 'top'}-left-radius`), - ); - $pushViewEl.css('border-radius', '0px'); - } + if (!pushOffset) pushOffset = app.theme === 'ios' ? 44 : 48; + sheet.$htmlEl[0].style.setProperty('--f7-sheet-push-offset', `${pushOffset}px`); + $el.addClass('sheet-modal-push'); + sheet.$htmlEl.addClass('with-modal-sheet-push'); + if (!sheet.params.swipeToStep) { + sheet.$htmlEl[0].style.setProperty('--f7-sheet-push-scale', pushViewScale(pushOffset)); + } else { + $pushViewEl = app.$el.children('.view, .views'); + pushBorderRadius = parseFloat( + $el.css(`border-${isTopSheetModal ? 'bottom' : 'top'}-left-radius`), + ); + $pushViewEl.css('border-radius', '0px'); } } }); @@ -532,6 +532,7 @@ class Sheet extends Modal { sheet.emit('local::_swipeStep', true); if (sheet.push) { sheet.$htmlEl[0].style.removeProperty('--f7-sheet-push-scale'); + sheet.$htmlEl[0].style.removeProperty('--f7-sheet-push-offset'); } }; sheet.stepToggle = function stepToggle() {