Browse Source

Fix loading local images (#4769)

When loading local image resource (images in Drawable folder), RNN mistakingly tried to load the image as a js asset even if it successfully loaded the local image.
Guy Carmeli 6 years ago
parent
commit
c82bc57d58
No account linked to committer's email address

+ 2
- 3
lib/android/app/src/main/java/com/reactnativenavigation/utils/ImageLoader.java View File

@@ -66,16 +66,15 @@ public class ImageLoader {
66 66
     @NonNull
67 67
     private Drawable getDrawable(Context context, String source) throws IOException {
68 68
         Drawable drawable;
69
-
70 69
         if (isLocalFile(Uri.parse(source))) {
71 70
             drawable = loadFile(source);
72 71
         } else {
73 72
             drawable = loadResource(source);
74
-            if (drawable == null || NavigationApplication.instance.isDebug()) {
73
+            if (drawable == null && NavigationApplication.instance.isDebug()) {
75 74
                 drawable = readJsDevImage(context, source);
76 75
             }
77 76
         }
78
-
77
+        if (drawable == null) throw new RuntimeException("Could not load image " + source);
79 78
         return drawable;
80 79
     }
81 80