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KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK;YAC3B,oBAAC,cAAc,IACb,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAC7B,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,EACjC,YAAY,EAAE,IAAI,CAAC,iBAAiB,EACpC,uBAAuB,EAAE,uBAAuB,EAChD,oBAAoB,EAAE,IAAI,CAAC,KAAK,CAAC,oBAAoB,EACrD,6BAA6B,EAAE,IAAI,CAAC,kCAAkC,EACtE,yBAAyB,EAAE,IAAI,CAAC,KAAK,CAAC,yBAAyB,EAC/D,yBAAyB,EAAE,IAAI,CAAC,KAAK,CAAC,yBAAyB,EAC/D,wBAAwB,EAAE,IAAI,CAAC,KAAK,CAAC,wBAAwB,EAC7D,4BAA4B,EAAE,IAAI,CAAC,KAAK,CAAC,4BAA4B,EACrE,uBAAuB,EAAE,IAAI,CAAC,KAAK,CAAC,uBAAuB,GAC3D,CACG,CACR,CAAC;IACJ,CAAC;;AA5CM,4BAAY,GAAG,EAAE,UAAU,EAAE,qBAAqB,EAAE,CAAC;AA+C9D,MAAM,cAAc,GAAG,wBAAwB,CAAC,4BAA4B,CAAC,CAAC","sourcesContent":["import { requireNativeViewManager } from '@unimodules/core';\nimport * as React from 'react';\nimport { View } from 'react-native';\n\ntype AppEvent = { [eventName: string]: any };\n\ntype PropsType = React.ComponentProps<typeof View> & {\n /**\n * AdMob iOS library banner size constants\n * (https://developers.google.com/admob/ios/banner)\n * banner (320x50, Standard Banner for Phones and Tablets)\n * largeBanner (320x100, Large Banner for Phones and Tablets)\n * mediumRectangle (300x250, IAB Medium Rectangle for Phones and Tablets)\n * fullBanner (468x60, IAB Full-Size Banner for Tablets)\n * leaderboard (728x90, IAB Leaderboard for Tablets)\n * smartBannerPortrait (Screen width x 32|50|90, Smart Banner for Phones and Tablets)\n * smartBannerLandscape (Screen width x 32|50|90, Smart Banner for Phones and Tablets)\n *\n * banner is default\n */\n bannerSize:\n | 'banner'\n | 'largeBanner'\n | 'mediumRectangle'\n | 'fullBanner'\n | 'leaderboard'\n | 'smartBannerPortrait'\n | 'smartBannerLandscape';\n /**\n * AdMob ad unit ID\n */\n adUnitID?: string;\n /**\n * Additional request params added to underlying request for the ad.\n */\n additionalRequestParams?: { [key: string]: string };\n /**\n * Whether the SDK should serve personalized ads (use only with user's consent). If this value is\n * `false` or `undefined`, this sets the `npa` key of `additionalRequestParams` to `'1'` following\n * https://developers.google.com/admob/ios/eu-consent#forward_consent_to_the_google_mobile_ads_sdk\n * and\n * https://developers.google.com/admob/android/eu-consent#forward_consent_to_the_google_mobile_ads_sdk.\n */\n servePersonalizedAds?: boolean;\n /**\n * AdMob iOS library events\n */\n onAdViewDidReceiveAd?: () => void;\n onDidFailToReceiveAdWithError?: (error: string) => void;\n onAdViewWillPresentScreen?: () => void;\n onAdViewWillDismissScreen?: () => void;\n onAdViewDidDismissScreen?: () => void;\n onAdViewWillLeaveApplication?: () => void;\n onAdMobDispatchAppEvent?: (event: AppEvent) => void;\n};\n\ntype StateType = {\n style: { width?: number; height?: number };\n};\n\nlet _hasWarnedAboutTestDeviceID = false;\n\nexport default class PublisherBanner extends React.Component<PropsType, StateType> {\n static defaultProps = { bannerSize: 'smartBannerPortrait' };\n\n state = { style: {} };\n\n _handleSizeChange = ({ nativeEvent }: { nativeEvent: { width: number; height: number } }) => {\n const { height, width } = nativeEvent;\n this.setState({ style: { width, height } });\n };\n\n _handleDidFailToReceiveAdWithError = ({ nativeEvent }: { nativeEvent: { error: string } }) =>\n this.props.onDidFailToReceiveAdWithError &&\n this.props.onDidFailToReceiveAdWithError(nativeEvent.error);\n\n render() {\n const additionalRequestParams: { [key: string]: string } = {\n ...this.props.additionalRequestParams,\n };\n if (!this.props.servePersonalizedAds) {\n additionalRequestParams.npa = '1';\n }\n if ((this.props as any).testDeviceID && !_hasWarnedAboutTestDeviceID) {\n console.warn(\n 'The `testDeviceID` prop of PublisherBanner is deprecated. Test device IDs are now set globally. Use AdMob.setTestDeviceID instead.'\n );\n _hasWarnedAboutTestDeviceID = true;\n }\n return (\n <View style={this.props.style}>\n <ExpoBannerView\n style={this.state.style}\n adUnitID={this.props.adUnitID}\n bannerSize={this.props.bannerSize}\n onSizeChange={this._handleSizeChange}\n additionalRequestParams={additionalRequestParams}\n onAdViewDidReceiveAd={this.props.onAdViewDidReceiveAd}\n onDidFailToReceiveAdWithError={this._handleDidFailToReceiveAdWithError}\n onAdViewWillPresentScreen={this.props.onAdViewWillPresentScreen}\n onAdViewWillDismissScreen={this.props.onAdViewWillDismissScreen}\n onAdViewDidDismissScreen={this.props.onAdViewDidDismissScreen}\n onAdViewWillLeaveApplication={this.props.onAdViewWillLeaveApplication}\n onAdmobDispatchAppEvent={this.props.onAdMobDispatchAppEvent}\n />\n </View>\n );\n }\n}\n\nconst ExpoBannerView = requireNativeViewManager('ExpoAdsPublisherBannerView');\n"]}
\No newline at end of file