1+ import { getIonTheme } from '@global/ionic-global' ;
12import { isIonContent , findClosestIonContent } from '@utils/content' ;
23import { createGesture } from '@utils/gesture' ;
34import { clamp , raf , getElementRoot } from '@utils/helpers' ;
45import { FOCUS_TRAP_DISABLE_CLASS } from '@utils/overlays' ;
56
67import type { Animation } from '../../../interface' ;
78import type { GestureDetail } from '../../../utils/gesture' ;
8- import { getBackdropValueForSheet } from '../utils' ;
9+ import { getBackdropValueForSheet , staticBackdropOpacity } from '../utils' ;
910
1011import { calculateSpringStep , handleCanDismiss } from './utils' ;
1112
@@ -53,6 +54,7 @@ export const createSheetGesture = (
5354 onDismiss : ( ) => void ,
5455 onBreakpointChange : ( breakpoint : number ) => void
5556) => {
57+ const theme = getIonTheme ( baseEl ) ;
5658 // Defaults for the sheet swipe animation
5759 const defaultBackdrop = [
5860 { offset : 0 , opacity : 'var(--backdrop-opacity)' } ,
@@ -65,12 +67,18 @@ export const createSheetGesture = (
6567 { offset : 1 , opacity : 0 } ,
6668 ] ;
6769
70+ const ionicThemeBackdrop = [
71+ { offset : 0 , opacity : staticBackdropOpacity } ,
72+ { offset : 1 , opacity : staticBackdropOpacity } ,
73+ ] ;
74+
6875 const SheetDefaults = {
6976 WRAPPER_KEYFRAMES : [
7077 { offset : 0 , transform : 'translateY(0%)' } ,
7178 { offset : 1 , transform : 'translateY(100%)' } ,
7279 ] ,
73- BACKDROP_KEYFRAMES : backdropBreakpoint !== 0 ? customBackdrop : defaultBackdrop ,
80+ BACKDROP_KEYFRAMES :
81+ theme === 'ionic' ? ionicThemeBackdrop : backdropBreakpoint !== 0 ? customBackdrop : defaultBackdrop ,
7482 } ;
7583
7684 const contentEl = baseEl . querySelector ( 'ion-content' ) ;
@@ -309,19 +317,35 @@ export const createSheetGesture = (
309317 { offset : 1 , transform : `translateY(${ ( 1 - snapToBreakpoint ) * 100 } %)` } ,
310318 ] ) ;
311319
312- backdropAnimation . keyframes ( [
313- {
314- offset : 0 ,
315- opacity : `calc(var(--backdrop-opacity) * ${ getBackdropValueForSheet (
316- 1 - breakpointOffset ,
317- backdropBreakpoint
318- ) } )`,
319- } ,
320- {
321- offset : 1 ,
322- opacity : `calc(var(--backdrop-opacity) * ${ getBackdropValueForSheet ( snapToBreakpoint , backdropBreakpoint ) } )` ,
323- } ,
324- ] ) ;
320+ backdropAnimation . keyframes (
321+ theme === 'ionic'
322+ ? [
323+ {
324+ offset : 0 ,
325+ opacity : staticBackdropOpacity ,
326+ } ,
327+ {
328+ offset : 1 ,
329+ opacity : staticBackdropOpacity ,
330+ } ,
331+ ]
332+ : [
333+ {
334+ offset : 0 ,
335+ opacity : `calc(var(--backdrop-opacity) * ${ getBackdropValueForSheet (
336+ 1 - breakpointOffset ,
337+ backdropBreakpoint
338+ ) } )`,
339+ } ,
340+ {
341+ offset : 1 ,
342+ opacity : `calc(var(--backdrop-opacity) * ${ getBackdropValueForSheet (
343+ snapToBreakpoint ,
344+ backdropBreakpoint
345+ ) } )`,
346+ } ,
347+ ]
348+ ) ;
325349
326350 animation . progressStep ( 0 ) ;
327351 }
0 commit comments