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

[LeftNav] Rename onChangeRequest to onRequestChange #2351

Merged
merged 1 commit into from
Dec 3, 2015
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion docs/src/app/components/app-left-nav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const AppLeftNav = React.createClass({
ref="leftNav"
docked={false}
open={this.state.leftNavOpen}
onChangeRequest={this._onLeftNavChangeRequest}
onRequestChange={this._onLeftNavChangeRequest}
header={header}
menuItems={menuItems}
selectedIndex={this._getSelectedIndex()}
Expand Down
16 changes: 8 additions & 8 deletions docs/src/app/components/pages/components/left-nav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default class LeftNavPage extends React.Component {
this.desc = 'The api of Left Nav has been changed to be declarative. ' +
'The methods close, open and toggle have been deprecated. ' +
'In order to control the Left Nav use the open property and handle ' +
'the onChangeRequest event. Also, as you have noticed there are no examples ' +
'the onRequestChange event. Also, as you have noticed there are no examples ' +
'for uncontrolled mode. That is because uncontrolled Left Nav can only be open ' +
'with swipe. The doc site has an uncontrolled Left Nav, swipe left with a touch ' +
'device to see it.';
Expand Down Expand Up @@ -124,21 +124,21 @@ export default class LeftNavPage extends React.Component {
header: 'LeftNav.open()',
desc: 'Opens the component. ' +
'Using this method is deprecated, use the ' +
'open property and handle onChangeRequest to control the left nav.',
'open property and handle onRequestChange to control the left nav.',
},
{
name: 'Deprecated: close',
header: 'LeftNav.close()',
desc: 'Closes the component, hiding it from view. ' +
'Using this method is deprecated, use the ' +
'open property and handle onChangeRequest to control the left nav.',
'open property and handle onRequestChange to control the left nav.',
},
{
name: 'Deprecated: toggle',
header: 'LeftNav.toggle()',
desc: 'Toggles between the open and closed states. ' +
'Using this method is deprecated, use the ' +
'open property and handle onChangeRequest to control the left nav.',
'open property and handle onRequestChange to control the left nav.',
},
],
},
Expand All @@ -157,17 +157,17 @@ export default class LeftNavPage extends React.Component {
header: 'function()',
desc: 'Fired when the component is opened. ' +
'Using this method is deprecated, use the ' +
'open property and handle onChangeRequest to control the left nav.',
'open property and handle onRequestChange to control the left nav.',
},
{
name: 'Deprecated: onNavClose',
header: 'function()',
desc: 'Fired when the component is closed. ' +
'Using this method is deprecated, use the ' +
'open property and handle onChangeRequest to control the left nav.',
'open property and handle onRequestChange to control the left nav.',
},
{
name: 'onChangeRequest',
name: 'onRequestChange',
header: 'function(open, reason)',
desc: 'Callback function that is fired when the ' +
'open state of the left nav is requested to be changed. ' +
Expand Down Expand Up @@ -214,7 +214,7 @@ import LeftNav from 'material-ui/lib/left-nav/';
<LeftNav open={this.state.navOpen} menuItems={menuItems} />
<LeftNav
open={this.state.undockedNavOpen}
onChangeRequest={this._changeLeftNavUndockedControlledClick}
onRequestChange={this._changeLeftNavUndockedControlledClick}
docked={false}
menuItems={menuItems} />
</div>
Expand Down
10 changes: 5 additions & 5 deletions docs/src/app/components/raw-code/left-nav-code.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ menuItems = [
</LeftNav>

//Controlled and undocked Left Nav.
<LeftNav
open={this.state.undockedNavOpen}
onChangeRequest={this._handleLeftNavChanged}
docked={false}
menuItems={menuItems} />
<LeftNav
open={this.state.undockedNavOpen}
onRequestChange={this._handleLeftNavChanged}
docked={false}
menuItems={menuItems} />
10 changes: 5 additions & 5 deletions src/left-nav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ const LeftNav = React.createClass({
menuItemClassNameSubheader: React.PropTypes.string,
menuItems: React.PropTypes.array,
onChange: React.PropTypes.func,
onChangeRequest: React.PropTypes.func,
onNavClose: React.PropTypes.func,
onNavOpen: React.PropTypes.func,
onRequestChange: React.PropTypes.func,
open: React.PropTypes.bool,
openRight: React.PropTypes.bool,
selectedIndex: React.PropTypes.number,
Expand Down Expand Up @@ -249,10 +249,10 @@ const LeftNav = React.createClass({

_testDeprecations() {
warning(!(typeof this.props.onNavClose === 'function'),
'onNavClose will be removed in favor of onChangeRequest');
'onNavClose will be removed in favor of onRequestChange');

warning(!(typeof this.props.onNavOpen === 'function'),
'onNavOpen will be removed in favor of onChangeRequest');
'onNavOpen will be removed in favor of onRequestChange');
},

_shouldShow() {
Expand All @@ -261,13 +261,13 @@ const LeftNav = React.createClass({

_close(reason) {
if (this.props.open === null) this.setState({open: false});
if (this.props.onChangeRequest) this.props.onChangeRequest(false, reason);
if (this.props.onRequestChange) this.props.onRequestChange(false, reason);
return this;
},

_open(reason) {
if (this.props.open === null) this.setState({open: true});
if (this.props.onChangeRequest) this.props.onChangeRequest(true, reason);
if (this.props.onRequestChange) this.props.onRequestChange(true, reason);
return this;
},

Expand Down