fix: remove event listener when leaving file page

This commit is contained in:
Sean Yesmunt 2019-03-21 15:35:34 -04:00
parent 26f1227b89
commit 85d17b607e

View file

@ -90,6 +90,9 @@ class MediaPlayer extends React.PureComponent<Props, State> {
componentWillUnmount() {
const mediaElement = this.mediaContainer.current.children[0];
document.removeEventListener('keydown', this.togglePlay);
if (mediaElement) {
mediaElement.removeEventListener('click', this.togglePlay);
}