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

Improve loading remote images

This commit is contained in:
Zhiyuan Zheng
2021-05-30 22:12:22 +02:00
parent ecb9ce0c3a
commit 8aa84f7568
5 changed files with 32 additions and 33 deletions

View File

@ -52,8 +52,8 @@ const ImageItem = ({
const scrollViewRef = useRef<ScrollView>(null)
const [scaled, setScaled] = useState(false)
const [imageDimensions, setImageDimensions] = useState({
width: imageSrc.width || 0,
height: imageSrc.height || 0
width: imageSrc.width || 1,
height: imageSrc.height || 1
})
const handleDoubleTap = useDoubleTapToZoom(scrollViewRef, scaled, SCREEN)

View File

@ -58,7 +58,7 @@ const saveIos = async ({ messageRef, mode, image }: CommonProps) => {
}
const saveAndroid = async ({ messageRef, mode, image }: CommonProps) => {
const fileUri: string = `${FileSystem.documentDirectory}test.jpg`
const fileUri: string = `${FileSystem.documentDirectory}${image.id}.jpg`
const downloadedFile: FileSystem.FileSystemDownloadResult = await FileSystem.downloadAsync(
image.url,
fileUri
@ -80,7 +80,7 @@ const saveAndroid = async ({ messageRef, mode, image }: CommonProps) => {
ref: messageRef,
mode,
type: 'success',
message: 'test'
message: i18next.t('screenImageViewer:content.save.succeed')
})
})
.catch(() => {