Skip to content

Commit ae39b06

Browse files
authored
Merge pull request Expensify#87678 from Expensify/claude-fixSpendRuleCardLandscapeOverlap
Fix spend rule card page landscape overlap
2 parents 5ad9230 + e1ab0ea commit ae39b06

2 files changed

Lines changed: 34 additions & 23 deletions

File tree

src/pages/workspace/rules/SpendRules/SpendRuleCardPage.tsx

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import FormAlertWithSubmitButton from '@components/FormAlertWithSubmitButton';
66
import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator';
77
import HeaderWithBackButton from '@components/HeaderWithBackButton';
88
import ScreenWrapper from '@components/ScreenWrapper';
9+
import ScrollView from '@components/ScrollView';
910
import SelectionList from '@components/SelectionList';
1011
import CardListItem from '@components/SelectionList/ListItem/CardListItem';
1112
import type {AdditionalCardProps} from '@components/SelectionList/ListItem/CardListItem';
@@ -184,7 +185,8 @@ function SpendRuleCardPage({route}: SpendRuleCardPageProps) {
184185
Navigation.goBack(parentRoute);
185186
};
186187

187-
const headerMessage = getHeaderMessage(listData.length > 0, false, inputValue, countryCode, false);
188+
const hasEligibleCards = eligibleCards.length > 0;
189+
const headerMessage = hasEligibleCards ? getHeaderMessage(listData.length > 0, false, inputValue, countryCode, false) : '';
188190

189191
return (
190192
<AccessOrNotFoundWrapper
@@ -214,12 +216,16 @@ function SpendRuleCardPage({route}: SpendRuleCardPageProps) {
214216
/>
215217
<SelectionList
216218
canSelectMultiple
217-
textInputOptions={{
218-
headerMessage,
219-
value: inputValue,
220-
label: translate('common.search'),
221-
onChangeText: setInputValue,
222-
}}
219+
textInputOptions={
220+
hasEligibleCards
221+
? {
222+
headerMessage,
223+
value: inputValue,
224+
label: translate('common.search'),
225+
onChangeText: setInputValue,
226+
}
227+
: undefined
228+
}
223229
data={listData}
224230
style={{
225231
listHeaderWrapperStyle: [styles.pt5, styles.pb2],
@@ -234,19 +240,21 @@ function SpendRuleCardPage({route}: SpendRuleCardPageProps) {
234240
shouldUpdateFocusedIndex
235241
shouldPreventDefaultFocusOnSelectRow={!canUseTouchScreen()}
236242
listEmptyContent={
237-
<BlockingView
238-
icon={illustrations.HandCard}
239-
iconWidth={variables.iconSection}
240-
iconHeight={variables.iconSection}
241-
title={inputValue.trim() ? translate('common.noResultsFound') : translate('workspace.rules.spendRules.noAvailableCards')}
242-
titleStyles={styles.mb2}
243-
subtitle={translate('workspace.rules.spendRules.noAvailableCardsSubtitle')}
244-
subtitleStyle={styles.textSupporting}
245-
/>
243+
<ScrollView contentContainerStyle={[styles.flexGrow1]}>
244+
<BlockingView
245+
icon={illustrations.HandCard}
246+
iconWidth={variables.iconSection}
247+
iconHeight={variables.iconSection}
248+
title={inputValue.trim() ? translate('common.noResultsFound') : translate('workspace.rules.spendRules.noAvailableCards')}
249+
titleStyles={styles.mb2}
250+
subtitle={translate('workspace.rules.spendRules.noAvailableCardsSubtitle')}
251+
subtitleStyle={styles.textSupporting}
252+
/>
253+
</ScrollView>
246254
}
247255
footerContent={
248256
<FormAlertWithSubmitButton
249-
buttonText={translate('common.save')}
257+
buttonText={hasEligibleCards ? translate('common.save') : translate('common.buttonConfirm')}
250258
isAlertVisible={false}
251259
isDisabled={isCardSettingsLoading}
252260
onSubmit={handleSave}

src/pages/workspace/rules/SpendRules/SpendRuleCategoryPage.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import BlockingView from '@components/BlockingViews/BlockingView';
44
import FormAlertWithSubmitButton from '@components/FormAlertWithSubmitButton';
55
import HeaderWithBackButton from '@components/HeaderWithBackButton';
66
import ScreenWrapper from '@components/ScreenWrapper';
7+
import ScrollView from '@components/ScrollView';
78
import SelectionList from '@components/SelectionList';
89
import MultiSelectListItem from '@components/SelectionList/ListItem/MultiSelectListItem';
910
import type {ListItem} from '@components/SelectionList/types';
@@ -125,12 +126,14 @@ function SpendRuleCategoryPage({route}: SpendRuleCategoryPageProps) {
125126
shouldUpdateFocusedIndex
126127
shouldPreventDefaultFocusOnSelectRow={!canUseTouchScreen()}
127128
listEmptyContent={
128-
<BlockingView
129-
icon={illustrations.Telescope}
130-
iconWidth={variables.emptyListIconWidth}
131-
iconHeight={variables.emptyListIconHeight}
132-
title={translate('common.noResultsFound')}
133-
/>
129+
<ScrollView contentContainerStyle={[styles.flexGrow1]}>
130+
<BlockingView
131+
icon={illustrations.Telescope}
132+
iconWidth={variables.emptyListIconWidth}
133+
iconHeight={variables.emptyListIconHeight}
134+
title={translate('common.noResultsFound')}
135+
/>
136+
</ScrollView>
134137
}
135138
footerContent={
136139
<FormAlertWithSubmitButton

0 commit comments

Comments
 (0)