Fix all type errors
This commit is contained in:
parent
c4ba5e7fd5
commit
7e3f6f0306
45 changed files with 377 additions and 294 deletions
|
@ -0,0 +1,21 @@
|
|||
// default implementation fallback for web
|
||||
|
||||
import React from 'react'
|
||||
import {View} from 'react-native'
|
||||
import {ImageSource} from '../../@types'
|
||||
|
||||
type Props = {
|
||||
imageSrc: ImageSource
|
||||
onRequestClose: () => void
|
||||
onZoom: (scaled: boolean) => void
|
||||
onLongPress: (image: ImageSource) => void
|
||||
delayLongPress: number
|
||||
swipeToCloseEnabled?: boolean
|
||||
doubleTapToZoomEnabled?: boolean
|
||||
}
|
||||
|
||||
const ImageItem = (_props: Props) => {
|
||||
return <View />
|
||||
}
|
||||
|
||||
export default React.memo(ImageItem)
|
|
@ -47,8 +47,8 @@ const useImageDimensions = (image: ImageSource): Dimensions | null => {
|
|||
if (imageDimensions) {
|
||||
resolve(imageDimensions)
|
||||
} else {
|
||||
// @ts-ignore
|
||||
Image.getSizeWithHeaders(
|
||||
// @ts-ignore
|
||||
source.uri,
|
||||
source.headers,
|
||||
(width: number, height: number) => {
|
||||
|
|
|
@ -61,7 +61,7 @@ const usePanResponder = ({
|
|||
let tmpTranslate: Position | null = null
|
||||
let isDoubleTapPerformed = false
|
||||
let lastTapTS: number | null = null
|
||||
let longPressHandlerRef: number | null = null
|
||||
let longPressHandlerRef: NodeJS.Timeout | null = null
|
||||
|
||||
const meaningfulShift = MIN_DIMENSION * 0.01
|
||||
const scaleValue = new Animated.Value(initialScale)
|
||||
|
|
|
@ -77,6 +77,7 @@ export const getImageStyles = (
|
|||
const transform = translate.getTranslateTransform()
|
||||
|
||||
if (scale) {
|
||||
// @ts-ignore TODO - is scale incorrect? might need to remove -prf
|
||||
transform.push({scale}, {perspective: new Animated.Value(1000)})
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import ImageView from './ImageViewing'
|
|||
import {useStores} from '../../../state'
|
||||
import * as models from '../../../state/models/shell-ui'
|
||||
import {saveImageModal} from '../../../lib/images'
|
||||
import {ImageSource} from './ImageViewing/@types'
|
||||
|
||||
export const Lightbox = observer(function Lightbox() {
|
||||
const store = useStores()
|
||||
|
@ -15,8 +16,14 @@ export const Lightbox = observer(function Lightbox() {
|
|||
const onClose = () => {
|
||||
store.shell.closeLightbox()
|
||||
}
|
||||
const onLongPress = ({uri}: {uri: string}) => {
|
||||
saveImageModal({uri})
|
||||
const onLongPress = (image: ImageSource) => {
|
||||
if (
|
||||
typeof image === 'object' &&
|
||||
'uri' in image &&
|
||||
typeof image.uri === 'string'
|
||||
) {
|
||||
saveImageModal({uri: image.uri})
|
||||
}
|
||||
}
|
||||
|
||||
if (store.shell.activeLightbox?.name === 'profile-image') {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue