From 4561e6f0bb3788017e6809d56d769d9875be5402 Mon Sep 17 00:00:00 2001 From: deepanshushuklad11 <111736628+deepanshushuklad11@users.noreply.github.com> Date: Fri, 20 Sep 2024 19:12:41 +0530 Subject: [PATCH] fix: view util bug (#79) --- .../dylanvann/fastimage/events/FastImageLoadEndEvent.java | 7 ++++++- .../com/dylanvann/fastimage/events/FastImageLoadEvent.java | 7 ++++++- .../fastimage/events/FastImageLoadStartEvent.java | 7 ++++++- android/src/newarch/java/com/FastImageViewManager.java | 3 ++- android/src/oldarch/java/com/FastImageViewManager.java | 3 ++- 5 files changed, 22 insertions(+), 5 deletions(-) diff --git a/android/src/main/java/com/dylanvann/fastimage/events/FastImageLoadEndEvent.java b/android/src/main/java/com/dylanvann/fastimage/events/FastImageLoadEndEvent.java index 226aff0d..162ca710 100644 --- a/android/src/main/java/com/dylanvann/fastimage/events/FastImageLoadEndEvent.java +++ b/android/src/main/java/com/dylanvann/fastimage/events/FastImageLoadEndEvent.java @@ -3,7 +3,8 @@ import androidx.annotation.NonNull; import com.facebook.react.uimanager.events.Event; - +import com.facebook.react.bridge.Arguments; +import com.facebook.react.bridge.WritableMap; public class FastImageLoadEndEvent extends Event { public FastImageLoadEndEvent(int surfaceId, int viewTag) { @@ -16,4 +17,8 @@ public String getEventName() { return "onFastImageLoadEnd"; } + @Override + protected WritableMap getEventData() { + return Arguments.createMap(); + } } diff --git a/android/src/main/java/com/dylanvann/fastimage/events/FastImageLoadEvent.java b/android/src/main/java/com/dylanvann/fastimage/events/FastImageLoadEvent.java index 282d931f..f0bc63f8 100644 --- a/android/src/main/java/com/dylanvann/fastimage/events/FastImageLoadEvent.java +++ b/android/src/main/java/com/dylanvann/fastimage/events/FastImageLoadEvent.java @@ -1,7 +1,8 @@ package com.dylanvann.fastimage.events; import androidx.annotation.NonNull; - +import com.facebook.react.bridge.Arguments; +import com.facebook.react.bridge.WritableMap; import com.facebook.react.uimanager.events.Event; public class FastImageLoadEvent extends Event { @@ -16,4 +17,8 @@ public String getEventName() { return "onFastImageLoad"; } + @Override + protected WritableMap getEventData() { + return Arguments.createMap(); + } } diff --git a/android/src/main/java/com/dylanvann/fastimage/events/FastImageLoadStartEvent.java b/android/src/main/java/com/dylanvann/fastimage/events/FastImageLoadStartEvent.java index e3f4d828..07abb553 100644 --- a/android/src/main/java/com/dylanvann/fastimage/events/FastImageLoadStartEvent.java +++ b/android/src/main/java/com/dylanvann/fastimage/events/FastImageLoadStartEvent.java @@ -1,7 +1,8 @@ package com.dylanvann.fastimage.events; import androidx.annotation.NonNull; - +import com.facebook.react.bridge.Arguments; +import com.facebook.react.bridge.WritableMap; import com.facebook.react.uimanager.events.Event; public class FastImageLoadStartEvent extends Event { @@ -16,4 +17,8 @@ public String getEventName() { return "onFastImageLoadStart"; } + @Override + protected WritableMap getEventData() { + return Arguments.createMap(); + } } diff --git a/android/src/newarch/java/com/FastImageViewManager.java b/android/src/newarch/java/com/FastImageViewManager.java index 3656e429..bcec57c2 100644 --- a/android/src/newarch/java/com/FastImageViewManager.java +++ b/android/src/newarch/java/com/FastImageViewManager.java @@ -136,8 +136,9 @@ public void onProgress(String key, long bytesRead, long expectedLength) { for (FastImageViewWithUrl view : viewsForKey) { ThemedReactContext context = (ThemedReactContext) view.getContext(); EventDispatcher dispatcher = UIManagerHelper.getEventDispatcherForReactTag(context, view.getId()); + int surfaceId = UIManagerHelper.getSurfaceId(context); FastImageProgressEvent event = new FastImageProgressEvent( - ViewUtil.NO_SURFACE_ID, + surfaceId, view.getId(), (int) bytesRead, (int) expectedLength); diff --git a/android/src/oldarch/java/com/FastImageViewManager.java b/android/src/oldarch/java/com/FastImageViewManager.java index 5ffe2a3f..b5926d16 100644 --- a/android/src/oldarch/java/com/FastImageViewManager.java +++ b/android/src/oldarch/java/com/FastImageViewManager.java @@ -122,8 +122,9 @@ public void onProgress(String key, long bytesRead, long expectedLength) { for (FastImageViewWithUrl view : viewsForKey) { ThemedReactContext context = (ThemedReactContext) view.getContext(); EventDispatcher dispatcher = UIManagerHelper.getEventDispatcherForReactTag(context, view.getId()); + int surfaceId = UIManagerHelper.getSurfaceId(context); FastImageProgressEvent event = new FastImageProgressEvent( - ViewUtil.NO_SURFACE_ID, + surfaceId, view.getId(), (int) bytesRead, (int) expectedLength);