fix: show toasts on every screen, including the Unified Inbox and contacts

Only the tab screens and the viewer had a toast host, so a viewer
action that failed after going back to the Unified Inbox or a contact
(both stack screens of their own) raised a toast nobody saw.

Every stack screen now gets a host through the navigator's
`screenLayout`, and only the focused screen's host renders, so the
screen kept live under the top one never shows the same toast a second
time. The tab screens' and the viewer's own hosts are gone.
This commit is contained in:
Linus Rath
2026-09-24 20:12:17 +02:00
parent e0b72883ac
commit cd911ada79
3 changed files with 26 additions and 10 deletions
+4 -3
View File
@@ -9,9 +9,10 @@ import { useToastStore, type Toast } from '../stores/toast-store';
import { useLocaleStore } from '../stores/locale-store';
/**
* Renders the toast queue above the tab bar. One host is mounted in App.tsx;
* the email undo snackbar keeps its own component because it is bound to
* the email store's pending-undo entry.
* Renders the toast queue above the tab bar. App.tsx gives every stack screen
* one and only the focused screen's renders; the email undo snackbar keeps
* its own component because it is bound to the email store's pending-undo
* entry.
*/
export function ToastHost(): React.ReactElement | null {
const toasts = useToastStore((s) => s.toasts);
-4
View File
@@ -18,7 +18,6 @@ import { MoveSheet } from '../components/MoveSheet';
import { ThreadMessageCard, ThreadCardPlaceholder } from '../components/email/ThreadMessageCard';
import { QuickReplyBox } from '../components/email/QuickReplyBox';
import { AddressActionSheet } from '../components/email/AddressActionSheet';
import { ToastHost } from '../components/ToastHost';
import { useEmailStore } from '../stores/email-store';
import { toast } from '../stores/toast-store';
import {
@@ -895,9 +894,6 @@ function EmailViewer({ route, navigation }: Props) {
/>
<AddressActionSheet address={addressSheet} onClose={() => setAddressSheet(null)} />
{/* The list's host sits under this screen; failures in here need their own. */}
<ToastHost />
</SafeAreaView>
);
}