Docyrus

EmailComposeDialog

Bottom-sheet launcher for the EmailComposer, wired to the Docyrus messaging API through useDocyrusEmailComposer.

iOSAndroidExpo Go
Preview EmailComposeDialog on your device

Scan with Expo Go

Download Expo Go, then scan the QR code to preview native components.

Installation

pnpm dlx @docyrus/cli add @docyrus/rn-email-compose-dialog
Required Packages(2 packages)
pnpm add @tanstack/react-query @docyrus/api-client

The dialog opens a full-height bottom AwesomeDialog sheet with the EmailComposer. The inner form mounts only while the sheet is open, so useDocyrusEmailComposer seeds fresh from to / cc / bcc / subject / body, and the accounts (GET /v1/messaging/email/accounts) and mention users (GET /v1/users) are only fetched while it is visible. A successful send shows a toast (mount a <Toaster />), calls onSent and closes the sheet.

Sending needs the Messaging.Email.Send scope. A QueryClientProvider must be mounted above it.

Email value renderers and form fields open this dialog automatically when you pass them a client (and no onComposeEmail).

Usage

import { useDocyrusClient } from '@docyrus/signin/react-native';

import { EmailComposeDialog } from '@/components/docyrus-native/email-compose-dialog';

const client = useDocyrusClient();

// Default trigger: a mail icon button
<EmailComposeDialog client={client} to={['alice@acme.com']} subject="Quick question" />

// Controlled, no trigger
<EmailComposeDialog client={client} trigger={null} open={open} onOpenChange={setOpen} onSent={r => console.log(r.accepted)} />

API Reference

PropTypeDefaultDescription
clientRestApiClient-Authenticated Docyrus REST client (required)
tostring[]-Pre-filled To
ccstring[]-Pre-filled Cc
bccstring[]-Pre-filled Bcc
subjectstring-Pre-filled subject
bodystring-Pre-filled HTML body
triggerReactNode | null-Trigger node (default: mail icon button); null renders none
openboolean-Controlled open state
onOpenChange(open: boolean) => void-Open state change callback
titlestring'Compose email'Sheet title
disabledboolean-Disables the default trigger
sendAsUserboolean-Send through the tenant account with the user identity
slashCommandsEmailComposerSlashCommand[]-Slash commands forwarded to the composer
onSent(result: DocyrusEmailSendResult) => void-Called after a successful send
classNamestring-Trigger classes

Type Exports

TypeDescription
EmailComposeDialogPropsProps

Differences from web

  • The dialog is a full-height bottom sheet with keyboard avoidance.
  • A custom trigger is wrapped in a Pressable.
  • The toast is the native toast.

On this page