react-native-google-mobile-ads 12.5.1 → 12.6.0
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/docs/displaying-ads-hook.mdx +2 -6
- package/docs/displaying-ads.mdx +27 -13
- package/lib/commonjs/version.js +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/types/RequestOptions.d.ts +7 -0
- package/lib/typescript/types/RequestOptions.d.ts.map +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/types/RequestOptions.ts +7 -1
- package/src/version.ts +1 -1
|
@@ -14,9 +14,7 @@ Google AdMob dashboard under "Ad units" should be used:
|
|
|
14
14
|
import { useInterstitialAd, TestIds } from 'react-native-google-mobile-ads';
|
|
15
15
|
|
|
16
16
|
export default function App() {
|
|
17
|
-
const interstitialAd = useInterstitialAd(TestIds.Interstitial
|
|
18
|
-
requestNonPersonalizedAdsOnly: true,
|
|
19
|
-
});
|
|
17
|
+
const interstitialAd = useInterstitialAd(TestIds.Interstitial);
|
|
20
18
|
|
|
21
19
|
return <View>{/* ... */}</View>;
|
|
22
20
|
}
|
|
@@ -38,9 +36,7 @@ The hook returns several states and functions to control ad.
|
|
|
38
36
|
import { useInterstitialAd, TestIds } from 'react-native-google-mobile-ads';
|
|
39
37
|
|
|
40
38
|
export default function App({ navigation }) {
|
|
41
|
-
const { isLoaded, isClosed, load, show } = useInterstitialAd(TestIds.INTERSTITIAL
|
|
42
|
-
requestNonPersonalizedAdsOnly: true,
|
|
43
|
-
});
|
|
39
|
+
const { isLoaded, isClosed, load, show } = useInterstitialAd(TestIds.INTERSTITIAL);
|
|
44
40
|
|
|
45
41
|
useEffect(() => {
|
|
46
42
|
// Start loading the interstitial straight away
|
package/docs/displaying-ads.mdx
CHANGED
|
@@ -22,7 +22,6 @@ import { AppOpenAd, TestIds, AdEventType } from 'react-native-google-mobile-ads'
|
|
|
22
22
|
const adUnitId = __DEV__ ? TestIds.APP_OPEN : 'ca-app-pub-xxxxxxxxxxxxx/yyyyyyyyyyyyyy';
|
|
23
23
|
|
|
24
24
|
const appOpenAd = AppOpenAd.createForAdRequest(adUnitId, {
|
|
25
|
-
requestNonPersonalizedAdsOnly: true,
|
|
26
25
|
keywords: ['fashion', 'clothing'],
|
|
27
26
|
});
|
|
28
27
|
|
|
@@ -76,7 +75,6 @@ import { InterstitialAd, TestIds, AdEventType } from 'react-native-google-mobile
|
|
|
76
75
|
const adUnitId = __DEV__ ? TestIds.INTERSTITIAL : 'ca-app-pub-xxxxxxxxxxxxx/yyyyyyyyyyyyyy';
|
|
77
76
|
|
|
78
77
|
const interstitial = InterstitialAd.createForAdRequest(adUnitId, {
|
|
79
|
-
requestNonPersonalizedAdsOnly: true,
|
|
80
78
|
keywords: ['fashion', 'clothing'],
|
|
81
79
|
});
|
|
82
80
|
```
|
|
@@ -99,7 +97,6 @@ import { InterstitialAd, AdEventType, TestIds } from 'react-native-google-mobile
|
|
|
99
97
|
const adUnitId = __DEV__ ? TestIds.INTERSTITIAL : 'ca-app-pub-xxxxxxxxxxxxx/yyyyyyyyyyyyyy';
|
|
100
98
|
|
|
101
99
|
const interstitial = InterstitialAd.createForAdRequest(adUnitId, {
|
|
102
|
-
requestNonPersonalizedAdsOnly: true,
|
|
103
100
|
keywords: ['fashion', 'clothing'],
|
|
104
101
|
});
|
|
105
102
|
|
|
@@ -164,7 +161,6 @@ import { RewardedAd, TestIds } from 'react-native-google-mobile-ads';
|
|
|
164
161
|
const adUnitId = __DEV__ ? TestIds.REWARDED : 'ca-app-pub-xxxxxxxxxxxxx/yyyyyyyyyyyyyy';
|
|
165
162
|
|
|
166
163
|
const rewarded = RewardedAd.createForAdRequest(adUnitId, {
|
|
167
|
-
requestNonPersonalizedAdsOnly: true,
|
|
168
164
|
keywords: ['fashion', 'clothing'],
|
|
169
165
|
});
|
|
170
166
|
```
|
|
@@ -187,7 +183,6 @@ import { RewardedAd, RewardedAdEventType, TestIds } from 'react-native-google-mo
|
|
|
187
183
|
const adUnitId = __DEV__ ? TestIds.REWARDED : 'ca-app-pub-xxxxxxxxxxxxx/yyyyyyyyyyyyyy';
|
|
188
184
|
|
|
189
185
|
const rewarded = RewardedAd.createForAdRequest(adUnitId, {
|
|
190
|
-
requestNonPersonalizedAdsOnly: true,
|
|
191
186
|
keywords: ['fashion', 'clothing'],
|
|
192
187
|
});
|
|
193
188
|
|
|
@@ -286,7 +281,6 @@ const adUnitId = __DEV__
|
|
|
286
281
|
: 'ca-app-pub-xxxxxxxxxxxxx/yyyyyyyyyyyyyy';
|
|
287
282
|
|
|
288
283
|
const rewardedInterstitial = RewardedInterstitialAd.createForAdRequest(adUnitId, {
|
|
289
|
-
requestNonPersonalizedAdsOnly: true,
|
|
290
284
|
keywords: ['fashion', 'clothing'],
|
|
291
285
|
});
|
|
292
286
|
```
|
|
@@ -315,7 +309,6 @@ const adUnitId = __DEV__
|
|
|
315
309
|
: 'ca-app-pub-xxxxxxxxxxxxx/yyyyyyyyyyyyyy';
|
|
316
310
|
|
|
317
311
|
const rewardedInterstitial = RewardedInterstitialAd.createForAdRequest(adUnitId, {
|
|
318
|
-
requestNonPersonalizedAdsOnly: true,
|
|
319
312
|
keywords: ['fashion', 'clothing'],
|
|
320
313
|
});
|
|
321
314
|
|
|
@@ -416,9 +409,6 @@ function App() {
|
|
|
416
409
|
<BannerAd
|
|
417
410
|
unitId={adUnitId}
|
|
418
411
|
size={BannerAdSize.ANCHORED_ADAPTIVE_BANNER}
|
|
419
|
-
requestOptions={{
|
|
420
|
-
requestNonPersonalizedAdsOnly: true,
|
|
421
|
-
}}
|
|
422
412
|
/>
|
|
423
413
|
);
|
|
424
414
|
}
|
|
@@ -445,6 +435,33 @@ or network triggers an event:
|
|
|
445
435
|
Each render of the component loads a single advert, allowing you to display multiple adverts at once. If you need to reload/change
|
|
446
436
|
an advert for a currently mounted component, you'll need to force a re-render inside of your own code.
|
|
447
437
|
|
|
438
|
+
### Collapsible banner ads
|
|
439
|
+
|
|
440
|
+
Collapsible banner ads are banner ads that are initially presented as a larger overlay, with a button to collapse them to the originally requested banner size.
|
|
441
|
+
Collapsible banner ads are intended to improve performance of anchored ads that are otherwise a smaller size.
|
|
442
|
+
This guide shows how to turn on collapsible banner ads for existing banner placements.
|
|
443
|
+
|
|
444
|
+
```js
|
|
445
|
+
import React from 'react';
|
|
446
|
+
import { BannerAd, BannerAdSize, TestIds } from 'react-native-google-mobile-ads';
|
|
447
|
+
|
|
448
|
+
const adUnitId = __DEV__ ? TestIds.ADAPTIVE_BANNER : 'ca-app-pub-xxxxxxxxxxxxx/yyyyyyyyyyyyyy';
|
|
449
|
+
|
|
450
|
+
function App() {
|
|
451
|
+
return (
|
|
452
|
+
<BannerAd
|
|
453
|
+
unitId={adUnitId}
|
|
454
|
+
size={BannerAdSize.ANCHORED_ADAPTIVE_BANNER}
|
|
455
|
+
requestOptions={{
|
|
456
|
+
networkExtras: {
|
|
457
|
+
collapsible: 'bottom',
|
|
458
|
+
},
|
|
459
|
+
}}
|
|
460
|
+
/>
|
|
461
|
+
);
|
|
462
|
+
}
|
|
463
|
+
```
|
|
464
|
+
|
|
448
465
|
### Displaying Google Ad Manager Banner
|
|
449
466
|
|
|
450
467
|
You can also display a Google Ad Manager banner ad unit. In this case, you have to import `GAMBannerAd` component and use `sizes` prop instead of `size` prop:
|
|
@@ -460,9 +477,6 @@ function App() {
|
|
|
460
477
|
<GAMBannerAd
|
|
461
478
|
unitId={adUnitId}
|
|
462
479
|
sizes={[BannerAdSize.FULL_BANNER]}
|
|
463
|
-
requestOptions={{
|
|
464
|
-
requestNonPersonalizedAdsOnly: true,
|
|
465
|
-
}}
|
|
466
480
|
/>
|
|
467
481
|
);
|
|
468
482
|
}
|
package/lib/commonjs/version.js
CHANGED
package/lib/module/version.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "12.
|
|
1
|
+
export declare const SDK_VERSION = "12.6.0";
|
|
2
2
|
export { default, MobileAds } from './MobileAds';
|
|
3
3
|
export { AdsConsentDebugGeography } from './AdsConsentDebugGeography';
|
|
4
4
|
export { AdsConsentPurposes } from './AdsConsentPurposes';
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collapsible Placement.
|
|
3
|
+
* The collapsible placement defines how the expanded region anchors to the banner ad.
|
|
4
|
+
*/
|
|
5
|
+
export declare type CollapsiblePlacement = 'top' | 'bottom';
|
|
1
6
|
export interface ServerSideVerificationOptions {
|
|
2
7
|
/**
|
|
3
8
|
* User identifier.
|
|
@@ -40,6 +45,8 @@ export interface RequestOptions {
|
|
|
40
45
|
*/
|
|
41
46
|
networkExtras?: {
|
|
42
47
|
[key: string]: string;
|
|
48
|
+
} & {
|
|
49
|
+
collapsible?: CollapsiblePlacement;
|
|
43
50
|
};
|
|
44
51
|
/**
|
|
45
52
|
* An array of keywords to be sent when loading the ad.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequestOptions.d.ts","sourceRoot":"","sources":["../../../src/types/RequestOptions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,6BAA6B;IAC5C;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,6BAA6B,CAAC,EAAE,OAAO,CAAC;IAExC;;;;;;;;;;;;;;;;OAgBG;IACH,aAAa,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"RequestOptions.d.ts","sourceRoot":"","sources":["../../../src/types/RequestOptions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,oBAAoB,GAAG,KAAK,GAAG,QAAQ,CAAC;AAEpD,MAAM,WAAW,6BAA6B;IAC5C;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,6BAA6B,CAAC,EAAE,OAAO,CAAC;IAExC;;;;;;;;;;;;;;;;OAgBG;IACH,aAAa,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,GAAG;QAAE,WAAW,CAAC,EAAE,oBAAoB,CAAA;KAAE,CAAC;IAEnF;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IAEpB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;OAIG;IACH,eAAe,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAE5C;;;;;;;;;;;;;OAaG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,6BAA6B,CAAC,EAAE,6BAA6B,CAAC;IAE9D;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "12.
|
|
1
|
+
export declare const version = "12.6.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-google-mobile-ads",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.6.0",
|
|
4
4
|
"author": "Invertase <oss@invertase.io> (http://invertase.io)",
|
|
5
5
|
"description": "React Native Google Mobile Ads is an easy way to monetize mobile apps with targeted, in-app advertising.",
|
|
6
6
|
"main": "lib/commonjs/index.js",
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collapsible Placement.
|
|
3
|
+
* The collapsible placement defines how the expanded region anchors to the banner ad.
|
|
4
|
+
*/
|
|
5
|
+
export type CollapsiblePlacement = 'top' | 'bottom';
|
|
6
|
+
|
|
1
7
|
export interface ServerSideVerificationOptions {
|
|
2
8
|
/**
|
|
3
9
|
* User identifier.
|
|
@@ -41,7 +47,7 @@ export interface RequestOptions {
|
|
|
41
47
|
* },
|
|
42
48
|
* });
|
|
43
49
|
*/
|
|
44
|
-
networkExtras?: { [key: string]: string };
|
|
50
|
+
networkExtras?: { [key: string]: string } & { collapsible?: CollapsiblePlacement };
|
|
45
51
|
|
|
46
52
|
/**
|
|
47
53
|
* An array of keywords to be sent when loading the ad.
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '12.
|
|
2
|
+
export const version = '12.6.0';
|