NZME / react-native-ad-manager

Google Ad Manager bridge for React Native
MIT License
51 stars 61 forks source link

[Android&iOS] - Wrong setup for correlator property #135

Open gladiuscode opened 1 month ago

gladiuscode commented 1 month ago

Hi!

We noticed that there is an issue with the correlator property. From JS-side typescript tells us to supply this property inside the targeting object, although such property is instead read from the the correlator prop. This prop isn't properly typed.

We've patched the lib and we will open a pull request soon.

gladiuscode commented 1 month ago

This is the patch we've setup to fix typescript issues:

diff --git a/node_modules/react-native-ad-manager/src/AdManagerTypes.ts b/node_modules/react-native-ad-manager/src/AdManagerTypes.ts
index d814551..a8e78f4 100644
--- a/node_modules/react-native-ad-manager/src/AdManagerTypes.ts
+++ b/node_modules/react-native-ad-manager/src/AdManagerTypes.ts
@@ -44,11 +44,6 @@ export interface IAdManagerTargeting {
    *  information to third-party ad networks if required.
    */
   location?: IAdManagerTargetingLocation;
-
-  /**
-   * Correlator string to pass to ad loader.
-   */
-  correlator?: string;
 }

 export interface IAdManagerTemplateImage {
diff --git a/node_modules/react-native-ad-manager/src/CTKAdManagerAdaptiveBanner.tsx b/node_modules/react-native-ad-manager/src/CTKAdManagerAdaptiveBanner.tsx
index b20a336..fe83bfc 100644
--- a/node_modules/react-native-ad-manager/src/CTKAdManagerAdaptiveBanner.tsx
+++ b/node_modules/react-native-ad-manager/src/CTKAdManagerAdaptiveBanner.tsx
@@ -44,6 +44,11 @@ interface IAdManagerAdaptiveBannerPropsBase extends ViewProps {
   testDevices?: string[];

   targeting?: IAdManagerTargeting;
+
+  /**
+   * Correlator string to pass to ad loader.
+   */
+  correlator?: string;
 }

 interface IAdManagerAdaptiveBannerProps
diff --git a/node_modules/react-native-ad-manager/src/CTKAdManagerBanner.tsx b/node_modules/react-native-ad-manager/src/CTKAdManagerBanner.tsx
index d3130cb..87cd7c9 100644
--- a/node_modules/react-native-ad-manager/src/CTKAdManagerBanner.tsx
+++ b/node_modules/react-native-ad-manager/src/CTKAdManagerBanner.tsx
@@ -52,6 +52,11 @@ interface IAdManagerBannerPropsBase extends ViewProps {
   testDevices?: string[];

   targeting?: IAdManagerTargeting;
+
+  /**
+   * Correlator string to pass to ad loader.
+   */
+  correlator?: string;
 }

 interface IAdManagerBannerProps extends IAdManagerBannerPropsBase {
diff --git a/node_modules/react-native-ad-manager/src/native-ads/withNativeAd.tsx b/node_modules/react-native-ad-manager/src/native-ads/withNativeAd.tsx
index fef346b..0049556 100644
--- a/node_modules/react-native-ad-manager/src/native-ads/withNativeAd.tsx
+++ b/node_modules/react-native-ad-manager/src/native-ads/withNativeAd.tsx
@@ -31,12 +31,12 @@ import { LINKING_ERROR } from '../Constants';
  */
 interface INativeAdPropsBase extends ViewProps {
   adSize?: string;
-  correlator?: string;
   customTemplateIds?: string[];
   validAdSizes?: string[];
   validAdTypes?: ('banner' | 'native' | 'template')[];
   customClickTemplateIds?: string[];
   targeting?: IAdManagerTargeting;
+  correlator?: string;
 }

 interface INativeAdNativeProps extends INativeAdPropsBase {