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

[Popover] Remove window-listenable mixin #3308

Merged
merged 1 commit into from
Feb 12, 2016
Merged
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
32 changes: 15 additions & 17 deletions src/popover/popover.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import ReactDOM from 'react-dom';
import WindowListenable from '../mixins/window-listenable';
import EventListener from 'react-event-listener';
import RenderToLayer from '../render-to-layer';
import PropTypes from '../utils/prop-types';
import Paper from '../paper';
Expand Down Expand Up @@ -107,10 +107,6 @@ const Popover = React.createClass({
muiTheme: React.PropTypes.object,
},

mixins: [
WindowListenable,
],

getDefaultProps() {
return {
anchorOrigin: {
Expand Down Expand Up @@ -187,11 +183,6 @@ const Popover = React.createClass({
this.setPlacement();
},

windowListeners: {
resize: 'setPlacementThrottled',
scroll: 'setPlacementThrottledScrolled',
},

renderLayer() {
let {
animated,
Expand Down Expand Up @@ -387,13 +378,20 @@ const Popover = React.createClass({

render() {
return (
<RenderToLayer
ref="layer"
open={this.state.open}
componentClickAway={this.componentClickAway}
useLayerForClickAway={this.props.useLayerForClickAway}
render={this.renderLayer}
/>
<noscript>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let me know what you think about this, the children component both return null, I wasn't sure what the right tag was to use for something that ultimately wasn't rendering anything. I settled for noscript (which is what I think React uses when you return null) but if you'd prefer div or something else let me know.

Copy link
Member

Choose a reason for hiding this comment

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

no div. I think is good 👍

<EventListener
elementName="window"
onScroll={this.setPlacementThrottledScrolled}
onResize={this.setPlacementThrottled}
/>
<RenderToLayer
ref="layer"
open={this.state.open}
componentClickAway={this.componentClickAway}
useLayerForClickAway={this.props.useLayerForClickAway}
render={this.renderLayer}
/>
</noscript>
);
},

Expand Down