fix: don't rerender function

This commit is contained in:
Fredrik Burmester
2025-02-20 17:25:47 +01:00
parent 5447c36bcd
commit 82ced0f101

View File

@@ -10,6 +10,7 @@ import { ListItem } from "../list/ListItem";
import { useTranslation } from "react-i18next";
import { storage } from "@/utils/mmkv";
import { RECENTLY_ADDED_SENT_NOTIFICATIONS_ITEM_IDS_KEY } from "@/utils/recently-added-notifications";
import { useCallback } from "react";
export const StorageSettings = () => {
const { deleteAllFiles, appSizeUsage } = useDownload();
@@ -43,6 +44,10 @@ export const StorageSettings = () => {
return ((value / total) * 100).toFixed(2);
};
const clearRecentlyAddedNotifications = useCallback(() => {
storage.delete(RECENTLY_ADDED_SENT_NOTIFICATIONS_ITEM_IDS_KEY);
}, []);
return (
<View>
<View className="flex flex-col gap-y-1">
@@ -114,9 +119,7 @@ export const StorageSettings = () => {
<ListGroup>
<ListItem
textColor="red"
onPress={() => {
storage.set(RECENTLY_ADDED_SENT_NOTIFICATIONS_ITEM_IDS_KEY, "[]");
}}
onPress={clearRecentlyAddedNotifications}
title={"Reset recently added notifications"}
/>
</ListGroup>