Skip to content

Commit

Permalink
Use better variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan committed May 6, 2024
1 parent 83e699c commit 768ce68
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/components/Lightbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,18 @@ type Props = {
}

const Lightbox = ({ index, onClose, onDelete, photos, title, description, content, style }: Props) => {
const [imageIndexAfterSwipe, setImageIndexAfterSwipe] = useState<number>()
const initialImageIndex = index ?? 0
const [currentImageIndex, setCurrentImageIndex] = useState<number>(initialImageIndex)

const imageIndex = index ?? 0

const onPressDelete = onDelete ? () => onDelete(imageIndexAfterSwipe ?? imageIndex) : undefined
const onPressDelete = onDelete ? () => onDelete(currentImageIndex) : undefined

return (
<ImageView
images={photos.map((photo) => ({ uri: photo }))}
imageIndex={imageIndex}
imageIndex={currentImageIndex}
visible={index !== undefined}
swipeToCloseEnabled={false}
onImageIndexChange={setImageIndexAfterSwipe}
onImageIndexChange={setCurrentImageIndex}
onRequestClose={onClose}
HeaderComponent={getLightboxHeaderComponent(photos.length, onClose)}
FooterComponent={getLightboxFooterComponent(title, description, content, style, onPressDelete)}
Expand Down

0 comments on commit 768ce68

Please sign in to comment.