DylanVann / react-native-fast-image

🚩 FastImage, performant React Native image component.
MIT License
8.17k stars 1.5k forks source link

[Android] Crash, Error while updating property 'source' of a view managed by: FastImageView #840

Open thanakij opened 2 years ago

thanakij commented 2 years ago

Describe the bug There is an app crash reported by Crashlytics on a device running Android 4.4.4 (Samsung, Galaxy Core Prime)

FastImageViewManager.java line 111
com.dylanvann.fastimage.FastImageViewManager.setSrc
Caused by java.lang.ClassCastException
androidx.appcompat.widget.TintContextWrapper cannot be cast to e.g.x0.t0.d0

To Reproduce I cannot reproduce this, but hopefully the log provided by Crashlytics would shred some light on this.

Expected behavior Should not crash.

Screenshots

Dependency versions

Note: if these are not the latest versions of each I recommend updating as extra effort will not be taken to be backwards compatible, and updating might resolving your issue.

dcboy commented 2 years ago

this issues is same for me, how to resolve

thanakij commented 2 years ago

Hi @dcboy, I tried to tackle the issue and created a pull request #843.

I was wondering if you can help to confirm if it works for you as well.

dcboy commented 2 years ago

@thanakij could you help to create patch-package for me to test?

thanakij commented 2 years ago

Yes, please see my "patches/react-native-fast-image+8.5.11.patch" below, @dcboy.

diff --git a/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageRequestListener.java b/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageRequestListener.java
index 361417b..85b8eeb 100644
--- a/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageRequestListener.java
+++ b/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageRequestListener.java
@@ -1,5 +1,6 @@
 package com.dylanvann.fastimage;

+import android.content.Context;
 import android.graphics.drawable.Drawable;

 import com.bumptech.glide.load.DataSource;
@@ -7,9 +8,9 @@ import com.bumptech.glide.load.engine.GlideException;
 import com.bumptech.glide.request.RequestListener;
 import com.bumptech.glide.request.target.ImageViewTarget;
 import com.bumptech.glide.request.target.Target;
+import com.facebook.react.bridge.ReactContext;
 import com.facebook.react.bridge.WritableMap;
 import com.facebook.react.bridge.WritableNativeMap;
-import com.facebook.react.uimanager.ThemedReactContext;
 import com.facebook.react.uimanager.events.RCTEventEmitter;

 public class FastImageRequestListener implements RequestListener<Drawable> {
@@ -37,11 +38,14 @@ public class FastImageRequestListener implements RequestListener<Drawable> {
             return false;
         }
         FastImageViewWithUrl view = (FastImageViewWithUrl) ((ImageViewTarget) target).getView();
-        ThemedReactContext context = (ThemedReactContext) view.getContext();
-        RCTEventEmitter eventEmitter = context.getJSModule(RCTEventEmitter.class);
         int viewId = view.getId();
-        eventEmitter.receiveEvent(viewId, REACT_ON_ERROR_EVENT, new WritableNativeMap());
-        eventEmitter.receiveEvent(viewId, REACT_ON_LOAD_END_EVENT, new WritableNativeMap());
+        Context context = view.getContext();
+        ReactContext reactContext = context instanceof ReactContext ? (ReactContext) context : null;
+        if (reactContext != null) {
+            RCTEventEmitter eventEmitter = reactContext.getJSModule(RCTEventEmitter.class);
+            eventEmitter.receiveEvent(viewId, REACT_ON_ERROR_EVENT, new WritableNativeMap());
+            eventEmitter.receiveEvent(viewId, REACT_ON_LOAD_END_EVENT, new WritableNativeMap());
+        }
         return false;
     }

@@ -51,11 +55,14 @@ public class FastImageRequestListener implements RequestListener<Drawable> {
             return false;
         }
         FastImageViewWithUrl view = (FastImageViewWithUrl) ((ImageViewTarget) target).getView();
-        ThemedReactContext context = (ThemedReactContext) view.getContext();
-        RCTEventEmitter eventEmitter = context.getJSModule(RCTEventEmitter.class);
         int viewId = view.getId();
-        eventEmitter.receiveEvent(viewId, REACT_ON_LOAD_EVENT, mapFromResource(resource));
-        eventEmitter.receiveEvent(viewId, REACT_ON_LOAD_END_EVENT, new WritableNativeMap());
+        Context context = view.getContext();
+        ReactContext reactContext = context instanceof ReactContext ? (ReactContext) context : null;
+        if (reactContext != null) {
+            RCTEventEmitter eventEmitter = reactContext.getJSModule(RCTEventEmitter.class);
+            eventEmitter.receiveEvent(viewId, REACT_ON_LOAD_EVENT, mapFromResource(resource));
+            eventEmitter.receiveEvent(viewId, REACT_ON_LOAD_END_EVENT, new WritableNativeMap());
+        }
         return false;
     }
 }
diff --git a/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageViewManager.java b/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageViewManager.java
index 0944463..81a425d 100644
--- a/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageViewManager.java
+++ b/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageViewManager.java
@@ -10,6 +10,7 @@ import com.bumptech.glide.Glide;
 import com.bumptech.glide.RequestManager;
 import com.bumptech.glide.load.model.GlideUrl;
 import com.bumptech.glide.request.Request;
+import com.facebook.react.bridge.ReactContext;
 import com.facebook.react.bridge.ReadableMap;
 import com.facebook.react.bridge.WritableMap;
 import com.facebook.react.bridge.WritableNativeMap;
@@ -57,6 +58,10 @@ class FastImageViewManager extends SimpleViewManager<FastImageViewWithUrl> imple

     @ReactProp(name = "source")
     public void setSrc(FastImageViewWithUrl view, @Nullable ReadableMap source) {
+        int viewId = view.getId();
+        Context context = view.getContext();
+        ReactContext reactContext = context instanceof ReactContext ? (ReactContext) context : null;
+
         if (source == null || !source.hasKey("uri") || isNullOrEmpty(source.getString("uri"))) {
             // Cancel existing requests.
             clearView(view);
@@ -69,15 +74,15 @@ class FastImageViewManager extends SimpleViewManager<FastImageViewWithUrl> imple
             return;
         }

-        //final GlideUrl glideUrl = FastImageViewConverter.getGlideUrl(view.getContext(), source);
-        final FastImageSource imageSource = FastImageViewConverter.getImageSource(view.getContext(), source);
+        //final GlideUrl glideUrl = FastImageViewConverter.getGlideUrl(context, source);
+        final FastImageSource imageSource = FastImageViewConverter.getImageSource(context, source);
         if (imageSource.getUri().toString().length() == 0) {
-            ThemedReactContext context = (ThemedReactContext) view.getContext();
-            RCTEventEmitter eventEmitter = context.getJSModule(RCTEventEmitter.class);
-            int viewId = view.getId();
-            WritableMap event = new WritableNativeMap();
-            event.putString("message", "Invalid source prop:" + source);
-            eventEmitter.receiveEvent(viewId, REACT_ON_ERROR_EVENT, event);
+            if (reactContext != null) {
+                WritableMap event = new WritableNativeMap();
+                event.putString("message", "Invalid source prop:" + source);
+                RCTEventEmitter eventEmitter = reactContext.getJSModule(RCTEventEmitter.class);
+                eventEmitter.receiveEvent(viewId, REACT_ON_ERROR_EVENT, event);
+            }

             // Cancel existing requests.
             if (requestManager != null) {
@@ -108,10 +113,10 @@ class FastImageViewManager extends SimpleViewManager<FastImageViewWithUrl> imple
             VIEWS_FOR_URLS.put(key, newViewsForKeys);
         }

-        ThemedReactContext context = (ThemedReactContext) view.getContext();
-        RCTEventEmitter eventEmitter = context.getJSModule(RCTEventEmitter.class);
-        int viewId = view.getId();
-        eventEmitter.receiveEvent(viewId, REACT_ON_LOAD_START_EVENT, new WritableNativeMap());
+        if (reactContext != null) {
+            RCTEventEmitter eventEmitter = reactContext.getJSModule(RCTEventEmitter.class);
+            eventEmitter.receiveEvent(viewId, REACT_ON_LOAD_START_EVENT, new WritableNativeMap());
+        }

         if (requestManager != null) {
             requestManager
@@ -176,14 +181,15 @@ class FastImageViewManager extends SimpleViewManager<FastImageViewWithUrl> imple
     public void onProgress(String key, long bytesRead, long expectedLength) {
         List<FastImageViewWithUrl> viewsForKey = VIEWS_FOR_URLS.get(key);
         if (viewsForKey != null) {
-            for (FastImageViewWithUrl view : viewsForKey) {
+            Context context = null;
+            for (FastImageViewWithUrl view: viewsForKey) {
+                context = view.getContext();
+                if (!(context instanceof ReactContext)) continue; // this view is not of react context
                 WritableMap event = new WritableNativeMap();
                 event.putInt("loaded", (int) bytesRead);
                 event.putInt("total", (int) expectedLength);
-                ThemedReactContext context = (ThemedReactContext) view.getContext();
-                RCTEventEmitter eventEmitter = context.getJSModule(RCTEventEmitter.class);
-                int viewId = view.getId();
-                eventEmitter.receiveEvent(viewId, REACT_ON_PROGRESS_EVENT, event);
+                RCTEventEmitter eventEmitter = ((ReactContext) context).getJSModule(RCTEventEmitter.class);
+                eventEmitter.receiveEvent(view.getId(), REACT_ON_PROGRESS_EVENT, event);
             }
         }
     }
ilenin commented 2 years ago

The same issue.. The problem occurs on old android versions like Android 4.4.. In newer versions this problem doesn't occur.

@DylanVann Could u pls check PR #843 of @thanakij?

thanakij commented 2 years ago

@ilenin, thanks for pinging me, I have done some more research and found this thread. So I have updated my code in the PR!

thanakij commented 2 years ago

Below is what my current patch looks like:

diff --git a/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageRequestListener.java b/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageRequestListener.java
index 361417b..831513f 100644
--- a/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageRequestListener.java
+++ b/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageRequestListener.java
@@ -1,5 +1,6 @@
 package com.dylanvann.fastimage;

+import android.content.Context;
 import android.graphics.drawable.Drawable;

 import com.bumptech.glide.load.DataSource;
@@ -7,9 +8,9 @@ import com.bumptech.glide.load.engine.GlideException;
 import com.bumptech.glide.request.RequestListener;
 import com.bumptech.glide.request.target.ImageViewTarget;
 import com.bumptech.glide.request.target.Target;
+import com.facebook.react.bridge.ReactContext;
 import com.facebook.react.bridge.WritableMap;
 import com.facebook.react.bridge.WritableNativeMap;
-import com.facebook.react.uimanager.ThemedReactContext;
 import com.facebook.react.uimanager.events.RCTEventEmitter;

 public class FastImageRequestListener implements RequestListener<Drawable> {
@@ -37,11 +38,14 @@ public class FastImageRequestListener implements RequestListener<Drawable> {
             return false;
         }
         FastImageViewWithUrl view = (FastImageViewWithUrl) ((ImageViewTarget) target).getView();
-        ThemedReactContext context = (ThemedReactContext) view.getContext();
-        RCTEventEmitter eventEmitter = context.getJSModule(RCTEventEmitter.class);
         int viewId = view.getId();
-        eventEmitter.receiveEvent(viewId, REACT_ON_ERROR_EVENT, new WritableNativeMap());
-        eventEmitter.receiveEvent(viewId, REACT_ON_LOAD_END_EVENT, new WritableNativeMap());
+        Context context = view.getContext();
+        ReactContext reactContext = FastImageViewManager.getReactContext(context);
+        if (reactContext != null) {
+            RCTEventEmitter eventEmitter = reactContext.getJSModule(RCTEventEmitter.class);
+            eventEmitter.receiveEvent(viewId, REACT_ON_ERROR_EVENT, new WritableNativeMap());
+            eventEmitter.receiveEvent(viewId, REACT_ON_LOAD_END_EVENT, new WritableNativeMap());
+        }
         return false;
     }

@@ -51,11 +55,14 @@ public class FastImageRequestListener implements RequestListener<Drawable> {
             return false;
         }
         FastImageViewWithUrl view = (FastImageViewWithUrl) ((ImageViewTarget) target).getView();
-        ThemedReactContext context = (ThemedReactContext) view.getContext();
-        RCTEventEmitter eventEmitter = context.getJSModule(RCTEventEmitter.class);
         int viewId = view.getId();
-        eventEmitter.receiveEvent(viewId, REACT_ON_LOAD_EVENT, mapFromResource(resource));
-        eventEmitter.receiveEvent(viewId, REACT_ON_LOAD_END_EVENT, new WritableNativeMap());
+        Context context = view.getContext();
+        ReactContext reactContext = FastImageViewManager.getReactContext(context);
+        if (reactContext != null) {
+            RCTEventEmitter eventEmitter = reactContext.getJSModule(RCTEventEmitter.class);
+            eventEmitter.receiveEvent(viewId, REACT_ON_LOAD_EVENT, mapFromResource(resource));
+            eventEmitter.receiveEvent(viewId, REACT_ON_LOAD_END_EVENT, new WritableNativeMap());
+        }
         return false;
     }
 }
diff --git a/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageViewManager.java b/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageViewManager.java
index 0944463..2355b98 100644
--- a/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageViewManager.java
+++ b/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageViewManager.java
@@ -10,6 +10,7 @@ import com.bumptech.glide.Glide;
 import com.bumptech.glide.RequestManager;
 import com.bumptech.glide.load.model.GlideUrl;
 import com.bumptech.glide.request.Request;
+import com.facebook.react.bridge.ReactContext;
 import com.facebook.react.bridge.ReadableMap;
 import com.facebook.react.bridge.WritableMap;
 import com.facebook.react.bridge.WritableNativeMap;
@@ -57,6 +58,10 @@ class FastImageViewManager extends SimpleViewManager<FastImageViewWithUrl> imple

     @ReactProp(name = "source")
     public void setSrc(FastImageViewWithUrl view, @Nullable ReadableMap source) {
+        int viewId = view.getId();
+        Context context = view.getContext();
+        ReactContext reactContext = getReactContext(context);
+
         if (source == null || !source.hasKey("uri") || isNullOrEmpty(source.getString("uri"))) {
             // Cancel existing requests.
             clearView(view);
@@ -69,15 +74,15 @@ class FastImageViewManager extends SimpleViewManager<FastImageViewWithUrl> imple
             return;
         }

-        //final GlideUrl glideUrl = FastImageViewConverter.getGlideUrl(view.getContext(), source);
-        final FastImageSource imageSource = FastImageViewConverter.getImageSource(view.getContext(), source);
+        //final GlideUrl glideUrl = FastImageViewConverter.getGlideUrl(context, source);
+        final FastImageSource imageSource = FastImageViewConverter.getImageSource(context, source);
         if (imageSource.getUri().toString().length() == 0) {
-            ThemedReactContext context = (ThemedReactContext) view.getContext();
-            RCTEventEmitter eventEmitter = context.getJSModule(RCTEventEmitter.class);
-            int viewId = view.getId();
-            WritableMap event = new WritableNativeMap();
-            event.putString("message", "Invalid source prop:" + source);
-            eventEmitter.receiveEvent(viewId, REACT_ON_ERROR_EVENT, event);
+            if (reactContext != null) {
+                WritableMap event = new WritableNativeMap();
+                event.putString("message", "Invalid source prop:" + source);
+                RCTEventEmitter eventEmitter = reactContext.getJSModule(RCTEventEmitter.class);
+                eventEmitter.receiveEvent(viewId, REACT_ON_ERROR_EVENT, event);
+            }

             // Cancel existing requests.
             if (requestManager != null) {
@@ -108,10 +113,10 @@ class FastImageViewManager extends SimpleViewManager<FastImageViewWithUrl> imple
             VIEWS_FOR_URLS.put(key, newViewsForKeys);
         }

-        ThemedReactContext context = (ThemedReactContext) view.getContext();
-        RCTEventEmitter eventEmitter = context.getJSModule(RCTEventEmitter.class);
-        int viewId = view.getId();
-        eventEmitter.receiveEvent(viewId, REACT_ON_LOAD_START_EVENT, new WritableNativeMap());
+        if (reactContext != null) {
+            RCTEventEmitter eventEmitter = reactContext.getJSModule(RCTEventEmitter.class);
+            eventEmitter.receiveEvent(viewId, REACT_ON_LOAD_START_EVENT, new WritableNativeMap());
+        }

         if (requestManager != null) {
             requestManager
@@ -176,14 +181,15 @@ class FastImageViewManager extends SimpleViewManager<FastImageViewWithUrl> imple
     public void onProgress(String key, long bytesRead, long expectedLength) {
         List<FastImageViewWithUrl> viewsForKey = VIEWS_FOR_URLS.get(key);
         if (viewsForKey != null) {
+            ReactContext reactContext = null;
             for (FastImageViewWithUrl view : viewsForKey) {
+                reactContext = getReactContext(view.getContext());
+                if (reactContext == null) continue; // cannot extract ReactContext
                 WritableMap event = new WritableNativeMap();
                 event.putInt("loaded", (int) bytesRead);
                 event.putInt("total", (int) expectedLength);
-                ThemedReactContext context = (ThemedReactContext) view.getContext();
-                RCTEventEmitter eventEmitter = context.getJSModule(RCTEventEmitter.class);
-                int viewId = view.getId();
-                eventEmitter.receiveEvent(viewId, REACT_ON_PROGRESS_EVENT, event);
+                RCTEventEmitter eventEmitter = reactContext.getJSModule(RCTEventEmitter.class);
+                eventEmitter.receiveEvent(view.getId(), REACT_ON_PROGRESS_EVENT, event);
             }
         }
     }
@@ -193,12 +199,22 @@ class FastImageViewManager extends SimpleViewManager<FastImageViewWithUrl> imple
         return 0.5f;
     }

-    private boolean isNullOrEmpty(final String url) {
-        return url == null || url.trim().isEmpty();
+    private void clearView(FastImageViewWithUrl view) {
+        if (requestManager != null && view != null && view.getTag() != null && view.getTag() instanceof Request) {
+            requestManager.clear(view);
+        }
     }

+    /* Below this line:
+     * - a group of static utility methods
+     * - could be moved to something like Utils.java in the future
+     */

-    private static boolean isValidContextForGlide(final Context context) {
+    public static boolean isNullOrEmpty(final String url) {
+        return url == null || url.trim().isEmpty();
+    }
+
+    public static boolean isValidContextForGlide(final Context context) {
         Activity activity = getActivityFromContext(context);

         if (activity == null) {
@@ -208,41 +224,31 @@ class FastImageViewManager extends SimpleViewManager<FastImageViewWithUrl> imple
         return !isActivityDestroyed(activity);
     }

-    private static Activity getActivityFromContext(final Context context) {
+    public static Activity getActivityFromContext(Context context) {
         if (context instanceof Activity) {
             return (Activity) context;
         }
-
-        if (context instanceof ThemedReactContext) {
-            final Context baseContext = ((ThemedReactContext) context).getBaseContext();
-            if (baseContext instanceof Activity) {
-                return (Activity) baseContext;
-            }
-
-            if (baseContext instanceof ContextWrapper) {
-                final ContextWrapper contextWrapper = (ContextWrapper) baseContext;
-                final Context wrapperBaseContext = contextWrapper.getBaseContext();
-                if (wrapperBaseContext instanceof Activity) {
-                    return (Activity) wrapperBaseContext;
-                }
-            }
+        if (context instanceof ContextWrapper) {
+            return getActivityFromContext(((ContextWrapper) context).getBaseContext());
         }
+        return null;
+    }

+    public static ReactContext getReactContext(Context context) {
+        if (context instanceof ReactContext) {
+            return (ReactContext) context;
+        }
+        if (context instanceof ContextWrapper) {
+            return getReactContext(((ContextWrapper) context).getBaseContext());
+        }
         return null;
     }

-    private static boolean isActivityDestroyed(Activity activity) {
+    public static boolean isActivityDestroyed(Activity activity) {
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
             return activity.isDestroyed() || activity.isFinishing();
         } else {
             return activity.isDestroyed() || activity.isFinishing() || activity.isChangingConfigurations();
         }
-
-    }
-
-    private void clearView(FastImageViewWithUrl view) {
-        if (requestManager != null && view != null && view.getTag() != null && view.getTag() instanceof Request) {
-            requestManager.clear(view);
-        }
     }
 }
anchalarora commented 2 years ago

I am facing the same issue: I have fixed it by applying a null check in the FastImageSource.java file. This issue is happening because Glide lib doesn't allow null or empty string to be passed to GlideUrl object, So it's crashing.

Please anyone suggest if this approach is fine and a PR can be raised.

Solution: @Override public Uri getUri() { if(mUri != null && !mUri.equals("")) return mUri; return null; }

public Headers getHeaders() {
  if(mHeaders != null)
    return mHeaders;
  return null;
}

public GlideUrl getGlideUrl() {
  if(getUri().toString() != null && !getUri().toString().equals("")) {
    return new GlideUrl(getUri().toString(), getHeaders());
  }else {
    return new GlideUrl(Glide,getHeaders());
  }
}
thanakij commented 2 years ago

Hi @anchalarora, based on what you suggested, I believe yours is for a different issue as the current issue is about ClassCastException while yours is about NullPointerException.

So why not report a new issue and PR. :)

anchalarora commented 2 years ago

Hey Thanakij,

Thanks for your suggestion. I am trying to raise a new PR but facing an issue. While I try to push my code , I get an error that access is denied to me (anchalarora).

I have created Personal access token , and using below command:

git push @.***//.git

Can you please help me with this?

Regards, Anchal

On Wed, Dec 8, 2021 at 10:34 AM Thanakij Pechprasarn < @.***> wrote:

Hi @anchalarora https://github.com/anchalarora, based on what you suggested, I believe yours is for a different issue as the current issue is about ClassCastException while yours is about NullPointerException.

So why not report a new issue and PR. :)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/DylanVann/react-native-fast-image/issues/840#issuecomment-988501718, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB2JTASF6BTRDO4QWNTNKY3UP3RMJANCNFSM5GDJJ4AA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

--

Thanks and Regards, Anchal Arora

fdobre commented 2 years ago

I am facing the same issue: I have fixed it by applying a null check in the FastImageSource.java file. This issue is happening because Glide lib doesn't allow null or empty string to be passed to GlideUrl object, So it's crashing.

Please anyone suggest if this approach is fine and a PR can be raised.

Solution: @OverRide public Uri getUri() { if(mUri != null && !mUri.equals("")) return mUri; return null; }

public Headers getHeaders() {
  if(mHeaders != null)
    return mHeaders;
  return null;
}

public GlideUrl getGlideUrl() {
  if(getUri().toString() != null && !getUri().toString().equals("")) {
    return new GlideUrl(getUri().toString(), getHeaders());
  }else {
    return new GlideUrl(Glide,getHeaders());
  }
}

Any update on this? I am having a similar issue


Fatal Exception: com.facebook.react.bridge.JSApplicationIllegalArgumentException
Error while updating property 'source' of a view managed by: FastImageView
com.facebook.react.uimanager.ViewManagersPropertyCache$PropSetter.updateViewProp (ViewManagersPropertyCache.java:102)
com.facebook.react.uimanager.ViewManagerPropertyUpdater$FallbackViewManagerSetter.setProperty (ViewManagerPropertyUpdater.java:136)
com.facebook.react.uimanager.ViewManagerPropertyUpdater.updateProps (ViewManagerPropertyUpdater.java:56)
com.facebook.react.uimanager.ViewManager.updateProperties (ViewManager.java:49)
com.facebook.react.uimanager.NativeViewHierarchyManager.createView (NativeViewHierarchyManager.java:290)
com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute (UIViewOperationQueue.java:188)
com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.dispatchPendingNonBatchedOperations (UIViewOperationQueue.java:1103)
com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded (UIViewOperationQueue.java:1074)
com.facebook.react.uimanager.GuardedFrameCallback.doFrame (GuardedFrameCallback.java:29)
com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame (ReactChoreographer.java:175)
com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame (ChoreographerCompat.java:85)
android.view.Choreographer$CallbackRecord.run (Choreographer.java:1008)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1130)
Caused by java.lang.reflect.InvocationTargetException
java.lang.reflect.Method.invoke (Method.java)
com.facebook.react.uimanager.ViewManagersPropertyCache$PropSetter.updateViewProp (ViewManagersPropertyCache.java:87)
com.facebook.react.uimanager.ViewManagerPropertyUpdater$FallbackViewManagerSetter.setProperty (ViewManagerPropertyUpdater.java:136)
com.facebook.react.uimanager.ViewManagerPropertyUpdater.updateProps (ViewManagerPropertyUpdater.java:56)
com.facebook.react.uimanager.ViewManager.updateProperties (ViewManager.java:49)
com.facebook.react.uimanager.NativeViewHierarchyManager.createView (NativeViewHierarchyManager.java:290)
com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute (UIViewOperationQueue.java:188)
com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.dispatchPendingNonBatchedOperations (UIViewOperationQueue.java:1103)
com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded (UIViewOperationQueue.java:1074)
com.facebook.react.uimanager.GuardedFrameCallback.doFrame (GuardedFrameCallback.java:29)
com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame (ReactChoreographer.java:175)
com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame (ChoreographerCompat.java:85)
android.view.Choreographer$CallbackRecord.run (Choreographer.java:1008)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1130)
Caused by java.lang.IllegalArgumentException
Must not be null or empty
com.bumptech.glide.util.Preconditions.checkNotEmpty (Preconditions.java:37)
com.bumptech.glide.load.model.GlideUrl.<init> (GlideUrl.java:56)
com.dylanvann.fastimage.FastImageSource.getGlideUrl (FastImageSource.java:110)
com.dylanvann.fastimage.FastImageViewManager.setSrc (FastImageViewManager.java:75)
java.lang.reflect.Method.invoke (Method.java)
com.facebook.react.uimanager.ViewManagersPropertyCache$PropSetter.updateViewProp (ViewManagersPropertyCache.java:87)
com.facebook.react.uimanager.ViewManagerPropertyUpdater$FallbackViewManagerSetter.setProperty (ViewManagerPropertyUpdater.java:136)
com.facebook.react.uimanager.ViewManagerPropertyUpdater.updateProps (ViewManagerPropertyUpdater.java:56)
com.facebook.react.uimanager.ViewManager.updateProperties (ViewManager.java:49)
com.facebook.react.uimanager.NativeViewHierarchyManager.createView (NativeViewHierarchyManager.java:290)
com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute (UIViewOperationQueue.java:188)
com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.dispatchPendingNonBatchedOperations (UIViewOperationQueue.java:1103)
com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded (UIViewOperationQueue.java:1074)
com.facebook.react.uimanager.GuardedFrameCallback.doFrame (GuardedFrameCallback.java:29)
com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame (ReactChoreographer.java:175)
com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame (ChoreographerCompat.java:85)
android.view.Choreographer$CallbackRecord.run (Choreographer.java:1008)```

Is this issue reported anywhere so I can upvote it? @anchalarora @thanakij 
@DylanVann is the fix suggested by anchalarora OK for a PR to be created with it?
fdobre commented 2 years ago

Hey Thanakij, Thanks for your suggestion. I am trying to raise a new PR but facing an issue. While I try to push my code , I get an error that access is denied to me (anchalarora). I have created Personal access token , and using below command: git push @.//.git Can you please help me with this? Regards, Anchal … On Wed, Dec 8, 2021 at 10:34 AM Thanakij Pechprasarn < @.> wrote: Hi @anchalarora https://github.com/anchalarora, based on what you suggested, I believe yours is for a different issue as the current issue is about ClassCastException while yours is about NullPointerException. So why not report a new issue and PR. :) — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#840 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB2JTASF6BTRDO4QWNTNKY3UP3RMJANCNFSM5GDJJ4AA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. -- Thanks and Regards, Anchal Arora

Please let me know if I can help you with the PR. You can try to fork it and then make a PR.

If that still doesn't work please let me know if you provide me what need to be changed and in what file I will create the PR.

I have a few hundred of crashes caused by the empty url.

anchalarora commented 2 years ago

@fdobre : Hey , I have raised the PR for this issue by forking the repo 29 days back. https://github.com/DylanVann/react-native-fast-image/pull/851/commits/1cfae0c695e1a3e974ea24986083447877b8f41b It's still pending to be merged.

fdobre commented 2 years ago

@fdobre : Hey , I have raised the PR for this issue by forking the repo 29 days back. 1cfae0c It's still pending to be merged.

Thank you! I noticed the PR:

https://github.com/DylanVann/react-native-fast-image/pull/851

thanakij commented 2 years ago

Hi @anchalarora and @fdobre, this issue is for ClassCastExpception and PR for this issue is already created #843.

So would you mind discuss NullPointerException in a separate PR so we can really discuss only on things related to this particular issue ClassCastException?