1 | import { requireNativeViewManager } from '@unimodules/core';
|
2 | import React from 'react';
|
3 | export default class BannerAd extends React.Component {
|
4 | render() {
|
5 | const { type, onPress, onError, style, ...props } = this.props;
|
6 | const size = _getSizeForAdType(type);
|
7 | return (React.createElement(NativeBannerView, Object.assign({ size: size, onAdPress: onPress, onAdError: onError, style: [style, { height: size }] }, props)));
|
8 | }
|
9 | }
|
10 | function _getSizeForAdType(type) {
|
11 | const sizes = { standard: 50, large: 90, rectangle: 250 };
|
12 | return sizes.hasOwnProperty(type) ? sizes[type] : sizes.standard;
|
13 | }
|
14 | const NativeBannerView = requireNativeViewManager('CTKBannerView');
|
15 |
|
\ | No newline at end of file |