REF: Load WalletLists faster with useEffet

This commit is contained in:
Marcos Rodriguez Velez 2024-05-04 20:24:36 -04:00
parent 538a1327b6
commit 430e4e34ad
No known key found for this signature in database
GPG key ID: 6030B2F48CCE86D7

View file

@ -1,4 +1,4 @@
import React, { useCallback, useEffect, useLayoutEffect, useReducer, useRef } from 'react'; import React, { useCallback, useEffect, useReducer, useRef } from 'react';
import { import {
View, View,
TouchableOpacity, TouchableOpacity,
@ -166,7 +166,7 @@ const WalletsList: React.FC = () => {
} }
}; };
useLayoutEffect(() => { useEffect(() => {
setOptions({ setOptions({
navigationBarColor: colors.navigationBarColor, navigationBarColor: colors.navigationBarColor,
headerShown: !isDesktop, headerShown: !isDesktop,
@ -176,26 +176,14 @@ const WalletsList: React.FC = () => {
// eslint-disable-next-line react/no-unstable-nested-components // eslint-disable-next-line react/no-unstable-nested-components
headerRight: () => headerRight: () =>
I18nManager.isRTL ? null : ( I18nManager.isRTL ? null : (
<TouchableOpacity <TouchableOpacity accessibilityRole="button" accessibilityLabel={loc._.more} testID="SettingsButton" onPress={navigateToSettings}>
accessibilityRole="button"
accessibilityLabel={loc._.more}
testID="SettingsButton"
style={styles.headerTouch}
onPress={navigateToSettings}
>
<Icon size={22} name="more-horiz" type="material" color={colors.foregroundColor} /> <Icon size={22} name="more-horiz" type="material" color={colors.foregroundColor} />
</TouchableOpacity> </TouchableOpacity>
), ),
// eslint-disable-next-line react/no-unstable-nested-components // eslint-disable-next-line react/no-unstable-nested-components
headerLeft: () => headerLeft: () =>
I18nManager.isRTL ? ( I18nManager.isRTL ? (
<TouchableOpacity <TouchableOpacity accessibilityRole="button" accessibilityLabel={loc._.more} testID="SettingsButton" onPress={navigateToSettings}>
accessibilityRole="button"
accessibilityLabel={loc._.more}
testID="SettingsButton"
style={styles.headerTouch}
onPress={navigateToSettings}
>
<Icon size={22} name="more-horiz" type="material" color={colors.foregroundColor} /> <Icon size={22} name="more-horiz" type="material" color={colors.foregroundColor} />
</TouchableOpacity> </TouchableOpacity>
) : null, ) : null,
@ -472,10 +460,6 @@ const styles = StyleSheet.create({
walletsListWrapper: { walletsListWrapper: {
flex: 1, flex: 1,
}, },
headerTouch: {
height: 48,
paddingVertical: 10,
},
listHeaderBack: { listHeaderBack: {
flexDirection: 'row', flexDirection: 'row',
justifyContent: 'space-between', justifyContent: 'space-between',