Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mobile - Disable long press event in media blocks #40651

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/block-library/src/cover/controls.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ function Controls( {
styles.mediaPreview,
mediaBackground,
] }
onLongPress={ openMediaOptions }
>
<View style={ styles.mediaInner }>
{ IMAGE_BACKGROUND_TYPE === backgroundType && (
Expand Down
1 change: 0 additions & 1 deletion packages/block-library/src/cover/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,6 @@ const Cover = ( {
<TouchableWithoutFeedback
accessible={ ! isParentSelected }
onPress={ onMediaPressed }
onLongPress={ openMediaOptionsRef.current }
disabled={ ! isParentSelected }
>
<View style={ [ styles.background, backgroundColor ] }>
Expand Down
1 change: 0 additions & 1 deletion packages/block-library/src/file/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,6 @@ export class FileEdit extends Component {
<TouchableWithoutFeedback
accessible={ ! isSelected }
onPress={ this.onFilePressed }
onLongPress={ openMediaOptions }
disabled={ ! isSelected }
>
<View
Expand Down
1 change: 0 additions & 1 deletion packages/block-library/src/image/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,6 @@ export class ImageEdit extends Component {
<TouchableWithoutFeedback
accessible={ ! isSelected }
onPress={ this.onImagePressed }
onLongPress={ openMediaOptions }
disabled={ ! isSelected }
>
<View style={ styles.content }>
Expand Down
4 changes: 3 additions & 1 deletion packages/block-library/src/media-text/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ class MediaTextEdit extends Component {
const widthString = `${ temporaryMediaWidth }%`;
const innerBlockWidth = shouldStack ? 100 : 100 - temporaryMediaWidth;
const innerBlockWidthString = `${ innerBlockWidth }%`;
const hasMedia =
mediaType === MEDIA_TYPE_IMAGE || mediaType === MEDIA_TYPE_VIDEO;

const innerBlockContainerStyle = [
{ width: innerBlockWidthString },
Expand Down Expand Up @@ -344,7 +346,7 @@ class MediaTextEdit extends Component {
<>
{ mediaType === MEDIA_TYPE_IMAGE && this.getControls() }
<BlockControls>
{ ( isMediaSelected || mediaType === MEDIA_TYPE_VIDEO ) && (
{ hasMedia && (
<ToolbarGroup>
<Button
label={ __( 'Edit media' ) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ class MediaContainer extends Component {
<TouchableWithoutFeedback
accessible={ ! isSelected }
onPress={ this.onMediaPressed }
onLongPress={ openMediaOptions }
disabled={ ! isSelected }
>
<View
Expand Down Expand Up @@ -222,7 +221,7 @@ class MediaContainer extends Component {
);
}

renderVideo( params, openMediaOptions ) {
renderVideo( params ) {
fluiddot marked this conversation as resolved.
Show resolved Hide resolved
const {
aligmentStyles,
mediaUrl,
Expand Down Expand Up @@ -251,7 +250,6 @@ class MediaContainer extends Component {
<TouchableWithoutFeedback
accessible={ ! isSelected }
onPress={ this.onMediaPressed }
onLongPress={ openMediaOptions }
disabled={ ! isSelected }
>
<View style={ [ styles.videoContainer, aligmentStyles ] }>
Expand Down Expand Up @@ -305,7 +303,7 @@ class MediaContainer extends Component {
mediaElement = this.renderImage( params, openMediaOptions );
break;
case MEDIA_TYPE_VIDEO:
mediaElement = this.renderVideo( params, openMediaOptions );
mediaElement = this.renderVideo( params );
break;
}
return mediaElement;
Expand Down