Skip to content

Commit

Permalink
[fixed] Removes unneeded sanitizeProps function (reactjs#169)
Browse files Browse the repository at this point in the history
fixes reactjs#165

The sanitize props function seems to be unneeded and there
is no concrete explanation for why it is there.  This removes
it to prevent problems caused by calling it.
  • Loading branch information
claydiffrient committed Apr 23, 2016
1 parent c55d6b4 commit aa66819
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 58 deletions.
54 changes: 1 addition & 53 deletions examples/basic/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,46 +6,16 @@ var appElement = document.getElementById('example');

Modal.setAppElement('#example');

Modal.defaultStyles = {
overlay : {
position : 'fixed',
top : 0,
left : 0,
right : 0,
bottom : 0,
backgroundColor : 'rebeccapurple'
},
content : {
position : 'absolute',
top : '40px',
left : '40px',
right : '40px',
bottom : '40px',
border : '1px solid #ccc',
background : '#fff',
overflow : 'auto',
WebkitOverflowScrolling : 'touch',
borderRadius : '4px',
outline : 'none',
padding : '20px'

}
}

var App = React.createClass({

getInitialState: function() {
return { modalIsOpen: false, modalIsOpen2: false };
return { modalIsOpen: false };
},

openModal: function() {
this.setState({modalIsOpen: true});
},

openModal2: function() {
this.setState({modalIsOpen2: true});
},

closeModal: function() {
this.setState({modalIsOpen: false});
},
Expand All @@ -69,7 +39,6 @@ var App = React.createClass({
return (
<div>
<button onClick={this.openModal}>Open Modal</button>
<button onClick={this.openModal2}>Open Modal 2</button>
<Modal
ref="mymodal"
closeTimeoutMS={150}
Expand All @@ -92,27 +61,6 @@ var App = React.createClass({
<button>hi</button>
</form>
</Modal>
<Modal
closeTimeoutMS={150}
isOpen={this.state.modalIsOpen2}
onRequestClose={this.handleModalCloseRequest}
>
<h1>Hello</h1>
<button onClick={this.closeModal}>close</button>
<div>I am a modal</div>
<form>
<input onChange={this.handleInputChange} />
<input />
<input />
<input />
<input />
<br/>
<button>hi</button>
<button>hi</button>
<button>hi</button>
<button>hi</button>
</form>
</Modal>
</div>
);
}
Expand Down
5 changes: 0 additions & 5 deletions lib/components/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ var Modal = React.createClass({
},

componentWillReceiveProps: function(newProps) {
sanitizeProps(newProps);
this.renderPortal(newProps);
},

Expand Down Expand Up @@ -110,7 +109,3 @@ Modal.defaultStyles = {
}

module.exports = Modal

function sanitizeProps(props) {
delete props.ref;
}

0 comments on commit aa66819

Please sign in to comment.