From 392df98bfeedfe8615657448f62439c888649444 Mon Sep 17 00:00:00 2001 From: Tugdual de Kerviler Date: Thu, 23 May 2019 14:08:39 +0200 Subject: [PATCH] [RN mobile] Accessibility: Handle the iOS z-gesture to exit modals and block selection (#15153) * Close the modal on z-gesture on iOS * Disable cancel and retry dialog if image is already uploaded * Fix long press disabled by TouchableWithoutFeedback wrapper * Updated image label for double tap and hold gesture * Remove long press gesture from image, since edit image function is not reachable anymore * Solve merge conflict * Adding long press gesture to image block on selected state * Fix lint issues --- .../block-library/src/image/edit.native.js | 59 ++++++++++--------- .../src/mobile/bottom-sheet/index.native.js | 1 + 2 files changed, 33 insertions(+), 27 deletions(-) diff --git a/packages/block-library/src/image/edit.native.js b/packages/block-library/src/image/edit.native.js index f45c455f1a8abf..7ef23a0b0f9b89 100644 --- a/packages/block-library/src/image/edit.native.js +++ b/packages/block-library/src/image/edit.native.js @@ -211,22 +211,16 @@ class ImageEdit extends React.Component { this.setState( { showSettings: false } ); }; - const toolbarEditButton = ( - { - return ( - - { getMediaOptions() } - - - ); - } } > - + const getToolbarEditButton = ( open ) => ( + + + + + ); const getInspectorControls = () => ( @@ -276,11 +270,9 @@ class ImageEdit extends React.Component { } const imageContainerHeight = Dimensions.get( 'window' ).width / IMAGE_ASPECT_RATIO; - - return ( + const getImageComponent = ( openMediaOptions, getMediaOptions ) => ( { getInspectorControls() } + { getMediaOptions() } { ( ! this.state.isCaptionSelected ) && - - { toolbarEditButton } - + getToolbarEditButton( openMediaOptions ) } - { ! imageWidthWithinContainer && - { this.getIcon( false ) } - } + { ! imageWidthWithinContainer && + + { this.getIcon( false ) } + } { isUploadFailed && @@ -383,6 +379,15 @@ class ImageEdit extends React.Component { ); + + return ( + { + return getImageComponent( open, getMediaOptions ); + } } + /> + ); } } diff --git a/packages/components/src/mobile/bottom-sheet/index.native.js b/packages/components/src/mobile/bottom-sheet/index.native.js index 6caed0b1da4854..9106709cea25ef 100644 --- a/packages/components/src/mobile/bottom-sheet/index.native.js +++ b/packages/components/src/mobile/bottom-sheet/index.native.js @@ -135,6 +135,7 @@ class BottomSheet extends Component { swipeDirection="down" onMoveShouldSetResponder={ panResponder.panHandlers.onMoveShouldSetResponder } onMoveShouldSetResponderCapture={ panResponder.panHandlers.onMoveShouldSetResponderCapture } + onAccessibilityEscape={ this.props.onClose } >