package com.reactnativenavigation.react;

import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;

import com.reactnativenavigation.NavigationApplication;

public class ImageLoader {
    private static final String FILE_SCHEME = "file";

    public static Drawable loadImage(String iconSource) {
        if (NavigationApplication.instance.isDebug()) {
            return JsDevImageLoader.loadIcon(iconSource);
        } else {
            Uri uri = Uri.parse(iconSource);
            if (isLocalFile(uri)) {
                return loadFile(uri);
            } else {
                return loadResource(iconSource);
            }
        }
    }

    private static boolean isLocalFile(Uri uri) {
        return FILE_SCHEME.equals(uri.getScheme());
    }

    private static Drawable loadFile(Uri uri) {
        return new BitmapDrawable(NavigationApplication.instance.getResources(), uri.getPath());
    }

    private static Drawable loadResource(String iconSource) {
        return ResourceDrawableIdHelper.instance.getResourceDrawable(NavigationApplication.instance, iconSource);
    }
}

@@ -35,16 +35,87 @@
 react;%0A%0A
+import android.graphics.Bitmap;%0Aimport android.graphics.BitmapFactory;%0A
 import a
@@ -920,32 +920,97 @@
 File(Uri uri) %7B%0A
+        Bitmap bitmap = BitmapFactory.decodeFile(uri.getPath());%0A
         return n
@@ -1074,29 +1074,22 @@
 rces(), 
-uri.getPath()
+bitmap
 );%0A    %7D

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