From b40cc6bf3ea24b9ffe824e84c7a4a7b78d73f00f Mon Sep 17 00:00:00 2001 From: vakrilov Date: Wed, 22 Jan 2020 18:06:11 +0200 Subject: [PATCH] fix(andoird): crash on setting elevation on API21 --- nativescript-core/ui/core/view/view.android.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nativescript-core/ui/core/view/view.android.ts b/nativescript-core/ui/core/view/view.android.ts index 244edad35..03691fc4e 100644 --- a/nativescript-core/ui/core/view/view.android.ts +++ b/nativescript-core/ui/core/view/view.android.ts @@ -388,7 +388,7 @@ export class View extends ViewCommon { this.nativeViewProtected.setClickable(this._isClickable); } } - + this._manager = null; this._rootManager = null; super.onUnloaded(); @@ -832,6 +832,11 @@ export class View extends ViewCommon { stateListAnimator.addState([statePressed, stateEnabled], pressedSet); stateListAnimator.addState([stateEnabled], notPressedSet); stateListAnimator.addState([], defaultSet); + + const currentAnimator = nativeView.getStateListAnimator(); + if (currentAnimator) { + currentAnimator.jumpToCurrentState(); + } nativeView.setStateListAnimator(stateListAnimator); }