Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/dynamic-height-issue #359

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ export default class ModalBox extends React.PureComponent {
if (this.props.isOpen != prevProps.isOpen) {
this.handleOpenning();
}
if(!this.state.isOpen){
this.ignoreOnOpened=false
}
}

componentWillUnmount() {
Expand Down Expand Up @@ -269,7 +272,7 @@ export default class ModalBox extends React.PureComponent {
animOpen,
positionDest
});
if (this.props.onOpened) this.props.onOpened();
if (this.props.onOpened && !this.ignoreOnOpened) this.props.onOpened();
});
});
}
Expand Down Expand Up @@ -410,9 +413,20 @@ export default class ModalBox extends React.PureComponent {

// If the dimensions are still the same we're done
let newState = {};
if (height !== this.state.height) newState.height = height;
if (width !== this.state.width) newState.width = width;
this.layoutChanged=false
if (height !== this.state.height) {
newState.height = height;
this.layoutChanged=true
}
if (width !== this.state.width) {
newState.width = width;
this.layoutChanged=true
}
this.setState(newState);
if(this.state.isOpen && this.layoutChanged){
this.ignoreOnOpened=true
this.animateOpen();
}

if (this.onViewLayoutCalculated) this.onViewLayoutCalculated();
}
Expand Down