From 7ebee30f01f01702b6234011d81215f4c2889dfc Mon Sep 17 00:00:00 2001 From: jinming Date: Thu, 5 Dec 2024 20:14:31 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix=EF=BC=9A=20home=20=20layout=20in=20smal?= =?UTF-8?q?l=20screen=20and=20refresh=20logic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components2024/WordsMatrix/index.tsx | 1 + .../mobile/src/screens/Home/MultiAddressHome.tsx | 16 +++++----------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/apps/mobile/src/components2024/WordsMatrix/index.tsx b/apps/mobile/src/components2024/WordsMatrix/index.tsx index 5a9baad49..a2db57a41 100644 --- a/apps/mobile/src/components2024/WordsMatrix/index.tsx +++ b/apps/mobile/src/components2024/WordsMatrix/index.tsx @@ -111,6 +111,7 @@ const getStyle = createGetStyles2024(({ colors2024 }) => ({ width: '48%', minWidth: 0, borderRadius: 12, + marginRight: -4, flexShrink: 0, position: 'relative', diff --git a/apps/mobile/src/screens/Home/MultiAddressHome.tsx b/apps/mobile/src/screens/Home/MultiAddressHome.tsx index 66bf56957..ef13368f1 100644 --- a/apps/mobile/src/screens/Home/MultiAddressHome.tsx +++ b/apps/mobile/src/screens/Home/MultiAddressHome.tsx @@ -205,18 +205,11 @@ function MultiAddressHome(): JSX.Element { if (!addresses.length) { return; } - const { pendingsLength, pendings } = + const { pendingsLength } = transactionHistoryService.getPendingsAddresses(addresses); - console.debug('fetchHistory :', balanceCacheAccounts, pendings); setPendingTxCount(pendingsLength); - if (pendingsLength) { - if (!timeRef.current) { - timeRef.current = setInterval(fetchHistory, 5000); - } - } else { - timeRef.current && clearInterval(timeRef.current); - timeRef.current = null; - } + timeRef.current && clearInterval(timeRef.current); + timeRef.current = pendingsLength ? setInterval(fetchHistory, 5000) : null; }, [balanceCacheAccounts]); const detectHasAccounts = useMemoizedFn(async () => { @@ -245,7 +238,7 @@ function MultiAddressHome(): JSX.Element { const { redirectAction } = await detectHasAccounts(); if (redirectAction) { redirectAction(); - } else if (!timeRef.current) { + } else { fetchHistory(); } })(); @@ -613,6 +606,7 @@ const getStyle = createGetStyles2024(({ colors2024, isLight }) => ({ ? colors2024['neutral-bg-1'] : colors2024['neutral-bg-2'], width: '48%', + marginRight: -6, minWidth: 0, borderRadius: 18, flexShrink: 0, From 2d1aa6d9f5e89f5d92e774a82c0d6610a48f1974 Mon Sep 17 00:00:00 2001 From: jinming Date: Fri, 6 Dec 2024 10:25:37 +0800 Subject: [PATCH 2/2] fix: layout css update --- apps/mobile/src/components2024/WordsMatrix/index.tsx | 3 +-- apps/mobile/src/screens/Home/MultiAddressHome.tsx | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/mobile/src/components2024/WordsMatrix/index.tsx b/apps/mobile/src/components2024/WordsMatrix/index.tsx index a2db57a41..bbd84dd4d 100644 --- a/apps/mobile/src/components2024/WordsMatrix/index.tsx +++ b/apps/mobile/src/components2024/WordsMatrix/index.tsx @@ -108,10 +108,9 @@ const getStyle = createGetStyles2024(({ colors2024 }) => ({ borderWidth: 1, borderColor: 'transparent', backgroundColor: colors2024['neutral-bg-2'], - width: '48%', + width: '47%', minWidth: 0, borderRadius: 12, - marginRight: -4, flexShrink: 0, position: 'relative', diff --git a/apps/mobile/src/screens/Home/MultiAddressHome.tsx b/apps/mobile/src/screens/Home/MultiAddressHome.tsx index ef13368f1..3b29fb589 100644 --- a/apps/mobile/src/screens/Home/MultiAddressHome.tsx +++ b/apps/mobile/src/screens/Home/MultiAddressHome.tsx @@ -605,8 +605,7 @@ const getStyle = createGetStyles2024(({ colors2024, isLight }) => ({ backgroundColor: isLight ? colors2024['neutral-bg-1'] : colors2024['neutral-bg-2'], - width: '48%', - marginRight: -6, + width: '47%', minWidth: 0, borderRadius: 18, flexShrink: 0,