react-native-admob / admob

Admob for React Native with powerful hooks and components

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multiple InterstitialAds in one component?

quan2nd opened this issue · comments

I have multiple Interstitial IDs, is there a way I can use multiple InterstitialAds in one component?
Thank you.

Hi, sorry for late comment.

You can just use multiple hooks if you are using hook, or make multiple instances if you are using ad instances.

Example:

const { adLoaded: adALoaded } = useInterstitialAd(UNIT_ID_A);
const { adLoaded: adBLoaded } = useInterstitialAd(UNIT_ID_B);
const adA = InterstitialAd.createAd(UNIT_ID_A);
const adB = InterstitialAd.createAd(UNIT_ID_B);

adA.load();
adA.show();

adB.load();
...