@@ -12,6 +12,12 @@ import {
12
12
} from '@nativescript/core' ;
13
13
import { CardViewBase } from './cardview-common' ;
14
14
15
+ declare module '@nativescript/core/ui/core/view' {
16
+ interface View {
17
+ _resumeNativeUpdates ( type ) ;
18
+ }
19
+ }
20
+
15
21
// use custom class to get the same behavior as android which is
16
22
// highlight even if clicked on subview (which is not a control)
17
23
@@ -42,7 +48,6 @@ export class CardView extends CardViewBase {
42
48
if ( this . shape ) {
43
49
this . scheme . shapeScheme = this . getShapeScheme ( ) ;
44
50
}
45
- console . log ( 'createNativeView' , this . scheme . shapeScheme ) ;
46
51
view . applyThemeWithScheme ( scheme ) ;
47
52
}
48
53
view . interactable = this . isUserInteractionEnabled ;
@@ -102,6 +107,7 @@ export class CardView extends CardViewBase {
102
107
private setBottomLeftCornerRadius ( value : number ) {
103
108
const shapeScheme = this . getShapeScheme ( ) ;
104
109
const current = shapeScheme . smallComponentShape . bottomLeftCorner ;
110
+ this . needsElevationSet = true ;
105
111
if ( current instanceof MDCCutCornerTreatment ) {
106
112
shapeScheme . mediumComponentShape . bottomLeftCorner = MDCCornerTreatment . cornerWithCut ( value ) ;
107
113
} else {
@@ -111,6 +117,7 @@ export class CardView extends CardViewBase {
111
117
private setBottomRightCornerRadius ( value : number ) {
112
118
const shapeScheme = this . getShapeScheme ( ) ;
113
119
const current = shapeScheme . smallComponentShape . bottomRightCorner ;
120
+ this . needsElevationSet = true ;
114
121
if ( current instanceof MDCCutCornerTreatment ) {
115
122
shapeScheme . mediumComponentShape . bottomRightCorner = MDCCornerTreatment . cornerWithCut ( value ) ;
116
123
} else {
@@ -120,6 +127,7 @@ export class CardView extends CardViewBase {
120
127
private setTopLeftCornerRadius ( value : number ) {
121
128
const shapeScheme = this . getShapeScheme ( ) ;
122
129
const current = shapeScheme . smallComponentShape . topLeftCorner ;
130
+ this . needsElevationSet = true ;
123
131
if ( current instanceof MDCCutCornerTreatment ) {
124
132
shapeScheme . mediumComponentShape . topLeftCorner = MDCCornerTreatment . cornerWithCut ( value ) ;
125
133
} else {
@@ -129,12 +137,26 @@ export class CardView extends CardViewBase {
129
137
private setTopRightCornerRadius ( value : number ) {
130
138
const shapeScheme = this . getShapeScheme ( ) ;
131
139
const current = shapeScheme . smallComponentShape . topRightCorner ;
140
+ this . needsElevationSet = true ;
132
141
if ( current instanceof MDCCutCornerTreatment ) {
133
142
shapeScheme . mediumComponentShape . topRightCorner = MDCCornerTreatment . cornerWithCut ( value ) ;
134
143
} else {
135
144
shapeScheme . mediumComponentShape . topRightCorner = MDCCornerTreatment . cornerWithRadius ( value ) ;
136
145
}
137
146
}
147
+ needsElevationSet = false ;
148
+ public _resumeNativeUpdates ( type ) {
149
+ super . _resumeNativeUpdates ( type ) ;
150
+ if ( this . needsElevationSet && ( this . elevation || this . dynamicElevationOffset ) ) {
151
+ this . needsElevationSet = false ;
152
+ if ( this . elevation ) {
153
+ this [ elevationProperty . setNative ] ( this . elevation ) ;
154
+ }
155
+ if ( this . dynamicElevationOffset ) {
156
+ this [ dynamicElevationOffsetProperty . setNative ] ( this . dynamicElevationOffset ) ;
157
+ }
158
+ }
159
+ }
138
160
// trick to get the same behavior as android (don't disable all children)
139
161
[ isUserInteractionEnabledProperty . setNative ] ( value : boolean ) {
140
162
this . nativeViewProtected . interactable = value ;
0 commit comments