Skip to content

Commit

Permalink
[RNMobile] Fix dismiss keyboard button for the post title (#17260)
Browse files Browse the repository at this point in the history
  • Loading branch information
geriux authored and pinarol committed Aug 30, 2019
1 parent 7aa44a2 commit f9fa455
Showing 1 changed file with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ function HeaderToolbar( {
undo,
showInserter,
showKeyboardHideButton,
clearSelectedBlock,
theme,
onHideKeyboard,
} ) {
const scrollViewRef = useRef( null );
const scrollToStart = () => {
Expand Down Expand Up @@ -76,7 +76,7 @@ function HeaderToolbar( {
<ToolbarButton
title={ __( 'Hide keyboard' ) }
icon="keyboard-hide"
onClick={ clearSelectedBlock }
onClick={ onHideKeyboard }
extraProps={ { hint: __( 'Tap to hide the keyboard' ) } }
/>
</Toolbar>
Expand All @@ -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 );

0 comments on commit f9fa455

Please sign in to comment.