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
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,6 @@ export class BlockList extends Component {
ListHeaderComponent={ header }
ListEmptyComponent={ this.renderDefaultBlockAppender }
ListFooterComponent={ withFooter && this.renderBlockListFooter }
getItemLayout={ ( data, index ) => {
return { length: 0, offset: 0, index };
} }
/>

{ renderAppender && blockClientIds.length > 0 &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ class InnerBlocks extends Component {
rootClientId={ clientId }
renderAppender={ renderAppender }
withFooter={ false }
isFullyBordered={ true }
/>
) }
</>
Expand Down
20 changes: 17 additions & 3 deletions packages/block-editor/src/components/inserter/menu.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ import { BottomSheet, Icon } from '@wordpress/components';
import styles from './style.scss';

export class InserterMenu extends Component {
constructor() {
super( ...arguments );

this.onLayout = this.onLayout.bind( this );
this.state = {
numberOfColumns: this.calculateNumberOfColumns(),
};
}

componentDidMount() {
this.onOpen();
}
Expand All @@ -47,9 +56,13 @@ export class InserterMenu extends Component {
this.props.hideInsertionPoint();
}

onLayout() {
const numberOfColumns = this.calculateNumberOfColumns();
this.setState( { numberOfColumns } );
}

render() {
const { getStylesFromColorScheme } = this.props;
const numberOfColumns = this.calculateNumberOfColumns();
const bottomPadding = styles.contentBottomPadding;
const modalIconWrapperStyle = getStylesFromColorScheme( styles.modalIconWrapper, styles.modalIconWrapperDark );
const modalIconStyle = getStylesFromColorScheme( styles.modalIcon, styles.modalIconDark );
Expand All @@ -63,10 +76,11 @@ export class InserterMenu extends Component {
hideHeader
>
<FlatList
onLayout={ this.onLayout }
scrollEnabled={ false }
key={ `InserterUI-${ numberOfColumns }` } //re-render when numberOfColumns changes
key={ `InserterUI-${ this.state.numberOfColumns }` } //re-render when numberOfColumns changes
keyboardShouldPersistTaps="always"
numColumns={ numberOfColumns }
numColumns={ this.state.numberOfColumns }
data={ this.props.items }
ItemSeparatorComponent={ () =>
<View style={ styles.rowSeparator } />
Expand Down
16 changes: 9 additions & 7 deletions packages/block-library/src/media-text/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { View } from 'react-native';
import { __, _x } from '@wordpress/i18n';
import {
BlockControls,
BlockVerticalAlignmentToolbar,
// BlockVerticalAlignmentToolbar,
InnerBlocks,
withColors,
} from '@wordpress/block-editor';
Expand Down Expand Up @@ -131,15 +131,16 @@ class MediaTextEdit extends Component {
attributes,
backgroundColor,
setAttributes,
isMobile,
// isMobile,
} = this.props;
const {
isStackedOnMobile,
// isStackedOnMobile,
mediaPosition,
mediaWidth,
verticalAlignment,
} = attributes;
const shouldStack = isStackedOnMobile && isMobile;
const shouldStack = false; // We are temporarily not stacking until we fix alignment buttons
// const shouldStack = isStackedOnMobile && isMobile; // <<< Original line
const temporaryMediaWidth = shouldStack ? 100 : ( this.state.mediaWidth || mediaWidth );
const widthString = `${ temporaryMediaWidth }%`;
const containerStyles = {
Expand All @@ -165,21 +166,22 @@ class MediaTextEdit extends Component {
onClick: () => setAttributes( { mediaPosition: 'right' } ),
} ];

const onVerticalAlignmentChange = ( alignment ) => {
/* const onVerticalAlignmentChange = ( alignment ) => {
setAttributes( { verticalAlignment: alignment } );
};
}; */

return (
<>
<BlockControls>
<Toolbar
controls={ toolbarControls }
/>
{ /* // Temporarily commenting out until alignment functionality is fixed
<BlockVerticalAlignmentToolbar
onChange={ onVerticalAlignmentChange }
value={ verticalAlignment }
isCollapsed={ false }
/>
/> */ }
</BlockControls>
<View style={ containerStyles }>
<View style={ { width: widthString } }>
Expand Down
13 changes: 5 additions & 8 deletions packages/block-library/src/media-text/media-container.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,14 @@ class MediaContainer extends Component {
}

componentDidMount() {
const { mediaId, mediaUrl, onSelectMedia } = this.props;
const { mediaId, mediaUrl, onMediaUpdate, mediaType } = this.props;

if ( mediaId && mediaUrl && ! isURL( mediaUrl ) ) {
if ( mediaUrl.indexOf( 'file:' ) === 0 ) {
requestMediaImport( mediaUrl, ( id, url, type ) => {
if ( mediaUrl.indexOf( 'file:' ) === 0 && mediaType === MEDIA_TYPE_IMAGE ) {
// We don't want to call this for video because it is starting a media upload for the cover url
requestMediaImport( mediaUrl, ( id, url ) => {
if ( url ) {
onSelectMedia( {
media_type: type,
id,
url,
} );
onMediaUpdate( { id, url } );
}
} );
}
Expand Down