UNPKG

3.34 kBTypeScriptView Raw
1import React from 'react';
2import { View } from 'react-native';
3import { NativeAdIconView } from './AdIconView';
4import { NativeAdMediaView } from './AdMediaView';
5import AdsManager from './NativeAdsManager';
6declare type AdContainerProps<P> = {
7 adsManager: AdsManager;
8 onAdLoaded?: ((ad: NativeAd) => void) | null;
9 onError?: (error: Error) => void;
10} & Pick<P, Exclude<keyof P, keyof AdProps>>;
11declare type AdProps = {
12 nativeAd: NativeAd;
13};
14/**
15 * A higher-order function that wraps the given `Component` type and returns a new container
16 * component type that passes in an extra `nativeAd` prop to the wrapped component.
17 *
18 * The container component renders null if the native ads manager is not yet ready to display ads or
19 * if no ad could be loaded.
20 */
21export default function withNativeAd<P>(Component: React.ComponentType<P & AdProps>): React.ComponentType<AdContainerProps<P>>;
22declare type NativeAdViewProps = {
23 adsManager: string;
24 onAdLoaded?: (event: {
25 nativeEvent: NativeAd;
26 }) => void;
27} & React.ComponentProps<typeof View>;
28declare type NativeAdView = React.Component<NativeAdViewProps>;
29declare const NativeAdView: React.ComponentType<any>;
30export declare type AdIconViewContextValue = {
31 nativeRef: (component: NativeAdMediaView | null) => void;
32};
33export declare type AdMediaViewContextValue = {
34 nativeRef: (component: NativeAdIconView | null) => void;
35};
36export declare type AdTriggerViewContextValue = {
37 registerComponent: (component: React.Component) => void;
38 unregisterComponent: (component: React.Component) => void;
39 onTriggerAd: () => void;
40};
41export declare type AdOptionsViewContextValue = {
42 nativeAdViewRef: React.RefObject<NativeAdView>;
43};
44export declare const AdIconViewContext: React.Context<AdIconViewContextValue | null>;
45export declare const AdMediaViewContext: React.Context<AdMediaViewContextValue | null>;
46export declare const AdTriggerViewContext: React.Context<AdTriggerViewContextValue | null>;
47export declare const AdOptionsViewContext: React.Context<AdOptionsViewContextValue | null>;
48export declare type NativeAd = {
49 /**
50 * The headline the advertiser entered when they created their ad. This is usually the ad's main
51 * title.
52 */
53 headline?: string;
54 /**
55 * The link description which is additional information that the advertiser may have entered
56 */
57 linkDescription?: string;
58 /**
59 * The name of the Facebook Page or mobile app that represents the business running the ad
60 */
61 advertiserName?: string;
62 /**
63 * The ad's social context, such as, "Over half a million users"
64 */
65 socialContext?: string;
66 /**
67 * The call-to-action phrase of the ad, such as, "Install Now"
68 */
69 callToActionText?: string;
70 /**
71 * The body text, truncated to 90 characters, that contains the text the advertiser entered when
72 * they created their ad to tell people what the ad promotes
73 */
74 bodyText?: string;
75 /**
76 * The word "ad", translated into the viewer's language
77 */
78 adTranslation?: string;
79 /**
80 * The word "promoted", translated into the viewer's language
81 */
82 promotedTranslation?: string;
83 /**
84 * The word "sponsored", translated into the viewer's language
85 */
86 sponsoredTranslation?: string;
87};
88export {};