Skip to content

Commit 485eeba

Browse files
committed
fix(ui): fix home screen rerender causing navigation lag
1 parent 6d85a23 commit 485eeba

25 files changed

+136
-172
lines changed

e2e/backup.e2e.js

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

9797
// remove 2 default widgets, leave PriceWidget
98-
await element(by.id('WalletsScrollView')).scroll(200, 'down', NaN, 0.85);
98+
await element(by.id('HomeScrollView')).scroll(200, 'down', NaN, 0.85);
9999
await element(by.id('WidgetsEdit')).tap();
100100
for (const w of ['NewsWidget', 'BlocksWidget']) {
101101
await element(by.id('WidgetActionDelete').withAncestor(by.id(w))).tap();
@@ -124,7 +124,7 @@ d('Backup', () => {
124124
await sleep(200); // animation
125125

126126
// check widgets
127-
await element(by.id('WalletsScrollView')).scroll(300, 'down', NaN, 0.85);
127+
await element(by.id('HomeScrollView')).scroll(300, 'down', NaN, 0.85);
128128
await expect(element(by.id('PriceWidget'))).toExist();
129129
await expect(element(by.id('NewsWidget'))).not.toExist();
130130
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
@@ -100,7 +100,7 @@ d('Boost', () => {
100100
await element(by.id('Close')).tap();
101101

102102
// check Activity
103-
await element(by.id('WalletsScrollView')).scrollTo('bottom', NaN, 0.85);
103+
await element(by.id('HomeScrollView')).scrollTo('bottom', NaN, 0.85);
104104
await expect(element(by.id('ActivityShort-1'))).toBeVisible();
105105
await expect(
106106
element(by.text('100 000').withAncestor(by.id('ActivityShort-2'))),
@@ -211,7 +211,7 @@ d('Boost', () => {
211211
await element(by.id('Close')).tap();
212212

213213
// check Activity
214-
await element(by.id('WalletsScrollView')).scrollTo('bottom', NaN, 0.85);
214+
await element(by.id('HomeScrollView')).scrollTo('bottom', NaN, 0.85);
215215
await expect(element(by.id('ActivityShort-1'))).toBeVisible();
216216
await expect(
217217
element(by.text('100 000').withAncestor(by.id('ActivityShort-2'))),
@@ -276,7 +276,7 @@ d('Boost', () => {
276276
await restoreWallet(seed);
277277

278278
// check activity after restore
279-
await element(by.id('WalletsScrollView')).scrollTo('bottom', NaN, 0.85);
279+
await element(by.id('HomeScrollView')).scrollTo('bottom', NaN, 0.85);
280280
await expect(element(by.id('BoostingIcon'))).toBeVisible();
281281
await element(by.id('ActivityShort-1')).tap();
282282
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
@@ -234,7 +234,7 @@ d('Lightning', () => {
234234
.withTimeout(10000);
235235

236236
// check tx history
237-
await element(by.id('WalletsScrollView')).scroll(1000, 'down', NaN, 0.85);
237+
await element(by.id('HomeScrollView')).scroll(1000, 'down', NaN, 0.85);
238238
await expect(
239239
element(by.text('1 000').withAncestor(by.id('ActivityShort-1'))),
240240
).toBeVisible();
@@ -325,7 +325,7 @@ d('Lightning', () => {
325325
.withTimeout(10000);
326326

327327
// check tx history
328-
await element(by.id('WalletsScrollView')).scroll(1000, 'down', NaN, 0.85);
328+
await element(by.id('HomeScrollView')).scroll(1000, 'down', NaN, 0.85);
329329
await expect(
330330
element(by.text('111').withAncestor(by.id('ActivityShort-2'))),
331331
).toBeVisible();

e2e/lnurl.e2e.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ d('LNURL', () => {
200200
.withTimeout(10000);
201201
await element(by.id('Close')).tap();
202202
// check if comment is displayed
203-
await element(by.id('WalletsScrollView')).scrollTo('bottom', NaN, 0.85);
203+
await element(by.id('HomeScrollView')).scrollTo('bottom', NaN, 0.85);
204204
await element(by.id('ActivityShort-1')).tap();
205205
await expect(element(by.id('InvoiceComment'))).toHaveText('test comment');
206206
await element(by.id('NavigationClose')).tap();

e2e/onchain.e2e.js

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

147147
// check Activity
148-
await element(by.id('WalletsScrollView')).scroll(1000, 'down', NaN, 0.85);
148+
await element(by.id('HomeScrollView')).scroll(1000, 'down', NaN, 0.85);
149149
await expect(element(by.id('ActivityShort-1'))).toBeVisible();
150150
await expect(element(by.id('ActivityShort-2'))).toBeVisible();
151151
await expect(element(by.id('ActivityShort-3'))).toBeVisible();
@@ -311,7 +311,7 @@ d('Onchain', () => {
311311
).toHaveText('0');
312312

313313
// check number of outputs for send tx
314-
await element(by.id('WalletsScrollView')).scroll(1000, 'down', NaN, 0.85);
314+
await element(by.id('HomeScrollView')).scroll(1000, 'down', NaN, 0.85);
315315
await expect(element(by.id('ActivityShort-1'))).toBeVisible();
316316
await expect(element(by.id('ActivityShort-2'))).toBeVisible();
317317
await element(by.id('ActivityShowAll')).tap();

e2e/transfer.e2e.js

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

219219
// check activity after restore
220-
await element(by.id('WalletsScrollView')).scrollTo('bottom', NaN, 0.85);
220+
await element(by.id('HomeScrollView')).scrollTo('bottom', NaN, 0.85);
221221
await element(by.id('ActivityShort-1')).tap();
222222
await expect(element(by.id('StatusTransfer'))).toBeVisible();
223223

@@ -237,7 +237,7 @@ d('Transfer', () => {
237237
await restoreWallet(seed);
238238

239239
// check activity after restore
240-
await element(by.id('WalletsScrollView')).scrollTo('bottom', NaN, 0.85);
240+
await element(by.id('HomeScrollView')).scrollTo('bottom', NaN, 0.85);
241241
await expect(element(by.id('BoostingIcon'))).toBeVisible();
242242
await element(by.id('ActivityShort-1')).tap();
243243
await expect(element(by.id('StatusBoosting'))).toBeVisible();
@@ -331,12 +331,12 @@ d('Transfer', () => {
331331
await expect(element(by.id('Suggestion-lightningSettingUp'))).toBeVisible();
332332

333333
// check activity
334-
await element(by.id('WalletsScrollView')).scrollTo('bottom', NaN, 0.85);
334+
await element(by.id('HomeScrollView')).scrollTo('bottom', NaN, 0.85);
335335
await expect(element(by.text('From Savings (±30m)'))).toBeVisible();
336336
await element(by.id('ActivityShort-1')).tap();
337337
await expect(element(by.text('Transfer (±30m)'))).toBeVisible();
338338
await element(by.id('NavigationClose')).tap();
339-
await element(by.id('WalletsScrollView')).scrollTo('top', NaN, 0.85);
339+
await element(by.id('HomeScrollView')).scrollTo('top', NaN, 0.85);
340340

341341
// Mine 3 blocks
342342
await rpc.generateToAddress(3, await rpc.getNewAddress());

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', NaN, 0.85);
38+
await element(by.id('HomeScrollView')).scroll(300, 'down', NaN, 0.85);
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', NaN, 0.85);
53+
await element(by.id('HomeScrollView')).scroll(200, 'down', NaN, 0.85);
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: 9 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';
@@ -19,8 +19,8 @@ import { resetSendTransaction } from '../store/actions/wallet';
1919
import { spendingOnboardingSelector } from '../store/reselect/aggregations';
2020
import { viewControllersSelector } from '../store/reselect/ui';
2121
import { toggleBottomSheet } from '../store/utils/ui';
22-
import { AnimatedView } from '../styles/components';
2322
import { ScanIcon } from '../styles/icons';
23+
import { objectKeys } from '../utils/objectKeys';
2424
import ButtonBlur from './buttons/ButtonBlur';
2525

2626
const TabBar = ({
@@ -35,8 +35,8 @@ 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 = objectKeys(viewControllers);
39+
return viewControllerKeys.some((view) => viewControllers[view].isOpen);
4040
}, [viewControllers]);
4141

4242
const onReceivePress = (): void => {
@@ -73,19 +73,16 @@ const TabBar = ({
7373
return Platform.OS === 'android' ? androidStyles : iosStyles;
7474
}, [white10]);
7575

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

8080
if (shouldHide) {
8181
return <></>;
8282
}
8383

8484
return (
85-
<AnimatedView
86-
style={[styles.tabRoot, { bottom }]}
87-
color="transparent"
88-
entering={FadeIn}>
85+
<Animated.View style={[styles.tabRoot, { bottom }]} entering={FadeIn}>
8986
<ButtonBlur
9087
style={styles.send}
9188
text={t('send')}
@@ -110,7 +107,7 @@ const TabBar = ({
110107
testID="Receive"
111108
onPress={onReceivePress}
112109
/>
113-
</AnimatedView>
110+
</Animated.View>
114111
);
115112
};
116113

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)