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

dialog render-to-layer version #2129

Merged
merged 3 commits into from
Nov 24, 2015
Merged

Conversation

chrismcv
Copy link
Contributor

This PR created a wrapped dialog component that uses the render to layer component to put the dialog in a separate dom tree.

The reason for the wrapping is so that refs can continue to be used as normal within the dialog component for animation.

(This doesn't depend on the #2043 branch)

@@ -45,27 +46,26 @@ const Overlay = React.createClass({
autoLockScrolling: React.PropTypes.bool,
show: React.PropTypes.bool,
transitionEnabled: React.PropTypes.bool,
style: React.PropTypes.object,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove this property?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

carelessness - merging from #1845 by hand... apologies

@chrismcv
Copy link
Contributor Author

@oliviertassinari - rebasing this wasn't as the warning have moved completely, so git merge had a bad day at the office. I've manually rolled in your changes. Can I suggest no further changes to dialog.jsx get added to master until this is merged (assuming that is planned for soon.)

@oliviertassinari
Copy link
Member

@chrismcv Sorry about this. I had to merge the fix #2142. Otherwise, I agree, let's freeze dialog.jsx.

},

getDefaultProps() {
return {
show:true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the show property be required instead of adding a default value?

@@ -39,36 +40,35 @@ const Overlay = React.createClass({
componentWillReceiveProps (nextProps, nextContext) {
let newMuiTheme = nextContext.muiTheme ? nextContext.muiTheme : this.state.muiTheme;
this.setState({muiTheme: newMuiTheme});
if (this.state.show !== nextProps.show) {
this.setState({show:nextProps.show}, this._applyAutoLockScrolling);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is two setState call. Do you if this will have an impact on perf?
Actually, it looks like we don't need to have show in the state.
Can't we just use the show property?

@chrismcv
Copy link
Contributor Author

@oliviertassinari - your'e right, state not required, have removed :)

@@ -134,6 +131,16 @@ const Overlay = React.createClass({
if (!this.props.autoLockScrolling) this._allowScrolling();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You removed the function call to this method.
So I think that we can remove preventScrolling and allowScrolling method.

This component is also used by LeftNav, I have just checked, it should be fine.
I think that it will also be good to move _allowScrollingand _preventScrolling inside _applyAutoLockScrolling since their are only called by this method.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

componentWillUnmount calls _allowScrolling, had a think about combining, but think its best to keep this separate. Does that sound ok?

@oliviertassinari
Copy link
Member

@chrismcv I think that I'm done with my comments and that we can soon merge 😄.

@chrismcv chrismcv force-pushed the dialog-r2l branch 2 times, most recently from 365e81b to c01336d Compare November 21, 2015 18:29
@chrismcv
Copy link
Contributor Author

@oliviertassinari - defaultOpen added back in, and squashed.

@oliviertassinari
Copy link
Member

I have noticed one issue. When we open the dialog for a second time, the height is not correct.
I think that it's linked to the render-to-layout component since this bug only happen if you reopen the dialog at max one second after.

@oliviertassinari oliviertassinari added PR: needs revision The pull request can't be merged. More details is available on the code review or fails in the CI and removed Review: review-needed labels Nov 24, 2015
@chrismcv
Copy link
Contributor Author

@oliviertassinari apologies - rebase caused some confusion there, hence open and close. I had another rebase issue so manually merged it (see b4b7bb9).

Does this fix your height issue?

@oliviertassinari
Copy link
Member

@chrismcv The height issue is gone, great work 👍!

oliviertassinari added a commit that referenced this pull request Nov 24, 2015
[Dialog] Use render-to-layer component
@oliviertassinari oliviertassinari merged commit 41a2266 into mui:master Nov 24, 2015
@oliviertassinari oliviertassinari added Review: accepted and removed PR: needs revision The pull request can't be merged. More details is available on the code review or fails in the CI labels Nov 24, 2015
@chrismcv chrismcv deleted the dialog-r2l branch February 1, 2016 21:13
@zannager zannager added the component: dialog This is the name of the generic UI component, not the React module! label Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: dialog This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants