This commit is contained in:
Zhiyuan Zheng 2021-04-19 11:34:50 +02:00
parent c9964f8d1f
commit 292101ab30
No known key found for this signature in database
GPG Key ID: 078A93AB607D85E0
2 changed files with 12 additions and 6 deletions

View File

@ -6,7 +6,9 @@ const saveIos = async (
image: Nav.RootStackParamList['Screen-ImagesViewer']['imageUrls'][0]
) => {
CameraRoll.save(image.url)
.then(() => haptics('Success'))
.then(() => {
haptics('Success')
})
.catch(() => {
if (image.remote_url) {
CameraRoll.save(image.remote_url)

View File

@ -11,15 +11,19 @@ import {
useSafeAreaInsets
} from 'react-native-safe-area-context'
import ImageViewer from './ImageViewer/Root'
import { saveAndroid, saveIos } from './ImageViewer/save'
const saveImage = async (
image: Nav.RootStackParamList['Screen-ImagesViewer']['imageUrls'][0]
) => {
const save = require('./ImageViewer/save')
Platform.select({
ios: save.saveIos(image),
android: save.saveAndroid(image)
})
switch (Platform.OS) {
case 'ios':
saveIos(image)
break
case 'android':
saveAndroid(image)
break
}
}
const HeaderComponent = React.memo(