Browse Source

Return empty Drawable when bridge isn't available (#1360)

Guy Carmeli 7 years ago
parent
commit
822afefd7e

+ 4
- 2
android/app/src/main/java/com/reactnativenavigation/react/JsDevImageLoader.java View File

6
 import android.graphics.drawable.Drawable;
6
 import android.graphics.drawable.Drawable;
7
 import android.os.StrictMode;
7
 import android.os.StrictMode;
8
 import android.support.annotation.NonNull;
8
 import android.support.annotation.NonNull;
9
+import android.util.Log;
9
 
10
 
10
 import com.reactnativenavigation.NavigationApplication;
11
 import com.reactnativenavigation.NavigationApplication;
11
 
12
 
13
 import java.net.URL;
14
 import java.net.URL;
14
 
15
 
15
 public class JsDevImageLoader {
16
 public class JsDevImageLoader {
16
-
17
+    private static final String TAG = "JsDevImageLoader";
17
     public static Drawable loadIcon(String iconDevUri) {
18
     public static Drawable loadIcon(String iconDevUri) {
18
         try {
19
         try {
19
             StrictMode.ThreadPolicy threadPolicy = StrictMode.getThreadPolicy();
20
             StrictMode.ThreadPolicy threadPolicy = StrictMode.getThreadPolicy();
24
             StrictMode.setThreadPolicy(threadPolicy);
25
             StrictMode.setThreadPolicy(threadPolicy);
25
             return drawable;
26
             return drawable;
26
         } catch (Exception e) {
27
         } catch (Exception e) {
27
-            throw new RuntimeException(iconDevUri, e);
28
+            Log.e(TAG, "Unable to load icon: " + iconDevUri);
29
+            return new BitmapDrawable();
28
         }
30
         }
29
     }
31
     }
30
 
32