React Native
For the complete documentation index, see llms.txt. This page is also available as markdown.

Export Wallet on React Native

Reveal the seed phrase or private key via WebView

The web export hooks, useExportWallet and useExportPrivateKey, are not available on React Native.

Export can't go through a plain hook — the secret must never touch your JS. Use ZeroDevExportWebView instead: it renders Turnkey's export iframe inside an isolated WebView, so the plaintext stays in the iframe's context.

This flow requires an Expo development build — see the quickstart.

Install peer dependencies

It needs react-native-webview and uuid (native module — rebuild the dev client afterwards):

npx expo install react-native-webview uuid
npx expo run:android   # or: npx expo run:ios
yarn expo install react-native-webview uuid
yarn expo run:android   # or: yarn expo run:ios
pnpm expo install react-native-webview uuid
pnpm expo run:android   # or: pnpm expo run:ios
bunx expo install react-native-webview uuid
bunx expo run:android   # or: bunx expo run:ios

Add the component

import { ZeroDevExportWebView } from "@zerodev/wallet-react/react-native/export/webview";
import { useState } from "react";
import { Button, Text } from "react-native";

export function ExportWallet() {
  const [show, setShow] = useState(false);
  const [ready, setReady] = useState(false);
  const [error, setError] = useState<string | null>(null);

  return (
    <>
      <Button title="Export wallet" onPress={() => setShow(true)} />

      {show && !ready && !error ? <Text>Loading…</Text> : null}
      {error ? <Text style={{ color: "red" }}>{error}</Text> : null}

      {show && !error ? (
        <ZeroDevExportWebView
          kind="wallet"
          onReady={() => setReady(true)}
          onError={(message) => setError(message)}
          style={ready ? { height: 240 } : { height: 0 }}
        />
      ) : null}
    </>
  );
}
  • onReady fires once the secret is on screen → flips ready, which clears the "Loading…" line and gives the WebView its height.
  • onError captures the message → the !error guard unmounts the WebView and the red error line shows instead.
  • The loading message shows while mounted-but-not-yet-ready (show && !ready && !error).
  • Use kind="privateKey" to export the account's private key instead of the seed phrase.

How it stays secure

Mounting the component starts the export; unmounting it dismisses the secret. The decrypted seed phrase or private key is only ever rendered inside Turnkey's export iframe within the WebView — it never crosses into your app's JavaScript context.

On this page