[admob] Provide a default request for Interstitials & Rewarded Videos

This commit is contained in:
Elliot Hesp 2017-06-07 12:36:04 +01:00
parent f92e1b7afd
commit ac2091d890
2 changed files with 9 additions and 3 deletions

View File

@ -87,7 +87,6 @@ class AdMobComponent extends React.Component {
* @returns {XML} * @returns {XML}
*/ */
render() { render() {
console.log(this.props)
return ( return (
<this.nativeView <this.nativeView
{...this.props} {...this.props}

View File

@ -1,5 +1,6 @@
import { NativeModules } from 'react-native'; import { NativeModules } from 'react-native';
import { statics } from './'; import { statics } from './';
import AdRequest from './AdRequest';
import { nativeToJSError } from '../../utils'; import { nativeToJSError } from '../../utils';
const FirebaseAdMob = NativeModules.RNFirebaseAdmob; const FirebaseAdMob = NativeModules.RNFirebaseAdmob;
@ -43,8 +44,14 @@ export default class RewardedVideo {
* @param request * @param request
* @returns {*} * @returns {*}
*/ */
loadAd(request: AdRequest) { loadAd(request?: AdRequest) {
return FirebaseAdMob.rewardedVideoLoadAd(this.adUnit, request); let adRequest = request;
if (!adRequest || !Object.keys(adRequest)) {
adRequest = new AdRequest().addTestDevice().build();
}
return FirebaseAdMob.rewardedVideoLoadAd(this.adUnit, adRequest);
} }
/** /**