import * as React from 'react'; import type { ViewProps } from 'react-native'; import type { AdInfo, AdLoadFailedInfo } from './types/AdInfo'; import type { AdViewHandler, NativeUIComponentAdViewOptions, AdViewId } from './types/AdViewProps'; /** * Defines the format of an ad. */ export declare enum AdFormat { /** * Banner ad. */ BANNER = "BANNER", /** * MREC ad. */ MREC = "MREC" } /** * Defines the position for rendering a banner or MREC ad within its container. */ export declare enum AdViewPosition { TOP_CENTER = "top_center", TOP_LEFT = "top_left", TOP_RIGHT = "top_right", CENTERED = "centered", CENTER_LEFT = "center_left", CENTER_RIGHT = "center_right", BOTTOM_LEFT = "bottom_left", BOTTOM_CENTER = "bottom_center", BOTTOM_RIGHT = "bottom_right" } /** * Renders a banner or MREC ad using a native view, with adaptive or responsive sizing. * * - **Banners**: 320×50 on phones, 728×90 on tablets. * - **MRECs**: Fixed size of 300×250 on all devices. * * Internally uses {@link AppLovinMAX.isTablet()} to determine banner size on tablets. * You can also use this method externally to assist with layout decisions. * * For adaptive banners, use {@link BannerAd.getAdaptiveHeightForWidth()} to determine the appropriate height. * * **Preloading**: * If you preload an ad for AdView using {@link preloadNativeUIComponentAdView}, * pass the returned {@link AdViewId} to this component to display the preloaded instance. * * **Note:** The AppLovin SDK must be initialized before using this component. * * ### Example: * ```tsx * { ... }} * /> * ``` * * For complete implementation examples, see: * - https://github.com/AppLovin/AppLovin-MAX-React-Native/blob/master/example/src/NativeBannerExample.tsx * - https://github.com/AppLovin/AppLovin-MAX-React-Native/blob/master/example/src/NativeMRecExample.tsx */ export declare const AdView: React.ForwardRefExoticComponent void; onAdCollapsed?: (adInfo: AdInfo) => void; } & ViewProps & React.RefAttributes>; /** * Preloads a native UI component for {@link AdView}, enabling faster ad display on first mount. * * - When you mount {@link AdView} with the preloaded Ad Unit ID, it uses the preloaded native UI component. * - Unmounting {@link AdView} does not destroy the preloaded component—it will be reused on the next mount. * - You must manually destroy the preloaded component when it is no longer needed using {@link destroyNativeUIComponentAdView}. * * @param adUnitId - The Ad Unit ID for which ads should be preloaded. * @param adFormat - The ad format to preload. Must be either {@link AdFormat.BANNER} or {@link AdFormat.MREC}. * @param options - Optional properties to configure the native UI component (e.g., placement, custom data). * @returns A promise that resolves to an {@link AdViewId}, uniquely identifying the preloaded component instance. * @throws An error if the preload request fails. */ export declare const preloadNativeUIComponentAdView: (adUnitId: string, adFormat: AdFormat, options?: NativeUIComponentAdViewOptions) => Promise; /** * Destroys a preloaded native UI component identified by its {@link AdViewId}. * * - This method should be called when the preloaded component is no longer needed to free resources. * * @param adViewId - The {@link AdViewId} of the native UI component to be destroyed. * @returns A promise that resolves when the native UI component is successfully destroyed. * @throws An error if the destruction process fails. */ export declare const destroyNativeUIComponentAdView: (adViewId: AdViewId) => Promise; /** * Adds the specified event listener to receive {@link AdInfo} when a native UI component loads a new ad. * * @param listener Listener to be notified. */ export declare const addNativeUIComponentAdViewAdLoadedEventListener: (listener: (adInfo: AdInfo) => void) => void; /** * Removes the event listener registered to receive {@link AdInfo} when a native UI component loads a new ad. */ export declare const removeNativeUIComponentAdViewAdLoadedEventListener: () => void; /** * Adds the specified event listener to receive {@link AdLoadFailedInfo} when a native UI component could not load a new ad. * * @param listener Listener to be notified. */ export declare const addNativeUIComponentAdViewAdLoadFailedEventListener: (listener: (errorInfo: AdLoadFailedInfo) => void) => void; /** * Removes the event listener registered to receive {@link AdLoadFailedInfo} when a native UI component could not load a new ad. */ export declare const removeNativeUIComponentAdViewAdLoadFailedEventListener: () => void; //# sourceMappingURL=AdView.d.ts.map