Skip to content

Commit

Permalink
Remove style-propable from left-nav
Browse files Browse the repository at this point in the history
  • Loading branch information
newoga committed Feb 8, 2016
1 parent 484f038 commit 2082041
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions src/left-nav.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import React from 'react';
import ReactDOM from 'react-dom';
import KeyCode from './utils/key-code';
import StylePropable from './mixins/style-propable';
import autoPrefix from './styles/auto-prefix';
import Transitions from './styles/transitions';
import WindowListenable from './mixins/window-listenable';
Expand Down Expand Up @@ -89,13 +87,11 @@ const LeftNav = React.createClass({
muiTheme: React.PropTypes.object,
},

//for passing default theme context to children
childContextTypes: {
muiTheme: React.PropTypes.object,
},

mixins: [
StylePropable,
WindowListenable,
],

Expand Down Expand Up @@ -133,11 +129,8 @@ const LeftNav = React.createClass({
this._enableSwipeHandling();
},

//to update theme inside state whenever a new theme is passed down
//from the parent / owner using context
componentWillReceiveProps(nextProps, nextContext) {
const newMuiTheme = nextContext.muiTheme ? nextContext.muiTheme : this.state.muiTheme;
const newState = {muiTheme: newMuiTheme};
const newState = {muiTheme: nextContext.muiTheme || this.state.muiTheme};

// If docked is changed, change the open state for when uncontrolled.
if (this.props.docked !== nextProps.docked) newState.open = nextProps.docked;
Expand Down Expand Up @@ -283,7 +276,7 @@ const LeftNav = React.createClass({
},

_setPosition(translateX) {
const leftNav = ReactDOM.findDOMNode(this.refs.clickAwayableElement);
const leftNav = this.refs.clickAwayableElement;
const transformCSS = `translate3d(${(this._getTranslateMultiplier() * translateX)}px, 0, 0)`;
this.refs.overlay.setOpacity(1 - translateX / this._getMaxTranslateX());
autoPrefix.set(leftNav.style, 'transform', transformCSS, this.state.muiTheme);
Expand Down Expand Up @@ -383,7 +376,7 @@ const LeftNav = React.createClass({
ref="overlay"
show={this._shouldShow()}
className={overlayClassName}
style={this.mergeStyles(styles.overlay, overlayStyle)}
style={Object.assign(styles.overlay, overlayStyle)}
transitionEnabled={!this.state.swiping}
onTouchTap={this._onOverlayTouchTap}
/>
Expand All @@ -399,7 +392,7 @@ const LeftNav = React.createClass({
rounded={false}
transitionEnabled={!this.state.swiping}
className={className}
style={this.mergeStyles(styles.root, openRight && styles.rootWhenOpenRight, style)}
style={Object.assign(styles.root, openRight && styles.rootWhenOpenRight, style)}
>
{children}
</Paper>
Expand Down

0 comments on commit 2082041

Please sign in to comment.