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

fix: display for non collectable tabs #4292

Merged
merged 11 commits into from
Oct 12, 2023
24 changes: 14 additions & 10 deletions src/tokens/Assets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ function AssetsScreen({ navigation, route }: Props) {
}
})

const sections: SectionListData<TokenBalance | Position | Nft, SectionData>[] = []
const sections: SectionListData<TokenBalance | Position | Nft[], SectionData>[] = []
positionsByDapp.forEach((positions, appName) => {
sections.push({
data: positions,
Expand Down Expand Up @@ -315,7 +315,7 @@ function AssetsScreen({ navigation, route }: Props) {
}
}

const NftItem = ({ item, index }: { item: Nft; index: number }) => {
const NftItem = ({ item }: { item: Nft }) => {
return (
<View testID="NftItem" style={styles.nftsTouchableContainer}>
<Touchable
Expand Down Expand Up @@ -351,7 +351,7 @@ function AssetsScreen({ navigation, route }: Props) {
return (
<View style={styles.nftsPairingContainer}>
{item.map((nft, index) => (
<NftItem key={index} item={nft} index={index} />
<NftItem key={index} item={nft} />
))}
</View>
)
Expand Down Expand Up @@ -396,7 +396,7 @@ function AssetsScreen({ navigation, route }: Props) {
else if (nftsLoading) return null
else
return (
<View style={{ marginTop: listHeaderHeight }}>
<View style={[{ marginTop: listHeaderHeight }, styles.noNftsTextContainer]}>
<Text style={styles.noNftsText}>{t('nftGallery.noNfts')}</Text>
</View>
)
Expand Down Expand Up @@ -432,10 +432,10 @@ function AssetsScreen({ navigation, route }: Props) {
paddingBottom: insets.bottom,
opacity: listHeaderHeight > 0 ? 1 : 0,
},
activeTab === AssetTabType.Collectibles && styles.nftsContentContainer,
activeTab === AssetTabType.Collectibles && nftsError
? { alignItems: 'center' }
: { paddingLeft: Spacing.Thick24 },
activeTab === AssetTabType.Collectibles &&
!nftsError &&
nfts.length > 0 &&
styles.nftsContentContainer,
]}
// ensure header is above the scrollbar on ios overscroll
scrollIndicatorInsets={{ top: listHeaderHeight }}
Expand Down Expand Up @@ -575,6 +575,7 @@ const styles = StyleSheet.create({
},
nftsContentContainer: {
alignItems: 'flex-start',
paddingHorizontal: Spacing.Thick24,
},
nftsErrorView: {
width: nftImageSize,
Expand All @@ -586,7 +587,7 @@ const styles = StyleSheet.create({
borderRadius: Spacing.Regular16,
},
nftsNoMetadataText: {
...typeScale.titleLarge,
...typeScale.labelSmall,
textAlign: 'center',
},
nftsTouchableContainer: {
Expand All @@ -597,10 +598,13 @@ const styles = StyleSheet.create({
borderRadius: Spacing.Regular16,
},
noNftsText: {
...typeScale.labelMedium,
...typeScale.bodySmall,
color: Colors.gray3,
MuckT marked this conversation as resolved.
Show resolved Hide resolved
textAlign: 'center',
},
noNftsTextContainer: {
paddingHorizontal: Spacing.Thick24,
},
})

export default AssetsScreen