Skip to content

Commit

Permalink
[RNMobile] fix show appender and separator in Group block (#19908)
Browse files Browse the repository at this point in the history
* fix appender to duplicate separator line
  • Loading branch information
jbinda authored Jan 28, 2020
1 parent f6470e6 commit 17f6eae
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions packages/block-editor/src/components/block-list/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export class BlockList extends Component {
this.scrollViewInnerRef = this.scrollViewInnerRef.bind( this );
this.addBlockToEndOfPost = this.addBlockToEndOfPost.bind( this );
this.shouldFlatListPreventAutomaticScroll = this.shouldFlatListPreventAutomaticScroll.bind( this );
this.shouldShowInnerBlockAppender = this.shouldShowInnerBlockAppender.bind( this );
}

addBlockToEndOfPost( newBlock ) {
Expand Down Expand Up @@ -67,6 +68,14 @@ export class BlockList extends Component {
);
}

shouldShowInnerBlockAppender() {
const {
blockClientIds,
renderAppender,
} = this.props;
return ( renderAppender && blockClientIds.length > 0 );
}

render() {
const {
clearSelectedBlock,
Expand All @@ -75,7 +84,6 @@ export class BlockList extends Component {
title,
header,
withFooter = true,
renderAppender,
isReadOnly,
isRootList,
} = this.props;
Expand Down Expand Up @@ -104,11 +112,12 @@ export class BlockList extends Component {
ListFooterComponent={ ! isReadOnly && withFooter && this.renderBlockListFooter }
/>

{ renderAppender && blockClientIds.length > 0 && (
{ this.shouldShowInnerBlockAppender() && (
<View style={ styles.paddingToContent }>
<BlockListAppender
rootClientId={ this.props.rootClientId }
renderAppender={ this.props.renderAppender }
showSeparator
/>
</View>
)
Expand Down Expand Up @@ -146,7 +155,7 @@ export class BlockList extends Component {
onCaretVerticalPositionChange={ this.onCaretVerticalPositionChange }
isSmallScreen={ ! this.props.isFullyBordered }
/> ) }
{ shouldShowInsertionPointAfter( clientId ) && <BlockInsertionPoint /> }
{ ! this.shouldShowInnerBlockAppender() && shouldShowInsertionPointAfter( clientId ) && <BlockInsertionPoint /> }
</View>
</ReadableContentView>
);
Expand Down

0 comments on commit 17f6eae

Please sign in to comment.