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

Trying out expo 43

This commit is contained in:
Zhiyuan Zheng
2021-10-24 00:43:00 +02:00
parent 567a09d6c6
commit b96a1ca49b
25 changed files with 1203 additions and 1487 deletions

View File

@ -2,11 +2,12 @@ import haptics from '@components/haptics'
import { displayMessage } from '@components/Message'
import CameraRoll from '@react-native-community/cameraroll'
import { RootStackParamList } from '@utils/navigation/navigators'
import * as FileSystem from 'expo-file-system'
import * as MediaLibrary from 'expo-media-library'
import i18next from 'i18next'
import { RefObject } from 'react'
import { Platform } from 'react-native'
import FlashMessage from 'react-native-flash-message'
import { FileSystem, Permissions } from 'react-native-unimodules'
type CommonProps = {
messageRef: RefObject<FlashMessage>
@ -60,17 +61,15 @@ const saveIos = async ({ messageRef, mode, image }: CommonProps) => {
const saveAndroid = async ({ messageRef, mode, image }: CommonProps) => {
const fileUri: string = `${FileSystem.documentDirectory}${image.id}.jpg`
const downloadedFile: FileSystem.FileSystemDownloadResult = await FileSystem.downloadAsync(
image.url,
fileUri
)
const downloadedFile: FileSystem.FileSystemDownloadResult =
await FileSystem.downloadAsync(image.url, fileUri)
if (downloadedFile.status != 200) {
console.warn('error!')
}
const perm = await Permissions.askAsync(Permissions.MEDIA_LIBRARY)
if (perm.status != 'granted') {
const perm = await MediaLibrary.requestPermissionsAsync()
if (!perm.granted) {
return
}