OptionalmanualWhether to enable the manual impression counting.
After setting this value to true, call recordManualImpression() from the ref object.
import { GAMBannerAd, BannerAdSize, TestIds } from 'react-native-google-mobile-ads';
function HomeScreen() {
const ref = useRef<GAMBannerAd>(null);
const recordManualImpression = () => {
ref.current?.recordManualImpression();
}
return (
<GAMBannerAd
ref={ref}
unitId={TestIds.GAM_BANNER}
sizes={[BannerAdSize.FULL_BANNER]}
manualImpressionsEnabled={true}
/>
);
}
OptionalmaxLimit inline adaptive banner height. By default, inline adaptive banners instantiated without a maxHeight value have a maxHeight equal to the device height.
OptionalonCalled when a click is recorded for an ad. Prefer this over onAdOpened
when counting taps or hiding the banner after N clicks.
OptionalonCalled when a full-screen overlay presented after a banner click has been dismissed and the user returns to the app.
OptionalonWhen an ad has failed to load.
Additive reason / phase / responseInfo fields ride on the Error
instance (Error & Partial<AdErrorPayload>) so existing
(error: Error) => void handlers stay assignable under strictFunctionTypes.
OptionalonCalled when an impression is recorded for an ad.
OptionalonWhen an ad has finished loading.
OptionalonCalled when a full-screen overlay is about to be presented after a banner
click (in-app browser / interstitial overlay). Not every click presents an
overlay — on iOS many creatives leave the app without this callback. Use
onAdClicked to observe every recorded click.
OptionalonWhen an ad received Ad Manager specific app events.
OptionalonCalled when ad generates revenue. See: https://developers.google.com/admob/android/impression-level-ad-revenue
OptionalonCalled when ad size dimensions changed
OptionalrequestThe request options for this banner.
The available sizes of the banner. Can be a array of predefined sizes via BannerAdSize or custom dimensions, e.g. 300x200.
Inventory must be available for the banner sizes specified, otherwise a no-fill error will be sent to onAdFailedToLoad.
The Google Mobile Ads unit ID for the banner.
OptionalwidthSets the width for adaptive banners (inline and anchored). If not specified, the width defaults to the full device width.
An interface for a GAM Banner advert component.
Example
The
GAMBannerAdinterface is exposed as a React component, allowing you to integrate ads within your existing React Native code base. The component itself is isolated, meaning any standardViewprops (e.g.style) are not forwarded on. It is recommended you wrap theGAMBannerAdwithin your ownViewif you wish to apply custom props for use-cases such as positioning.