import * as React from 'react' ; interface IProps { readonly onComplete : ( ) => void ; readonly children : React . ReactElement ; } export const CompleteListener = React . memo ( function CompleteListener ( props ) { function handleKeyPress ( event ) { if ( ( event . ctrlKey || event . metaKey ) && event . key === 'Enter' ) { event . stopPropagation ( ) ; event . preventDefault ( ) ; props . onComplete ( ) ; } } return ( < div onKeyPress = { event => handleKeyPress ( event ) } > { props . children } < /div>); } ) ;