> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dynamic.xyz/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Migrate React Native from expo-secure-store to react-native-keychain

> Swap the legacy React Native SDK's secure-storage dependency from expo-secure-store to react-native-keychain.

The legacy React Native SDK (`@dynamic-labs/legacy-react-native-extension`) has moved its secure-storage dependency from [`expo-secure-store`](https://docs.expo.dev/versions/latest/sdk/securestore/) to [`react-native-keychain`](https://github.com/oblador/react-native-keychain). This is a breaking change for any app that installed the SDK directly or through its peer dependencies.

> [!NOTE]
>
> No code changes are required. The SDK manages the storage layer internally; you only need to update your dependency list and rebuild the native layer.

> [!NOTE]
>
> The legacy React Native SDK packages have been renamed with a `legacy-` prefix. When you update your dependencies, use `@dynamic-labs/legacy-react-native-extension` (and `legacy-client`, `legacy-react-hooks`, `legacy-viem-extension`, etc.) instead of the unprefixed names. The installation docs already reflect these names.

## What changes

| Before | After |
| - | - |
| `expo-secure-store` installed | `react-native-keychain` installed |
| `@dynamic-labs/react-native-extension` (and related packages) | `@dynamic-labs/legacy-react-native-extension` (and related `legacy-*` packages) |
| Native build linked `ExpoSecureStore` | Native build links `RNKeychainManager` |

## Migration steps

**1. Replace the dependency**

Remove `expo-secure-store` from your project and install `react-native-keychain`.

> [tab] npm
>
> ```bash theme={"system"}
> npm uninstall expo-secure-store
> npm install react-native-keychain@^10.0.0
> ```

> [tab] yarn
>
> ```bash theme={"system"}
> yarn remove expo-secure-store
> yarn add react-native-keychain@^10.0.0
> ```

> [tab] pnpm
>
> ```bash theme={"system"}
> pnpm remove expo-secure-store
> pnpm add react-native-keychain@^10.0.0
> ```

> [tab] Expo
>
> ```bash theme={"system"}
> npm uninstall expo-secure-store
> npx expo install react-native-keychain@^10.0.0
> ```
>
> > [!NOTE]
> >
> > Replace `npm uninstall` with your package manager's remove command (`yarn remove` or `pnpm remove`) if you are not using npm.

**2. Clean and reinstall**

Delete your lockfile and native build folders so the new dependency is the only secure-storage native module linked.

> [!WARNING]
>
> Only delete `ios/` and `android/` if you generated them from `npx expo prebuild` and have no manual native changes. Back up any custom native code first.

```bash theme={"system"}
rm -rf node_modules ios android package-lock.json
npm install
```

**3. Rebuild the native layer**

For Expo managed or bare workflows, regenerate and rebuild the native projects.

> [tab] Expo (managed)
>
> ```bash theme={"system"}
> npx expo prebuild
> npx expo run:ios
> npx expo run:android
> ```

> [tab] Bare React Native
>
> ```bash theme={"system"}
> cd ios && pod install && cd ..
> npx react-native run-ios
> npx react-native run-android
> ```

> [tab] EAS Build
>
> ```bash theme={"system"}
> eas build --profile <your-profile> --platform all
> ```

## Verify the migration

After rebuilding, confirm that:

* `expo-secure-store` no longer appears in your lockfile.
* `react-native-keychain` appears in `node_modules`.
* Your app builds and the SDK initializes without a secure-storage error.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.