Skip to content

Commit

Permalink
Merge pull request #47706 from daledah/fix/46717
Browse files Browse the repository at this point in the history
fix: prevent selectable report field items
  • Loading branch information
grgia authored Aug 22, 2024
2 parents d8f9e52 + 02f71d7 commit 4ad8900
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ function ReportFieldsListValuesPage({
{!shouldShowEmptyState && (
<SelectionListWithModal
canSelectMultiple={canSelectMultiple}
turnOnSelectionModeOnLongPress
turnOnSelectionModeOnLongPress={!hasAccountingConnections}
onTurnOnSelectionMode={(item) => item && toggleValue(item)}
sections={listValuesSections}
onCheckboxPress={toggleValue}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function WorkspaceReportFieldsPage({
params: {policyID},
},
}: WorkspaceReportFieldsPageProps) {
const {shouldUseNarrowLayout} = useResponsiveLayout();
const {shouldUseNarrowLayout, isSmallScreenWidth} = useResponsiveLayout();
const styles = useThemeStyles();
const theme = useTheme();
const {translate} = useLocalize();
Expand All @@ -78,7 +78,7 @@ function WorkspaceReportFieldsPage({
const isConnectedToAccounting = Object.keys(policy?.connections ?? {}).length > 0;
const currentConnectionName = PolicyUtils.getCurrentConnectionName(policy);

const canSelectMultiple = !hasAccountingConnections && shouldUseNarrowLayout ? selectionMode?.isEnabled : true;
const canSelectMultiple = !hasAccountingConnections && (isSmallScreenWidth ? selectionMode?.isEnabled : true);

const fetchReportFields = useCallback(() => {
ReportField.openPolicyReportFieldsPage(policyID);
Expand Down Expand Up @@ -297,7 +297,7 @@ function WorkspaceReportFieldsPage({
{!shouldShowEmptyState && !isLoading && (
<SelectionListWithModal
canSelectMultiple={canSelectMultiple}
turnOnSelectionModeOnLongPress
turnOnSelectionModeOnLongPress={!hasAccountingConnections}
onTurnOnSelectionMode={(item) => item && updateSelectedReportFields(item)}
sections={reportFieldsSections}
onCheckboxPress={updateSelectedReportFields}
Expand Down

0 comments on commit 4ad8900

Please sign in to comment.