Skip to content

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

mobile: fix crash when clicking sort button in trash

Ammar Ahmed72e41167738f
diff --git a/apps/mobile/app/components/sheets/sort/index.tsx b/apps/mobile/app/components/sheets/sort/index.tsx
index 49f275d59..4f241f6f9 100644
--- a/apps/mobile/app/components/sheets/sort/index.tsx
+++ b/apps/mobile/app/components/sheets/sort/index.tsx
@@ -54,7 +54,11 @@ const Sort = ({
const { colors } = useThemeColors();
const [groupOptions, setGroupOptions] = useState(
db.settings.getGroupOptions(
- screen === "Notes" ? "home" : ((type + "s") as GroupingKey)
+ screen === "Notes"
+ ? "home"
+ : screen === "Trash"
+ ? "trash"
+ : ((type + "s") as GroupingKey)
)
);
const updateGroupOptions = async (_groupOptions: GroupOptions) => {
@@ -185,7 +189,7 @@ const Sort = ({
]()}
</Paragraph>
- {groupOptions.sortBy === item ? (
+ {groupOptions?.sortBy === item ? (
<AppIcon
size={AppFontSize.lg}
name="check"