1
0
mirror of https://github.com/tooot-app/app synced 2025-04-24 23:18:47 +02:00

Fix Plerooma search crash

Potentially could be crashing in other scenarios where history data is missing
This commit is contained in:
xmflsct 2022-12-21 15:31:18 +01:00
parent 5e90a0d8f3
commit 10f7d74600

View File

@ -52,6 +52,7 @@ const ComponentHashtag: React.FC<PropsWithChildren & Props> = ({
> >
#{hashtag.name} #{hashtag.name}
</CustomText> </CustomText>
{hashtag.history?.length ? (
<View <View
style={{ flexDirection: 'row', alignItems: 'center', alignSelf: 'stretch' }} style={{ flexDirection: 'row', alignItems: 'center', alignSelf: 'stretch' }}
onLayout={({ onLayout={({
@ -61,13 +62,14 @@ const ComponentHashtag: React.FC<PropsWithChildren & Props> = ({
}) => setHeight(height)} }) => setHeight(height)}
> >
<Sparkline <Sparkline
data={hashtag.history?.map(h => parseInt(h.uses)).reverse()} data={hashtag.history.map(h => parseInt(h.uses)).reverse()}
width={width} width={width}
height={height} height={height}
margin={children ? StyleConstants.Spacing.S : undefined} margin={children ? StyleConstants.Spacing.S : undefined}
/> />
{children} {children}
</View> </View>
) : null}
</Pressable> </Pressable>
) )
} }