@24jieqi/react-native-brayant-ad 0.1.13 → 0.1.15
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/android/src/main/java/com/brayantad/dy/banner/view/BannerAdView.java +4 -3
- package/ios/PangleAdModule/BannerAdViewManager.m +9 -1
- package/lib/commonjs/dy/component/BannerAd.js +17 -3
- package/lib/commonjs/dy/component/BannerAd.js.map +1 -1
- package/lib/module/dy/component/BannerAd.js +17 -3
- package/lib/module/dy/component/BannerAd.js.map +1 -1
- package/lib/typescript/src/dy/component/BannerAd.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/dy/component/BannerAd.tsx +19 -3
|
@@ -5,6 +5,7 @@ import static com.facebook.react.bridge.UiThreadUtil.runOnUiThread;
|
|
|
5
5
|
import android.app.Activity;
|
|
6
6
|
import android.util.Log;
|
|
7
7
|
import android.view.View;
|
|
8
|
+
import android.view.ViewGroup;
|
|
8
9
|
import android.widget.RelativeLayout;
|
|
9
10
|
|
|
10
11
|
import androidx.annotation.NonNull;
|
|
@@ -63,7 +64,7 @@ public class BannerAdView extends RelativeLayout {
|
|
|
63
64
|
Log.d(TAG, "[DEBUG] setHeight called - codeid=" + _codeid + ", height=" + height + ", current width=" + _expectedWidth);
|
|
64
65
|
_expectedHeight = height;
|
|
65
66
|
|
|
66
|
-
|
|
67
|
+
ViewGroup.LayoutParams params = getLayoutParams();
|
|
67
68
|
if (params != null) {
|
|
68
69
|
params.height = height;
|
|
69
70
|
setLayoutParams(params);
|
|
@@ -228,14 +229,14 @@ public class BannerAdView extends RelativeLayout {
|
|
|
228
229
|
|
|
229
230
|
Log.d(TAG, "[DEBUG] onRenderSuccess - adView added to feed_container");
|
|
230
231
|
|
|
231
|
-
|
|
232
|
+
ViewGroup.LayoutParams containerParams = mExpressContainer.getLayoutParams();
|
|
232
233
|
if (containerParams != null) {
|
|
233
234
|
containerParams.height = (int) height;
|
|
234
235
|
mExpressContainer.setLayoutParams(containerParams);
|
|
235
236
|
Log.d(TAG, "[DEBUG] onRenderSuccess - feed_container LayoutParams updated to height=" + (int) height);
|
|
236
237
|
}
|
|
237
238
|
|
|
238
|
-
|
|
239
|
+
ViewGroup.LayoutParams viewParams = BannerAdView.this.getLayoutParams();
|
|
239
240
|
if (viewParams != null) {
|
|
240
241
|
viewParams.height = (int) height;
|
|
241
242
|
BannerAdView.this.setLayoutParams(viewParams);
|
|
@@ -13,9 +13,17 @@
|
|
|
13
13
|
|
|
14
14
|
@end
|
|
15
15
|
|
|
16
|
+
// BannerAd is currently Android-only
|
|
17
|
+
// This file is kept for potential future iOS support
|
|
18
|
+
// For now, BannerAdViewManager is not registered on iOS to avoid conflicts
|
|
19
|
+
|
|
16
20
|
@implementation BannerAdViewManager
|
|
17
21
|
|
|
18
|
-
|
|
22
|
+
// BannerAd currently only supports Android platform
|
|
23
|
+
// To avoid "Tried to register two views with the same name" error,
|
|
24
|
+
// we do not register this ViewManager on iOS
|
|
25
|
+
// Uncomment the line below if iOS support is added in the future
|
|
26
|
+
// RCT_EXPORT_MODULE(BannerAdViewManager)
|
|
19
27
|
|
|
20
28
|
- (UIView *)view {
|
|
21
29
|
// BannerAd is managed by BannerAd singleton, not a direct view
|
|
@@ -7,11 +7,15 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
10
|
-
|
|
11
|
-
const
|
|
10
|
+
// BannerAd currently only supports Android platform
|
|
11
|
+
const ComponentName = _reactNative.Platform.select({
|
|
12
|
+
android: 'BannerAdViewManager',
|
|
13
|
+
ios: undefined
|
|
14
|
+
});
|
|
15
|
+
const LINKING_ERROR = `The package 'react-native-brayant-ad' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
|
|
12
16
|
ios: "- You have run 'pod install'\n",
|
|
13
17
|
default: ''
|
|
14
|
-
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
18
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n' + '\nNote: BannerAd is currently only supported on Android platform.';
|
|
15
19
|
const BannerAdView = props => {
|
|
16
20
|
const {
|
|
17
21
|
codeid,
|
|
@@ -28,7 +32,17 @@ const BannerAdView = props => {
|
|
|
28
32
|
} = props;
|
|
29
33
|
const [dismissed, setDismissed] = (0, _react.useState)(false);
|
|
30
34
|
const [height, setHeight] = (0, _react.useState)(adHeight);
|
|
35
|
+
|
|
36
|
+
// BannerAd is only supported on Android
|
|
37
|
+
if (_reactNative.Platform.OS !== 'android') {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
31
40
|
if (!visible || dismissed) return null;
|
|
41
|
+
|
|
42
|
+
// Ensure ComponentName is defined for Android
|
|
43
|
+
if (!ComponentName) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
32
46
|
const BannerAdComponent = _reactNative.UIManager.getViewManagerConfig(ComponentName) != null ? (0, _reactNative.requireNativeComponent)(ComponentName) : () => {
|
|
33
47
|
throw new Error(LINKING_ERROR);
|
|
34
48
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ComponentName","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ComponentName","Platform","select","android","ios","undefined","LINKING_ERROR","BannerAdView","props","codeid","style","adWidth","adHeight","onAdRenderSuccess","onAdError","onAdDismiss","onAdClick","onAdShow","onAdDislike","visible","dismissed","setDismissed","useState","height","setHeight","OS","BannerAdComponent","UIManager","getViewManagerConfig","requireNativeComponent","Error","createElement","width","nativeEvent","_default","exports"],"sourceRoot":"../../../../src","sources":["dy/component/BannerAd.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAA2E,SAAAD,wBAAAG,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAL,uBAAA,YAAAA,CAAAG,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAA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,14 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { Platform, requireNativeComponent, UIManager } from 'react-native';
|
|
3
|
-
|
|
4
|
-
const
|
|
3
|
+
// BannerAd currently only supports Android platform
|
|
4
|
+
const ComponentName = Platform.select({
|
|
5
|
+
android: 'BannerAdViewManager',
|
|
6
|
+
ios: undefined
|
|
7
|
+
});
|
|
8
|
+
const LINKING_ERROR = `The package 'react-native-brayant-ad' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
|
|
5
9
|
ios: "- You have run 'pod install'\n",
|
|
6
10
|
default: ''
|
|
7
|
-
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
11
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n' + '\nNote: BannerAd is currently only supported on Android platform.';
|
|
8
12
|
const BannerAdView = props => {
|
|
9
13
|
const {
|
|
10
14
|
codeid,
|
|
@@ -21,7 +25,17 @@ const BannerAdView = props => {
|
|
|
21
25
|
} = props;
|
|
22
26
|
const [dismissed, setDismissed] = useState(false);
|
|
23
27
|
const [height, setHeight] = useState(adHeight);
|
|
28
|
+
|
|
29
|
+
// BannerAd is only supported on Android
|
|
30
|
+
if (Platform.OS !== 'android') {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
24
33
|
if (!visible || dismissed) return null;
|
|
34
|
+
|
|
35
|
+
// Ensure ComponentName is defined for Android
|
|
36
|
+
if (!ComponentName) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
25
39
|
const BannerAdComponent = UIManager.getViewManagerConfig(ComponentName) != null ? requireNativeComponent(ComponentName) : () => {
|
|
26
40
|
throw new Error(LINKING_ERROR);
|
|
27
41
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useState","Platform","requireNativeComponent","UIManager","ComponentName","
|
|
1
|
+
{"version":3,"names":["React","useState","Platform","requireNativeComponent","UIManager","ComponentName","select","android","ios","undefined","LINKING_ERROR","default","BannerAdView","props","codeid","style","adWidth","adHeight","onAdRenderSuccess","onAdError","onAdDismiss","onAdClick","onAdShow","onAdDislike","visible","dismissed","setDismissed","height","setHeight","OS","BannerAdComponent","getViewManagerConfig","Error","createElement","width","e","nativeEvent"],"sourceRoot":"../../../../src","sources":["dy/component/BannerAd.tsx"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAASC,QAAQ,EAAEC,sBAAsB,EAAEC,SAAS,QAAQ,cAAc;AAG1E;AACA,MAAMC,aAAa,GAAGH,QAAQ,CAACI,MAAM,CAAC;EACpCC,OAAO,EAAE,qBAAqB;EAC9BC,GAAG,EAAEC;AACP,CAAC,CAAuB;AAgBxB,MAAMC,aAAa,GACjB,kFAAkF,GAClFR,QAAQ,CAACI,MAAM,CAAC;EAAEE,GAAG,EAAE,gCAAgC;EAAEG,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B,GAC/B,mEAAmE;AAErE,MAAMC,YAAY,GAAIC,KAAoB,IAAK;EAC7C,MAAM;IACJC,MAAM;IACNC,KAAK;IACLC,OAAO,GAAG,GAAG;IACbC,QAAQ,GAAG,EAAE;IACbC,iBAAiB;IACjBC,SAAS;IACTC,WAAW;IACXC,SAAS;IACTC,QAAQ;IACRC,WAAW;IACXC,OAAO,GAAG;EACZ,CAAC,GAAGX,KAAK;EAET,MAAM,CAACY,SAAS,EAAEC,YAAY,CAAC,GAAGzB,QAAQ,CAAC,KAAK,CAAC;EACjD,MAAM,CAAC0B,MAAM,EAAEC,SAAS,CAAC,GAAG3B,QAAQ,CAACgB,QAAQ,CAAC;;EAE9C;EACA,IAAIf,QAAQ,CAAC2B,EAAE,KAAK,SAAS,EAAE;IAC7B,OAAO,IAAI;EACb;EAEA,IAAI,CAACL,OAAO,IAAIC,SAAS,EAAE,OAAO,IAAI;;EAEtC;EACA,IAAI,CAACpB,aAAa,EAAE;IAClB,OAAO,IAAI;EACb;EAEA,MAAMyB,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eAAexB,YAAY","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BannerAd.d.ts","sourceRoot":"","sources":["../../../../../src/dy/component/BannerAd.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"BannerAd.d.ts","sourceRoot":"","sources":["../../../../../src/dy/component/BannerAd.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAQ9C,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iBAAiB,CAAC,EAAE,QAAQ,CAAC;IAC7B,SAAS,CAAC,EAAE,QAAQ,CAAC;IACrB,WAAW,CAAC,EAAE,QAAQ,CAAC;IACvB,SAAS,CAAC,EAAE,QAAQ,CAAC;IACrB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,WAAW,CAAC,EAAE,QAAQ,CAAC;CACxB;AASD,QAAA,MAAM,YAAY,GAAI,OAAO,aAAa,6BAoEzC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { Platform, requireNativeComponent, UIManager } from 'react-native';
|
|
3
3
|
import type { ViewStyle } from 'react-native';
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
// BannerAd currently only supports Android platform
|
|
6
|
+
const ComponentName = Platform.select({
|
|
7
|
+
android: 'BannerAdViewManager',
|
|
8
|
+
ios: undefined,
|
|
9
|
+
}) as string | undefined;
|
|
5
10
|
|
|
6
11
|
export interface BannerAdProps {
|
|
7
12
|
codeid: string;
|
|
@@ -18,10 +23,11 @@ export interface BannerAdProps {
|
|
|
18
23
|
}
|
|
19
24
|
|
|
20
25
|
const LINKING_ERROR =
|
|
21
|
-
`The package 'react-native-
|
|
26
|
+
`The package 'react-native-brayant-ad' doesn't seem to be linked. Make sure: \n\n` +
|
|
22
27
|
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
23
28
|
'- You rebuilt the app after installing the package\n' +
|
|
24
|
-
'- You are not using Expo Go\n'
|
|
29
|
+
'- You are not using Expo Go\n' +
|
|
30
|
+
'\nNote: BannerAd is currently only supported on Android platform.';
|
|
25
31
|
|
|
26
32
|
const BannerAdView = (props: BannerAdProps) => {
|
|
27
33
|
const {
|
|
@@ -41,8 +47,18 @@ const BannerAdView = (props: BannerAdProps) => {
|
|
|
41
47
|
const [dismissed, setDismissed] = useState(false);
|
|
42
48
|
const [height, setHeight] = useState(adHeight);
|
|
43
49
|
|
|
50
|
+
// BannerAd is only supported on Android
|
|
51
|
+
if (Platform.OS !== 'android') {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
|
|
44
55
|
if (!visible || dismissed) return null;
|
|
45
56
|
|
|
57
|
+
// Ensure ComponentName is defined for Android
|
|
58
|
+
if (!ComponentName) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
|
|
46
62
|
const BannerAdComponent =
|
|
47
63
|
UIManager.getViewManagerConfig(ComponentName) != null
|
|
48
64
|
? requireNativeComponent<BannerAdProps>(ComponentName)
|