Anthonyzou / react-native-image-zoom

Image pan and zoom for Android
https://www.npmjs.com/package/react-native-image-zoom
MIT License
115 stars 52 forks source link

Example crash #6

Closed rokugou closed 8 years ago

rokugou commented 8 years ago

Base64 image problem.

ATAL EXCEPTION: main
Process: com.example, PID: 9898
java.lang.ClassCastException: byte[] cannot be cast to java.lang.String
    at com.image.zoom.ViewManager$1.onResourceReady(ViewManager.java:60)
    at com.bumptech.glide.request.GenericRequest.onResourceReady(GenericRequest.java:522)
    at com.bumptech.glide.request.GenericRequest.onResourceReady(GenericRequest.java:507)
    at com.bumptech.glide.load.engine.EngineJob.handleResultOnMainThread(EngineJob.java:158)
    at com.bumptech.glide.load.engine.EngineJob.access$100(EngineJob.java:22)
    at com.bumptech.glide.load.engine.EngineJob$MainThreadCallback.handleMessage(EngineJob.java:202)
    at android.os.Handler.dispatchMessage(Handler.java:98)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5422)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

if i remove the listener for Glide, it works.

        //handle base64
        if (source.startsWith("data:image/png;base64,")){
            Glide
                    .with(view.getContext())
                    .load(Base64.decode(source.replaceAll("data:image\\/.*;base64,", ""), Base64.DEFAULT))
                    .into(view)
            ;
            return;
        }
Anthonyzou commented 8 years ago

I took out the listeners 5a21e3a82c20de47e2060cbaf8c8ca3c1db32ba1