From 4df121e01ac8c2353607f49359086e14766fc625 Mon Sep 17 00:00:00 2001 From: Zhiyuan Zheng Date: Sun, 11 Apr 2021 11:25:40 +0200 Subject: [PATCH] Fix crash --- src/components/Parse/Emojis.tsx | 28 +++++++++++-------------- src/components/Timeline/Shared/Poll.tsx | 18 +++++++++------- src/screens/Compose/Root/Drafts.tsx | 1 + 3 files changed, 23 insertions(+), 24 deletions(-) diff --git a/src/components/Parse/Emojis.tsx b/src/components/Parse/Emojis.tsx index a0124abc..34c1066f 100644 --- a/src/components/Parse/Emojis.tsx +++ b/src/components/Parse/Emojis.tsx @@ -73,23 +73,19 @@ const ParseEmojis = React.memo( if (emojiIndex === -1) { return {emojiShortcode} } else { - if (i === 0) { - return + const uri = reduceMotionEnabled + ? emojis[emojiIndex].static_url + : emojis[emojiIndex].url + if (validUrl.isHttpsUri(uri)) { + return ( + + ) } else { - const uri = reduceMotionEnabled - ? emojis[emojiIndex].static_url - : emojis[emojiIndex].url - if (validUrl.isHttpsUri(uri)) { - return ( - - ) - } else { - return null - } + return null } } } else { diff --git a/src/components/Timeline/Shared/Poll.tsx b/src/components/Timeline/Shared/Poll.tsx index 8a76be92..2e9c2ce5 100644 --- a/src/components/Timeline/Shared/Poll.tsx +++ b/src/components/Timeline/Shared/Poll.tsx @@ -152,14 +152,16 @@ const TimelinePoll: React.FC = ({ ) } else { - return ( - - ]} - /> - - ) + if (poll.expires_at) { + return ( + + ]} + /> + + ) + } } }, [mode, i18n.language, poll.expired, poll.expires_at]) diff --git a/src/screens/Compose/Root/Drafts.tsx b/src/screens/Compose/Root/Drafts.tsx index 7d0be641..0808f1e7 100644 --- a/src/screens/Compose/Root/Drafts.tsx +++ b/src/screens/Compose/Root/Drafts.tsx @@ -28,6 +28,7 @@ const ComposeDrafts: React.FC = ({ accessibleRefDrafts }) => { if (!composeState.dirty && instanceDrafts?.length) { return (