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

custom minwidth added #52

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: 15 additions & 5 deletions src/Modal/Modal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ export default class Modal extends React.Component {
onDidClose: PropTypes.func,
onDidShow: PropTypes.func,
isAutoClosable: PropTypes.boolean,
onClose: PropTypes.func
onClose: PropTypes.func,
customMinWidth: PropTypes.string
};

static defaultProps = {
customMinWidth: '960px'
};

constructor(props, ...args) {
Expand All @@ -42,13 +47,13 @@ export default class Modal extends React.Component {
componentWillUnmount() {
this._enableRootScroll();
}

componentWillReceiveProps(nextProps) {
if (nextProps.isShown !== this.props.isShown) {
nextProps.isShown ? this.show() : this.hide();
}
}

show(callback: () => void) {
callback && this._onDidShowCallbacks.push(callback);

Expand Down Expand Up @@ -145,6 +150,8 @@ export default class Modal extends React.Component {
}

render() {
const customMinWidth = this.props.customMinWidth;

return (
<Teleport ref={(c) => this._teleport = c}>
<Transition
Expand All @@ -169,7 +176,11 @@ export default class Modal extends React.Component {
<AutoClosable onClose={this._onCloseHandler}>
<TeleportContext>
<View styles={[styles.popupWrapper]}>
<Popup styles={[styles.popup]} isRounded >
<Popup
styles={[styles.popup]}
style={{minWidth: customMinWidth}}
isRounded
>
{this._renderChildren()}
</Popup>
</View>
Expand Down Expand Up @@ -241,7 +252,6 @@ const styles = StyleSheet.create({
padding: 0,
flexDirection: 'column',
overflow: 'hidden',
minWidth: '960px',
minHeight: '400px',
},
shownOverlay: {
Expand Down