Skip to content

Commit

Permalink
feat(admob, ios): add adaptive banner support (#4565)
Browse files Browse the repository at this point in the history
* feat: adaptive banner support
* refactor: move size determination to stringToAdSize
* fix: typo and ios only note
  • Loading branch information
dylancom authored Nov 17, 2020
1 parent 01bce1f commit ce8ac1a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/admob/ios/RNFBAdMob/RNFBAdMobCommon.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions packages/admob/lib/BannerAdSize.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

export default {
BANNER: 'BANNER',
ADAPTIVE_BANNER: 'ADAPTIVE_BANNER',
FULL_BANNER: 'FULL_BANNER',
LARGE_BANNER: 'LARGE_BANNER',
LEADERBOARD: 'LEADERBOARD',
Expand Down
7 changes: 7 additions & 0 deletions packages/admob/lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down

1 comment on commit ce8ac1a

@vercel
Copy link

@vercel vercel bot commented on ce8ac1a Nov 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.