I'm trying to use Admob Rewarded Video in my React Native app.
Here is the code I am testing:
const advert = firebase.admob().rewarded('ca-app-pub-3940256099942544/5224354917');
const AdRequest = firebase.admob.AdRequest;
const request = new AdRequest();
// Load the advert with our AdRequest
advert.loadAd(request.build());
advert.on('onAdLoaded', () => {
console.log('Advert ready to show.');
});
advert.on('onRewarded', (event) => {
console.log('The user watched the entire video and will now be rewarded!', event);
});
if (advert.isLoaded()) {
advert.show();
}
else {
advert.on('onAdLoaded', () => {
console.log('Advert ready to show.');
advert.show();
});
}
This is perfectly working when I execute it from the main screen of the app (root of the navigator), but not anymore after I move to an other screen by calling this.props.navigation.navigate('ScreenB');
:
The ad is showing normally but I cannot skip, open or close it... The app gets stuck in this state.
I am currently testing on iOS simulator and I use the following config:
"react": "16.6.0-alpha.8af6728", "react-native": "^0.57.2", "react-native-firebase": "^5.1.0"
Am I missing something or is it a bug?