From f9fa455452e9c49eb102d7d5d94b275f622bc905 Mon Sep 17 00:00:00 2001 From: Gerardo Pacheco Date: Fri, 30 Aug 2019 11:06:27 +0200 Subject: [PATCH] [RNMobile] Fix dismiss keyboard button for the post title (#17260) --- .../header/header-toolbar/index.native.js | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) 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 97ca3a62349bc..278b0af30548e 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 @@ -30,8 +30,8 @@ function HeaderToolbar( { undo, showInserter, showKeyboardHideButton, - clearSelectedBlock, theme, + onHideKeyboard, } ) { const scrollViewRef = useRef( null ); const scrollToStart = () => { @@ -76,7 +76,7 @@ function HeaderToolbar( { @@ -94,11 +94,19 @@ export default compose( [ showInserter: select( 'core/edit-post' ).getEditorMode() === 'visual' && select( 'core/editor' ).getEditorSettings().richEditingEnabled, isTextModeEnabled: select( 'core/edit-post' ).getEditorMode() === 'text', } ) ), - withDispatch( ( dispatch ) => ( { - redo: dispatch( 'core/editor' ).redo, - undo: dispatch( 'core/editor' ).undo, - clearSelectedBlock: dispatch( 'core/block-editor' ).clearSelectedBlock, - } ) ), + withDispatch( ( dispatch ) => { + const { clearSelectedBlock } = dispatch( 'core/block-editor' ); + const { togglePostTitleSelection } = dispatch( 'core/editor' ); + + return { + redo: dispatch( 'core/editor' ).redo, + undo: dispatch( 'core/editor' ).undo, + onHideKeyboard() { + clearSelectedBlock(); + togglePostTitleSelection( false ); + }, + }; + } ), withViewportMatch( { isLargeViewport: 'medium' } ), withTheme, ] )( HeaderToolbar );