Skip to main content
<MoonPayConnectionReset> is a headless component (renders nothing visible) that clears the customer’s MoonPay connection for this partner. It is the declarative alternative to client.resetConnection(). Mount this component after clearing your own local auth state to signal to MoonPay that the customer has signed out. Unmount it after you receive the "complete" event (or on error). The reset completes or times out within 5 seconds.
SignOutScreen.tsx
import React from "react";
import {
  MoonPayConnectionReset,
  type ConnectionResetEvent,
} from "@moonpay/platform-sdk-react-native";

export function SignOutScreen({ onDone }: { onDone: () => void }) {
  const [resetting, setResetting] = React.useState(true);

  const handleEvent = (event: ConnectionResetEvent) => {
    if (event.kind === "complete") {
      setResetting(false);
      onDone();
    }
    if (event.kind === "error") {
      console.error(event.payload.message);
      setResetting(false);
      onDone();
    }
  };

  return <>{resetting && <MoonPayConnectionReset onEvent={handleEvent} />}</>;
}

Props

PropTypeRequiredDescription
onEvent(event: ConnectionResetEvent) => voidCallback for reset lifecycle events. See ConnectionResetEvent.
This component renders nothing visible (0×0). It has no style prop.

ConnectionResetEvent

kindPayloadWhen you receive it
"complete"The connection was successfully reset.
"error"{ message: string }The reset failed or timed out. Unmount and continue.