Skip to content

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

mobile: fix sort options not working in trash

Ammar Ahmed4f212453a6e4
diff --git a/apps/mobile/app/components/sheets/sort/index.tsx b/apps/mobile/app/components/sheets/sort/index.tsx
index 981256648..12faec218 100644
--- a/apps/mobile/app/components/sheets/sort/index.tsx
+++ b/apps/mobile/app/components/sheets/sort/index.tsx
@@ -148,10 +148,15 @@ const Sort = ({
>
{Object.keys(SORT).map((item) => {
const sortOptionVisibility = {
- relevance: screen === "Search",
- dueDate: screen === "Reminders",
- dateModified: screen === "Tags" || screen === "Reminders",
- dateEdited: screen !== "Tags" && screen !== "Reminders"
+ dateCreated: groupType !== "trash",
+ relevance: groupType === "search",
+ dueDate: groupType === "reminders",
+ dateModified: groupType === "reminders" || groupType === "tags",
+ dateEdited:
+ groupType !== "tags" &&
+ groupType !== "reminders" &&
+ groupType !== "trash",
+ dateDeleted: groupType === "trash"
};
// Check if this sort option should be skipped for the current screen
@@ -179,10 +184,7 @@ const Sort = ({
onPress={async () => {
const _groupOptions: GroupOptions = {
...groupOptions,
- sortBy:
- type === "trash"
- ? "dateDeleted"
- : (item as SortOptions["sortBy"])
+ sortBy: item as SortOptions["sortBy"]
};
await updateGroupOptions(_groupOptions);
}}
diff --git a/apps/mobile/app/utils/constants.ts b/apps/mobile/app/utils/constants.ts
index 12aa6656a..cd54ea844 100644
--- a/apps/mobile/app/utils/constants.ts
+++ b/apps/mobile/app/utils/constants.ts
@@ -48,7 +48,8 @@ export const SORT = {
dateCreated: "Date created",
title: "Title",
dueDate: "Due date",
- relevance: "Relevance"
+ relevance: "Relevance",
+ dateDeleted: "Date deleted"
};
export const itemSkus = [