Interstistial ad always load on mounted even loadOnMounted = false ??
zoobibackups opened this issue · comments
zoobibackups commented
I try to load interstitial ad on onPress evets but ads are always loaded on mounted. Check my code below
import { useInterstitialAd, TestIds } from '@react-native-admob/admob';
const App = () => {
const { adLoaded, load} = useInterstitialAd(TestIds.INTERSTITIAL, {
requestOptions: {
loadOnMounted: false, // i am not loading ad on mounting
loadOnDismissed: false
},
});
useEffect(() => {
if (adLoaded) {
console.log("Loaded") /// i never call the load function but still the add is loaded why?????
}
},[adLoaded])
/* rest of the code*/
}
How to resolve this now????
Thanks.
Jay Kim commented
Your option object is wrong. It should be:
{
loadOnMounted: false,
loadOnDismissed: false,
requestOptions:{
//...
},
}
They should be declared outside of the requestOptions
object.
zoobibackups commented
Your option object is wrong. It should be:
{ loadOnMounted: false, loadOnDismissed: false, requestOptions:{ //... }, }They should be declared outside of the
requestOptions
object.
My bad, thank you its working now.