diff --git a/packages/edit-post/src/components/header/header-toolbar/index.native.js b/packages/edit-post/src/components/header/header-toolbar/index.native.js index 9c71845889d371..487dcea882dab1 100644 --- a/packages/edit-post/src/components/header/header-toolbar/index.native.js +++ b/packages/edit-post/src/components/header/header-toolbar/index.native.js @@ -1,7 +1,7 @@ /** * External dependencies */ -import { ScrollView, Keyboard, Platform, View } from 'react-native'; +import { ScrollView, View } from 'react-native'; /** * WordPress dependencies @@ -31,14 +31,6 @@ function HeaderToolbar( { showKeyboardHideButton, clearSelectedBlock, } ) { - const hideKeyboard = () => { - clearSelectedBlock(); - if ( Platform.OS === 'android' ) { - // Avoiding extra blur calls on iOS but still needed for android. - Keyboard.dismiss(); - } - }; - return ( @@ -96,7 +88,7 @@ export default compose( [ withDispatch( ( dispatch ) => ( { redo: dispatch( 'core/editor' ).redo, undo: dispatch( 'core/editor' ).undo, - clearSelectedBlock: dispatch( 'core/editor' ).clearSelectedBlock, + clearSelectedBlock: dispatch( 'core/block-editor' ).clearSelectedBlock, } ) ), withViewportMatch( { isLargeViewport: 'medium' } ), ] )( HeaderToolbar ); diff --git a/packages/editor/src/components/provider/index.native.js b/packages/editor/src/components/provider/index.native.js index d2b1458d3e2e56..d19da119ef0ba5 100644 --- a/packages/editor/src/components/provider/index.native.js +++ b/packages/editor/src/components/provider/index.native.js @@ -118,6 +118,8 @@ class NativeEditorProvider extends Component { const { mode, switchMode } = this.props; // refresh html content first this.serializeToNativeAction(); + // make sure to blur the selected block and dismiss the keyboard + this.props.clearSelectedBlock(); switchMode( mode === 'visual' ? 'text' : 'visual' ); } @@ -161,11 +163,15 @@ export default compose( [ editPost, resetEditorBlocks, } = dispatch( 'core/editor' ); + const { + clearSelectedBlock, + } = dispatch( 'core/block-editor' ); const { switchEditorMode, } = dispatch( 'core/edit-post' ); return { + clearSelectedBlock, editTitle( title ) { editPost( { title } ); },