close modal by clicking outside of it

This commit is contained in:
seanyesmunt 2018-05-31 00:32:31 -04:00 committed by Sean Yesmunt
parent 5ad42609c3
commit 7339727e29
3 changed files with 12 additions and 3 deletions

View file

@ -195,7 +195,10 @@ class Video extends React.PureComponent<Props> {
style={layoverStyle} style={layoverStyle}
> >
<VideoPlayButton <VideoPlayButton
play={this.playContent} play={e => {
e.stopPropagation();
this.playContent();
}}
fileInfo={fileInfo} fileInfo={fileInfo}
uri={uri} uri={uri}
isLoading={isLoading} isLoading={isLoading}

View file

@ -56,7 +56,7 @@ export class Modal extends React.PureComponent<ModalProps> {
return ( return (
<ReactModal <ReactModal
{...modalProps} {...modalProps}
onCloseRequested={onAborted || onConfirmed} onRequestClose={onAborted || onConfirmed}
className={classnames(className, { className={classnames(className, {
modal: !fullScreen, modal: !fullScreen,
'modal--fullscreen': fullScreen, 'modal--fullscreen': fullScreen,

View file

@ -3,6 +3,12 @@ import FilePrice from 'component/filePrice';
import { Modal } from 'modal/modal'; import { Modal } from 'modal/modal';
class ModalAffirmPurchase extends React.PureComponent { class ModalAffirmPurchase extends React.PureComponent {
constructor() {
super();
this.onAffirmPurchase = this.onAffirmPurchase.bind(this);
}
onAffirmPurchase() { onAffirmPurchase() {
this.props.closeModal(); this.props.closeModal();
this.props.loadVideo(this.props.uri); this.props.loadVideo(this.props.uri);
@ -20,7 +26,7 @@ class ModalAffirmPurchase extends React.PureComponent {
type="confirm" type="confirm"
isOpen isOpen
contentLabel={__('Confirm Purchase')} contentLabel={__('Confirm Purchase')}
onConfirmed={this.onAffirmPurchase.bind(this)} onConfirmed={this.onAffirmPurchase}
onAborted={cancelPurchase} onAborted={cancelPurchase}
> >
{__('This will purchase')} <strong>{title}</strong> {__('for')}{' '} {__('This will purchase')} <strong>{title}</strong> {__('for')}{' '}