This commit is contained in:
Zhiyuan Zheng 2021-04-01 18:39:53 +02:00
parent 5a45e1d0dc
commit cf33c52e49
No known key found for this signature in database
GPG Key ID: 078A93AB607D85E0
3 changed files with 21 additions and 5 deletions

View File

@ -6,6 +6,7 @@ import {
Pressable, Pressable,
StyleProp, StyleProp,
StyleSheet, StyleSheet,
View,
ViewStyle ViewStyle
} from 'react-native' } from 'react-native'
import { Blurhash } from 'react-native-blurhash' import { Blurhash } from 'react-native-blurhash'
@ -94,9 +95,24 @@ const GracefullyImage = React.memo(
[source] [source]
) )
const blurhashView = useMemo(() => { const blurhashView = useMemo(() => {
return blurhash && (hidden || !imageLoaded) ? ( if (hidden || !imageLoaded) {
<Blurhash decodeAsync blurhash={blurhash} style={styles.blurhash} /> if (blurhash) {
) : null return (
<Blurhash decodeAsync blurhash={blurhash} style={styles.blurhash} />
)
} else {
return (
<View
style={[
styles.blurhash,
{ backgroundColor: theme.disabled }
]}
/>
)
}
} else {
return null
}
}, [hidden, imageLoaded]) }, [hidden, imageLoaded])
return ( return (

View File

@ -69,7 +69,7 @@ const ParseEmojis = React.memo(
return emojiShortcode === `:${emoji.shortcode}:` return emojiShortcode === `:${emoji.shortcode}:`
}) })
if (emojiIndex === -1) { if (emojiIndex === -1) {
return <Text>{emojiShortcode}</Text> return <Text key={emojiShortcode}>{emojiShortcode}</Text>
} else { } else {
if (i === 0) { if (i === 0) {
return <Text key={emojiShortcode}> </Text> return <Text key={emojiShortcode}> </Text>

View File

@ -195,7 +195,7 @@ const ScreenCompose: React.FC<ScreenComposeProp> = ({
const autoSave = composeState.dirty const autoSave = composeState.dirty
? setInterval(() => { ? setInterval(() => {
saveDraft() saveDraft()
}, 2000) }, 1000)
: removeDraft() : removeDraft()
return () => autoSave && clearInterval(autoSave) return () => autoSave && clearInterval(autoSave)
}, [composeState]) }, [composeState])