[🐛] Bug Report Title - Ads cannot be reloaded
Issue
There might be several reasons why an interstitial ad doesn't load properly (e.g. ad network error, frequency capping, etc...). When this happens, show won't work since the ad wasn't loaded, but unfortunately load won't work either because this line is preventing subsequent calls to load: https://github.com/invertase/react-native-google-mobile-ads/blob/8026f65686b0562f974a6d48b3f8d22571c7182f/src/ads/MobileAd.ts#L176
This makes the ad instance useless unless the property ad._isLoadCalled is manually set to false. This is especially bad for hooks, where only the show, load handlers are available and there is no way to recreate the ad instance unless you use a different adUnitId or requestOptions: https://github.com/invertase/react-native-google-mobile-ads/blob/8026f65686b0562f974a6d48b3f8d22571c7182f/src/hooks/useInterstitialAd.ts#L39-L43
IMO multiple calls to load should be allowed even if this._isLoadCalled is true
Note: This issue was already reported in https://github.com/invertase/react-native-google-mobile-ads/issues/126 but was closed without a solution
Project Files
Javascript
Click To Expand
package.json:
{
"name": "sample_app",
"private": true,
"scripts": {
"start": "expo start --dev-client",
"android": "expo run:android",
"ios": "expo run:ios",
"eject": "expo eject"
},
"dependencies": {
"@react-native-async-storage/async-storage": "~1.17.3",
"expo": "^45.0.0",
"expo-application": "~4.1.0",
"expo-constants": "~13.1.1",
"expo-font": "~10.1.0",
"expo-haptics": "~11.2.0",
"expo-keep-awake": "~10.1.1",
"expo-linear-gradient": "~11.3.0",
"expo-linking": "~3.1.0",
"expo-navigation-bar": "~1.2.0",
"expo-splash-screen": "~0.15.1",
"expo-status-bar": "~1.3.0",
"expo-store-review": "~5.2.0",
"expo-system-ui": "~1.2.0",
"expo-tracking-transparency": "~2.2.0",
"prop-types": "^15.7.2",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-native": "0.68.2",
"react-native-google-mobile-ads": "^7.0.1",
"react-native-web": "0.17.7"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@babel/runtime": "^7.4.2",
"babel-preset-expo": "~9.1.0",
"babel-runtime": "^6.26.0",
"expo-dev-client": "~1.0.0"
},
"rnpm": {
"assets": [
"./assets/fonts"
]
},
"version": "1.0.0"
}
admob.json:
# N/A
iOS
Click To Expand
ios/Podfile:
# N/A
Android
Click To Expand
android/build.gradle:
// N/A
android/app/build.gradle:
// N/A
android/settings.gradle:
// N/A
AndroidManifest.xml:
<!-- N/A -->
Environment
Click To Expand
react-native info output:
OUTPUT GOES HERE
- Platform that you're experiencing the issue on:
- [ ] iOS
- [ ] Android
- [ ] iOS but have not tested behavior on Android
- [ ] Android but have not tested behavior on iOS
- [x] Both
- Are you using
TypeScript?No
- 👉 Check out
Invertaseon Twitter for updates on the library.