Skip to content
This repository has been archived by the owner on Apr 27, 2022. It is now read-only.

Interstistial ad always load on mounted even loadOnMounted = false ?? #71

Closed
zoobibackups opened this issue Nov 25, 2021 · 2 comments
Closed

Comments

@zoobibackups
Copy link

zoobibackups commented Nov 25, 2021

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.

@zoobibackups zoobibackups changed the title Interstistia ad load on mounted even loadOnMounted = false; ???? Interstistial ad always load on mounted even loadOnMounted = false ?? Nov 25, 2021
@wjaykim
Copy link
Collaborator

wjaykim commented Nov 25, 2021

Your option object is wrong. It should be:

{
  loadOnMounted: false,
  loadOnDismissed: false,
  requestOptions:{
    //...
  },
}

They should be declared outside of the requestOptions object.

@zoobibackups
Copy link
Author

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants