mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-22 15:04:50 +01:00
REF: no need for debounce as data is local and minimal
This commit is contained in:
parent
0bf1961498
commit
14b68ce831
1 changed files with 12 additions and 12 deletions
|
@ -1,7 +1,7 @@
|
|||
import dayjs from 'dayjs';
|
||||
import calendar from 'dayjs/plugin/calendar';
|
||||
import React, { useEffect, useLayoutEffect, useMemo, useState } from 'react';
|
||||
import { FlatList, NativeSyntheticEvent, StyleSheet, View } from 'react-native';
|
||||
import { FlatList, NativeSyntheticEvent, StyleSheet, View, LayoutAnimation, UIManager, Platform } from 'react-native';
|
||||
|
||||
import {
|
||||
CurrencyRate,
|
||||
|
@ -18,10 +18,14 @@ import { useTheme } from '../../components/themes';
|
|||
import { useExtendedNavigation } from '../../hooks/useExtendedNavigation';
|
||||
import loc from '../../loc';
|
||||
import { FiatUnit, FiatUnitSource, FiatUnitType, getFiatRate } from '../../models/fiatUnit';
|
||||
import useDebounce from '../../hooks/useDebounce';
|
||||
|
||||
dayjs.extend(calendar);
|
||||
|
||||
// Enable LayoutAnimation for Android
|
||||
if (Platform.OS === 'android' && UIManager.setLayoutAnimationEnabledExperimental) {
|
||||
UIManager.setLayoutAnimationEnabledExperimental(true);
|
||||
}
|
||||
|
||||
const Currency: React.FC = () => {
|
||||
const { setPreferredFiatCurrencyStorage } = useSettings();
|
||||
const [isSavingNewPreferredCurrency, setIsSavingNewPreferredCurrency] = useState<FiatUnitType | undefined>();
|
||||
|
@ -31,17 +35,13 @@ const Currency: React.FC = () => {
|
|||
const { colors } = useTheme();
|
||||
const { setOptions } = useExtendedNavigation();
|
||||
const [search, setSearch] = useState('');
|
||||
const debouncedSearch = useDebounce(search, 300);
|
||||
|
||||
const data = useMemo(
|
||||
() =>
|
||||
Object.values(FiatUnit).filter(
|
||||
item =>
|
||||
item.endPointKey.toLowerCase().includes(debouncedSearch.toLowerCase()) ||
|
||||
item.country.toLowerCase().includes(debouncedSearch.toLowerCase()),
|
||||
),
|
||||
[debouncedSearch],
|
||||
);
|
||||
const data = useMemo(() => {
|
||||
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
|
||||
return Object.values(FiatUnit).filter(
|
||||
item => item.endPointKey.toLowerCase().includes(search.toLowerCase()) || item.country.toLowerCase().includes(search.toLowerCase()),
|
||||
);
|
||||
}, [search]);
|
||||
|
||||
const stylesHook = StyleSheet.create({
|
||||
flex: {
|
||||
|
|
Loading…
Add table
Reference in a new issue