Skip to content

Commit 88487a2

Browse files
committed
fix(android): placeholder and other wont have memory issues anymore when using res://...
1 parent b35c1b8 commit 88487a2

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/image.android.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -802,13 +802,9 @@ export class Img extends ImageBase {
802802
}
803803

804804
private getDrawableFromResource(resourceName: string) {
805-
const img = ImageSource.fromResourceSync(resourceName.substr(RESOURCE_PREFIX.length));
806-
let drawable: android.graphics.drawable.BitmapDrawable = null;
807-
if (img) {
808-
drawable = new android.graphics.drawable.BitmapDrawable(ad.getApplicationContext().getResources(), img.android);
809-
}
810-
811-
return drawable;
805+
const identifier = ad.getApplication().getResources().getIdentifier(resourceName.substr(RESOURCE_PREFIX.length), 'drawable', ad.getApplication().getPackageName());
806+
// we return the identifier to allow Fresco to handle memory / caching
807+
return identifier;
812808
}
813809

814810
startAnimating() {

0 commit comments

Comments
 (0)