@@ -12,6 +12,12 @@ import {
1212} from '@nativescript/core' ;
1313import { CardViewBase } from './cardview-common' ;
1414
15+ declare module '@nativescript/core/ui/core/view' {
16+ interface View {
17+ _resumeNativeUpdates ( type ) ;
18+ }
19+ }
20+
1521// use custom class to get the same behavior as android which is
1622// highlight even if clicked on subview (which is not a control)
1723
@@ -42,7 +48,6 @@ export class CardView extends CardViewBase {
4248 if ( this . shape ) {
4349 this . scheme . shapeScheme = this . getShapeScheme ( ) ;
4450 }
45- console . log ( 'createNativeView' , this . scheme . shapeScheme ) ;
4651 view . applyThemeWithScheme ( scheme ) ;
4752 }
4853 view . interactable = this . isUserInteractionEnabled ;
@@ -102,6 +107,7 @@ export class CardView extends CardViewBase {
102107 private setBottomLeftCornerRadius ( value : number ) {
103108 const shapeScheme = this . getShapeScheme ( ) ;
104109 const current = shapeScheme . smallComponentShape . bottomLeftCorner ;
110+ this . needsElevationSet = true ;
105111 if ( current instanceof MDCCutCornerTreatment ) {
106112 shapeScheme . mediumComponentShape . bottomLeftCorner = MDCCornerTreatment . cornerWithCut ( value ) ;
107113 } else {
@@ -111,6 +117,7 @@ export class CardView extends CardViewBase {
111117 private setBottomRightCornerRadius ( value : number ) {
112118 const shapeScheme = this . getShapeScheme ( ) ;
113119 const current = shapeScheme . smallComponentShape . bottomRightCorner ;
120+ this . needsElevationSet = true ;
114121 if ( current instanceof MDCCutCornerTreatment ) {
115122 shapeScheme . mediumComponentShape . bottomRightCorner = MDCCornerTreatment . cornerWithCut ( value ) ;
116123 } else {
@@ -120,6 +127,7 @@ export class CardView extends CardViewBase {
120127 private setTopLeftCornerRadius ( value : number ) {
121128 const shapeScheme = this . getShapeScheme ( ) ;
122129 const current = shapeScheme . smallComponentShape . topLeftCorner ;
130+ this . needsElevationSet = true ;
123131 if ( current instanceof MDCCutCornerTreatment ) {
124132 shapeScheme . mediumComponentShape . topLeftCorner = MDCCornerTreatment . cornerWithCut ( value ) ;
125133 } else {
@@ -129,12 +137,26 @@ export class CardView extends CardViewBase {
129137 private setTopRightCornerRadius ( value : number ) {
130138 const shapeScheme = this . getShapeScheme ( ) ;
131139 const current = shapeScheme . smallComponentShape . topRightCorner ;
140+ this . needsElevationSet = true ;
132141 if ( current instanceof MDCCutCornerTreatment ) {
133142 shapeScheme . mediumComponentShape . topRightCorner = MDCCornerTreatment . cornerWithCut ( value ) ;
134143 } else {
135144 shapeScheme . mediumComponentShape . topRightCorner = MDCCornerTreatment . cornerWithRadius ( value ) ;
136145 }
137146 }
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+ }
138160 // trick to get the same behavior as android (don't disable all children)
139161 [ isUserInteractionEnabledProperty . setNative ] ( value : boolean ) {
140162 this . nativeViewProtected . interactable = value ;
0 commit comments