sbugert / react-native-admob

A react-native component for Google AdMob banners
BSD 2-Clause "Simplified" License
1.13k stars 532 forks source link

abmob instrstail ad close #555

Closed zoobibackups closed 3 years ago

zoobibackups commented 3 years ago

I have a simple function where I want to show an add-on the button click but there is a problem if the user clicks the button for the first time then this event is called one. if the user clicks the button a second time then it is called 2 times and the third time the there time and so on. Here is my code.

 const searchnumber = () =>{
        AdMobInterstitial.showAd().catch(error => {
// i want to navigate to another secrren but for firt time it navigate one if clcik the button second time then it navigates two time
          console.log('Show ad Error ad')
        });
            AdMobInterstitial.addEventListener('adClosed', () => {  
              console.log('ad closed')
             AdMobInterstitial.requestAd().catch(error => {});
        });
}