Explorar el Código

small badge fix

Viktoriia hace 8 meses
padre
commit
316f4fbd71
Se han modificado 1 ficheros con 3 adiciones y 0 borrados
  1. 3 0
      src/screens/InAppScreens/MessagesScreen/ChatScreen/index.tsx

+ 3 - 0
src/screens/InAppScreens/MessagesScreen/ChatScreen/index.tsx

@@ -59,6 +59,7 @@ import { NAVIGATION_PAGES } from 'src/types';
 import { usePushNotification } from 'src/contexts/PushNotificationContext';
 import ReactionsListModal from '../Components/ReactionsListModal';
 import { dismissChatNotifications } from '../utils';
+import { useMessagesStore } from 'src/stores/unreadMessagesStore';
 
 const options = {
   enableVibrateFallback: true,
@@ -121,6 +122,7 @@ const ChatScreen = ({ route }: { route: any }) => {
   const { isSubscribed } = usePushNotification();
   const [isLoadingEarlier, setIsLoadingEarlier] = useState(false);
   const [hasMoreMessages, setHasMoreMessages] = useState(true);
+  const updateUnreadMessagesCount = useMessagesStore((state) => state.updateUnreadMessagesCount);
 
   const appState = useRef(AppState.currentState);
 
@@ -141,6 +143,7 @@ const ChatScreen = ({ route }: { route: any }) => {
 
     return () => {
       if (unsubscribe) unsubscribe();
+      updateUnreadMessagesCount();
     };
   }, [id]);