Skip to content

Commit 80dc0ad

Browse files
committed
fix: backdrop ignoreTouchAnimation
feat: added backdropProperties tp customize backdrop
1 parent de970a9 commit 80dc0ad

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/ui-drawer/index.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ export const backdropColorProperty = new Property<Drawer, Color>({
6464
name: 'backdropColor',
6565
valueConverter: (c) => (c ? new Color(c) : null)
6666
});
67+
export const backdropPropertiesProperty = new Property<Drawer, Object>({
68+
name: 'backdropProperties'
69+
});
6770
export const leftDrawerModeProperty = new Property<Drawer, Mode>({
6871
name: 'leftDrawerMode'
6972
});
@@ -135,6 +138,7 @@ export class Drawer extends GridLayout {
135138
public bottomSwipeDistance = 40;
136139
public topSwipeDistance = 40;
137140
public backdropColor = new Color('rgba(0, 0, 0, 0.7)');
141+
public backdropProperties = {};
138142
public leftOpenedDrawerAllowDraging = true;
139143
public rightOpenedDrawerAllowDraging = true;
140144
public bottomOpenedDrawerAllowDraging = true;
@@ -160,7 +164,7 @@ export class Drawer extends GridLayout {
160164
private mTranslationY: { [k in VerticalSide]: number } = { bottom: 0, top: 0 };
161165
private mShowingSide: Side | VerticalSide = null;
162166
// private mNeedToSetSide: Side | VerticalSide;
163-
private mModes: Partial<{ [k in Side | VerticalSide]: Mode }> = { };
167+
private mModes: Partial<{ [k in Side | VerticalSide]: Mode }> = {};
164168

165169
translationFunction?: TranslationFunctionType;
166170

@@ -174,7 +178,9 @@ export class Drawer extends GridLayout {
174178
_onBackDropEnabledValueChanged() {
175179
if (this.backDropEnabled && !this.backDrop) {
176180
this.backDrop = new GridLayout();
181+
this.backDrop.ignoreTouchAnimation = true;
177182
this.backDrop.backgroundColor = this.backdropColor;
183+
Object.assign(this.backDrop, this.backdropProperties);
178184
this.backDrop.opacity = 0;
179185
this.backDrop.visibility = 'hidden';
180186

@@ -505,6 +511,11 @@ export class Drawer extends GridLayout {
505511
this.backDrop.backgroundColor = value;
506512
}
507513
}
514+
[backdropPropertiesProperty.setNative](value) {
515+
if (this.backDrop) {
516+
Object.assign(this.backDrop, this.backdropProperties);
517+
}
518+
}
508519
[leftDrawerModeProperty.setNative](value: Mode) {
509520
this.onSideModeChanged('left', value);
510521
}

0 commit comments

Comments
 (0)