diff --git a/android/src/main/java/com/klarna/mobile/sdk/reactnative/checkout/KlarnaCheckoutViewEventSender.java b/android/src/main/java/com/klarna/mobile/sdk/reactnative/checkout/KlarnaCheckoutViewEventSender.java index 81743ebb..929f5105 100644 --- a/android/src/main/java/com/klarna/mobile/sdk/reactnative/checkout/KlarnaCheckoutViewEventSender.java +++ b/android/src/main/java/com/klarna/mobile/sdk/reactnative/checkout/KlarnaCheckoutViewEventSender.java @@ -45,13 +45,12 @@ public void sendKlarnaMobileSDKError(@Nullable KlarnaCheckoutView view, @NonNull KlarnaEventHandlerEventsUtil.sendKlarnaMobileSDKError(this, view, klarnaMobileSDKError); } - public void sendOnResizedEvent(@Nullable EventDispatcher eventDispatcher, int viewId, int height) { + public void sendOnResizedEvent(@Nullable KlarnaCheckoutView view, int height) { WritableMap params = ArgumentsUtil.createMap( new HashMap() {{ put("height", String.valueOf(height)); }} ); - ComponentEvent event = new ComponentEvent(viewId, EVENT_NAME_ON_RESIZED, params); - postEvent(eventDispatcher, event); + postEventForView(view, EVENT_NAME_ON_RESIZED, params); } } diff --git a/android/src/main/java/com/klarna/mobile/sdk/reactnative/checkout/KlarnaCheckoutViewManager.java b/android/src/main/java/com/klarna/mobile/sdk/reactnative/checkout/KlarnaCheckoutViewManager.java index 99fe98c6..ca2a5102 100644 --- a/android/src/main/java/com/klarna/mobile/sdk/reactnative/checkout/KlarnaCheckoutViewManager.java +++ b/android/src/main/java/com/klarna/mobile/sdk/reactnative/checkout/KlarnaCheckoutViewManager.java @@ -74,7 +74,7 @@ protected ResizeObserverWrapperView createViewInstance(@NonN if (eventDispatcher == null) { return; } - eventSender.sendOnResizedEvent(eventDispatcher, resizeObserverWrapperView.getId(), newHeight); + eventSender.sendOnResizedEvent(resizeObserverWrapperView.getView(), newHeight); }); view.addInterfaceToWebView(); diff --git a/android/src/main/java/com/klarna/mobile/sdk/reactnative/common/event/ComponentEventSender.java b/android/src/main/java/com/klarna/mobile/sdk/reactnative/common/event/ComponentEventSender.java index 8cf57dc8..3fa3869d 100644 --- a/android/src/main/java/com/klarna/mobile/sdk/reactnative/common/event/ComponentEventSender.java +++ b/android/src/main/java/com/klarna/mobile/sdk/reactnative/common/event/ComponentEventSender.java @@ -31,10 +31,10 @@ protected void postEvent(@Nullable EventDispatcher eventDispatcher, @NonNull Com protected ComponentEvent createEvent(@Nullable View view, @NonNull String eventName, @Nullable WritableMap params) { T viewReference = getView(view); - if (view == null) { + if (viewReference == null) { return null; } - return new ComponentEvent(view.getId(), eventName, params); + return new ComponentEvent(viewReference.getId(), eventName, params); } protected void postEventForView(@Nullable View view, @NonNull String eventName, @Nullable WritableMap params) {