<br />

Google Mobile Ads SDK for React Native supports fixed ad sizes for your banner ads. For details on
banner ads, see [Set up banner ads](https://developers.google.com/admob/react-native/banner.md.txt).

## Set a fixed ad size

To set a fixed ad size, pass a fixed [`AdSize`](https://developers.google.com/admob/react-native/reference.md.txt#AdSize) constant
when calling the [`BannerAd.load`](https://developers.google.com/admob/react-native/reference/class/BannerAd#BannerAd.load) method.

The following example passes the ad size and ad unit ID, logs a message
on success, and logs an error on failure:

```tsx
BannerAd.load(
  {
    adUnitId: 'AD_UNIT_ID',
    adSize: AdSize.BANNER,
  },
  {
    // Called when an ad has finished loading.
    onAdLoaded: (_ad) => {
      console.log('Fixed size banner ad loaded successfully.');
    },
    // Called when an ad request fails.
    onAdFailedToLoad: (error: LoadAdError) => {
      console.error('Failed to load fixed size banner:', error.message);
    },
  },
);
```

Replace `AD_UNIT_ID` with your ad unit ID.

## Choose a banner size

The following table lists the standard banner sizes:

| Size in dp (width x height) | Description | Availability | AdSize constant |
|---|---|---|---|
| 320x50 | Banner | Phones and tablets | `AdSize.BANNER` |
| 320x100 | Large banner | Phones and tablets | `AdSize.LARGE_BANNER` |
| 300x250 | IAB medium rectangle | Phones and tablets | `AdSize.MEDIUM_RECTANGLE` |
| 468x60 | IAB full-size banner | Tablets | `AdSize.FULL_BANNER` |
| 728x90 | IAB leaderboard | Tablets | `AdSize.LEADERBOARD` |

## Ensure sufficient container size

The view container size to place your banner ad must be at least as large as
the banner. Padding decreases the size of your container. If the banner doesn't
fit the container, the ad doesn't show and the request fails. Refresh requests
fail with a [`LoadAdError`](https://developers.google.com/admob/react-native/reference/class/LoadAdError.md.txt) object, which invokes the
[`onAdFailedToRefresh`](https://developers.google.com/admob/react-native/reference/interface/BannerAdViewProps#BannerAdViewProps.onAdFailedToRefresh) callback.

On Android, Google Mobile Ads SDK for React Native logs a warning in Logcat:

    W/Ads: Not enough space to show ad. Needs 320x50 dp, but only has 288x495 dp.