Light popup ads use the Hook API. useLightPopupAd manages loading state and customization options together inside your component.
The previous static API (LightPopupAd.loadAd and friends) is deprecated. Static listeners such as LightPopupAd.addAdLoadedEventListener do not receive events for ads loaded through the Hook or instance API — when you move ad loading to the new API, move the event listeners with it.
useLightPopupAd releases the previous ad when the component unmounts or the Ad Unit changes. Do not change the component’s key or call load() again solely because the screen size or orientation changes. Keeping the same component lets the native SDK adjust the existing ad’s layout. Supported orientations follow your app’s settings.If you manage an instance created with LightPopupAd.createForAdRequest() directly, call destroy() when you finish using it. removeAllListeners() only removes event subscriptions. Create a new instance instead of reusing one after destroy().
import { useEffect } from "react";import { LightPopupAd } from "react-native-daro";useEffect(() => { const ad = LightPopupAd.createForAdRequest(adUnitId); ad.load(); return () => ad.destroy();}, [adUnitId]);
Assistant
Responses are generated using AI and may contain mistakes.