Skip to content

Commit

Permalink
android code
Browse files Browse the repository at this point in the history
  • Loading branch information
dylancom committed Dec 27, 2023
1 parent cef8f9e commit e93695f
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,20 @@ public void onAfterUpdateTransaction(@NonNull ReactNativeAdView reactViewGroup)
reactViewGroup.setPropsChanged(false);
}

@Override
public void onDropViewInstance(@NonNull ReactNativeAdView reactViewGroup) {
BaseAdView adView = getAdView(reactViewGroup);
if (adView != null) {
adView.setAdListener(null);
if (adView instanceof AdManagerAdView) {
((AdManagerAdView) adView).setAppEventListener(null);
}
adView.destroy();
reactViewGroup.removeView(adView);
}
super.onDropViewInstance(reactViewGroup);
}

private BaseAdView initAdView(ReactNativeAdView reactViewGroup) {
BaseAdView oldAdView = getAdView(reactViewGroup);
if (oldAdView != null) {
Expand Down

0 comments on commit e93695f

Please sign in to comment.