setupad-prebid-react-native 0.1.6 → 0.1.7

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.
@@ -77,6 +77,33 @@ using namespace facebook::react;
77
77
  [super updateProps:props oldProps:oldProps];
78
78
  }
79
79
 
80
+ - (void)handleCommand:(const NSString *)commandName args:(const NSArray *)args
81
+ {
82
+ NSLog(@"VeonPrebid iOS: handleCommand: %@", commandName);
83
+
84
+ if ([commandName isEqualToString:@"loadBanner"]) {
85
+ [_view performSelector:@selector(loadBanner)];
86
+ } else if ([commandName isEqualToString:@"showBanner"]) {
87
+ [_view performSelector:@selector(showBanner)];
88
+ } else if ([commandName isEqualToString:@"hideBanner"]) {
89
+ [_view performSelector:@selector(hideBanner)];
90
+ } else if ([commandName isEqualToString:@"loadInterstitial"]) {
91
+ [_view performSelector:@selector(loadInterstitial)];
92
+ } else if ([commandName isEqualToString:@"showInterstitial"]) {
93
+ [_view performSelector:@selector(showInterstitial)];
94
+ } else if ([commandName isEqualToString:@"hideInterstitial"]) {
95
+ [_view performSelector:@selector(hideInterstitial)];
96
+ } else if ([commandName isEqualToString:@"pauseAuction"]) {
97
+ [_view performSelector:@selector(pauseAuction)];
98
+ } else if ([commandName isEqualToString:@"resumeAuction"]) {
99
+ [_view performSelector:@selector(resumeAuction)];
100
+ } else if ([commandName isEqualToString:@"destroyAuction"]) {
101
+ [_view performSelector:@selector(destroyAuction)];
102
+ } else {
103
+ [super handleCommand:commandName args:args];
104
+ }
105
+ }
106
+
80
107
  - (void)updateEventEmitter:(EventEmitter::Shared const &)eventEmitter
81
108
  {
82
109
  [super updateEventEmitter:eventEmitter];
@@ -1,21 +1,9 @@
1
1
  "use strict";
2
2
 
3
3
  import { useRef, useImperativeHandle, forwardRef, useCallback } from 'react';
4
- import { UIManager, findNodeHandle, StyleSheet, View } from 'react-native';
5
- import VeonPrebidReactNativeView from './VeonPrebidReactNativeViewNativeComponent';
4
+ import { StyleSheet, View } from 'react-native';
5
+ import VeonPrebidReactNativeView, { Commands } from './VeonPrebidReactNativeViewNativeComponent';
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
- // Command IDs - must match ViewManager (starts from 0 in iOS Old Architecture!)
8
- const Commands = {
9
- loadBanner: 0,
10
- showBanner: 1,
11
- hideBanner: 2,
12
- loadInterstitial: 3,
13
- showInterstitial: 4,
14
- hideInterstitial: 5,
15
- pauseAuction: 6,
16
- resumeAuction: 7,
17
- destroyAuction: 8
18
- };
19
7
  const VeonPrebidAd = /*#__PURE__*/forwardRef((props, ref) => {
20
8
  const {
21
9
  adType,
@@ -32,26 +20,35 @@ const VeonPrebidAd = /*#__PURE__*/forwardRef((props, ref) => {
32
20
  style
33
21
  } = props;
34
22
  const viewRef = useRef(null);
35
- const executeCommand = useCallback((commandName, commandId) => {
36
- const node = findNodeHandle(viewRef.current);
37
- if (!node) {
38
- console.warn(`Cannot execute ${commandName} - view not mounted`);
39
- return;
40
- }
41
- console.log(`Executing ${commandName} (ID: ${commandId}) on node: ${node}`);
42
- UIManager.dispatchViewManagerCommand(node, commandId, []);
43
- }, []);
44
23
  useImperativeHandle(ref, () => ({
45
- loadBanner: () => executeCommand('loadBanner', Commands.loadBanner),
46
- showBanner: () => executeCommand('showBanner', Commands.showBanner),
47
- hideBanner: () => executeCommand('hideBanner', Commands.hideBanner),
48
- loadInterstitial: () => executeCommand('loadInterstitial', Commands.loadInterstitial),
49
- showInterstitial: () => executeCommand('showInterstitial', Commands.showInterstitial),
50
- hideInterstitial: () => executeCommand('hideInterstitial', Commands.hideInterstitial),
51
- pauseAuction: () => executeCommand('pauseAuction', Commands.pauseAuction),
52
- resumeAuction: () => executeCommand('resumeAuction', Commands.resumeAuction),
53
- destroyAuction: () => executeCommand('destroyAuction', Commands.destroyAuction)
54
- }), [executeCommand]);
24
+ loadBanner: () => {
25
+ if (viewRef.current) Commands.loadBanner(viewRef.current);
26
+ },
27
+ showBanner: () => {
28
+ if (viewRef.current) Commands.showBanner(viewRef.current);
29
+ },
30
+ hideBanner: () => {
31
+ if (viewRef.current) Commands.hideBanner(viewRef.current);
32
+ },
33
+ loadInterstitial: () => {
34
+ if (viewRef.current) Commands.loadInterstitial(viewRef.current);
35
+ },
36
+ showInterstitial: () => {
37
+ if (viewRef.current) Commands.showInterstitial(viewRef.current);
38
+ },
39
+ hideInterstitial: () => {
40
+ if (viewRef.current) Commands.hideInterstitial(viewRef.current);
41
+ },
42
+ pauseAuction: () => {
43
+ if (viewRef.current) Commands.pauseAuction(viewRef.current);
44
+ },
45
+ resumeAuction: () => {
46
+ if (viewRef.current) Commands.resumeAuction(viewRef.current);
47
+ },
48
+ destroyAuction: () => {
49
+ if (viewRef.current) Commands.destroyAuction(viewRef.current);
50
+ }
51
+ }), []);
55
52
  const handleAdLoaded = useCallback(event => {
56
53
  const data = event.nativeEvent;
57
54
  console.log('Ad loaded:', data);
@@ -1 +1 @@
1
- {"version":3,"names":["useRef","useImperativeHandle","forwardRef","useCallback","UIManager","findNodeHandle","StyleSheet","View","VeonPrebidReactNativeView","jsx","_jsx","Commands","loadBanner","showBanner","hideBanner","loadInterstitial","showInterstitial","hideInterstitial","pauseAuction","resumeAuction","destroyAuction","VeonPrebidAd","props","ref","adType","configId","adUnitId","width","height","refreshInterval","onAdLoaded","onAdDisplayed","onAdFailed","onAdClicked","onAdClosed","style","viewRef","executeCommand","commandName","commandId","node","current","console","warn","log","dispatchViewManagerCommand","handleAdLoaded","event","data","nativeEvent","handleAdDisplayed","handleAdFailed","error","sdkType","handleAdClicked","handleAdClosed","containerStyle","overflow","children","absoluteFill","displayName"],"sourceRoot":"../../src","sources":["VeonPrebidAd.tsx"],"mappings":";;AAAA,SAASA,MAAM,EAAEC,mBAAmB,EAAEC,UAAU,EAAEC,WAAW,QAAQ,OAAO;AAC5E,SACEC,SAAS,EACTC,cAAc,EACdC,UAAU,EACVC,IAAI,QAEC,cAAc;AACrB,OAAOC,yBAAyB,MAAM,4CAA4C;AAAC,SAAAC,GA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EAAEA,MAAiB;MACzBC,eAAe,EAAEA,eAA0B;MAC3CC,UAAU,EAAEgB,cAAe;MAC3Bf,aAAa,EAAEmB,iBAAkB;MACjClB,UAAU,EAAEmB,cAAe;MAC3BlB,WAAW,EAAEqB,eAAgB;MAC7BpB,UAAU,EAAEqB;IAAe,CAC5B;EAAC,CACE,CAAC;AAEX,CACF,CAAC;AAEDlC,YAAY,CAACuC,WAAW,GAAG,cAAc;AAEzC,eAAevC,YAAY","ignoreList":[]}
1
+ {"version":3,"names":["useRef","useImperativeHandle","forwardRef","useCallback","StyleSheet","View","VeonPrebidReactNativeView","Commands","jsx","_jsx","VeonPrebidAd","props","ref","adType","configId","adUnitId","width","height","refreshInterval","onAdLoaded","onAdDisplayed","onAdFailed","onAdClicked","onAdClosed","style","viewRef","loadBanner","current","showBanner","hideBanner","loadInterstitial","showInterstitial","hideInterstitial","pauseAuction","resumeAuction","destroyAuction","handleAdLoaded","event","data","nativeEvent","console","log","handleAdDisplayed","handleAdFailed","error","sdkType","handleAdClicked","handleAdClosed","containerStyle","overflow","children","absoluteFill","displayName"],"sourceRoot":"../../src","sources":["VeonPrebidAd.tsx"],"mappings":";;AAAA,SAASA,MAAM,EAAEC,mBAAmB,EAAEC,UAAU,EAAEC,WAAW,QAAQ,OAAO;AAC5E,SACEC,UAAU,EACVC,IAAI,QAEC,cAAc;AACrB,OAAOC,yBAAyB,IAAIC,QAAQ,QAAQ,4CAA4C;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAGjG,MAAMC,YAAY,gBAAGR,UAAU,CAC7B,CAACS,KAAK,EAAEC,GAAG,KAAK;EACd,MAAM;IACJC,MAAM;IACNC,QAAQ;IACRC,QAAQ;IACRC,KAAK;IACLC,MAAM;IACNC,eAAe,GAAG,EAAE;IACpBC,UAAU;IACVC,aAAa;IACbC,UAAU;IACVC,WAAW;IACXC,UAAU;IACVC;EACF,CAAC,GAAGb,KAAK;EAET,MAAMc,OAAO,GAAGzB,MAAM,CAAM,IAAI,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e,IAAI,CAAC;EACpB,CAAC,EACD,CAACf,UAAU,CACb,CAAC;EAED,MAAMyB,cAAyB,GAAG;IAChCC,QAAQ,EAAE,QAAQ;IAClB,IAAIpC,MAAM,KAAK,QAAQ,IAAIG,KAAK,IAAIC,MAAM,GACtC;MAAED,KAAK;MAAEC;IAAO,CAAC,GACjB;MAAED,KAAK,EAAE,CAAC;MAAEC,MAAM,EAAE;IAAE,CAAC,CAAC;IAC5B,IAAIO,KAAK,IAAI,CAAC,CAAC;EACjB,CAAC;EAED,oBACEf,IAAA,CAACJ,IAAI;IAACmB,KAAK,EAAEwB,cAAe;IAAAE,QAAA,eAC1BzC,IAAA,CAACH,yBAAyB;MACxBM,GAAG,EAAEa,OAAQ;MACbD,KAAK,EAAEpB,UAAU,CAAC+C,YAAa;MAC/BtC,MAAM,EAAEA,MAAO;MACfC,QAAQ,EAAEA,QAAS;MACnBC,QAAQ,EAAEA,QAAS;MACnBC,KAAK,EAAEA,KAAgB;MACvBC,MAAM,EAAEA,MAAiB;MACzBC,eAAe,EAAEA,eAA0B;MAC3CC,UAAU,EAAEiB,cAAe;MAC3BhB,aAAa,EAAEsB,iBAAkB;MACjCrB,UAAU,EAAEsB,cAAe;MAC3BrB,WAAW,EAAEwB,eAAgB;MAC7BvB,UAAU,EAAEwB;IAAe,CAC5B;EAAC,CACE,CAAC;AAEX,CACF,CAAC;AAEDrC,YAAY,CAAC0C,WAAW,GAAG,cAAc;AAEzC,eAAe1C,YAAY","ignoreList":[]}
@@ -1,9 +1,10 @@
1
- import type { ViewProps } from 'react-native';
1
+ import type { HostComponent, ViewProps } from 'react-native';
2
2
  import type {
3
3
  Int32,
4
4
  DirectEventHandler,
5
5
  } from 'react-native/Libraries/Types/CodegenTypes';
6
6
  import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
7
+ import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
7
8
 
8
9
  /**
9
10
  * Event payload for ad events
@@ -44,6 +45,34 @@ export interface NativeProps extends ViewProps {
44
45
  onAdClosed?: DirectEventHandler<AdEventPayload>;
45
46
  }
46
47
 
48
+ type ComponentType = HostComponent<NativeProps>;
49
+
50
+ export interface NativeCommands {
51
+ loadBanner: (viewRef: React.ElementRef<ComponentType>) => void;
52
+ showBanner: (viewRef: React.ElementRef<ComponentType>) => void;
53
+ hideBanner: (viewRef: React.ElementRef<ComponentType>) => void;
54
+ loadInterstitial: (viewRef: React.ElementRef<ComponentType>) => void;
55
+ showInterstitial: (viewRef: React.ElementRef<ComponentType>) => void;
56
+ hideInterstitial: (viewRef: React.ElementRef<ComponentType>) => void;
57
+ pauseAuction: (viewRef: React.ElementRef<ComponentType>) => void;
58
+ resumeAuction: (viewRef: React.ElementRef<ComponentType>) => void;
59
+ destroyAuction: (viewRef: React.ElementRef<ComponentType>) => void;
60
+ }
61
+
62
+ export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
63
+ supportedCommands: [
64
+ 'loadBanner',
65
+ 'showBanner',
66
+ 'hideBanner',
67
+ 'loadInterstitial',
68
+ 'showInterstitial',
69
+ 'hideInterstitial',
70
+ 'pauseAuction',
71
+ 'resumeAuction',
72
+ 'destroyAuction',
73
+ ],
74
+ });
75
+
47
76
  /**
48
77
  * Native component for Veon Prebid ads
49
78
  */
@@ -1 +1 @@
1
- {"version":3,"file":"VeonPrebidAd.d.ts","sourceRoot":"","sources":["../../../src/VeonPrebidAd.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAe,MAAM,SAAS,CAAC;AAe5E,QAAA,MAAM,YAAY,4GAkIjB,CAAC;AAIF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"VeonPrebidAd.d.ts","sourceRoot":"","sources":["../../../src/VeonPrebidAd.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAe,MAAM,SAAS,CAAC;AAE5E,QAAA,MAAM,YAAY,4GA8HjB,CAAC;AAIF,eAAe,YAAY,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { ViewProps } from 'react-native';
1
+ import type { HostComponent, ViewProps } from 'react-native';
2
2
  import type { Int32, DirectEventHandler } from 'react-native/Libraries/Types/CodegenTypes';
3
3
  /**
4
4
  * Event payload for ad events
@@ -30,6 +30,19 @@ export interface NativeProps extends ViewProps {
30
30
  onAdClicked?: DirectEventHandler<AdEventPayload>;
31
31
  onAdClosed?: DirectEventHandler<AdEventPayload>;
32
32
  }
33
+ type ComponentType = HostComponent<NativeProps>;
34
+ export interface NativeCommands {
35
+ loadBanner: (viewRef: React.ElementRef<ComponentType>) => void;
36
+ showBanner: (viewRef: React.ElementRef<ComponentType>) => void;
37
+ hideBanner: (viewRef: React.ElementRef<ComponentType>) => void;
38
+ loadInterstitial: (viewRef: React.ElementRef<ComponentType>) => void;
39
+ showInterstitial: (viewRef: React.ElementRef<ComponentType>) => void;
40
+ hideInterstitial: (viewRef: React.ElementRef<ComponentType>) => void;
41
+ pauseAuction: (viewRef: React.ElementRef<ComponentType>) => void;
42
+ resumeAuction: (viewRef: React.ElementRef<ComponentType>) => void;
43
+ destroyAuction: (viewRef: React.ElementRef<ComponentType>) => void;
44
+ }
45
+ export declare const Commands: NativeCommands;
33
46
  /**
34
47
  * Native component for Veon Prebid ads
35
48
  */
@@ -1 +1 @@
1
- {"version":3,"file":"VeonPrebidReactNativeViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/VeonPrebidReactNativeViewNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EACV,KAAK,EACL,kBAAkB,EACnB,MAAM,2CAA2C,CAAC;AAGnD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,oDAAoD;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,uBAAuB;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,sCAAsC;IACtC,KAAK,CAAC,EAAE,KAAK,CAAC;IAEd,uCAAuC;IACvC,MAAM,CAAC,EAAE,KAAK,CAAC;IAEf,6DAA6D;IAC7D,eAAe,CAAC,EAAE,KAAK,CAAC;IAGxB,UAAU,CAAC,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAC;IAChD,aAAa,CAAC,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAC;IACnD,UAAU,CAAC,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAC;IAChD,WAAW,CAAC,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAC;IACjD,UAAU,CAAC,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAC;CACjD;AAED;;GAEG;;;;AACH,wBAAgF"}
1
+ {"version":3,"file":"VeonPrebidReactNativeViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/VeonPrebidReactNativeViewNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,KAAK,EACV,KAAK,EACL,kBAAkB,EACnB,MAAM,2CAA2C,CAAC;AAInD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,oDAAoD;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,uBAAuB;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,mCAAm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O,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC;IAClE,cAAc,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC;CACpE;AAED,eAAO,MAAM,QAAQ,EAAE,cAYrB,CAAC;AAEH;;GAEG;;;;AACH,wBAAgF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "setupad-prebid-react-native",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Prebid SDK for React Native",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -1,27 +1,12 @@
1
1
  import { useRef, useImperativeHandle, forwardRef, useCallback } from 'react';
2
2
  import {
3
- UIManager,
4
- findNodeHandle,
5
3
  StyleSheet,
6
4
  View,
7
5
  type ViewStyle,
8
6
  } from 'react-native';
9
- import VeonPrebidReactNativeView from './VeonPrebidReactNativeViewNativeComponent';
7
+ import VeonPrebidReactNativeView, { Commands } from './VeonPrebidReactNativeViewNativeComponent';
10
8
  import type { VeonPrebidAdProps, AdController, AdEventData } from './types';
11
9
 
12
- // Command IDs - must match ViewManager (starts from 0 in iOS Old Architecture!)
13
- const Commands = {
14
- loadBanner: 0,
15
- showBanner: 1,
16
- hideBanner: 2,
17
- loadInterstitial: 3,
18
- showInterstitial: 4,
19
- hideInterstitial: 5,
20
- pauseAuction: 6,
21
- resumeAuction: 7,
22
- destroyAuction: 8,
23
- } as const;
24
-
25
10
  const VeonPrebidAd = forwardRef<AdController, VeonPrebidAdProps>(
26
11
  (props, ref) => {
27
12
  const {
@@ -41,42 +26,38 @@ const VeonPrebidAd = forwardRef<AdController, VeonPrebidAdProps>(
41
26
 
42
27
  const viewRef = useRef<any>(null);
43
28
 
44
- const executeCommand = useCallback(
45
- (commandName: string, commandId: number) => {
46
- const node = findNodeHandle(viewRef.current);
47
- if (!node) {
48
- console.warn(`Cannot execute ${commandName} - view not mounted`);
49
- return;
50
- }
51
-
52
- console.log(
53
- `Executing ${commandName} (ID: ${commandId}) on node: ${node}`
54
- );
55
- UIManager.dispatchViewManagerCommand(node, commandId, []);
56
- },
57
- []
58
- );
59
-
60
29
  useImperativeHandle(
61
30
  ref,
62
31
  () => ({
63
- loadBanner: () => executeCommand('loadBanner', Commands.loadBanner),
64
- showBanner: () => executeCommand('showBanner', Commands.showBanner),
65
- hideBanner: () => executeCommand('hideBanner', Commands.hideBanner),
66
- loadInterstitial: () =>
67
- executeCommand('loadInterstitial', Commands.loadInterstitial),
68
- showInterstitial: () =>
69
- executeCommand('showInterstitial', Commands.showInterstitial),
70
- hideInterstitial: () =>
71
- executeCommand('hideInterstitial', Commands.hideInterstitial),
72
- pauseAuction: () =>
73
- executeCommand('pauseAuction', Commands.pauseAuction),
74
- resumeAuction: () =>
75
- executeCommand('resumeAuction', Commands.resumeAuction),
76
- destroyAuction: () =>
77
- executeCommand('destroyAuction', Commands.destroyAuction),
32
+ loadBanner: () => {
33
+ if (viewRef.current) Commands.loadBanner(viewRef.current);
34
+ },
35
+ showBanner: () => {
36
+ if (viewRef.current) Commands.showBanner(viewRef.current);
37
+ },
38
+ hideBanner: () => {
39
+ if (viewRef.current) Commands.hideBanner(viewRef.current);
40
+ },
41
+ loadInterstitial: () => {
42
+ if (viewRef.current) Commands.loadInterstitial(viewRef.current);
43
+ },
44
+ showInterstitial: () => {
45
+ if (viewRef.current) Commands.showInterstitial(viewRef.current);
46
+ },
47
+ hideInterstitial: () => {
48
+ if (viewRef.current) Commands.hideInterstitial(viewRef.current);
49
+ },
50
+ pauseAuction: () => {
51
+ if (viewRef.current) Commands.pauseAuction(viewRef.current);
52
+ },
53
+ resumeAuction: () => {
54
+ if (viewRef.current) Commands.resumeAuction(viewRef.current);
55
+ },
56
+ destroyAuction: () => {
57
+ if (viewRef.current) Commands.destroyAuction(viewRef.current);
58
+ },
78
59
  }),
79
- [executeCommand]
60
+ []
80
61
  );
81
62
 
82
63
  const handleAdLoaded = useCallback(
@@ -1,9 +1,10 @@
1
- import type { ViewProps } from 'react-native';
1
+ import type { HostComponent, ViewProps } from 'react-native';
2
2
  import type {
3
3
  Int32,
4
4
  DirectEventHandler,
5
5
  } from 'react-native/Libraries/Types/CodegenTypes';
6
6
  import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
7
+ import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
7
8
 
8
9
  /**
9
10
  * Event payload for ad events
@@ -44,6 +45,34 @@ export interface NativeProps extends ViewProps {
44
45
  onAdClosed?: DirectEventHandler<AdEventPayload>;
45
46
  }
46
47
 
48
+ type ComponentType = HostComponent<NativeProps>;
49
+
50
+ export interface NativeCommands {
51
+ loadBanner: (viewRef: React.ElementRef<ComponentType>) => void;
52
+ showBanner: (viewRef: React.ElementRef<ComponentType>) => void;
53
+ hideBanner: (viewRef: React.ElementRef<ComponentType>) => void;
54
+ loadInterstitial: (viewRef: React.ElementRef<ComponentType>) => void;
55
+ showInterstitial: (viewRef: React.ElementRef<ComponentType>) => void;
56
+ hideInterstitial: (viewRef: React.ElementRef<ComponentType>) => void;
57
+ pauseAuction: (viewRef: React.ElementRef<ComponentType>) => void;
58
+ resumeAuction: (viewRef: React.ElementRef<ComponentType>) => void;
59
+ destroyAuction: (viewRef: React.ElementRef<ComponentType>) => void;
60
+ }
61
+
62
+ export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
63
+ supportedCommands: [
64
+ 'loadBanner',
65
+ 'showBanner',
66
+ 'hideBanner',
67
+ 'loadInterstitial',
68
+ 'showInterstitial',
69
+ 'hideInterstitial',
70
+ 'pauseAuction',
71
+ 'resumeAuction',
72
+ 'destroyAuction',
73
+ ],
74
+ });
75
+
47
76
  /**
48
77
  * Native component for Veon Prebid ads
49
78
  */