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

Tapping on an empty editor area creates a new paragraph block #16439

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 14 additions & 1 deletion packages/block-editor/src/components/block-list/index.native.js
Expand Up @@ -2,7 +2,7 @@
* External dependencies
*/
import { identity } from 'lodash';
import { Text, View, Keyboard, SafeAreaView, Platform } from 'react-native';
import { Text, View, Keyboard, SafeAreaView, Platform, TouchableWithoutFeedback } from 'react-native';
import { subscribeMediaAppend } from 'react-native-gutenberg-bridge';

/**
Expand Down Expand Up @@ -33,6 +33,7 @@ export class BlockList extends Component {

this.renderItem = this.renderItem.bind( this );
this.renderAddBlockSeparator = this.renderAddBlockSeparator.bind( this );
this.renderBlockListFooter = this.renderBlockListFooter.bind( this );
this.shouldFlatListPreventAutomaticScroll = this.shouldFlatListPreventAutomaticScroll.bind( this );
this.renderDefaultBlockAppender = this.renderDefaultBlockAppender.bind( this );
this.onBlockTypeSelected = this.onBlockTypeSelected.bind( this );
Expand Down Expand Up @@ -171,6 +172,7 @@ export class BlockList extends Component {
title={ this.props.title }
ListHeaderComponent={ this.props.header }
ListEmptyComponent={ this.renderDefaultBlockAppender }
ListFooterComponent={ this.renderBlockListFooter }
/>
<SafeAreaView>
<View style={ { height: toolbarHeight } } />
Expand Down Expand Up @@ -242,6 +244,17 @@ export class BlockList extends Component {
);
}

renderBlockListFooter() {
const paragraphBlock = createBlock( 'core/paragraph' );
return (
<TouchableWithoutFeedback onPress={ () => {
this.finishBlockAppendingOrReplacing( paragraphBlock );
} } >
<View style={ styles.blockListFooter } />
</TouchableWithoutFeedback>
);
}

renderHTML() {
return (
<HTMLTextInput { ...this.props } parentHeight={ this.props.rootViewHeight } />
Expand Down
Expand Up @@ -73,3 +73,7 @@
.blockHolderFocused {
border-color: $gray-lighten-30;
}

.blockListFooter {
height: 80px;
}