react-native-modalbox
react-native-modalbox copied to clipboard
`componentWillReceiveProps` does not reflect `isOpen` prop properly.
The current componentWillReceiveProps function does not reflect the new properties accordingly.
If the isOpen property is modified, the handleOpenning function ends up comparing nextProps.isOpen against this.props.isDisabled in the open/close functions which shouldn't be the case.
It'd make more sense to pass in the current props and replace stuff like:
close: function() {
if (this.props.isDisabled) return;
if (!this.state.isAnimateClose && (this.state.isOpen || this.state.isAnimateOpen)) {
delete this.onViewLayoutCalculated;
this.animateClose();
}
}
with
close: function(nextProps = null) {
let props = nextProps || this.props;
if (props.isDisabled) return;
if (!this.state.isAnimateClose && (this.state.isOpen || this.state.isAnimateOpen)) {
delete this.onViewLayoutCalculated;
this.animateClose();
}
}
Or better yet, just move the handleOpenning function into componentDidUpdate instead.
any PR for this?
++