Skip to content

Commit

Permalink
Hide preview thumbnail when light changes to false
Browse files Browse the repository at this point in the history
  • Loading branch information
albanqoku committed Aug 10, 2019
1 parent 6876ec4 commit 183895d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/ReactPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,14 @@ export default class ReactPlayer extends Component {
return !isEqual(this.props, nextProps) || !isEqual(this.state, nextState)
}
componentWillUpdate (nextProps) {
const { light } = this.props
this.config = getConfig(nextProps, defaultProps)
if (!this.props.light && nextProps.light) {
if (!light && nextProps.light) {
this.setState({ showPreview: true })
}
if (light && !nextProps.light) {
this.setState({ showPreview: false })
}
}
onClickPreview = () => {
this.setState({ showPreview: false })
Expand Down

0 comments on commit 183895d

Please sign in to comment.