Skip to content

Commit

Permalink
Fix ZacharyRSmith#42: moved unblock assign to CDM
Browse files Browse the repository at this point in the history
  • Loading branch information
kuhelbeher committed Jan 13, 2019
1 parent 28582f1 commit 2fe55eb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,15 @@ class NavigationPrompt extends React.Component<PropsT, StateT> {
(this:Object).onConfirm = this.onConfirm.bind(this);
(this:Object).when = this.when.bind(this);

this.state = {...initState, unblock: props.history.block(this.block)};
this.state = {...initState};
}

componentDidMount() {
if (!this.props.disableNative) {
window.addEventListener('beforeunload', this.onBeforeUnload);
}

this.setState({unblock: this.props.history.block(this.block)});
}

componentDidUpdate(prevProps, prevState) {
Expand Down

0 comments on commit 2fe55eb

Please sign in to comment.