# Migrating from v11

Batch React-Native Plugin v12 is a major release which introduces **important breaking changes** from 11.x. This guide describes how to update your application when using a previous version.

### Upgrading the SDK version

***

To upgrade from v11 to v12, you need to change the SDK version to `12.0.0` in your `package.json` and then run:

{% tabs %}
{% tab title="Yarn" %}

```bash
yarn install
```

{% endtab %}

{% tab title="NPM" %}

```bash
npm install
```

{% endtab %}
{% endtabs %}

### Expo support

***

This version **removed support of Expo** from the `@batch.com/react-native-plugin` package. A new dedicated plugin has been added to manage Expo integration.&#x20;

So, if your application use Expo, please install the new npm package:

```
npx expo install @batch.com/expo-plugin
```

{% hint style="warning" %}
Do not remove the `@batch.com/react-native-plugin` dependency from your package.json. The expo-plugin is only a config plugin designed to automatically set up the native configuration for the Batch React-Native-Plugin during the expo pre-build.
{% endhint %}

Then replace `@batch.com/react-native-plugin"` by `@batch.com/expo-plugin"`  in your `app.json` file:

{% code title="app.json" lineNumbers="true" fullWidth="false" %}

```json
  "plugins": [
      [
        //"@batch.com/react-native-plugin",
        "@batch.com/expo-plugin",
        {
          // ...
        }
      ]
    ],
```

{% endcode %}

{% hint style="info" %}
If you were using the configuration field `shouldUseNonNullableIntent` introduced in v11.1, you can now remove it.
{% endhint %}

If you want to run your app locally, do not forget to run the `expo prebuild --clean` command to rebuild the app with the plugin changes.

### Core migration

***

#### Legacy Architecture

Batch-React-Native-Plugin is now a pure Turbo Module and does not support the legacy architecture anymore since react-native is [freezing the legacy architecture](https://github.com/reactwg/react-native-new-architecture/discussions/290) codebase and React-Native 0.82 no longer allows opting out, and Expo SDK 54 is the final release to include it.&#x20;

{% hint style="info" %}
If you are still on the legacy architecture and do not plan to migrate on the new one, please use the Batch-React-Native-Plugin v11.
{% endhint %}

#### React Native CLI

Batch no longer requires a custom React Native CLI configuration anymore.

&#x20;If `react-native.config.js` only exists for Batch in your project, please delete it or remove the `@batch.com/react-native-plugin` entry:

{% code title="react-native.config.js" %}

```javascript
module.exports = {
  dependencies: {
   // Remove from here
    '@batch.com/react-native-plugin': {
      platforms: {
        android: {
          packageInstance: 'new RNBatchPackage(this.getApplication())',
        },
      },
    },
    // To here
  },
};

```

{% endcode %}

### Android specifics

***

If you are using Expo, you can skip this section.

#### SDK Integration

Since the react-native cli configuration has been removed, you have to manually initialize the sdk from your Android native project to complete your setup.

Please update your `MainApplication` file as following:

{% tabs %}
{% tab title="Kotlin" %}

<pre class="language-kotlin" data-title="MainApplication.kt"><code class="lang-kotlin">import com.batch.batch_rn.RNBatchModule

<strong>override fun onCreate() {
</strong>    super.onCreate()
    // ...
    RNBatchModule.initialize(this)
}
</code></pre>

{% endtab %}

{% tab title="Java" %}
{% code title="MainApplication.java" %}

```java
import com.batch.batch_rn.RNBatchModule
 
@Override
public void onCreate() {
   super.onCreate();
   // ...
   RNBatchModule.initialize(this);
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### Do Not Disturb (DnD)&#x20;

The initial state of the "Do Not Disturb" (DnD) feature is no longer read from the Android resources. You should now add a meta-data tag `batch_do_not_disturb_initial_state` to the \<application> section of your `AndroidManifest`.

So if your application enable the initial DnD state, please update as following :

* Start by removing the old configuration field from your `build.gradle` file:

{% code title="build.gradle" %}

```gradle
defaultConfig {
    // ...
    resValue("bool", "BATCH_DO_NOT_DISTURB_INITIAL_STATE", "true") // Remove this line
}
```

{% endcode %}

* Then add the new flag to your `AndroidManifest.xml` :

{% code title="AndroidManifest.xml" %}

```xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
  ...
  <application android:name=".MainApplication" ...>
    ...
    <meta-data android:name="batch_do_not_disturb_initial_state" android:value="true"/>
  </application>
</manifest>
```

{% endcode %}

***

To see in details what's precisely changed since v11 please consult our [changelog](https://doc.batch.com/developer/sdk/sdk-changelog#id-9.0.0).
