|
1 |
| -import React, {forwardRef, useCallback, useEffect, useMemo, useRef, useState} from 'react'; |
| 1 | +import React, {forwardRef, useEffect, useMemo, useRef, useState} from 'react'; |
2 | 2 | import type {ForwardedRef} from 'react';
|
3 | 3 | import {ActivityIndicator, Keyboard, LogBox, View} from 'react-native';
|
4 | 4 | import type {LayoutChangeEvent} from 'react-native';
|
@@ -329,12 +329,12 @@ function AddressSearch(
|
329 | 329 | return predefinedPlaces?.filter((predefinedPlace) => isPlaceMatchForSearch(searchValue, predefinedPlace)) ?? [];
|
330 | 330 | }, [predefinedPlaces, searchValue]);
|
331 | 331 |
|
332 |
| - const listEmptyComponent = useCallback( |
333 |
| - () => (!isTyping ? null : <Text style={[styles.textLabel, styles.colorMuted, styles.pv4, styles.ph3, styles.overflowAuto]}>{translate('common.noResultsFound')}</Text>), |
| 332 | + const listEmptyComponent = useMemo( |
| 333 | + () => (!isTyping ? undefined : <Text style={[styles.textLabel, styles.colorMuted, styles.pv4, styles.ph3, styles.overflowAuto]}>{translate('common.noResultsFound')}</Text>), |
334 | 334 | [isTyping, styles, translate],
|
335 | 335 | );
|
336 | 336 |
|
337 |
| - const listLoader = useCallback( |
| 337 | + const listLoader = useMemo( |
338 | 338 | () => (
|
339 | 339 | <View style={[styles.pv4]}>
|
340 | 340 | <ActivityIndicator
|
@@ -462,15 +462,14 @@ function AddressSearch(
|
462 | 462 | }}
|
463 | 463 | inbetweenCompo={
|
464 | 464 | // We want to show the current location button even if there are no recent destinations
|
465 |
| - predefinedPlaces?.length === 0 && |
466 |
| - shouldShowCurrentLocationButton && ( |
| 465 | + predefinedPlaces?.length === 0 && shouldShowCurrentLocationButton ? ( |
467 | 466 | <View style={[StyleUtils.getGoogleListViewStyle(true), styles.overflowAuto, styles.borderLeft, styles.borderRight]}>
|
468 | 467 | <CurrentLocationButton
|
469 | 468 | onPress={getCurrentLocation}
|
470 | 469 | isDisabled={isOffline}
|
471 | 470 | />
|
472 | 471 | </View>
|
473 |
| - ) |
| 472 | + ) : undefined |
474 | 473 | }
|
475 | 474 | placeholder=""
|
476 | 475 | listViewDisplayed
|
|
0 commit comments