From 5065abdc4ef372498ca9076adf212bbe8e2c9794 Mon Sep 17 00:00:00 2001 From: Krishna Gupta Date: Sat, 13 Apr 2024 15:34:24 +0530 Subject: [PATCH] clear selected members data when navigating from ReportParticipantsPage. Signed-off-by: Krishna Gupta --- src/pages/ReportParticipantsPage.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/pages/ReportParticipantsPage.tsx b/src/pages/ReportParticipantsPage.tsx index f635499a286f..f6415ae9fa7d 100755 --- a/src/pages/ReportParticipantsPage.tsx +++ b/src/pages/ReportParticipantsPage.tsx @@ -1,4 +1,5 @@ -import React, {useCallback, useMemo, useRef, useState} from 'react'; +import {useIsFocused} from '@react-navigation/native'; +import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'; import {InteractionManager, View} from 'react-native'; import type {TextInput} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; @@ -58,6 +59,14 @@ function ReportParticipantsPage({report, personalDetails, session}: ReportPartic const currentUserAccountID = Number(session?.accountID); const isCurrentUserAdmin = ReportUtils.isGroupChatAdmin(report, currentUserAccountID); const isGroupChat = useMemo(() => ReportUtils.isGroupChat(report), [report]); + const isFocused = useIsFocused(); + + useEffect(() => { + if (isFocused) { + return; + } + setSelectedMembers([]); + }, [isFocused]); const getUsers = useCallback((): MemberOption[] => { let result: MemberOption[] = [];