react-native-google-mobile-ads 14.7.2 → 14.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/android/build.gradle +10 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeAppModule.java +2 -2
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsConsentModule.java +2 -2
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsMediaView.kt +57 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsMediaViewManager.kt +55 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsModule.kt +5 -4
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsNativeAdView.kt +107 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsNativeAdViewManager.kt +85 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsNativeModule.kt +211 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsPackage.kt +102 -13
- package/android/src/oldarch/com/facebook/react/viewmanagers/RNGoogleMobileAdsMediaViewManagerDelegate.java +29 -0
- package/android/src/oldarch/com/facebook/react/viewmanagers/RNGoogleMobileAdsMediaViewManagerInterface.java +10 -0
- package/android/src/oldarch/com/facebook/react/viewmanagers/RNGoogleMobileAdsNativeViewManagerDelegate.java +33 -0
- package/android/src/oldarch/com/facebook/react/viewmanagers/RNGoogleMobileAdsNativeViewManagerInterface.java +10 -0
- package/android/src/oldarch/io/invertase/googlemobileads/NativeGoogleMobileAdsNativeModuleSpec.kt +18 -0
- package/docs/displaying-ads.mdx +4 -0
- package/docs/index.mdx +6 -4
- package/docs/native-ads.mdx +385 -0
- package/docs.json +1 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsMediaView.h +49 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsMediaView.mm +152 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsNativeModule.h +35 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsNativeModule.mm +290 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsNativeView.h +48 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsNativeView.mm +223 -0
- package/jest.setup.ts +7 -0
- package/lib/commonjs/NativeAdEventType.js +19 -0
- package/lib/commonjs/NativeAdEventType.js.map +1 -0
- package/lib/commonjs/TestIds.js +15 -8
- package/lib/commonjs/TestIds.js.map +1 -1
- package/lib/commonjs/ads/native-ad/NativeAd.js +122 -0
- package/lib/commonjs/ads/native-ad/NativeAd.js.map +1 -0
- package/lib/commonjs/ads/native-ad/NativeAdContext.js +26 -0
- package/lib/commonjs/ads/native-ad/NativeAdContext.js.map +1 -0
- package/lib/commonjs/ads/native-ad/NativeAdView.js +48 -0
- package/lib/commonjs/ads/native-ad/NativeAdView.js.map +1 -0
- package/lib/commonjs/ads/native-ad/NativeAsset.js +71 -0
- package/lib/commonjs/ads/native-ad/NativeAsset.js.map +1 -0
- package/lib/commonjs/ads/native-ad/NativeMediaView.js +58 -0
- package/lib/commonjs/ads/native-ad/NativeMediaView.js.map +1 -0
- package/lib/commonjs/common/ref.js +45 -0
- package/lib/commonjs/common/ref.js.map +1 -0
- package/lib/commonjs/index.js +47 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/specs/components/GoogleMobileAdsBannerViewNativeComponent.js +17 -0
- package/lib/commonjs/specs/components/GoogleMobileAdsBannerViewNativeComponent.js.map +1 -1
- package/lib/commonjs/specs/components/GoogleMobileAdsMediaViewNativeComponent.js +26 -0
- package/lib/commonjs/specs/components/GoogleMobileAdsMediaViewNativeComponent.js.map +1 -0
- package/lib/commonjs/specs/components/GoogleMobileAdsNativeViewNativeComponent.js +31 -0
- package/lib/commonjs/specs/components/GoogleMobileAdsNativeViewNativeComponent.js.map +1 -0
- package/lib/commonjs/specs/modules/NativeGoogleMobileAdsModule.js +1 -1
- package/lib/commonjs/specs/modules/NativeGoogleMobileAdsNativeModule.js +25 -0
- package/lib/commonjs/specs/modules/NativeGoogleMobileAdsNativeModule.js.map +1 -0
- package/lib/commonjs/types/NativeAdRequestOptions.js +37 -0
- package/lib/commonjs/types/NativeAdRequestOptions.js.map +1 -0
- package/lib/commonjs/types/index.js +11 -0
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/module/NativeAdEventType.js +13 -0
- package/lib/module/NativeAdEventType.js.map +1 -0
- package/lib/module/TestIds.js +15 -8
- package/lib/module/TestIds.js.map +1 -1
- package/lib/module/ads/native-ad/NativeAd.js +115 -0
- package/lib/module/ads/native-ad/NativeAd.js.map +1 -0
- package/lib/module/ads/native-ad/NativeAdContext.js +20 -0
- package/lib/module/ads/native-ad/NativeAdContext.js.map +1 -0
- package/lib/module/ads/native-ad/NativeAdView.js +40 -0
- package/lib/module/ads/native-ad/NativeAdView.js.map +1 -0
- package/lib/module/ads/native-ad/NativeAsset.js +63 -0
- package/lib/module/ads/native-ad/NativeAsset.js.map +1 -0
- package/lib/module/ads/native-ad/NativeMediaView.js +50 -0
- package/lib/module/ads/native-ad/NativeMediaView.js.map +1 -0
- package/lib/module/common/ref.js +38 -0
- package/lib/module/common/ref.js.map +1 -0
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/specs/components/GoogleMobileAdsBannerViewNativeComponent.js +17 -0
- package/lib/module/specs/components/GoogleMobileAdsBannerViewNativeComponent.js.map +1 -1
- package/lib/module/specs/components/GoogleMobileAdsMediaViewNativeComponent.js +20 -0
- package/lib/module/specs/components/GoogleMobileAdsMediaViewNativeComponent.js.map +1 -0
- package/lib/module/specs/components/GoogleMobileAdsNativeViewNativeComponent.js +24 -0
- package/lib/module/specs/components/GoogleMobileAdsNativeViewNativeComponent.js.map +1 -0
- package/lib/module/specs/modules/NativeGoogleMobileAdsModule.js +1 -1
- package/lib/module/specs/modules/NativeGoogleMobileAdsNativeModule.js +20 -0
- package/lib/module/specs/modules/NativeGoogleMobileAdsNativeModule.js.map +1 -0
- package/lib/module/types/NativeAdRequestOptions.js +32 -0
- package/lib/module/types/NativeAdRequestOptions.js.map +1 -0
- package/lib/module/types/index.js +1 -0
- package/lib/module/types/index.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/NativeAdEventType.d.ts +39 -0
- package/lib/typescript/NativeAdEventType.d.ts.map +1 -0
- package/lib/typescript/TestIds.d.ts +3 -0
- package/lib/typescript/TestIds.d.ts.map +1 -1
- package/lib/typescript/ads/native-ad/NativeAd.d.ts +46 -0
- package/lib/typescript/ads/native-ad/NativeAd.d.ts.map +1 -0
- package/lib/typescript/ads/native-ad/NativeAdContext.d.ts +10 -0
- package/lib/typescript/ads/native-ad/NativeAdContext.d.ts.map +1 -0
- package/lib/typescript/ads/native-ad/NativeAdView.d.ts +8 -0
- package/lib/typescript/ads/native-ad/NativeAdView.d.ts.map +1 -0
- package/lib/typescript/ads/native-ad/NativeAsset.d.ts +18 -0
- package/lib/typescript/ads/native-ad/NativeAsset.d.ts.map +1 -0
- package/lib/typescript/ads/native-ad/NativeMediaView.d.ts +7 -0
- package/lib/typescript/ads/native-ad/NativeMediaView.d.ts.map +1 -0
- package/lib/typescript/common/ref.d.ts +13 -0
- package/lib/typescript/common/ref.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +6 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/specs/components/GoogleMobileAdsBannerViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/specs/components/GoogleMobileAdsMediaViewNativeComponent.d.ts +9 -0
- package/lib/typescript/specs/components/GoogleMobileAdsMediaViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/specs/components/GoogleMobileAdsNativeViewNativeComponent.d.ts +14 -0
- package/lib/typescript/specs/components/GoogleMobileAdsNativeViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/specs/modules/NativeGoogleMobileAdsModule.d.ts +1 -17
- package/lib/typescript/specs/modules/NativeGoogleMobileAdsModule.d.ts.map +1 -1
- package/lib/typescript/specs/modules/NativeGoogleMobileAdsNativeModule.d.ts +37 -0
- package/lib/typescript/specs/modules/NativeGoogleMobileAdsNativeModule.d.ts.map +1 -0
- package/lib/typescript/types/NativeAdRequestOptions.d.ts +36 -0
- package/lib/typescript/types/NativeAdRequestOptions.d.ts.map +1 -0
- package/lib/typescript/types/index.d.ts +1 -0
- package/lib/typescript/types/index.d.ts.map +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/NativeAdEventType.ts +46 -0
- package/src/TestIds.ts +13 -6
- package/src/ads/native-ad/NativeAd.ts +152 -0
- package/src/ads/native-ad/NativeAdContext.ts +26 -0
- package/src/ads/native-ad/NativeAdView.tsx +43 -0
- package/src/ads/native-ad/NativeAsset.tsx +66 -0
- package/src/ads/native-ad/NativeMediaView.tsx +44 -0
- package/src/common/ref.ts +44 -0
- package/src/index.ts +5 -0
- package/src/specs/components/GoogleMobileAdsBannerViewNativeComponent.ts +17 -0
- package/src/specs/components/GoogleMobileAdsMediaViewNativeComponent.ts +30 -0
- package/src/specs/components/GoogleMobileAdsNativeViewNativeComponent.ts +44 -0
- package/src/specs/modules/NativeGoogleMobileAdsModule.ts +2 -2
- package/src/specs/modules/NativeGoogleMobileAdsNativeModule.ts +64 -0
- package/src/types/NativeAdRequestOptions.ts +55 -0
- package/src/types/index.ts +1 -0
- package/src/version.ts +1 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import React, { useRef } from 'react';
|
|
19
|
+
import { ViewProps } from 'react-native';
|
|
20
|
+
import { NativeAd } from './NativeAd';
|
|
21
|
+
import { NativeAdContext } from './NativeAdContext';
|
|
22
|
+
import GoogleMobileAdsNativeView from '../../specs/components/GoogleMobileAdsNativeViewNativeComponent';
|
|
23
|
+
|
|
24
|
+
export type NativeAdViewProps = ViewProps & {
|
|
25
|
+
nativeAd: NativeAd;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const NativeAdView = (props: NativeAdViewProps) => {
|
|
29
|
+
const { nativeAd, children, ...viewProps } = props;
|
|
30
|
+
const ref = useRef<React.ElementRef<typeof GoogleMobileAdsNativeView>>(null);
|
|
31
|
+
return (
|
|
32
|
+
<GoogleMobileAdsNativeView
|
|
33
|
+
{...viewProps}
|
|
34
|
+
ref={ref}
|
|
35
|
+
responseId={nativeAd.responseId}
|
|
36
|
+
removeClippedSubviews={false}
|
|
37
|
+
>
|
|
38
|
+
<NativeAdContext.Provider value={{ nativeAd, viewRef: ref }}>
|
|
39
|
+
{children}
|
|
40
|
+
</NativeAdContext.Provider>
|
|
41
|
+
</GoogleMobileAdsNativeView>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import React, { ReactElement, useContext, useEffect, useRef } from 'react';
|
|
19
|
+
import { findNodeHandle } from 'react-native';
|
|
20
|
+
import { NativeAdContext } from './NativeAdContext';
|
|
21
|
+
import { Commands } from '../../specs/components/GoogleMobileAdsNativeViewNativeComponent';
|
|
22
|
+
import { composeRefs, getElementRef } from '../../common/ref';
|
|
23
|
+
|
|
24
|
+
export enum NativeAssetType {
|
|
25
|
+
ADVERTISER = 'advertiser',
|
|
26
|
+
BODY = 'body',
|
|
27
|
+
CALL_TO_ACTION = 'callToAction',
|
|
28
|
+
HEADLINE = 'headline',
|
|
29
|
+
PRICE = 'price',
|
|
30
|
+
STORE = 'store',
|
|
31
|
+
STAR_RATING = 'starRating',
|
|
32
|
+
ICON = 'icon',
|
|
33
|
+
IMAGE = 'image',
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type NativeAssetProps = {
|
|
37
|
+
assetType: NativeAssetType;
|
|
38
|
+
children: ReactElement;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const NativeAsset = (props: NativeAssetProps) => {
|
|
42
|
+
const { assetType, children } = props;
|
|
43
|
+
const { viewRef } = useContext(NativeAdContext);
|
|
44
|
+
const ref = useRef<React.Component>(null);
|
|
45
|
+
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (!viewRef.current) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const node = ref.current;
|
|
51
|
+
const reactTag = findNodeHandle(node);
|
|
52
|
+
if (reactTag) {
|
|
53
|
+
Commands.registerAsset(viewRef.current, assetType, reactTag);
|
|
54
|
+
}
|
|
55
|
+
}, [viewRef]);
|
|
56
|
+
|
|
57
|
+
if (!React.isValidElement(children)) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const childrenRef = getElementRef(children);
|
|
62
|
+
return React.cloneElement(children, {
|
|
63
|
+
// @ts-ignore
|
|
64
|
+
ref: composeRefs(ref, childrenRef),
|
|
65
|
+
}) as ReactElement;
|
|
66
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import React, { useContext } from 'react';
|
|
19
|
+
import { ViewProps } from 'react-native';
|
|
20
|
+
import GoogleMobileAdsMediaView from '../../specs/components/GoogleMobileAdsMediaViewNativeComponent';
|
|
21
|
+
import { NativeAsset } from './NativeAsset';
|
|
22
|
+
import { NativeAdContext } from './NativeAdContext';
|
|
23
|
+
|
|
24
|
+
export type NativeMediaViewProps = ViewProps & {
|
|
25
|
+
resizeMode?: 'cover' | 'contain' | 'stretch';
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const NativeMediaView = (props: NativeMediaViewProps) => {
|
|
29
|
+
const { resizeMode, style, ...viewProps } = props;
|
|
30
|
+
const { nativeAd } = useContext(NativeAdContext);
|
|
31
|
+
const { responseId, mediaContent } = nativeAd;
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
// @ts-ignore
|
|
35
|
+
<NativeAsset assetType={'media'}>
|
|
36
|
+
<GoogleMobileAdsMediaView
|
|
37
|
+
{...viewProps}
|
|
38
|
+
responseId={responseId}
|
|
39
|
+
resizeMode={resizeMode}
|
|
40
|
+
style={[{ aspectRatio: mediaContent?.aspectRatio }, style]}
|
|
41
|
+
/>
|
|
42
|
+
</NativeAsset>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
type PossibleRef<T> = React.Ref<T> | undefined;
|
|
4
|
+
interface ElementWithRef extends React.ReactElement {
|
|
5
|
+
ref?: PossibleRef<unknown>;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Access the ref using the method that doesn't yield a warning.
|
|
10
|
+
*
|
|
11
|
+
* Before React 19 accessing `element.props.ref` will throw a warning and suggest using `element.ref`
|
|
12
|
+
* After React 19 accessing `element.ref` does the opposite.
|
|
13
|
+
* https://github.com/facebook/react/pull/28348
|
|
14
|
+
*/
|
|
15
|
+
export function getElementRef(element: React.ReactElement): PossibleRef<unknown> {
|
|
16
|
+
// React <=18 in DEV
|
|
17
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, 'ref')?.get;
|
|
18
|
+
let mayWarn = getter && 'isReactWarning' in getter && getter.isReactWarning;
|
|
19
|
+
if (mayWarn) {
|
|
20
|
+
return (element as ElementWithRef).ref;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// React 19 in DEV
|
|
24
|
+
getter = Object.getOwnPropertyDescriptor(element, 'ref')?.get;
|
|
25
|
+
mayWarn = getter && 'isReactWarning' in getter && getter.isReactWarning;
|
|
26
|
+
if (mayWarn) {
|
|
27
|
+
return element.props.ref;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Not DEV
|
|
31
|
+
return element.props.ref || (element as ElementWithRef).ref;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function composeRefs<T>(...refs: PossibleRef<T>[]) {
|
|
35
|
+
return (value: T) => {
|
|
36
|
+
refs.forEach(ref => {
|
|
37
|
+
if (typeof ref === 'function') {
|
|
38
|
+
ref(value);
|
|
39
|
+
} else if (ref !== null && ref !== undefined) {
|
|
40
|
+
(ref as React.MutableRefObject<T>).current = value;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -37,6 +37,7 @@ export { TestIds } from './TestIds';
|
|
|
37
37
|
export { AdEventType } from './AdEventType';
|
|
38
38
|
export { BannerAdSize, GAMBannerAdSize } from './BannerAdSize';
|
|
39
39
|
export { GAMAdEventType } from './GAMAdEventType';
|
|
40
|
+
export { NativeAdEventType } from './NativeAdEventType';
|
|
40
41
|
export { RewardedAdEventType } from './RewardedAdEventType';
|
|
41
42
|
export { AdsConsent } from './AdsConsent';
|
|
42
43
|
export { AppOpenAd } from './ads/AppOpenAd';
|
|
@@ -44,6 +45,10 @@ export { InterstitialAd } from './ads/InterstitialAd';
|
|
|
44
45
|
export { RewardedAd } from './ads/RewardedAd';
|
|
45
46
|
export { RewardedInterstitialAd } from './ads/RewardedInterstitialAd';
|
|
46
47
|
export { BannerAd } from './ads/BannerAd';
|
|
48
|
+
export { NativeAd } from './ads/native-ad/NativeAd';
|
|
49
|
+
export { NativeAdView } from './ads/native-ad/NativeAdView';
|
|
50
|
+
export { NativeMediaView } from './ads/native-ad/NativeMediaView';
|
|
51
|
+
export { NativeAsset, NativeAssetType } from './ads/native-ad/NativeAsset';
|
|
47
52
|
export { GAMBannerAd } from './ads/GAMBannerAd';
|
|
48
53
|
export { GAMInterstitialAd } from './ads/GAMInterstitialAd';
|
|
49
54
|
export { useAppOpenAd } from './hooks/useAppOpenAd';
|
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
1
18
|
import type * as React from 'react';
|
|
2
19
|
import type { HostComponent, ViewProps } from 'react-native';
|
|
3
20
|
import type { BubblingEventHandler, Float } from 'react-native/Libraries/Types/CodegenTypes';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import type { HostComponent, ViewProps } from 'react-native';
|
|
19
|
+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
20
|
+
|
|
21
|
+
export interface NativeProps extends ViewProps {
|
|
22
|
+
responseId: string;
|
|
23
|
+
resizeMode?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
type NativeViewComponentType = HostComponent<NativeProps>;
|
|
27
|
+
|
|
28
|
+
export default codegenNativeComponent<NativeProps>(
|
|
29
|
+
'RNGoogleMobileAdsMediaView',
|
|
30
|
+
) as NativeViewComponentType;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import type * as React from 'react';
|
|
19
|
+
import type { HostComponent, ViewProps } from 'react-native';
|
|
20
|
+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
21
|
+
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
|
|
22
|
+
import type { Int32 } from 'react-native/Libraries/Types/CodegenTypes';
|
|
23
|
+
|
|
24
|
+
export interface NativeProps extends ViewProps {
|
|
25
|
+
responseId: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
type NativeViewComponentType = HostComponent<NativeProps>;
|
|
29
|
+
|
|
30
|
+
interface NativeCommands {
|
|
31
|
+
registerAsset: (
|
|
32
|
+
viewRef: React.ElementRef<NativeViewComponentType>,
|
|
33
|
+
assetType: string,
|
|
34
|
+
reactTag: Int32,
|
|
35
|
+
) => void;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
|
|
39
|
+
supportedCommands: ['registerAsset'],
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export default codegenNativeComponent<NativeProps>(
|
|
43
|
+
'RNGoogleMobileAdsNativeView',
|
|
44
|
+
) as NativeViewComponentType;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
2
|
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
import type { TurboModule } from 'react-native';
|
|
19
19
|
import { TurboModuleRegistry } from 'react-native';
|
|
20
|
-
import { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';
|
|
20
|
+
import type { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';
|
|
21
21
|
|
|
22
22
|
import { AdapterStatus } from '../../types';
|
|
23
23
|
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import type { TurboModule } from 'react-native';
|
|
19
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
20
|
+
import type {
|
|
21
|
+
Double,
|
|
22
|
+
Float,
|
|
23
|
+
UnsafeObject,
|
|
24
|
+
EventEmitter,
|
|
25
|
+
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
26
|
+
|
|
27
|
+
export type NativeAdProps = {
|
|
28
|
+
responseId: string;
|
|
29
|
+
advertiser: string | null;
|
|
30
|
+
body: string;
|
|
31
|
+
callToAction: string;
|
|
32
|
+
headline: string;
|
|
33
|
+
price: string | null;
|
|
34
|
+
store: string | null;
|
|
35
|
+
starRating: Double | null;
|
|
36
|
+
icon: NativeAdImage | null;
|
|
37
|
+
images: Array<NativeAdImage> | null;
|
|
38
|
+
mediaContent: NativeMediaContent;
|
|
39
|
+
extras: UnsafeObject | null;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export type NativeAdImage = {
|
|
43
|
+
url: string;
|
|
44
|
+
scale: Double;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export type NativeMediaContent = {
|
|
48
|
+
aspectRatio: Float;
|
|
49
|
+
hasVideoContent: boolean;
|
|
50
|
+
duration: Float;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export type NativeAdEventPayload = {
|
|
54
|
+
responseId: string;
|
|
55
|
+
type: string;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export interface Spec extends TurboModule {
|
|
59
|
+
load(adUnitId: string, requestOptions: UnsafeObject): Promise<NativeAdProps>;
|
|
60
|
+
destroy(responseId: string): void;
|
|
61
|
+
readonly onAdEvent: EventEmitter<NativeAdEventPayload>;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('RNGoogleMobileAdsNativeModule');
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { RequestOptions } from './RequestOptions';
|
|
19
|
+
|
|
20
|
+
export enum NativeMediaAspectRatio {
|
|
21
|
+
ANY = 1,
|
|
22
|
+
LANDSCAPE = 2,
|
|
23
|
+
PORTRAIT = 3,
|
|
24
|
+
SQUARE = 4,
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export enum NativeAdChoicesPlacement {
|
|
28
|
+
TOP_LEFT = 0,
|
|
29
|
+
TOP_RIGHT = 1,
|
|
30
|
+
BOTTOM_RIGHT = 2,
|
|
31
|
+
BOTTOM_LEFT = 3,
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface NativeAdRequestOptions extends RequestOptions {
|
|
35
|
+
/**
|
|
36
|
+
* Specifies a preference for the aspect ratio of ad creatives.
|
|
37
|
+
* Setting this option does not guarantee that all ad creatives will meet the preference specified.
|
|
38
|
+
* - When unset, the returned ad can have any media aspect ratio.
|
|
39
|
+
* - When set, you will be able to improve the user experience by specifying the preferred type of aspect ratio.
|
|
40
|
+
*/
|
|
41
|
+
aspectRatio?: NativeMediaAspectRatio;
|
|
42
|
+
/**
|
|
43
|
+
* Chooses which corner to render the AdChoices icon.
|
|
44
|
+
* - If unset, the AdChoices icon position is set to the top right.
|
|
45
|
+
* - If set, AdChoices is placed at the custom position as requested.
|
|
46
|
+
*/
|
|
47
|
+
adChoicesPlacement?: NativeAdChoicesPlacement;
|
|
48
|
+
/**
|
|
49
|
+
* Disables or enables a video's starting audio.
|
|
50
|
+
* - The start muted behavior is enabled by default.
|
|
51
|
+
* - When disabled, your app requests the video should begin with audio.
|
|
52
|
+
* - When enabled, your app requests that the video should begin with audio muted.
|
|
53
|
+
*/
|
|
54
|
+
startVideoMuted?: boolean;
|
|
55
|
+
}
|
package/src/types/index.ts
CHANGED
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '14.
|
|
2
|
+
export const version = '14.8.1';
|