Saves image on long press (#83)

* Saves image on long press

* Adds save on long press

* Forking lightbox

* move to wrapper only to the bottom sheet to reduce impact of this change

* lint

* lint

* lint

* Use official `share` API

* Clean up cache after download

* comment

* comment

* Reduce swipe close velocity

* Updates per feedback

* lint

* bugfix

* Adds delayed press-in for TouchableOpacity
This commit is contained in:
Aryan Goharzad 2023-01-25 18:25:34 -05:00 committed by GitHub
parent adf328b50c
commit eb33c3fa81
23 changed files with 1568 additions and 46 deletions

View file

@ -1,20 +1,22 @@
import React from 'react'
import {View} from 'react-native'
import {observer} from 'mobx-react-lite'
import ImageView from 'react-native-image-viewing'
import ImageView from './ImageViewing'
import {useStores} from '../../../state'
import * as models from '../../../state/models/shell-ui'
import {saveImageModal} from '../../../lib/images'
export const Lightbox = observer(function Lightbox() {
const store = useStores()
const onClose = () => {
console.log('hit')
store.shell.closeLightbox()
if (!store.shell.isLightboxActive) {
return null
}
if (!store.shell.isLightboxActive) {
return <View />
const onClose = () => {
store.shell.closeLightbox()
}
const onLongPress = ({uri}: {uri: string}) => {
saveImageModal({uri})
}
if (store.shell.activeLightbox?.name === 'profile-image') {
@ -35,6 +37,7 @@ export const Lightbox = observer(function Lightbox() {
imageIndex={opts.index}
visible
onRequestClose={onClose}
onLongPress={onLongPress}
/>
)
} else {