Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove maxWidth and add flex #5884

Open
wants to merge 2 commits into
base: x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions packages/kit/src/views/Swap/components/SwapQuoteResultRate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const SwapQuoteResultRate = ({
);
}, [fromToken, intl, isReverse, onOpenResult, rate, rateIsExit, toToken]);
return (
<XStack justifyContent="space-between" alignItems="center">
<XStack alignItems="center" gap="$5">
{isLoading ? (
<Stack py="$0.5">
<Skeleton h="$4" w="$32" />
Expand All @@ -109,9 +109,11 @@ const SwapQuoteResultRate = ({
rateContent
)}

<XStack alignItems="center" userSelect="none" gap="$1">
<XStack alignItems="center" userSelect="none" gap="$1" flex={1}>
{!providerIcon || !fromToken || !toToken || !onOpenResult ? null : (
<XStack
flex={1}
justifyContent="flex-end"
animation="quick"
y={openResult ? '$1' : '$0'}
opacity={openResult ? 0 : 1}
Expand All @@ -126,10 +128,7 @@ const SwapQuoteResultRate = ({
numberOfLines={1}
size="$bodyMdMedium"
ml="$1"
maxWidth={80}
$gtMd={{
maxWidth: 130,
}}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

考虑限制文本宽度,避免布局问题。

移除 SizableText 组件的 maxWidth 属性,可能会导致文本超出预期的宽度限制。如果提供者名称太长,可能会引起布局问题。

建议重新添加 maxWidth 属性,或者使用 numberOfLines 来限制文本的行数,避免潜在的布局问题。

>
{providerName ?? ''}
</SizableText>
Expand Down