From 6979c15a50ccafa3658102ddd361e26511b96fed Mon Sep 17 00:00:00 2001 From: Rayane Djouah <77965000+rayane-djouah@users.noreply.github.com> Date: Fri, 6 Sep 2024 16:18:37 +0100 Subject: [PATCH 1/6] Fix - App freezes when clicking checkbox in subtag list --- src/components/SelectionListWithModal/index.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/SelectionListWithModal/index.tsx b/src/components/SelectionListWithModal/index.tsx index ca34e579a431..a0e30a5ff10f 100644 --- a/src/components/SelectionListWithModal/index.tsx +++ b/src/components/SelectionListWithModal/index.tsx @@ -23,13 +23,14 @@ function SelectionListWithModal( const [isModalVisible, setIsModalVisible] = useState(false); const [longPressedItem, setLongPressedItem] = useState(null); const {translate} = useLocalize(); - const {shouldUseNarrowLayout} = useResponsiveLayout(); + // We need to use isSmallScreenWidth instead of shouldUseNarrowLayout https://github.com/Expensify/App/issues/48675 + const {isSmallScreenWidth} = useResponsiveLayout(); const {selectionMode} = useMobileSelectionMode(true); useEffect(() => { // We can access 0 index safely as we are not displaying multiple sections in table view const selectedItems = sections[0].data.filter((item) => item.isSelected); - if (!shouldUseNarrowLayout) { + if (!isSmallScreenWidth) { if (selectedItems.length === 0) { turnOffMobileSelectionMode(); } @@ -38,11 +39,11 @@ function SelectionListWithModal( if (selectedItems.length > 0 && !selectionMode?.isEnabled) { turnOnMobileSelectionMode(); } - }, [sections, selectionMode, shouldUseNarrowLayout]); + }, [sections, selectionMode, isSmallScreenWidth]); const handleLongPressRow = (item: TItem) => { // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing - if (!turnOnSelectionModeOnLongPress || !shouldUseNarrowLayout || item?.isDisabled || item?.isDisabledCheckbox) { + if (!turnOnSelectionModeOnLongPress || !isSmallScreenWidth || item?.isDisabled || item?.isDisabledCheckbox) { return; } setLongPressedItem(item); From 60f9fcc978c6af2726c19ba84bd74b3fa0fc1e29 Mon Sep 17 00:00:00 2001 From: Rayane Djouah <77965000+rayane-djouah@users.noreply.github.com> Date: Fri, 6 Sep 2024 17:28:10 +0100 Subject: [PATCH 2/6] Fix - Report fields - No checkbox next to list value on web layout --- .../reportFields/ReportFieldsListValuesPage.tsx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/pages/workspace/reportFields/ReportFieldsListValuesPage.tsx b/src/pages/workspace/reportFields/ReportFieldsListValuesPage.tsx index bf5599b6283f..f267f5cc7380 100644 --- a/src/pages/workspace/reportFields/ReportFieldsListValuesPage.tsx +++ b/src/pages/workspace/reportFields/ReportFieldsListValuesPage.tsx @@ -59,7 +59,8 @@ function ReportFieldsListValuesPage({ }: ReportFieldsListValuesPageProps) { const styles = useThemeStyles(); const {translate} = useLocalize(); - const {shouldUseNarrowLayout} = useResponsiveLayout(); + // We need to use isSmallScreenWidth instead of shouldUseNarrowLayout https://github.com/Expensify/App/issues/48724 + const {isSmallScreenWidth} = useResponsiveLayout(); const [formDraft] = useOnyx(ONYXKEYS.FORMS.WORKSPACE_REPORT_FIELDS_FORM_DRAFT); const {selectionMode} = useMobileSelectionMode(); @@ -67,7 +68,7 @@ function ReportFieldsListValuesPage({ const [deleteValuesConfirmModalVisible, setDeleteValuesConfirmModalVisible] = useState(false); const hasAccountingConnections = PolicyUtils.hasAccountingConnections(policy); - const canSelectMultiple = !hasAccountingConnections && (shouldUseNarrowLayout ? selectionMode?.isEnabled : true); + const canSelectMultiple = !hasAccountingConnections && (isSmallScreenWidth ? selectionMode?.isEnabled : true); const [listValues, disabledListValues] = useMemo(() => { let reportFieldValues: string[]; @@ -177,7 +178,7 @@ function ReportFieldsListValuesPage({ const getHeaderButtons = () => { const options: Array>> = []; - if (shouldUseNarrowLayout ? selectionMode?.isEnabled : selectedValuesArray.length > 0) { + if (isSmallScreenWidth ? selectionMode?.isEnabled : selectedValuesArray.length > 0) { if (selectedValuesArray.length > 0) { options.push({ icon: Expensicons.Trashcan, @@ -259,7 +260,7 @@ function ReportFieldsListValuesPage({ customText={translate('workspace.common.selected', {selectedNumber: selectedValuesArray.length})} options={options} isSplitButton={false} - style={[shouldUseNarrowLayout && styles.flexGrow1, shouldUseNarrowLayout && styles.mb3]} + style={[isSmallScreenWidth && styles.flexGrow1, isSmallScreenWidth && styles.mb3]} isDisabled={!selectedValuesArray.length} /> ); @@ -267,7 +268,7 @@ function ReportFieldsListValuesPage({ return (