Skip to content

Commit

Permalink
Remove the custom mobile code, and use the default web implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
daniloercoli committed Jan 25, 2019
1 parent 55feb8a commit e2346f1
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions packages/editor/src/components/post-title/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,13 @@ import { withDispatch } from '@wordpress/data';
import { withFocusOutside } from '@wordpress/components';
import { withInstanceId, compose } from '@wordpress/compose';

import {
getDefaultBlockName,
createBlock,
} from '@wordpress/blocks';

class PostTitle extends Component {
constructor() {
super( ...arguments );

this.onChange = this.onChange.bind( this );
this.onSelect = this.onSelect.bind( this );
this.onUnselect = this.onUnselect.bind( this );
this.onEnter = this.onEnter.bind( this );

this.state = {
isSelected: false,
Expand All @@ -48,14 +42,6 @@ class PostTitle extends Component {
this.props.onUpdate( title );
}

onEnter( ) {
const { insertBlocksAfter } = this.props;
if ( ! insertBlocksAfter ) {
return;
}
insertBlocksAfter( [ createBlock( getDefaultBlockName() ) ] );
}

render() {
const {
placeholder,
Expand All @@ -70,7 +56,7 @@ class PostTitle extends Component {
blurOnSubmit={ true }
textAlignVertical="top"
multiline={ false }
onSubmitEditing={ this.onEnter }
onSubmitEditing={ this.props.onEnterPress }
returnKeyType={ 'next' }
onChangeText={ this.onChange }
onFocus={ this.onSelect }
Expand All @@ -84,10 +70,14 @@ class PostTitle extends Component {

const applyWithDispatch = withDispatch( ( dispatch ) => {
const {
insertDefaultBlock,
clearSelectedBlock,
} = dispatch( 'core/editor' );

return {
onEnterPress() {
insertDefaultBlock( undefined, undefined, 0 );
},
clearSelectedBlock,
};
} );
Expand Down

0 comments on commit e2346f1

Please sign in to comment.