react-native-google-mobile-ads 13.3.0 → 13.4.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.
@@ -16,6 +16,6 @@ class OnNativeEvent(viewId: Int, private val event: WritableMap) : Event<OnNativ
16
16
  }
17
17
 
18
18
  companion object {
19
- const val EVENT_NAME = "topNative"
19
+ const val EVENT_NAME = "topNativeEvent"
20
20
  }
21
21
  }
@@ -399,18 +399,33 @@ The module exposes a [`BannerAd`](/reference/admob/bannerad) component. The `uni
399
399
  a banner:
400
400
 
401
401
  ```js
402
- import React from 'react';
402
+ import React, { useState, useEffect, useRef } from 'react';
403
+ import { AppState } from 'react-native';
403
404
  import { BannerAd, BannerAdSize, TestIds } from 'react-native-google-mobile-ads';
404
405
 
405
406
  const adUnitId = __DEV__ ? TestIds.ADAPTIVE_BANNER : 'ca-app-pub-xxxxxxxxxxxxx/yyyyyyyyyyyyyy';
406
407
 
407
408
  function App() {
408
- return (
409
- <BannerAd
410
- unitId={adUnitId}
411
- size={BannerAdSize.ANCHORED_ADAPTIVE_BANNER}
412
- />
413
- );
409
+ const appState = useRef(AppState.currentState);
410
+ const [key, setKey] = useState(`banner-${Date.now()}`);
411
+
412
+ // WKWebView can terminate if app is in a "suspended state", resulting in an empty banner when app returns to foreground.
413
+ // A Google Mobile Ads Advisor suggests requesting a new ad when the app is foregrounded.
414
+ // For more details, see: [https://groups.google.com/g/google-admob-ads-sdk/c/rwBpqOUr8m8]
415
+ useEffect(() => {
416
+ const subscription = AppState.addEventListener('change', nextAppState => {
417
+ if (appState.current.match(/background/) && nextAppState === 'active') {
418
+ setKey(`banner-${Date.now()}`);
419
+ }
420
+ appState.current = nextAppState;
421
+ });
422
+
423
+ return () => {
424
+ subscription.remove();
425
+ };
426
+ }, []);
427
+
428
+ return <BannerAd key={key} unitId={adUnitId} size={BannerAdSize.ANCHORED_ADAPTIVE_BANNER} />;
414
429
  }
415
430
  ```
416
431
 
@@ -473,12 +488,7 @@ import { GAMBannerAd, BannerAdSize, TestIds } from 'react-native-google-mobile-a
473
488
  const adUnitId = __DEV__ ? TestIds.GAM_BANNER : '/xxx/yyyy';
474
489
 
475
490
  function App() {
476
- return (
477
- <GAMBannerAd
478
- unitId={adUnitId}
479
- sizes={[BannerAdSize.FULL_BANNER]}
480
- />
481
- );
491
+ return <GAMBannerAd unitId={adUnitId} sizes={[BannerAdSize.FULL_BANNER]} />;
482
492
  }
483
493
  ```
484
494
 
@@ -5,6 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = void 0;
7
7
  // Generated by genversion.
8
- const version = '13.3.0';
8
+ const version = '13.4.0';
9
9
  exports.version = version;
10
10
  //# sourceMappingURL=version.js.map
@@ -1,3 +1,3 @@
1
1
  // Generated by genversion.
2
- export const version = '13.3.0';
2
+ export const version = '13.4.0';
3
3
  //# sourceMappingURL=version.js.map
@@ -1,4 +1,4 @@
1
- export declare const SDK_VERSION = "13.3.0";
1
+ export declare const SDK_VERSION = "13.4.0";
2
2
  export { default, MobileAds } from './MobileAds';
3
3
  export { AdsConsentDebugGeography } from './AdsConsentDebugGeography';
4
4
  export { AdsConsentPurposes } from './AdsConsentPurposes';
@@ -1,2 +1,2 @@
1
- export declare const version = "13.3.0";
1
+ export declare const version = "13.4.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": "13.3.0",
3
+ "version": "13.4.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",
@@ -41,15 +41,15 @@
41
41
  ],
42
42
  "sdkVersions": {
43
43
  "ios": {
44
- "googleMobileAds": "11.2.0",
45
- "googleUmp": "2.3.0"
44
+ "googleMobileAds": "11.5.0",
45
+ "googleUmp": "2.4.0"
46
46
  },
47
47
  "android": {
48
48
  "minSdk": 21,
49
- "targetSdk": 33,
50
- "compileSdk": 33,
51
- "buildTools": "33.0.0",
52
- "googleMobileAds": "23.0.0",
49
+ "targetSdk": 34,
50
+ "compileSdk": 34,
51
+ "buildTools": "34.0.0",
52
+ "googleMobileAds": "23.1.0",
53
53
  "googleUmp": "2.2.0"
54
54
  }
55
55
  },
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- export const version = '13.3.0';
2
+ export const version = '13.4.0';