Fix crash

This commit is contained in:
Zhiyuan Zheng 2021-04-11 11:25:40 +02:00
parent 81ffaabcdc
commit 4df121e01a
No known key found for this signature in database
GPG Key ID: 078A93AB607D85E0
3 changed files with 23 additions and 24 deletions

View File

@ -73,23 +73,19 @@ const ParseEmojis = React.memo(
if (emojiIndex === -1) {
return <Text key={emojiShortcode + i}>{emojiShortcode}</Text>
} else {
if (i === 0) {
return <Text key={emojiShortcode + i}> </Text>
const uri = reduceMotionEnabled
? emojis[emojiIndex].static_url
: emojis[emojiIndex].url
if (validUrl.isHttpsUri(uri)) {
return (
<FastImage
key={emojiShortcode + i}
source={{ uri }}
style={styles.image}
/>
)
} else {
const uri = reduceMotionEnabled
? emojis[emojiIndex].static_url
: emojis[emojiIndex].url
if (validUrl.isHttpsUri(uri)) {
return (
<FastImage
key={emojiShortcode + i}
source={{ uri }}
style={styles.image}
/>
)
} else {
return null
}
return null
}
}
} else {

View File

@ -152,14 +152,16 @@ const TimelinePoll: React.FC<Props> = ({
</Text>
)
} else {
return (
<Text style={[styles.expiration, { color: theme.secondary }]}>
<Trans
i18nKey='componentTimeline:shared.poll.meta.expiration.until'
components={[<RelativeTime date={poll.expires_at} />]}
/>
</Text>
)
if (poll.expires_at) {
return (
<Text style={[styles.expiration, { color: theme.secondary }]}>
<Trans
i18nKey='componentTimeline:shared.poll.meta.expiration.until'
components={[<RelativeTime date={poll.expires_at} />]}
/>
</Text>
)
}
}
}, [mode, i18n.language, poll.expired, poll.expires_at])

View File

@ -28,6 +28,7 @@ const ComposeDrafts: React.FC<Props> = ({ accessibleRefDrafts }) => {
if (!composeState.dirty && instanceDrafts?.length) {
return (
<View
accessible
ref={accessibleRefDrafts}
style={styles.base}
children={