Format image preview dialog callback
Co-authored-by: Julius Marminge <[email protected]>
This commit is contained in:
1 parent
406d486e06
commit
b89ba0651b
1 file changed
+9
-6
@@ -50,12 +50,15 @@ export const ExpandedImageDialog = memo(function ExpandedImageDialog({
|
||||
const activeIndex =
|
||||
imageCount > 0 ? (preview.index + navigationOffset + imageCount) % imageCount : preview.index;
|
||||
|
||||
const navigateImage = useCallback((direction: -1 | 1) => {
|
||||
setNavigationOffset((offset) => {
|
||||
if (imageCount <= 1) return offset;
|
||||
return offset + direction;
|
||||
});
|
||||
}, [imageCount]);
|
||||
const navigateImage = useCallback(
|
||||
(direction: -1 | 1) => {
|
||||
setNavigationOffset((offset) => {
|
||||
if (imageCount <= 1) return offset;
|
||||
return offset + direction;
|
||||
});
|
||||
},
|
||||
[imageCount],
|
||||
);
|
||||
|
||||
useExpandedImageDialogKeyboardShortcuts({
|
||||
imageCount,
|
||||
|
||||
Reference in new issue
Block a user