1 | import { requireNativeViewManager } from '@unimodules/core';
|
2 | import PropTypes from 'prop-types';
|
3 | import * as React from 'react';
|
4 | import { View, ViewPropTypes } from 'react-native';
|
5 | export default class PublisherBanner extends React.Component {
|
6 | constructor() {
|
7 | super(...arguments);
|
8 | this.state = { style: {} };
|
9 | this._handleSizeChange = ({ nativeEvent }) => {
|
10 | const { height, width } = nativeEvent;
|
11 | this.setState({ style: { width, height } });
|
12 | };
|
13 | this._handleDidFailToReceiveAdWithError = ({ nativeEvent }) => this.props.onDidFailToReceiveAdWithError &&
|
14 | this.props.onDidFailToReceiveAdWithError(nativeEvent.error);
|
15 | }
|
16 | render() {
|
17 | return (<View style={this.props.style}>
|
18 | <ExpoBannerView style={this.state.style} adUnitID={this.props.adUnitID} bannerSize={this.props.bannerSize} testDeviceID={this.props.testDeviceID} onSizeChange={this._handleSizeChange} onAdViewDidReceiveAd={this.props.onAdViewDidReceiveAd} onDidFailToReceiveAdWithError={this._handleDidFailToReceiveAdWithError} onAdViewWillPresentScreen={this.props.onAdViewWillPresentScreen} onAdViewWillDismissScreen={this.props.onAdViewWillDismissScreen} onAdViewDidDismissScreen={this.props.onAdViewDidDismissScreen} onAdViewWillLeaveApplication={this.props.onAdViewWillLeaveApplication} onAdmobDispatchAppEvent={this.props.onAdMobDispatchAppEvent}/>
|
19 | </View>);
|
20 | }
|
21 | }
|
22 | PublisherBanner.propTypes = {
|
23 | bannerSize: PropTypes.oneOf([
|
24 | 'banner',
|
25 | 'largeBanner',
|
26 | 'mediumRectangle',
|
27 | 'fullBanner',
|
28 | 'leaderboard',
|
29 | 'smartBannerPortrait',
|
30 | 'smartBannerLandscape',
|
31 | ]),
|
32 | adUnitID: PropTypes.string,
|
33 | testDeviceID: PropTypes.string,
|
34 | onAdViewDidReceiveAd: PropTypes.func,
|
35 | onDidFailToReceiveAdWithError: PropTypes.func,
|
36 | onAdViewWillPresentScreen: PropTypes.func,
|
37 | onAdViewWillDismissScreen: PropTypes.func,
|
38 | onAdViewDidDismissScreen: PropTypes.func,
|
39 | onAdViewWillLeaveApplication: PropTypes.func,
|
40 | onAdmobDispatchAppEvent: PropTypes.func,
|
41 | ...ViewPropTypes,
|
42 | };
|
43 | PublisherBanner.defaultProps = { bannerSize: 'smartBannerPortrait' };
|
44 | const ExpoBannerView = requireNativeViewManager('ExpoAdsPublisherBannerView');
|
45 | //# sourceMappingURL=PublisherBanner.js.map |
\ | No newline at end of file |