1
0
mirror of https://github.com/tooot-app/app synced 2025-04-17 11:47:24 +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,22 +52,24 @@ const ComponentHashtag: React.FC<PropsWithChildren & Props> = ({
>
#{hashtag.name}
</CustomText>
<View
style={{ flexDirection: 'row', alignItems: 'center', alignSelf: 'stretch' }}
onLayout={({
nativeEvent: {
layout: { height }
}
}) => setHeight(height)}
>
<Sparkline
data={hashtag.history?.map(h => parseInt(h.uses)).reverse()}
width={width}
height={height}
margin={children ? StyleConstants.Spacing.S : undefined}
/>
{children}
</View>
{hashtag.history?.length ? (
<View
style={{ flexDirection: 'row', alignItems: 'center', alignSelf: 'stretch' }}
onLayout={({
nativeEvent: {
layout: { height }
}
}) => setHeight(height)}
>
<Sparkline
data={hashtag.history.map(h => parseInt(h.uses)).reverse()}
width={width}
height={height}
margin={children ? StyleConstants.Spacing.S : undefined}
/>
{children}
</View>
) : null}
</Pressable>
)
}