-
Notifications
You must be signed in to change notification settings - Fork 87
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
feat(earn-info): keep token icon and name on the same line #6222
Changes from 3 commits
8526a93
82356dd
7792519
e08941d
981d640
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,8 +77,12 @@ function TitleSection({ | |
}) { | ||
return ( | ||
<View testID="TitleSection" onLayout={onLayout} style={styles.titleContainer}> | ||
<TokenIcons tokensInfo={tokensInfo} /> | ||
<Text style={styles.title}>{title}</Text> | ||
<View style={styles.titleTokenContainer}> | ||
<View style={styles.titleTokenIconContainer}> | ||
<TokenIcons tokensInfo={tokensInfo} /> | ||
</View> | ||
<Text style={styles.title}>{title}</Text> | ||
</View> | ||
<View style={styles.subtitleContainer}> | ||
<Text style={styles.subtitleLabel}> | ||
<Trans i18nKey="earnFlow.poolInfoScreen.chainName" values={{ networkName }}> | ||
|
@@ -212,7 +216,6 @@ export default function EarnPoolInfoScreen({ route, navigation }: Props) { | |
}, [allPositionsWithBalance]) | ||
|
||
const onPressWithdraw = () => { | ||
// TODO(tomm): once act-1385 is merge use the bottom sheet button presses | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is covered by the event |
||
AppAnalytics.track(EarnEvents.earn_pool_info_tap_withdraw, { | ||
poolId: positionId, | ||
providerId: appId, | ||
|
@@ -266,8 +269,8 @@ export default function EarnPoolInfoScreen({ route, navigation }: Props) { | |
navigation, | ||
title: <HeaderTitleSection earnPosition={pool} tokensInfo={tokensInfo} />, | ||
scrollPosition, | ||
startFadeInPosition: titleHeight - titleHeight * 0.33, | ||
animationDistance: titleHeight * 0.33, | ||
startFadeInPosition: titleHeight - titleHeight * 0.9, | ||
animationDistance: titleHeight * 0.66, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we document these magic numbers? And any reason why they are changing to different values, when compared to the existing one where both were 0.33 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are the values I found when testing locally that rendered the title in the header best. Moving to a single line for the token icon and title means we want a higher fade-in position and a lower animation distance. Alternatively, we could move the chain name and protocol name out of the header and compute the title height better, but that was a bigger change. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a comment and simplified a bit in e08941d. |
||
}) | ||
|
||
return ( | ||
|
@@ -522,7 +525,7 @@ const styles = StyleSheet.create({ | |
flex: 1, | ||
}, | ||
scrollContainer: { | ||
padding: Spacing.Thick24, | ||
paddingHorizontal: Spacing.Thick24, | ||
...(Platform.OS === 'android' && { | ||
minHeight: variables.height, | ||
}), | ||
|
@@ -542,6 +545,15 @@ const styles = StyleSheet.create({ | |
titleContainer: { | ||
gap: Spacing.Smallest8, | ||
}, | ||
titleTokenContainer: { | ||
flex: 1, | ||
flexDirection: 'row', | ||
alignItems: 'flex-start', | ||
gap: Spacing.Smallest8, | ||
}, | ||
titleTokenIconContainer: { | ||
flexShrink: 1, | ||
}, | ||
subtitleContainer: { | ||
flex: 1, | ||
flexDirection: 'row', | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for my understanding, what's the purpose of this extra wrapper View?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrapped the token icon in an extra view to shrink it down; otherwise, it'll take up the whole line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, seems like having flexShrink: 1 does not really make a difference? and just the wrapper View without style should suffice, so maybe we can drop the style?