Skip to content

Commit

Permalink
fix: adjust component structure & fix page flickering. (#6278)
Browse files Browse the repository at this point in the history
  • Loading branch information
huhuanming authored Nov 28, 2024
1 parent a98f15d commit aca5436
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,43 +61,22 @@ function TokenDetailsViews(props: IProps) {
</Stack>
);
}
if (platformEnv.isNative) {
return (
<>
<TokenDetailsHistory
return (
<TokenDetailsHistory
{...props}
accountId={currentAccountId}
setHistoryInit={setHistoryInit}
historyInit={historyInit}
ListHeaderComponent={
<TokenDetailsHeader
{...props}
accountId={currentAccountId}
setHistoryInit={setHistoryInit}
setOverviewInit={setOverviewInit}
overviewInit={overviewInit}
historyInit={historyInit}
ListHeaderComponent={
<TokenDetailsHeader
{...props}
accountId={currentAccountId}
setOverviewInit={setOverviewInit}
overviewInit={overviewInit}
historyInit={historyInit}
/>
}
/>
</>
);
}
return (
<>
<TokenDetailsHeader
{...props}
accountId={currentAccountId}
setOverviewInit={setOverviewInit}
overviewInit={overviewInit}
historyInit={historyInit}
/>
<TokenDetailsHistory
{...props}
accountId={currentAccountId}
setHistoryInit={setHistoryInit}
historyInit={historyInit}
/>
</>
}
/>
);
}

Expand Down
26 changes: 14 additions & 12 deletions packages/kit/src/views/AssetDetails/pages/TokenDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import type {
IAccountDeriveTypes,
} from '@onekeyhq/kit-bg/src/vaults/types';
import { ETranslations } from '@onekeyhq/shared/src/locale';
import platformEnv from '@onekeyhq/shared/src/platformEnv';
import type {
EModalAssetDetailRoutes,
IModalAssetDetailsParamList,
Expand Down Expand Up @@ -197,26 +198,27 @@ function TokenDetails() {
]);

const renderTokenDetailsView = useCallback(() => {
if (isLoading)
return (
<Stack
flex={1}
height="100%"
alignItems="center"
justifyContent="center"
>
<Spinner size="large" />
</Stack>
);
if (
vaultSettings?.mergeDeriveAssetsEnabled &&
isAllNetworks &&
!accountUtils.isOthersWallet({ walletId })
) {
if (isLoading)
return (
<Stack
flex={1}
height="100%"
alignItems="center"
justifyContent="center"
>
<Spinner size="large" />
</Stack>
);
if (tabs && !isEmpty(tabs)) {
return (
<Tab.Page
data={tabs}
contentItemWidth={platformEnv.isNative ? undefined : (640 as any)}
initialScrollIndex={0}
showsVerticalScrollIndicator={false}
/>
Expand Down Expand Up @@ -253,7 +255,7 @@ function TokenDetails() {
]);

return (
<Page scrollEnabled safeAreaEnabled={false}>
<Page safeAreaEnabled={false}>
<Page.Header
headerTitle={tokenInfo.name}
headerTitleStyle={headerTitleStyle}
Expand Down

0 comments on commit aca5436

Please sign in to comment.