Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/pages/ReportParticipantRoleSelectionPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import {View} from 'react-native';
import type {ValueOf} from 'type-fest';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import ScreenWrapper from '@components/ScreenWrapper';
import SelectionList from '@components/SelectionListWithSections';
import RadioListItem from '@components/SelectionListWithSections/RadioListItem';
import type {ListItem} from '@components/SelectionListWithSections/types';
import SelectionList from '@components/SelectionList';
import RadioListItem from '@components/SelectionList/ListItem/RadioListItem';
import type {ListItem} from '@components/SelectionList/ListItem/types';
import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
import * as Report from '@libs/actions/Report';
import {updateGroupChatMemberRoles} from '@libs/actions/Report';
import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types';
import Navigation from '@navigation/Navigation';
import type {ParticipantsNavigatorParamList} from '@navigation/types';
Expand All @@ -30,7 +30,7 @@ function ReportParticipantRoleSelectionPage({report, route}: ReportParticipantRo
const styles = useThemeStyles();

const accountID = Number(route?.params?.accountID) ?? -1;
const backTo = ROUTES.REPORT_PARTICIPANTS_DETAILS.getRoute(report?.reportID ?? '-1', accountID, route.params.backTo);
const backTo = ROUTES.REPORT_PARTICIPANTS_DETAILS.getRoute(report.reportID, accountID, route.params.backTo);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we use the default from CONST instead of removing the safety check?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bumping this @GCyganek

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked report type and it has reportID required, that's why I got rid of the fallback:

Screenshot 2025-10-12 at 09 33 07

see:
Screenshot 2025-10-12 at 09 34 42

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, thanks for confirming

const member = report.participants?.[accountID];

if (!member) {
Expand All @@ -53,7 +53,7 @@ function ReportParticipantRoleSelectionPage({report, route}: ReportParticipantRo
];

const changeRole = ({value}: ListItemType) => {
Report.updateGroupChatMemberRoles(report.reportID, [accountID], value);
updateGroupChatMemberRoles(report.reportID, [accountID], value);
Navigation.goBack(backTo);
};

Expand All @@ -65,11 +65,11 @@ function ReportParticipantRoleSelectionPage({report, route}: ReportParticipantRo
/>
<View style={[styles.containerWithSpaceBetween, styles.pointerEventsBoxNone]}>
<SelectionList
sections={[{data: items}]}
data={items}
ListItem={RadioListItem}
onSelectRow={changeRole}
shouldSingleExecuteRowSelect
initiallyFocusedOptionKey={items.find((item) => item.isSelected)?.keyForList}
initiallyFocusedItemKey={items.find((item) => item.isSelected)?.keyForList}
/>
</View>
</ScreenWrapper>
Expand Down
Loading