feat(banner): allow adaptive banners to use their container's width #674
+365
−90
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
In a project I’m working on, I need to apply horizontal padding to adaptive banners for better integration with my app's UI.
Currently, it's not possible to give adaptive banners a width different from the screen width, as mentioned in the stale issue #287.
If the parent view has a different width, padding, or margin, the banner may not display correctly, and parts of it could be cut off.
This PR adds possibility for adaptive banners to take their container's width, as suggested by @dylancom in #296 (comment))
I believe this should be the default behaviour for adaptive banner. but to avoid introducing a breaking change. I added a new prop
adaptiveMode
to enable this functionality:- MAIN_SCREEN (default): Keeps the existing behavior where the banner takes the screen width.
- CONTAINER: Allows the adaptive banners to use their container's width, with the ad reloaded when the width changes.
Related issues
#287
Release Summary
Allow adaptive banners to use their container's width.
Checklist
and followed the process outlined there for submitting PRs.
Android
iOS
e2e
tests added or updated in__tests__e2e__
jest
tests added or updated in__tests__
Test Plan
example.mp4
Think
react-native-google-mobile-ads
is great? Please consider supporting the project with any of the below:Invertase
on Twitter🔥