react-native-google-mobile-ads 13.5.0 → 13.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.mdx +8 -18
- package/lib/commonjs/hooks/useForeground.js +45 -0
- package/lib/commonjs/hooks/useForeground.js.map +1 -0
- package/lib/commonjs/index.js +8 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/module/hooks/useForeground.js +40 -0
- package/lib/module/hooks/useForeground.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/hooks/useForeground.d.ts +7 -0
- package/lib/typescript/hooks/useForeground.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +2 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/hooks/useForeground.ts +41 -0
- package/src/index.ts +1 -0
- package/src/version.ts +1 -1
package/docs/displaying-ads.mdx
CHANGED
|
@@ -399,9 +399,9 @@ The module exposes a [`BannerAd`](/reference/admob/bannerad) component. The `uni
|
|
|
399
399
|
a banner:
|
|
400
400
|
|
|
401
401
|
```js
|
|
402
|
-
import React, { useState,
|
|
403
|
-
import { AppState } from 'react-native';
|
|
404
|
-
import { BannerAd, BannerAdSize, TestIds } from 'react-native-google-mobile-ads';
|
|
402
|
+
import React, { useState, useRef } from 'react';
|
|
403
|
+
import { AppState, Platform } from 'react-native';
|
|
404
|
+
import { BannerAd, BannerAdSize, TestIds, useForeground } from 'react-native-google-mobile-ads';
|
|
405
405
|
|
|
406
406
|
const adUnitId = __DEV__ ? TestIds.ADAPTIVE_BANNER : 'ca-app-pub-xxxxxxxxxxxxx/yyyyyyyyyyyyyy';
|
|
407
407
|
|
|
@@ -409,21 +409,11 @@ function App() {
|
|
|
409
409
|
const bannerRef = useRef<BannerAd>(null);
|
|
410
410
|
const appState = useRef(AppState.currentState);
|
|
411
411
|
|
|
412
|
-
// WKWebView can terminate if app is in a "suspended state", resulting in an empty banner when app returns to foreground.
|
|
413
|
-
//
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
if (appState.current.match(/background/) && nextAppState === 'active') {
|
|
418
|
-
bannerRef.current?.load();
|
|
419
|
-
}
|
|
420
|
-
appState.current = nextAppState;
|
|
421
|
-
});
|
|
422
|
-
|
|
423
|
-
return () => {
|
|
424
|
-
subscription.remove();
|
|
425
|
-
};
|
|
426
|
-
}, []);
|
|
412
|
+
// (iOS) WKWebView can terminate if app is in a "suspended state", resulting in an empty banner when app returns to foreground.
|
|
413
|
+
// Therefore it's advised to "manually" request a new ad when the app is foregrounded (https://groups.google.com/g/google-admob-ads-sdk/c/rwBpqOUr8m8).
|
|
414
|
+
useForeground(() => {
|
|
415
|
+
Platform.OS === 'ios' && bannerRef.current?.load();
|
|
416
|
+
})
|
|
427
417
|
|
|
428
418
|
return (
|
|
429
419
|
<BannerAd ref={bannerRef} unitId={adUnitId} size={BannerAdSize.ANCHORED_ADAPTIVE_BANNER} />
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useForeground = useForeground;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
/*
|
|
10
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
11
|
+
*
|
|
12
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
* you may not use this library except in compliance with the License.
|
|
14
|
+
* You may obtain a copy of the License at
|
|
15
|
+
*
|
|
16
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
+
*
|
|
18
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
19
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
+
* See the License for the specific language governing permissions and
|
|
22
|
+
* limitations under the License.
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* A custom hook that invokes a callback when the app transitions to the foreground.
|
|
28
|
+
*
|
|
29
|
+
* @param {Function} callback - The function to be called when the app has come to the foreground.
|
|
30
|
+
*/
|
|
31
|
+
function useForeground(callback) {
|
|
32
|
+
const appState = (0, _react.useRef)(_reactNative.AppState.currentState);
|
|
33
|
+
(0, _react.useEffect)(() => {
|
|
34
|
+
const subscription = _reactNative.AppState.addEventListener('change', nextAppState => {
|
|
35
|
+
if (appState.current === 'background' && nextAppState === 'active') {
|
|
36
|
+
callback();
|
|
37
|
+
}
|
|
38
|
+
appState.current = nextAppState;
|
|
39
|
+
});
|
|
40
|
+
return () => {
|
|
41
|
+
subscription.remove();
|
|
42
|
+
};
|
|
43
|
+
}, []);
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=useForeground.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNative","useForeground","callback","appState","useRef","AppState","currentState","useEffect","subscription","addEventListener","nextAppState","current","remove"],"sourceRoot":"../../../src","sources":["hooks/useForeground.ts"],"mappings":";;;;;;AAiBA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAlBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACO,SAASE,aAAaA,CAACC,QAAoB,EAAE;EAClD,MAAMC,QAAQ,GAAG,IAAAC,aAAM,EAACC,qBAAQ,CAACC,YAAY,CAAC;EAE9C,IAAAC,gBAAS,EAAC,MAAM;IACd,MAAMC,YAAY,GAAGH,qBAAQ,CAACI,gBAAgB,CAAC,QAAQ,EAAEC,YAAY,IAAI;MACvE,IAAIP,QAAQ,CAACQ,OAAO,KAAK,YAAY,IAAID,YAAY,KAAK,QAAQ,EAAE;QAClER,QAAQ,CAAC,CAAC;MACZ;MACAC,QAAQ,CAACQ,OAAO,GAAGD,YAAY;IACjC,CAAC,CAAC;IAEF,OAAO,MAAM;MACXF,YAAY,CAACI,MAAM,CAAC,CAAC;IACvB,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;AACR"}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -30,6 +30,7 @@ var _exportNames = {
|
|
|
30
30
|
useInterstitialAd: true,
|
|
31
31
|
useRewardedAd: true,
|
|
32
32
|
useRewardedInterstitialAd: true,
|
|
33
|
+
useForeground: true,
|
|
33
34
|
RevenuePrecisions: true
|
|
34
35
|
};
|
|
35
36
|
Object.defineProperty(exports, "AdEventType", {
|
|
@@ -177,6 +178,12 @@ Object.defineProperty(exports, "useAppOpenAd", {
|
|
|
177
178
|
return _useAppOpenAd.useAppOpenAd;
|
|
178
179
|
}
|
|
179
180
|
});
|
|
181
|
+
Object.defineProperty(exports, "useForeground", {
|
|
182
|
+
enumerable: true,
|
|
183
|
+
get: function () {
|
|
184
|
+
return _useForeground.useForeground;
|
|
185
|
+
}
|
|
186
|
+
});
|
|
180
187
|
Object.defineProperty(exports, "useInterstitialAd", {
|
|
181
188
|
enumerable: true,
|
|
182
189
|
get: function () {
|
|
@@ -220,6 +227,7 @@ var _useAppOpenAd = require("./hooks/useAppOpenAd");
|
|
|
220
227
|
var _useInterstitialAd = require("./hooks/useInterstitialAd");
|
|
221
228
|
var _useRewardedAd = require("./hooks/useRewardedAd");
|
|
222
229
|
var _useRewardedInterstitialAd = require("./hooks/useRewardedInterstitialAd");
|
|
230
|
+
var _useForeground = require("./hooks/useForeground");
|
|
223
231
|
var _constants = require("./common/constants");
|
|
224
232
|
var _types = require("./types");
|
|
225
233
|
Object.keys(_types).forEach(function (key) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_version","require","_MobileAds","_interopRequireWildcard","_AdsConsentDebugGeography","_AdsConsentPurposes","_AdsConsentSpecialFeatures","_AdsConsentStatus","_AdsConsentPrivacyOptionsRequirementStatus","_MaxAdContentRating","_TestIds","_AdEventType","_BannerAdSize","_GAMAdEventType","_RewardedAdEventType","_AdsConsent","_AppOpenAd","_InterstitialAd","_RewardedAd","_RewardedInterstitialAd","_BannerAd","_GAMBannerAd","_GAMInterstitialAd","_useAppOpenAd","_useInterstitialAd","_useRewardedAd","_useRewardedInterstitialAd","_constants","_types","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","newObj","hasPropertyDescriptor","getOwnPropertyDescriptor","desc","set","SDK_VERSION","version"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_version","require","_MobileAds","_interopRequireWildcard","_AdsConsentDebugGeography","_AdsConsentPurposes","_AdsConsentSpecialFeatures","_AdsConsentStatus","_AdsConsentPrivacyOptionsRequirementStatus","_MaxAdContentRating","_TestIds","_AdEventType","_BannerAdSize","_GAMAdEventType","_RewardedAdEventType","_AdsConsent","_AppOpenAd","_InterstitialAd","_RewardedAd","_RewardedInterstitialAd","_BannerAd","_GAMBannerAd","_GAMInterstitialAd","_useAppOpenAd","_useInterstitialAd","_useRewardedAd","_useRewardedInterstitialAd","_useForeground","_constants","_types","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","newObj","hasPropertyDescriptor","getOwnPropertyDescriptor","desc","set","SDK_VERSION","version"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AnB,GAAA,IAAAc,GAAA,CAAAd,GAAA,SAAAmB,MAAA,CAAAH,OAAA,GAAAF,GAAA,MAAAG,KAAA,IAAAA,KAAA,CAAAM,GAAA,CAAAT,GAAA,EAAAK,MAAA,YAAAA,MAAA;AAhDxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACO,MAAMK,WAAW,GAAGC,gBAAO;AAACpB,OAAA,CAAAmB,WAAA,GAAAA,WAAA"}
|
package/lib/commonjs/version.js
CHANGED
|
@@ -0,0 +1,40 @@
|
|
|
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 { useEffect, useRef } from 'react';
|
|
19
|
+
import { AppState } from 'react-native';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* A custom hook that invokes a callback when the app transitions to the foreground.
|
|
23
|
+
*
|
|
24
|
+
* @param {Function} callback - The function to be called when the app has come to the foreground.
|
|
25
|
+
*/
|
|
26
|
+
export function useForeground(callback) {
|
|
27
|
+
const appState = useRef(AppState.currentState);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
const subscription = AppState.addEventListener('change', nextAppState => {
|
|
30
|
+
if (appState.current === 'background' && nextAppState === 'active') {
|
|
31
|
+
callback();
|
|
32
|
+
}
|
|
33
|
+
appState.current = nextAppState;
|
|
34
|
+
});
|
|
35
|
+
return () => {
|
|
36
|
+
subscription.remove();
|
|
37
|
+
};
|
|
38
|
+
}, []);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=useForeground.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","AppState","useForeground","callback","appState","currentState","subscription","addEventListener","nextAppState","current","remove"],"sourceRoot":"../../../src","sources":["hooks/useForeground.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACzC,SAASC,QAAQ,QAAQ,cAAc;;AAEvC;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAACC,QAAoB,EAAE;EAClD,MAAMC,QAAQ,GAAGJ,MAAM,CAACC,QAAQ,CAACI,YAAY,CAAC;EAE9CN,SAAS,CAAC,MAAM;IACd,MAAMO,YAAY,GAAGL,QAAQ,CAACM,gBAAgB,CAAC,QAAQ,EAAEC,YAAY,IAAI;MACvE,IAAIJ,QAAQ,CAACK,OAAO,KAAK,YAAY,IAAID,YAAY,KAAK,QAAQ,EAAE;QAClEL,QAAQ,CAAC,CAAC;MACZ;MACAC,QAAQ,CAACK,OAAO,GAAGD,YAAY;IACjC,CAAC,CAAC;IAEF,OAAO,MAAM;MACXF,YAAY,CAACI,MAAM,CAAC,CAAC;IACvB,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;AACR"}
|
package/lib/module/index.js
CHANGED
|
@@ -43,6 +43,7 @@ export { useAppOpenAd } from './hooks/useAppOpenAd';
|
|
|
43
43
|
export { useInterstitialAd } from './hooks/useInterstitialAd';
|
|
44
44
|
export { useRewardedAd } from './hooks/useRewardedAd';
|
|
45
45
|
export { useRewardedInterstitialAd } from './hooks/useRewardedInterstitialAd';
|
|
46
|
+
export { useForeground } from './hooks/useForeground';
|
|
46
47
|
export { RevenuePrecisions } from './common/constants';
|
|
47
48
|
export * from './types';
|
|
48
49
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["version","SDK_VERSION","default","MobileAds","AdsConsentDebugGeography","AdsConsentPurposes","AdsConsentSpecialFeatures","AdsConsentStatus","AdsConsentPrivacyOptionsRequirementStatus","MaxAdContentRating","TestIds","AdEventType","BannerAdSize","GAMBannerAdSize","GAMAdEventType","RewardedAdEventType","AdsConsent","AppOpenAd","InterstitialAd","RewardedAd","RewardedInterstitialAd","BannerAd","GAMBannerAd","GAMInterstitialAd","useAppOpenAd","useInterstitialAd","useRewardedAd","useRewardedInterstitialAd","RevenuePrecisions"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,OAAO,QAAQ,WAAW;;AAEnC;AACA,OAAO,MAAMC,WAAW,GAAGD,OAAO;AAElC,SAASE,OAAO,EAAEC,SAAS,QAAQ,aAAa;AAChD,SAASC,wBAAwB,QAAQ,4BAA4B;AACrE,SAASC,kBAAkB,QAAQ,sBAAsB;AACzD,SAASC,yBAAyB,QAAQ,6BAA6B;AACvE,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,yCAAyC,QAAQ,6CAA6C;AACvG,SAASC,kBAAkB,QAAQ,sBAAsB;AACzD,SAASC,OAAO,QAAQ,WAAW;AACnC,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,YAAY,EAAEC,eAAe,QAAQ,gBAAgB;AAC9D,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SAASC,mBAAmB,QAAQ,uBAAuB;AAC3D,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,cAAc,QAAQ,sBAAsB;AACrD,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,SAASC,sBAAsB,QAAQ,8BAA8B;AACrE,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,WAAW,QAAQ,mBAAmB;AAC/C,SAASC,iBAAiB,QAAQ,yBAAyB;AAC3D,SAASC,YAAY,QAAQ,sBAAsB;AACnD,SAASC,iBAAiB,QAAQ,2BAA2B;AAC7D,SAASC,aAAa,QAAQ,uBAAuB;AACrD,SAASC,yBAAyB,QAAQ,mCAAmC;AAC7E,SAASC,iBAAiB,QAAQ,oBAAoB;AACtD,cAAc,SAAS"}
|
|
1
|
+
{"version":3,"names":["version","SDK_VERSION","default","MobileAds","AdsConsentDebugGeography","AdsConsentPurposes","AdsConsentSpecialFeatures","AdsConsentStatus","AdsConsentPrivacyOptionsRequirementStatus","MaxAdContentRating","TestIds","AdEventType","BannerAdSize","GAMBannerAdSize","GAMAdEventType","RewardedAdEventType","AdsConsent","AppOpenAd","InterstitialAd","RewardedAd","RewardedInterstitialAd","BannerAd","GAMBannerAd","GAMInterstitialAd","useAppOpenAd","useInterstitialAd","useRewardedAd","useRewardedInterstitialAd","useForeground","RevenuePrecisions"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,OAAO,QAAQ,WAAW;;AAEnC;AACA,OAAO,MAAMC,WAAW,GAAGD,OAAO;AAElC,SAASE,OAAO,EAAEC,SAAS,QAAQ,aAAa;AAChD,SAASC,wBAAwB,QAAQ,4BAA4B;AACrE,SAASC,kBAAkB,QAAQ,sBAAsB;AACzD,SAASC,yBAAyB,QAAQ,6BAA6B;AACvE,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,yCAAyC,QAAQ,6CAA6C;AACvG,SAASC,kBAAkB,QAAQ,sBAAsB;AACzD,SAASC,OAAO,QAAQ,WAAW;AACnC,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,YAAY,EAAEC,eAAe,QAAQ,gBAAgB;AAC9D,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SAASC,mBAAmB,QAAQ,uBAAuB;AAC3D,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,cAAc,QAAQ,sBAAsB;AACrD,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,SAASC,sBAAsB,QAAQ,8BAA8B;AACrE,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,WAAW,QAAQ,mBAAmB;AAC/C,SAASC,iBAAiB,QAAQ,yBAAyB;AAC3D,SAASC,YAAY,QAAQ,sBAAsB;AACnD,SAASC,iBAAiB,QAAQ,2BAA2B;AAC7D,SAASC,aAAa,QAAQ,uBAAuB;AACrD,SAASC,yBAAyB,QAAQ,mCAAmC;AAC7E,SAASC,aAAa,QAAQ,uBAAuB;AACrD,SAASC,iBAAiB,QAAQ,oBAAoB;AACtD,cAAc,SAAS"}
|
package/lib/module/version.js
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A custom hook that invokes a callback when the app transitions to the foreground.
|
|
3
|
+
*
|
|
4
|
+
* @param {Function} callback - The function to be called when the app has come to the foreground.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useForeground(callback: () => void): void;
|
|
7
|
+
//# sourceMappingURL=useForeground.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useForeground.d.ts","sourceRoot":"","sources":["../../../src/hooks/useForeground.ts"],"names":[],"mappings":"AAoBA;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,IAAI,QAejD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "13.
|
|
1
|
+
export declare const SDK_VERSION = "13.6.0";
|
|
2
2
|
export { default, MobileAds } from './MobileAds';
|
|
3
3
|
export { AdsConsentDebugGeography } from './AdsConsentDebugGeography';
|
|
4
4
|
export { AdsConsentPurposes } from './AdsConsentPurposes';
|
|
@@ -23,6 +23,7 @@ export { useAppOpenAd } from './hooks/useAppOpenAd';
|
|
|
23
23
|
export { useInterstitialAd } from './hooks/useInterstitialAd';
|
|
24
24
|
export { useRewardedAd } from './hooks/useRewardedAd';
|
|
25
25
|
export { useRewardedInterstitialAd } from './hooks/useRewardedInterstitialAd';
|
|
26
|
+
export { useForeground } from './hooks/useForeground';
|
|
26
27
|
export { RevenuePrecisions } from './common/constants';
|
|
27
28
|
export * from './types';
|
|
28
29
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,WAAW,WAAU,CAAC;AAEnC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,yCAAyC,EAAE,MAAM,6CAA6C,CAAC;AACxG,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAA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,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,cAAc,SAAS,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "13.
|
|
1
|
+
export declare const version = "13.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": "13.
|
|
3
|
+
"version": "13.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",
|
|
@@ -0,0 +1,41 @@
|
|
|
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 { useEffect, useRef } from 'react';
|
|
19
|
+
import { AppState } from 'react-native';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* A custom hook that invokes a callback when the app transitions to the foreground.
|
|
23
|
+
*
|
|
24
|
+
* @param {Function} callback - The function to be called when the app has come to the foreground.
|
|
25
|
+
*/
|
|
26
|
+
export function useForeground(callback: () => void) {
|
|
27
|
+
const appState = useRef(AppState.currentState);
|
|
28
|
+
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
const subscription = AppState.addEventListener('change', nextAppState => {
|
|
31
|
+
if (appState.current === 'background' && nextAppState === 'active') {
|
|
32
|
+
callback();
|
|
33
|
+
}
|
|
34
|
+
appState.current = nextAppState;
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
return () => {
|
|
38
|
+
subscription.remove();
|
|
39
|
+
};
|
|
40
|
+
}, []);
|
|
41
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -44,5 +44,6 @@ export { useAppOpenAd } from './hooks/useAppOpenAd';
|
|
|
44
44
|
export { useInterstitialAd } from './hooks/useInterstitialAd';
|
|
45
45
|
export { useRewardedAd } from './hooks/useRewardedAd';
|
|
46
46
|
export { useRewardedInterstitialAd } from './hooks/useRewardedInterstitialAd';
|
|
47
|
+
export { useForeground } from './hooks/useForeground';
|
|
47
48
|
export { RevenuePrecisions } from './common/constants';
|
|
48
49
|
export * from './types';
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '13.
|
|
2
|
+
export const version = '13.6.0';
|