UNPKG

react-native-ad-manager

Version:

A react-native component for Google Ad Manager banners, interstitials and native ads.

71 lines (70 loc) 4.03 kB
import React, { JSXElementConstructor } from 'react'; import { NativeSyntheticEvent, ViewProps } from 'react-native'; import { NativeAdsManager } from './NativeAdsManager'; import type { IAdManagerTargeting, TReactNodeHandleRef } from '../AdManagerTypes'; import type { IAdManagerEventBase, IAdManagerEventCustomClick, IAdManagerEventAppEvent, IAdManagerEventLoadedBanner, IAdManagerEventLoadedNative, IAdManagerEventLoadedTemplate, IAdManagerEventSize } from '../AdManagerEvent'; interface INativeAdPropsBase extends ViewProps { adSize?: string; correlator?: string; customTemplateIds?: string[]; validAdSizes?: string[]; validAdTypes?: ('banner' | 'native' | 'template')[]; customClickTemplateIds?: string[]; targeting?: IAdManagerTargeting; } interface INativeAdProps extends INativeAdPropsBase { adsManager: NativeAdsManager; adLoaderIndex?: string; onSizeChange?: (event: IAdManagerEventSize) => void; onAdLoaded?: (event: IAdManagerEventLoadedBanner | IAdManagerEventLoadedTemplate | IAdManagerEventLoadedNative) => void; onAdFailedToLoad?: (error: Error) => void; onAppEvent?: (event: IAdManagerEventAppEvent) => void; onAdOpened?: (event: IAdManagerEventBase) => void; onAdClosed?: (event: IAdManagerEventBase) => void; onAdCustomClick?: (event: IAdManagerEventCustomClick) => void; onAdRecordImpression?: (event: IAdManagerEventBase) => void; } interface INativeAdState { clickableChildren: Set<TReactNodeHandleRef>; style: { width?: number; height?: number; }; nativeAd?: IAdManagerEventLoadedBanner | IAdManagerEventLoadedTemplate | IAdManagerEventLoadedNative; } declare const _default: (Component: JSXElementConstructor<any>) => { new (props: INativeAdProps): { clickableChildrenNodeHandles: Map<any, any>; componentDidMount(): void; registerClickableChild: (child: TReactNodeHandleRef) => void; unregisterClickableChild: (child: TReactNodeHandleRef) => void; handleSizeChange: ({ nativeEvent, }: NativeSyntheticEvent<IAdManagerEventSize>) => void; handleAdLoaded: ({ nativeEvent, }: NativeSyntheticEvent<IAdManagerEventLoadedBanner | IAdManagerEventLoadedTemplate | IAdManagerEventLoadedNative>) => void; shouldComponentUpdate(nextProps: INativeAdProps, nextState: INativeAdState): boolean; componentDidUpdate(_: INativeAdProps, prevState: INativeAdState): void; reloadAd(): void; renderAdComponent(componentProps: INativeAdProps): JSX.Element | null; render(): JSX.Element; context: any; setState<K extends keyof INativeAdState>(state: INativeAdState | ((prevState: Readonly<INativeAdState>, props: Readonly<INativeAdProps>) => INativeAdState | Pick<INativeAdState, K> | null) | Pick<INativeAdState, K> | null, callback?: (() => void) | undefined): void; forceUpdate(callback?: (() => void) | undefined): void; readonly props: Readonly<INativeAdProps> & Readonly<{ children?: React.ReactNode; }>; state: Readonly<INativeAdState>; refs: { [key: string]: React.ReactInstance; }; componentWillUnmount?(): void; componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void; getSnapshotBeforeUpdate?(prevProps: Readonly<INativeAdProps>, prevState: Readonly<INativeAdState>): any; componentWillMount?(): void; UNSAFE_componentWillMount?(): void; componentWillReceiveProps?(nextProps: Readonly<INativeAdProps>, nextContext: any): void; UNSAFE_componentWillReceiveProps?(nextProps: Readonly<INativeAdProps>, nextContext: any): void; componentWillUpdate?(nextProps: Readonly<INativeAdProps>, nextState: Readonly<INativeAdState>, nextContext: any): void; UNSAFE_componentWillUpdate?(nextProps: Readonly<INativeAdProps>, nextState: Readonly<INativeAdState>, nextContext: any): void; }; contextType?: React.Context<any> | undefined; }; export default _default;