Skip to content
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
15 changes: 11 additions & 4 deletions packages/block-library/src/image/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -509,11 +509,14 @@ export class ImageEdit extends Component {
image,
clientId,
imageDefaultSize,
context: { imageCrop = false } = {},
context,
featuredImageId,
wasBlockJustInserted,
} = this.props;
const { align, url, alt, id, sizeSlug, className } = attributes;
const hasImageContext = context
? Object.keys( context ).length > 0
: false;

const imageSizes = Array.isArray( this.props.imageSizes )
? this.props.imageSizes
Expand Down Expand Up @@ -627,9 +630,11 @@ export class ImageEdit extends Component {

const additionalImageProps = {
height: '100%',
resizeMode: imageCrop ? 'cover' : 'contain',
resizeMode: context?.imageCrop ? 'cover' : 'contain',
};

const imageContainerStyles = [ hasImageContext && styles.fixedHeight ];

const getImageComponent = ( openMediaOptions, getMediaOptions ) => (
<Badge label={ __( 'Featured' ) } show={ isFeaturedImage }>
<TouchableWithoutFeedback
Expand Down Expand Up @@ -662,7 +667,7 @@ export class ImageEdit extends Component {
retryMessage,
} ) => {
return (
<View style={ styles.isGallery }>
<View style={ imageContainerStyles }>
<Image
align={
align && alignToFlex[ align ]
Expand All @@ -686,7 +691,9 @@ export class ImageEdit extends Component {
url={ url }
shapeStyle={ styles[ className ] }
width={ this.getWidth() }
{ ...additionalImageProps }
{ ...( hasImageContext
? additionalImageProps
: {} ) }
/>
</View>
);
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/image/styles.native.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
padding-bottom: $grid-unit;
}

.isGallery {
.fixedHeight {
height: 150;
overflow: visible;
}
Expand Down