Browse Source

fix #1149 and the related issue in #43#issuecomment-267370982 (#1188)

Create BitmapDrawable using a constructor that actually uses the Resources reference
fqborges 7 years ago
parent
commit
79f07f8a8a

+ 4
- 1
android/app/src/main/java/com/reactnativenavigation/react/ImageLoader.java View File

@@ -1,5 +1,7 @@
1 1
 package com.reactnativenavigation.react;
2 2
 
3
+import android.graphics.Bitmap;
4
+import android.graphics.BitmapFactory;
3 5
 import android.graphics.drawable.BitmapDrawable;
4 6
 import android.graphics.drawable.Drawable;
5 7
 import android.net.Uri;
@@ -27,7 +29,8 @@ public class ImageLoader {
27 29
     }
28 30
 
29 31
     private static Drawable loadFile(Uri uri) {
30
-        return new BitmapDrawable(NavigationApplication.instance.getResources(), uri.getPath());
32
+        Bitmap bitmap = BitmapFactory.decodeFile(uri.getPath());
33
+        return new BitmapDrawable(NavigationApplication.instance.getResources(), bitmap);
31 34
     }
32 35
 
33 36
     private static Drawable loadResource(String iconSource) {