Skip to content
Merged
Show file tree
Hide file tree
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
13 changes: 6 additions & 7 deletions src/components/AddressSearch/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {forwardRef, useCallback, useEffect, useMemo, useRef, useState} from 'react';
import React, {forwardRef, useEffect, useMemo, useRef, useState} from 'react';
import type {ForwardedRef} from 'react';
import {ActivityIndicator, Keyboard, LogBox, View} from 'react-native';
import type {LayoutChangeEvent} from 'react-native';
Expand Down Expand Up @@ -329,12 +329,12 @@ function AddressSearch(
return predefinedPlaces?.filter((predefinedPlace) => isPlaceMatchForSearch(searchValue, predefinedPlace)) ?? [];
}, [predefinedPlaces, searchValue]);

const listEmptyComponent = useCallback(
() => (!isTyping ? null : <Text style={[styles.textLabel, styles.colorMuted, styles.pv4, styles.ph3, styles.overflowAuto]}>{translate('common.noResultsFound')}</Text>),
const listEmptyComponent = useMemo(

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.

useCallback returns a function while useMemo returns the ReactElement itself.

Screenshot 2024-09-18 at 01 26 11

Same with listLoaderComponent.

() => (!isTyping ? undefined : <Text style={[styles.textLabel, styles.colorMuted, styles.pv4, styles.ph3, styles.overflowAuto]}>{translate('common.noResultsFound')}</Text>),
[isTyping, styles, translate],
);

const listLoader = useCallback(
const listLoader = useMemo(
() => (
<View style={[styles.pv4]}>
<ActivityIndicator
Expand Down Expand Up @@ -462,15 +462,14 @@ function AddressSearch(
}}
inbetweenCompo={
// We want to show the current location button even if there are no recent destinations
predefinedPlaces?.length === 0 &&
shouldShowCurrentLocationButton && (
predefinedPlaces?.length === 0 && shouldShowCurrentLocationButton ? (
<View style={[StyleUtils.getGoogleListViewStyle(true), styles.overflowAuto, styles.borderLeft, styles.borderRight]}>
<CurrentLocationButton
onPress={getCurrentLocation}
isDisabled={isOffline}
/>
</View>
)
) : undefined

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.

predefinedPlaces?.length === 0 && shouldShowCurrentLocationButton can be false while inbetweenCompo expects a ReactNode.

Screenshot 2024-09-18 at 01 23 08

}
placeholder=""
listViewDisplayed
Expand Down
1 change: 1 addition & 0 deletions src/components/MenuItemList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ function MenuItemList({
<>
{menuItems.map((menuItemProps) => (
<OfflineWithFeedback
key={menuItemProps.key ?? menuItemProps.title}
pendingAction={menuItemProps.pendingAction}
onClose={menuItemProps.onPendingActionDismiss}
errors={menuItemProps.error}
Expand Down
14 changes: 10 additions & 4 deletions src/components/MoneyRequestConfirmationListFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,10 @@ function MoneyRequestConfirmationListFooter({
},
{
item: (
<MentionReportContext.Provider value={mentionReportContextValue}>
<MentionReportContext.Provider
key={translate('common.description')}
value={mentionReportContextValue}
>
<MenuItemWithTopDescription
key={translate('common.description')}
shouldShowRightIcon={!isReadOnly}
Expand Down Expand Up @@ -504,7 +507,10 @@ function MoneyRequestConfirmationListFooter({
},
{
item: (
<View style={[styles.flexRow, styles.justifyContentBetween, styles.alignItemsCenter, styles.ml5, styles.mr8, styles.optionRow]}>
<View
key={translate('common.billable')}
style={[styles.flexRow, styles.justifyContentBetween, styles.alignItemsCenter, styles.ml5, styles.mr8, styles.optionRow]}
>
<ToggleSettingOptionRow
switchAccessibilityLabel={translate('common.billable')}
title={translate('common.billable')}
Expand All @@ -521,8 +527,8 @@ function MoneyRequestConfirmationListFooter({
},
];

const primaryFields: JSX.Element[] = [];
const supplementaryFields: JSX.Element[] = [];
const primaryFields: React.JSX.Element[] = [];
const supplementaryFields: React.JSX.Element[] = [];

classifiedFields.forEach((field) => {
if (field.shouldShow && !field.isSupplementary) {
Expand Down