---
metadata:
  - name: generator
    content: Diplodoc Platform v5.52.0
alternate:
  - https://ads.yandex.com/helpcenter/en/dev/react-native/react-native-migration-800.md
  - https://ads.yandex.com/helpcenter/ru/dev/react-native/react-native-migration-800.md
  - https://ads.yandex.com/helpcenter/zh/dev/react-native/react-native-migration-800.md
  - href: en/dev/react-native/react-native-migration-800.md
    type: text/markdown
    title: Markdown version
  - href: llms.txt
    type: text/markdown
    title: llms.txt
---
> **Documentation Index:** Fetch the complete configuration index at https://ads.yandex.com/helpcenter/en/llms.txt

# Guide for migrating to version 8

Plugin version 8.0.0 removes some callbacks and APIs that are incompatible with the new native SDK. This guide lists the code changes you need.


## 1. Removed `BannerView` callbacks

The following `BannerView` props are removed and no longer supported:

| Prop | Platform |
|------|----------|
| `onLeftApplication` | iOS, Android |
| `onWillPresentScreen` | iOS |
| `onDidDismissScreen` | iOS |
| `onReturnToApplication` | Android |
| `onAdClose` | iOS, Android |

**What to do:** remove these props everywhere you use `BannerView`.

#### Before

```tsx
<BannerView
  adRequest={{ adUnitId: 'R-M-XXXXX-YY' }}
  size={adSize}
  onAdLoaded={() => console.log('loaded')}
  onAdClicked={() => console.log('clicked')}
  onLeftApplication={() => console.log('left app')}
  onWillPresentScreen={() => console.log('will present')}
  onDidDismissScreen={() => console.log('did dismiss')}
  onReturnToApplication={() => console.log('returned')}
  onAdClose={() => console.log('closed')}
  onAdImpression={(e) => console.log('impression', e)}
  onAdFailedToLoad={(e) => console.log('failed', e)}
/>
```

#### After

```tsx
<BannerView
  adRequest={{ adUnitId: 'R-M-XXXXX-YY' }}
  size={adSize}
  onAdLoaded={() => console.log('loaded')}
  onAdClicked={() => console.log('clicked')}
  onAdImpression={(e) => console.log('impression', e)}
  onAdFailedToLoad={(e) => console.log('failed', e)}
/>
```

## 2. Replace `AdRequestConfiguration` with `AdRequest`

`AdRequestConfiguration` is removed. Pass request parameters, including `adUnitId`, directly to `loadAd` as `AdRequestParams`.

**What to do:**

- remove imports and construction of `AdRequestConfiguration`;
- pass `adUnitId` and other fields directly to `loadAd`.

#### Before

```tsx
import { InterstitialAdLoader, AdRequestConfiguration, Gender } from '@yandex-ads/react-native-yandex-ads';

const loader = await InterstitialAdLoader.create();
const config = new AdRequestConfiguration({
  adUnitId: 'R-M-XXXXX-YY',
  age: '25',
  gender: Gender.Male,
});
const ad = await loader.loadAd(config);
```

#### After

```tsx
import { InterstitialAdLoader, Gender } from '@yandex-ads/react-native-yandex-ads';

const loader = await InterstitialAdLoader.create();
const ad = await loader.loadAd({
  adUnitId: 'R-M-XXXXX-YY',
  targeting: {
    age: '25',
    gender: Gender.Male,
  },
});
```

The same applies to `RewardedAdLoader` and `AppOpenAdLoader`.

## 3. Move `adUnitId` from `BannerView` props into `adRequest`

The `adUnitId` prop is removed from `BannerView`. The ad unit ID is now a required field inside `adRequest`.

**What to do:** remove the `adUnitId` prop and set `adRequest.adUnitId`.

#### Before

```tsx
<BannerView
  adUnitId="R-M-XXXXX-YY"
  size={adSize}
/>
```

#### After

```tsx
<BannerView
  size={adSize}
  adRequest={{ adUnitId: 'R-M-XXXXX-YY' }}
/>
```

## 4. Move targeting into a `targeting` object

`age`, `gender`, `location`, `contextQuery`, and `contextTags` are nested under `targeting` for fullscreen formats and `BannerView`.

**What to do:** wrap those fields in `targeting: { ... }`.

### Fullscreen (interstitial, rewarded, app open)

#### Before

```ts
loader.loadAd({
  adUnitId: 'R-M-XXXXX-YY',
  age: '25',
  gender: Gender.Male,
  contextTags: ['sport', 'news'],
});
```

#### After

```tsx
loader.loadAd({
  adUnitId: 'R-M-XXXXX-YY',
  targeting: {
    age: '25',
    gender: Gender.Male,
    contextTags: ['sport', 'news'],
  },
});
```

### `BannerView`

#### Before

```tsx
import { Gender } from '@yandex-ads/react-native-yandex-ads';

<BannerView
  adUnitId="R-M-XXXXX-YY"
  size={adSize}
  adRequest={{ age: '25', gender: Gender.Male }}
/>
```

#### After

```tsx
import { Gender } from '@yandex-ads/react-native-yandex-ads';

<BannerView
  size={adSize}
  adRequest={{ adUnitId: 'R-M-XXXXX-YY', targeting: { age: '25', gender: Gender.Male } }}
/>
```

## 5. New `AdInfo` interface

Version 8.0.0 adds `AdInfo` with metadata for a loaded ad.

```ts
interface AdInfo {
  adUnitId: string;
  extraData?: string;
  partnerText?: string;
  creatives: Creative[];
}

interface Creative {
  creativeId?: string;
  campaignId?: string;
  placeId?: string;
  offerId?: string;
}
```

### `AdInfo` for fullscreen formats

`InterstitialAd`, `RewardedAd`, and `AppOpenAd` expose an `adInfo` getter:

```ts
const ad = await loader.loadAd({ adUnitId: 'R-M-XXXXX-YY' });
console.log(ad.adInfo?.adUnitId);
console.log(ad.adInfo?.creatives);
```

### `AdInfo` in `BannerView`

`onAdLoaded` receives an event with `adInfo`:

```tsx
<BannerView
  size={adSize}
  adRequest={{ adUnitId: 'R-M-XXXXX-YY' }}
  onAdLoaded={(event) => {
    const adInfo = event.nativeEvent.adInfo;
    console.log(adInfo?.adUnitId);
  }}
/>
```

## 6. Version requirements

### iOS

- **Xcode**: 16.4 or later.
- **AppMetricaCore**: 6.0.0 or later.
- **AppMetricaLibraryAdapter**: 6.0.0 or later.
- **AppMetricaAdSupport**: 6.0.0 or later.
- **AppMetricaIDSync**: 6.0.0 or later.

### Android

- **Gradle**: 7.0 or later.
- **Android Gradle Plugin**: 8.3.2 or later.
- **Android SDK**: API 21 (Android 5.0) or later.
- **Kotlin**: 1.9.0 or later.
- **Java**: 8 or later.
