Merge pull request #99 from tooot-app/main

Fix crash
This commit is contained in:
xmflsct 2021-04-11 18:00:09 +02:00 committed by GitHub
commit 80c6b1fe26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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={