1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Removed expo blurhash

This commit is contained in:
Zhiyuan Zheng
2021-01-28 01:31:19 +01:00
parent c9c6e126ae
commit 9c36052c2a
7 changed files with 36 additions and 290 deletions

View File

@ -1,6 +1,4 @@
import { StyleConstants } from '@utils/styles/constants'
import { Surface } from 'gl-react-expo'
import { Blurhash } from 'gl-react-blurhash'
import React, { useCallback, useState } from 'react'
import {
ImageStyle,
@ -9,6 +7,7 @@ import {
StyleSheet,
ViewStyle
} from 'react-native'
import { Blurhash } from 'react-native-blurhash'
import FastImage from 'react-native-fast-image'
import { useTheme } from '@utils/styles/ThemeManager'
@ -43,7 +42,9 @@ const GracefullyImage: React.FC<Props> = ({
onLoad={() => setImageLoaded(true)}
/>
{blurhash && (hidden || !imageLoaded) ? (
<Surface
<Blurhash
decodeAsync
blurhash={blurhash}
style={{
width: '100%',
height: '100%',
@ -51,9 +52,7 @@ const GracefullyImage: React.FC<Props> = ({
top: StyleConstants.Spacing.XS / 2,
left: StyleConstants.Spacing.XS / 2
}}
>
<Blurhash hash={blurhash} />
</Surface>
/>
) : null}
</>
)

View File

@ -4,10 +4,9 @@ import { Slider } from '@sharcoux/slider'
import { StyleConstants } from '@utils/styles/constants'
import { useTheme } from '@utils/styles/ThemeManager'
import { Audio } from 'expo-av'
import { Surface } from 'gl-react-expo'
import { Blurhash } from 'gl-react-blurhash'
import React, { useCallback, useState } from 'react'
import { StyleSheet, View } from 'react-native'
import { Blurhash } from 'react-native-blurhash'
import attachmentAspectRatio from './aspectRatio'
import analytics from '@components/analytics'
@ -63,16 +62,15 @@ const AttachmentAudio: React.FC<Props> = ({
>
<View style={styles.overlay}>
{sensitiveShown ? (
audio.blurhash && (
<Surface
audio.blurhash ? (
<Blurhash
blurhash={audio.blurhash}
style={{
width: '100%',
height: '100%'
}}
>
<Blurhash hash={audio.blurhash} />
</Surface>
)
/>
) : null
) : (
<>
{audio.preview_url && (

View File

@ -3,11 +3,10 @@ import Button from '@components/Button'
import openLink from '@components/openLink'
import { StyleConstants } from '@utils/styles/constants'
import { useTheme } from '@utils/styles/ThemeManager'
import { Blurhash } from 'gl-react-blurhash'
import { Surface } from 'gl-react-expo'
import React from 'react'
import { useTranslation } from 'react-i18next'
import { StyleSheet, Text, View } from 'react-native'
import { Blurhash } from 'react-native-blurhash'
import attachmentAspectRatio from './aspectRatio'
export interface Props {
@ -34,15 +33,14 @@ const AttachmentUnsupported: React.FC<Props> = ({
]}
>
{attachment.blurhash ? (
<Surface
<Blurhash
blurhash={attachment.blurhash}
style={{
position: 'absolute',
width: '100%',
height: '100%'
}}
>
<Blurhash hash={attachment.blurhash} />
</Surface>
/>
) : null}
{!sensitiveShown ? (
<>

View File

@ -1,10 +1,9 @@
import Button from '@components/Button'
import { StyleConstants } from '@utils/styles/constants'
import { Video } from 'expo-av'
import { Surface } from 'gl-react-expo'
import { Blurhash } from 'gl-react-blurhash'
import React, { useCallback, useRef, useState } from 'react'
import { Pressable, StyleSheet, View } from 'react-native'
import { Blurhash } from 'react-native-blurhash'
import attachmentAspectRatio from './aspectRatio'
import analytics from '@components/analytics'
@ -85,14 +84,13 @@ const AttachmentVideo: React.FC<Props> = ({
<Pressable style={styles.overlay}>
{sensitiveShown ? (
video.blurhash ? (
<Surface
<Blurhash
blurhash={video.blurhash}
style={{
width: '100%',
height: '100%'
}}
>
<Blurhash hash={video.blurhash} />
</Surface>
/>
) : null
) : (
<Button