mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 21:01:34 +08:00
Fix crash on API 23 where constantState.newDrawable(nativeView.getResources()); throws exception in Java. (#4959)
Fix https://github.com/bradmartin/nativescript-floatingactionbutton/issues/57 Addition to https://github.com/NativeScript/NativeScript/issues/4728
This commit is contained in:
@ -460,7 +460,11 @@ export class View extends ViewCommon {
|
|||||||
if (drawable) {
|
if (drawable) {
|
||||||
const constantState = drawable.getConstantState();
|
const constantState = drawable.getConstantState();
|
||||||
if (constantState) {
|
if (constantState) {
|
||||||
return constantState.newDrawable(nativeView.getResources());
|
try {
|
||||||
|
return constantState.newDrawable(nativeView.getResources());
|
||||||
|
} catch (e) {
|
||||||
|
return drawable;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return drawable;
|
return drawable;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user