Skip to content

Commit 45b4546

Browse files
committed
fix(ui): fix home screen rerender causing navigation lag
1 parent 8d77b69 commit 45b4546

25 files changed

+142
-171
lines changed

e2e/backup.e2e.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ d('Backup', () => {
9191
await element(by.id('NavigationClose')).atIndex(0).tap();
9292

9393
// remove 2 default widgets, leave PriceWidget
94-
await element(by.id('WalletsScrollView')).scroll(200, 'down', 0);
94+
await element(by.id('HomeScrollView')).scroll(200, 'down', 0);
9595
await element(by.id('WidgetsEdit')).tap();
9696
for (const w of ['NewsWidget', 'BlocksWidget']) {
9797
await element(by.id('WidgetActionDelete').withAncestor(by.id(w))).tap();
@@ -121,7 +121,7 @@ d('Backup', () => {
121121
await sleep(200); // animation
122122

123123
// check widgets
124-
await element(by.id('WalletsScrollView')).scroll(300, 'down', 0);
124+
await element(by.id('HomeScrollView')).scroll(300, 'down', 0);
125125
await expect(element(by.id('PriceWidget'))).toExist();
126126
await expect(element(by.id('NewsWidget'))).not.toExist();
127127
await expect(element(by.id('BlocksWidget'))).not.toExist();

e2e/boost.e2e.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ d('Boost', () => {
9696
await element(by.id('Close')).tap();
9797

9898
// check Activity
99-
await element(by.id('WalletsScrollView')).scrollTo('bottom', 0);
99+
await element(by.id('HomeScrollView')).scrollTo('bottom', 0);
100100
await expect(element(by.id('ActivityShort-1'))).toBeVisible();
101101
await expect(
102102
element(by.text('100 000').withAncestor(by.id('ActivityShort-2'))),
@@ -207,7 +207,7 @@ d('Boost', () => {
207207
await element(by.id('Close')).tap();
208208

209209
// check Activity
210-
await element(by.id('WalletsScrollView')).scrollTo('bottom', 0);
210+
await element(by.id('HomeScrollView')).scrollTo('bottom', 0);
211211
await expect(element(by.id('ActivityShort-1'))).toBeVisible();
212212
await expect(
213213
element(by.text('100 000').withAncestor(by.id('ActivityShort-2'))),
@@ -273,7 +273,7 @@ d('Boost', () => {
273273
await restoreWallet(seed);
274274

275275
// check activity after restore
276-
await element(by.id('WalletsScrollView')).scrollTo('bottom', 0);
276+
await element(by.id('HomeScrollView')).scrollTo('bottom', 0);
277277
await expect(element(by.id('BoostingIcon'))).toBeVisible();
278278
await element(by.id('ActivityShort-1')).tap();
279279
await expect(element(by.id('BoostedButton'))).toBeVisible();

e2e/lightning.e2e.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ d('Lightning', () => {
230230
.withTimeout(10000);
231231

232232
// check tx history
233-
await element(by.id('WalletsScrollView')).scroll(1000, 'down', 0);
233+
await element(by.id('HomeScrollView')).scroll(1000, 'down', 0);
234234
await expect(
235235
element(by.text('1 000').withAncestor(by.id('ActivityShort-1'))),
236236
).toBeVisible();
@@ -322,7 +322,7 @@ d('Lightning', () => {
322322
.withTimeout(10000);
323323

324324
// check tx history
325-
await element(by.id('WalletsScrollView')).scroll(1000, 'down', 0);
325+
await element(by.id('HomeScrollView')).scroll(1000, 'down', 0);
326326
await expect(
327327
element(by.text('111').withAncestor(by.id('ActivityShort-2'))),
328328
).toBeVisible();

e2e/lnurl.e2e.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ d('LNURL', () => {
195195
.withTimeout(10000);
196196
await element(by.id('Close')).tap();
197197
// check if comment is displayed
198-
await element(by.id('WalletsScrollView')).scrollTo('bottom', 0);
198+
await element(by.id('HomeScrollView')).scrollTo('bottom', 0);
199199
await element(by.id('ActivityShort-1')).tap();
200200
await expect(element(by.id('InvoiceComment'))).toHaveText('test comment');
201201
await element(by.id('NavigationClose')).tap();

e2e/onchain.e2e.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ d('Onchain', () => {
140140
).toHaveText('0');
141141

142142
// check Activity
143-
await element(by.id('WalletsScrollView')).scroll(1000, 'down', 0);
143+
await element(by.id('HomeScrollView')).scroll(1000, 'down', 0);
144144
await expect(element(by.id('ActivityShort-1'))).toBeVisible();
145145
await expect(element(by.id('ActivityShort-2'))).toBeVisible();
146146
await expect(element(by.id('ActivityShort-3'))).toBeVisible();
@@ -306,7 +306,7 @@ d('Onchain', () => {
306306
).toHaveText('0');
307307

308308
// check number of outputs for send tx
309-
await element(by.id('WalletsScrollView')).scroll(1000, 'down', 0);
309+
await element(by.id('HomeScrollView')).scroll(1000, 'down', 0);
310310
await expect(element(by.id('ActivityShort-1'))).toBeVisible();
311311
await expect(element(by.id('ActivityShort-2'))).toBeVisible();
312312
await element(by.id('ActivityShowAll')).tap();

e2e/transfer.e2e.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ d('Transfer', () => {
214214
await expect(element(by.id('Suggestion-lightningSettingUp'))).toBeVisible();
215215

216216
// check activity after restore
217-
await element(by.id('WalletsScrollView')).scrollTo('bottom', 0);
217+
await element(by.id('HomeScrollView')).scrollTo('bottom', 0);
218218
await element(by.id('ActivityShort-1')).tap();
219219
await expect(element(by.id('StatusTransfer'))).toBeVisible();
220220

@@ -235,7 +235,7 @@ d('Transfer', () => {
235235
await restoreWallet(seed);
236236

237237
// check activity after restore
238-
await element(by.id('WalletsScrollView')).scrollTo('bottom', 0);
238+
await element(by.id('HomeScrollView')).scrollTo('bottom', 0);
239239
await expect(element(by.id('BoostingIcon'))).toBeVisible();
240240
await element(by.id('ActivityShort-1')).tap();
241241
await expect(element(by.id('StatusBoosting'))).toBeVisible();
@@ -327,7 +327,7 @@ d('Transfer', () => {
327327
await expect(element(by.id('Suggestion-lightningSettingUp'))).toBeVisible();
328328

329329
// check activity
330-
await element(by.id('WalletsScrollView')).scrollTo('bottom', 0);
330+
await element(by.id('HomeScrollView')).scrollTo('bottom', 0);
331331
await expect(element(by.text('From Savings (±30m)'))).toBeVisible();
332332
await element(by.id('ActivityShort-1')).tap();
333333
await expect(element(by.text('Transfer (±30m)'))).toBeVisible();

e2e/widgets.e2e.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ d('Widgets', () => {
3535
}
3636

3737
// add price widget
38-
await element(by.id('WalletsScrollView')).scroll(300, 'down', 0);
38+
await element(by.id('HomeScrollView')).scroll(300, 'down', 0);
3939
await element(by.id('WidgetsAdd')).tap();
4040
await element(by.id('WidgetsOnboarding-button')).tap();
4141
await element(by.id('WidgetListItem-price')).tap();
@@ -50,7 +50,7 @@ d('Widgets', () => {
5050
await element(by.id('WidgetEditField-showSource')).tap();
5151
await element(by.id('WidgetEditPreview')).tap();
5252
await element(by.id('WidgetSave')).tap();
53-
await element(by.id('WalletsScrollView')).scroll(200, 'down', 0);
53+
await element(by.id('HomeScrollView')).scroll(200, 'down', 0);
5454
await expect(element(by.id('PriceWidget'))).toBeVisible();
5555
await expect(element(by.id('PriceWidgetRow-BTC/EUR'))).toBeVisible();
5656
await expect(element(by.id('PriceWidgetSource'))).toBeVisible();

src/components/NavigationHeader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ const NavigationHeader = ({
9494

9595
if (hasWalletRoute || parent) {
9696
// for nested navigators, pop to top of parent navigator
97-
navigation.popTo('Wallet', { screen: 'Wallets' });
97+
navigation.popTo('Wallet', { screen: 'Home' });
9898
} else {
9999
navigation.popToTop();
100100
}

src/components/TabBar.tsx

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
StyleSheet,
88
ViewStyle,
99
} from 'react-native';
10-
import { FadeIn } from 'react-native-reanimated';
10+
import Animated, { FadeIn } from 'react-native-reanimated';
1111
import { useSafeAreaInsets } from 'react-native-safe-area-context';
1212

1313
import { receiveIcon, sendIcon } from '../assets/icons/tabs';
@@ -18,8 +18,8 @@ import type { RootNavigationProp } from '../navigation/types';
1818
import { resetSendTransaction } from '../store/actions/wallet';
1919
import { spendingOnboardingSelector } from '../store/reselect/aggregations';
2020
import { viewControllersSelector } from '../store/reselect/ui';
21+
import { TViewController } from '../store/types/ui';
2122
import { toggleBottomSheet } from '../store/utils/ui';
22-
import { AnimatedView } from '../styles/components';
2323
import { ScanIcon } from '../styles/icons';
2424
import ButtonBlur from './buttons/ButtonBlur';
2525

@@ -35,8 +35,15 @@ const TabBar = ({
3535
const isSpendingOnboarding = useAppSelector(spendingOnboardingSelector);
3636

3737
const shouldHide = useMemo(() => {
38-
const activityFilterSheets = ['timeRangePrompt', 'tagsPrompt'];
39-
return activityFilterSheets.some((view) => viewControllers[view].isOpen);
38+
const viewControllerKeys: TViewController[] = [
39+
'backupPrompt',
40+
'PINNavigation',
41+
'highBalance',
42+
'appUpdatePrompt',
43+
'timeRangePrompt',
44+
'tagsPrompt',
45+
];
46+
return viewControllerKeys.some((view) => viewControllers[view].isOpen);
4047
}, [viewControllers]);
4148

4249
const onReceivePress = (): void => {
@@ -73,19 +80,16 @@ const TabBar = ({
7380
return Platform.OS === 'android' ? androidStyles : iosStyles;
7481
}, [white10]);
7582

76-
const bottom = useMemo(() => Math.max(insets.bottom, 16), [insets.bottom]);
77-
const sendXml = useMemo(() => sendIcon('white'), []);
78-
const receiveXml = useMemo(() => receiveIcon('white'), []);
83+
const bottom = Math.max(insets.bottom, 16);
84+
const sendXml = sendIcon('white');
85+
const receiveXml = receiveIcon('white');
7986

8087
if (shouldHide) {
8188
return <></>;
8289
}
8390

8491
return (
85-
<AnimatedView
86-
style={[styles.tabRoot, { bottom }]}
87-
color="transparent"
88-
entering={FadeIn}>
92+
<Animated.View style={[styles.tabRoot, { bottom }]} entering={FadeIn}>
8993
<ButtonBlur
9094
style={styles.send}
9195
text={t('send')}
@@ -110,7 +114,7 @@ const TabBar = ({
110114
testID="Receive"
111115
onPress={onReceivePress}
112116
/>
113-
</AnimatedView>
117+
</Animated.View>
114118
);
115119
};
116120

src/navigation/bottom-sheet/AppUpdatePrompt.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const imageSrc = require('../../assets/illustrations/wand.png');
2626
const ASK_INTERVAL = 1000 * 60 * 60 * 12; // 12h - how long this prompt will be hidden if user taps Later
2727
const CHECK_DELAY = 2500; // how long user needs to stay on Wallets screen before he will see this prompt
2828

29-
const AppUpdatePrompt = ({ enabled }: { enabled: boolean }): ReactElement => {
29+
const AppUpdatePrompt = (): ReactElement => {
3030
const { t } = useTranslation('other');
3131
const snapPoints = useSnapPoints('large');
3232
const dispatch = useAppDispatch();
@@ -50,14 +50,13 @@ const AppUpdatePrompt = ({ enabled }: { enabled: boolean }): ReactElement => {
5050
const shouldShowBottomSheet = useMemo(() => {
5151
const isTimeoutOver = Number(new Date()) - ignoreTimestamp > ASK_INTERVAL;
5252
return (
53-
enabled &&
5453
!__E2E__ &&
5554
updateInfo !== null &&
5655
!updateInfo.critical &&
5756
isTimeoutOver &&
5857
!anyBottomSheetIsOpen
5958
);
60-
}, [enabled, updateInfo, ignoreTimestamp, anyBottomSheetIsOpen]);
59+
}, [updateInfo, ignoreTimestamp, anyBottomSheetIsOpen]);
6160

6261
useEffect(() => {
6362
if (!shouldShowBottomSheet) {
@@ -104,6 +103,7 @@ const AppUpdatePrompt = ({ enabled }: { enabled: boolean }): ReactElement => {
104103
}
105104
description={t('update_text')}
106105
image={imageSrc}
106+
showBackButton={false}
107107
continueText={t('update_button')}
108108
cancelText={t('cancel')}
109109
testID="AppUpdatePrompt"

0 commit comments

Comments
 (0)