Merge commit '54c92d0640e8765e4ab3d624dc1577bcc4ed7bfa'

This commit is contained in:
Chris Bianca 2017-10-23 09:21:10 +01:00
commit 31e78c8709
1 changed files with 20 additions and 11 deletions

View File

@ -13,13 +13,26 @@ const adMobPropTypes = {
unitId: PropTypes.string.isRequired,
request: PropTypes.object,
video: PropTypes.object,
};
Object.keys(EventTypes).forEach((eventType) => {
adMobPropTypes[eventType] = PropTypes.func;
});
Object.keys(NativeExpressEventTypes).forEach((eventType) => {
adMobPropTypes[eventType] = PropTypes.func;
});
const nativeComponents = {};
function getNativeComponent(name) {
if (nativeComponents[name]) return nativeComponents[name];
const component = requireNativeComponent(name, AdMobComponent, {
nativeOnly: {
onBannerEvent: true,
},
});
nativeComponents[name] = component;
return component;
}
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;
@ -36,11 +49,7 @@ class AdMobComponent extends React.Component {
height: 0,
};
this.nativeView = requireNativeComponent(props.class, AdMobComponent, {
nativeOnly: {
onBannerEvent: true,
},
});
this.nativeView = getNativeComponent(props.class);
}
/**