Skip to content

Commit

Permalink
Fix worm bug (null tags)
Browse files Browse the repository at this point in the history
  • Loading branch information
adityapawar1 committed Apr 9, 2024
1 parent f9f6ed6 commit 05bf2d3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/components/PreviewCard/PreviewCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,25 @@ function PreviewCard({
numberOfLines={3}
style={[globalStyles.subtext, styles.storyDescription]}
>
"{cheerio.load(excerpt.html).text()}"
"{cheerio.load(excerpt.html ?? "").text()}"
</Text>
</View>
</View>
<View style={styles.tagsContainer}>
<View style={styles.tagsRow}>
<View style={styles.tag}>
<Text key={tags[0]} style={globalStyles.button1}>
{tags[0]}
</Text>
</View>
{(tags?.length ?? 0) > 0 &&
<View style={styles.tag}>
<Text key={tags[0]} style={globalStyles.button1}>
{tags[0]}
</Text>
</View>
}
</View>
<View style={styles.moreTags}>
<Pressable>
<Text style={[globalStyles.subtext, styles.moreTagsText]}>
{' '}
+ {tags.length - 1} more tags
+ {(tags?.length ?? 1) - 1} more tags
</Text>
</Pressable>
</View>
Expand Down
1 change: 1 addition & 0 deletions src/components/PreviewCard/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ const styles = StyleSheet.create({
paddingTop: 4,
},
moreTags: {
paddingVertical: 10,
paddingRight: 12,
alignItems: 'center',
justifyContent: 'center',
Expand Down

0 comments on commit 05bf2d3

Please sign in to comment.