From ce8ac1ac5542f24aeab9df4d7f638c831f12b31a Mon Sep 17 00:00:00 2001 From: Dylan Date: Tue, 17 Nov 2020 21:09:09 +0100 Subject: [PATCH] feat(admob, ios): add adaptive banner support (#4565) * feat: adaptive banner support * refactor: move size determination to stringToAdSize * fix: typo and ios only note --- packages/admob/ios/RNFBAdMob/RNFBAdMobCommon.m | 3 +++ packages/admob/lib/BannerAdSize.js | 1 + packages/admob/lib/index.d.ts | 7 +++++++ 3 files changed, 11 insertions(+) diff --git a/packages/admob/ios/RNFBAdMob/RNFBAdMobCommon.m b/packages/admob/ios/RNFBAdMob/RNFBAdMobCommon.m index 23d514a04e..fbb74d7d80 100644 --- a/packages/admob/ios/RNFBAdMob/RNFBAdMobCommon.m +++ b/packages/admob/ios/RNFBAdMob/RNFBAdMobCommon.m @@ -181,6 +181,9 @@ + (GADAdSize)stringToAdSize:(NSString *)value { return kGADAdSizeLeaderboard; } else if ([value isEqualToString:@"SMART_BANNER"]) { return kGADAdSizeSmartBannerPortrait; + } else if ([value isEqualToString:@"ADAPTIVE_BANNER"]) { + CGFloat viewWidth = [[UIScreen mainScreen]bounds].size.width; + return GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(viewWidth); } else { return kGADAdSizeBanner; } diff --git a/packages/admob/lib/BannerAdSize.js b/packages/admob/lib/BannerAdSize.js index 274725342a..ead444103e 100644 --- a/packages/admob/lib/BannerAdSize.js +++ b/packages/admob/lib/BannerAdSize.js @@ -18,6 +18,7 @@ export default { BANNER: 'BANNER', + ADAPTIVE_BANNER: 'ADAPTIVE_BANNER', FULL_BANNER: 'FULL_BANNER', LARGE_BANNER: 'LARGE_BANNER', LEADERBOARD: 'LEADERBOARD', diff --git a/packages/admob/lib/index.d.ts b/packages/admob/lib/index.d.ts index 921d2db4e6..50583170ea 100644 --- a/packages/admob/lib/index.d.ts +++ b/packages/admob/lib/index.d.ts @@ -237,6 +237,13 @@ export namespace FirebaseAdMobTypes { */ SMART_BANNER: 'SMART_BANNER'; + /** + * A (next generation) dynamically sized banner that is full-width and auto-height. + * + * iOS only + */ + ADAPTIVE_BANNER: 'ADAPTIVE_BANNER'; + /** * A dynamically sized banner that matches its parent's width and expands/contracts its height to match the ad's content after loading completes. */