From 237d56bcb97d63c4b878e6ed6e3deec57e5838c0 Mon Sep 17 00:00:00 2001 From: Jonathan <--global> Date: Fri, 3 May 2024 14:28:11 +0200 Subject: [PATCH] Add hit slop --- src/components/Lightbox.tsx | 51 ++++++++--------- .../__snapshots__/Lightbox.test.tsx.snap | 57 ++++++++++++++++--- 2 files changed, 74 insertions(+), 34 deletions(-) diff --git a/src/components/Lightbox.tsx b/src/components/Lightbox.tsx index dfd0c44..d16e140 100644 --- a/src/components/Lightbox.tsx +++ b/src/components/Lightbox.tsx @@ -11,31 +11,30 @@ import font from '../styles/font' import textStyle from '../styles/text' import theme from '../styles/theme' +const hitSlop = { top: 16, left: 16, bottom: 16, right: 16 } + const getLightboxHeaderComponent = (numberOfPages: number, onClose: () => void) => - ({ imageIndex }: { imageIndex: number }) => { - const hitSlop = { top: 16, left: 16, bottom: 16, right: 16 } - return ( - - - - - - - - onClose()} hitSlop={hitSlop}> - - - + ({ imageIndex }: { imageIndex: number }) => ( + + + + + + + + onClose()} hitSlop={hitSlop}> + + - - ) - } + + + ) const getLightboxFooterComponent = ( @@ -62,11 +61,9 @@ const getLightboxFooterComponent = {onPressDelete && ( - + + + )} diff --git a/src/components/__tests__/__snapshots__/Lightbox.test.tsx.snap b/src/components/__tests__/__snapshots__/Lightbox.test.tsx.snap index 54fa24d..e9210dc 100644 --- a/src/components/__tests__/__snapshots__/Lightbox.test.tsx.snap +++ b/src/components/__tests__/__snapshots__/Lightbox.test.tsx.snap @@ -1992,6 +1992,14 @@ exports[`Lightbox Rendering With a delete button 1`] = ` accessible={true} collapsable={false} focusable={true} + hitSlop={ + { + "bottom": 16, + "left": 16, + "right": 16, + "top": 16, + } + } onClick={[Function]} onResponderGrant={[Function]} onResponderMove={[Function]} @@ -2004,14 +2012,49 @@ exports[`Lightbox Rendering With a delete button 1`] = ` "opacity": 1, } } - testID="delete-photo" > - + + +