Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

mobile: show delete-all button only when items are in list

Ammar Ahmedee48990c90ad
diff --git a/apps/mobile/app/screens/settings/failed-inbox-items.tsx b/apps/mobile/app/screens/settings/failed-inbox-items.tsx
index cb09c13f4..9beb1dfb9 100644
--- a/apps/mobile/app/screens/settings/failed-inbox-items.tsx
+++ b/apps/mobile/app/screens/settings/failed-inbox-items.tsx
@@ -195,26 +195,30 @@ export const FailedInboxItems = () => {
title={strings.failedInboxItems()}
canGoBack={true}
id="Settings"
- rightButton={{
- name: "delete",
- color: colors.primary.icon,
- onPress: async () => {
- presentDialog({
- title: strings.deleteAll(),
- paragraph: strings.deleteAllFailedItemsDesc(),
- positiveText: strings.delete(),
- positiveType: "errorShade",
- positivePress: async () => {
- if (result.status !== "pending") {
- await db.inboxItemsHistory.deleteFailed();
- result.refresh();
- }
+ rightButton={
+ items?.length > 0
+ ? {
+ name: "delete",
+ color: colors.primary.icon,
+ onPress: async () => {
+ presentDialog({
+ title: strings.deleteAll(),
+ paragraph: strings.deleteAllFailedItemsDesc(),
+ positiveText: strings.delete(),
+ positiveType: "errorShade",
+ positivePress: async () => {
+ if (result.status !== "pending") {
+ await db.inboxItemsHistory.deleteFailed();
+ result.refresh();
+ }
- return true;
+ return true;
+ }
+ });
+ }
}
- });
- }
- }}
+ : undefined
+ }
/>
{result.status === "pending" ? (