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

View File

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

View File

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