merge from master
This commit is contained in:
commit
a0e1f744ba
|
@ -1,39 +1,28 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { ViewPropTypes, requireNativeComponent } from 'react-native';
|
import { ViewPropTypes, requireNativeComponent } from 'react-native';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { statics } from './';
|
import EventTypes, { NativeExpressEventTypes } from './EventTypes';
|
||||||
import { nativeToJSError } from '../../utils';
|
import { nativeToJSError } from '../../utils';
|
||||||
|
|
||||||
import AdRequest from './AdRequest';
|
import AdRequest from './AdRequest';
|
||||||
import VideoOptions from './VideoOptions';
|
import VideoOptions from './VideoOptions';
|
||||||
|
|
||||||
class AdMobComponent extends React.Component {
|
const adMobPropTypes = {
|
||||||
|
|
||||||
static propTypes = {
|
|
||||||
...ViewPropTypes,
|
...ViewPropTypes,
|
||||||
|
|
||||||
// TODO ehesp: cant init this outside of the component; statics isn't defined
|
|
||||||
...(() => {
|
|
||||||
const eventProps = {};
|
|
||||||
Object.keys(statics.EventTypes).forEach((key) => {
|
|
||||||
eventProps[key] = PropTypes.func;
|
|
||||||
});
|
|
||||||
return eventProps;
|
|
||||||
}),
|
|
||||||
|
|
||||||
...(() => {
|
|
||||||
const eventProps = {};
|
|
||||||
Object.keys(statics.NativeExpressEventTypes).forEach((key) => {
|
|
||||||
eventProps[key] = PropTypes.func;
|
|
||||||
});
|
|
||||||
return eventProps;
|
|
||||||
}),
|
|
||||||
|
|
||||||
size: PropTypes.string.isRequired,
|
size: PropTypes.string.isRequired,
|
||||||
unitId: PropTypes.string.isRequired,
|
unitId: PropTypes.string.isRequired,
|
||||||
request: PropTypes.object,
|
request: PropTypes.object,
|
||||||
video: PropTypes.object,
|
video: PropTypes.object,
|
||||||
};
|
}
|
||||||
|
Object.keys(EventTypes).forEach(eventType => {
|
||||||
|
adMobPropTypes[eventType] = PropTypes.func;
|
||||||
|
});
|
||||||
|
Object.keys(NativeExpressEventTypes).forEach(eventType => {
|
||||||
|
adMobPropTypes[eventType] = PropTypes.func;
|
||||||
|
});
|
||||||
|
|
||||||
|
class AdMobComponent extends React.Component {
|
||||||
|
static propTypes = adMobPropTypes;
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
request: new AdRequest().addTestDevice().build(),
|
request: new AdRequest().addTestDevice().build(),
|
||||||
|
@ -94,7 +83,6 @@ class AdMobComponent extends React.Component {
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default AdMobComponent;
|
export default AdMobComponent;
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
|
||||||
|
export default {
|
||||||
|
onAdLoaded: 'onAdLoaded',
|
||||||
|
onAdOpened: 'onAdOpened',
|
||||||
|
onAdLeftApplication: 'onAdLeftApplication',
|
||||||
|
onAdClosed: 'onAdClosed',
|
||||||
|
onAdFailedToLoad: 'onAdFailedToLoad',
|
||||||
|
};
|
||||||
|
|
||||||
|
export const NativeExpressEventTypes = {
|
||||||
|
onVideoEnd: 'onVideoEnd',
|
||||||
|
onVideoMute: 'onVideoMute',
|
||||||
|
onVideoPause: 'onVideoPause',
|
||||||
|
onVideoPlay: 'onVideoPlay',
|
||||||
|
onVideoStart: 'onVideoStart',
|
||||||
|
};
|
||||||
|
|
||||||
|
export const RewardedVideoEventTypes = {
|
||||||
|
onRewarded: 'onRewarded',
|
||||||
|
onRewardedVideoStarted: 'onRewardedVideoStarted',
|
||||||
|
};
|
|
@ -7,6 +7,10 @@ import VideoOptions from './VideoOptions';
|
||||||
import Banner from './Banner';
|
import Banner from './Banner';
|
||||||
import NativeExpress from './NativeExpress';
|
import NativeExpress from './NativeExpress';
|
||||||
|
|
||||||
|
import EventTypes, {
|
||||||
|
NativeExpressEventTypes,
|
||||||
|
RewardedVideoEventTypes,
|
||||||
|
} from './EventTypes';
|
||||||
|
|
||||||
export default class AdMob extends ModuleBase {
|
export default class AdMob extends ModuleBase {
|
||||||
static _NAMESPACE = 'admob';
|
static _NAMESPACE = 'admob';
|
||||||
|
@ -81,22 +85,7 @@ export const statics = {
|
||||||
NativeExpress,
|
NativeExpress,
|
||||||
AdRequest,
|
AdRequest,
|
||||||
VideoOptions,
|
VideoOptions,
|
||||||
EventTypes: {
|
EventTypes,
|
||||||
onAdLoaded: 'onAdLoaded',
|
RewardedVideoEventTypes,
|
||||||
onAdOpened: 'onAdOpened',
|
NativeExpressEventTypes,
|
||||||
onAdLeftApplication: 'onAdLeftApplication',
|
|
||||||
onAdClosed: 'onAdClosed',
|
|
||||||
onAdFailedToLoad: 'onAdFailedToLoad',
|
|
||||||
},
|
|
||||||
RewardedVideoEventTypes: {
|
|
||||||
onRewarded: 'onRewarded',
|
|
||||||
onRewardedVideoStarted: 'onRewardedVideoStarted',
|
|
||||||
},
|
|
||||||
NativeExpressEventTypes: {
|
|
||||||
onVideoEnd: 'onVideoEnd',
|
|
||||||
onVideoMute: 'onVideoMute',
|
|
||||||
onVideoPause: 'onVideoPause',
|
|
||||||
onVideoPlay: 'onVideoPlay',
|
|
||||||
onVideoStart: 'onVideoStart',
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "react-native-firebase",
|
"name": "react-native-firebase",
|
||||||
"version": "2.1.2",
|
"version": "2.1.3",
|
||||||
"author": "Invertase <contact@invertase.io> (http://invertase.io)",
|
"author": "Invertase <contact@invertase.io> (http://invertase.io)",
|
||||||
"description": "A well tested, feature rich Firebase implementation for React Native, supporting iOS & Android. Individual module support for Auth, Database, Messaging (FCM), Remote Config, Storage, Admob, Analytics, Crash Reporting, and Performance.",
|
"description": "A well tested, feature rich Firebase implementation for React Native, supporting iOS & Android. Individual module support for Auth, Database, Messaging (FCM), Remote Config, Storage, Admob, Analytics, Crash Reporting, and Performance.",
|
||||||
"main": "index",
|
"main": "index",
|
||||||
|
|
Loading…
Reference in New Issue