Skip to content

Commit

Permalink
fix: view util bug (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
deepanshushuklad11 committed Sep 23, 2024
1 parent 9d413ee commit 4561e6f
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<FastImageLoadEndEvent> {

public FastImageLoadEndEvent(int surfaceId, int viewTag) {
Expand All @@ -16,4 +17,8 @@ public String getEventName() {
return "onFastImageLoadEnd";
}

@Override
protected WritableMap getEventData() {
return Arguments.createMap();
}
}
Original file line number Diff line number Diff line change
@@ -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<FastImageLoadEvent> {
Expand All @@ -16,4 +17,8 @@ public String getEventName() {
return "onFastImageLoad";
}

@Override
protected WritableMap getEventData() {
return Arguments.createMap();
}
}
Original file line number Diff line number Diff line change
@@ -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<FastImageLoadStartEvent> {
Expand All @@ -16,4 +17,8 @@ public String getEventName() {
return "onFastImageLoadStart";
}

@Override
protected WritableMap getEventData() {
return Arguments.createMap();
}
}
3 changes: 2 additions & 1 deletion android/src/newarch/java/com/FastImageViewManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion android/src/oldarch/java/com/FastImageViewManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 4561e6f

Please sign in to comment.