`Ad already loaded` error in React-native EXPO CLI

Viewed 139

When i Click on Button, Admob ad display, but when i click again they show me Error Ad is already Loaded and then ad not display.

import * as React from 'react';
import { ScrollView, View,Button } from 'react-native'
import {AdMobInterstitial} from 'expo-ads-admob';
export default function Publications() {
    const showad = async () => {
        try {
         // Display an interstitial
await AdMobInterstitial.setAdUnitID('ca-app-pub-3940256099942544/1033173712'); // Test ID, Replace with your-admob-unit-id
await AdMobInterstitial.requestAdAsync({ servePersonalizedAds: true});
await AdMobInterstitial.showAdAsync();
 } catch (error) {
        console.error(error);
       } 
     }   
      return (        
         <Button       
         title="Press me"
         onPress={showad}/>
       )   
}
0 Answers
Related