Skip to content

Commit

Permalink
Use flex: 0.5 for every action + use consistent variable naming
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan committed May 6, 2024
1 parent a57afda commit a3713a6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/components/Lightbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ type Props = {
}

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

const onPressDelete = onDelete ? () => onDelete(currentImageIndex ?? initialIndex) : undefined
const onPressDelete = onDelete ? () => onDelete(currentImageIndex ?? initialImageIndex) : undefined

return (
<ImageView
images={photos.map((photo) => ({ uri: photo }))}
imageIndex={initialIndex}
imageIndex={initialImageIndex}
visible={index !== undefined}
swipeToCloseEnabled={false}
onImageIndexChange={setCurrentImageIndex}
Expand Down Expand Up @@ -153,7 +153,7 @@ const styles = StyleSheet.create({
marginHorizontal: theme.margin.common,
},
buttonContainer: {
width: '50%',
flex: 0.5,
alignItems: 'center',
},
})
Original file line number Diff line number Diff line change
Expand Up @@ -1967,7 +1967,7 @@ exports[`Lightbox Rendering With a delete button 1`] = `
style={
{
"alignItems": "center",
"width": "50%",
"flex": 0.5,
}
}
>
Expand Down

0 comments on commit a3713a6

Please sign in to comment.