Skip to content

Commit

Permalink
Update isFullscreen state from props
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Hugg committed May 7, 2021
1 parent b6f30cd commit 9d367e2
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions VideoPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,15 @@ export default class VideoPlayer extends Component {
};
}

componentDidUpdate = (prevProps) => {
const {isFullscreen} = this.props;

if (prevProps.isFullscreen !== isFullscreen) {
this.setState({
isFullscreen,
});
}
};
/**
| -------------------------------------------------------
| Events
Expand Down Expand Up @@ -1063,7 +1072,7 @@ export default class VideoPlayer extends Component {
{...this.player.seekPanResponder.panHandlers}>
<View
style={styles.seekbar.track}
onLayout={event =>
onLayout={(event) =>
(this.player.seekerWidth = event.nativeEvent.layout.width)
}
pointerEvents={'none'}>
Expand Down Expand Up @@ -1193,7 +1202,7 @@ export default class VideoPlayer extends Component {
<View style={[styles.player.container, this.styles.containerStyle]}>
<Video
{...this.props}
ref={videoPlayer => (this.player.ref = videoPlayer)}
ref={(videoPlayer) => (this.player.ref = videoPlayer)}
resizeMode={this.state.resizeMode}
volume={this.state.volume}
paused={this.state.paused}
Expand Down

0 comments on commit 9d367e2

Please sign in to comment.