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

Fixes for code style consistency #1496

Merged
merged 1 commit into from
Jan 31, 2017
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
26 changes: 13 additions & 13 deletions src/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ const Select = React.createClass({
};
},

componentWillMount() {
componentWillMount () {
this._instancePrefix = 'react-select-' + (this.props.instanceId || ++instanceId) + '-';
const valueArray = this.getValueArray(this.props.value);

Expand All @@ -186,7 +186,7 @@ const Select = React.createClass({
}
},

componentWillReceiveProps(nextProps) {
componentWillReceiveProps (nextProps) {
const valueArray = this.getValueArray(nextProps.value, nextProps);

if (nextProps.required) {
Expand Down Expand Up @@ -237,15 +237,15 @@ const Select = React.createClass({
}
},

componentWillUnmount() {
componentWillUnmount () {
if (!document.removeEventListener && document.detachEvent) {
document.detachEvent('ontouchstart', this.handleTouchOutside);
} else {
document.removeEventListener('touchstart', this.handleTouchOutside);
}
},

toggleTouchOutsideEvent(enabled) {
toggleTouchOutsideEvent (enabled) {
if (enabled) {
if (!document.addEventListener && document.attachEvent) {
document.attachEvent('ontouchstart', this.handleTouchOutside);
Expand All @@ -261,7 +261,7 @@ const Select = React.createClass({
}
},

handleTouchOutside(event) {
handleTouchOutside (event) {
// handle touch outside on ios to dismiss menu
if (this.wrapper && !this.wrapper.contains(event.target)) {
this.closeMenu();
Expand All @@ -279,7 +279,7 @@ const Select = React.createClass({
}
},

blurInput() {
blurInput () {
if (!this.input) return;
this.input.blur();
},
Expand All @@ -297,7 +297,7 @@ const Select = React.createClass({
handleTouchEnd (event) {
// Check if the view is being dragged, In this case
// we don't want to fire the click event (because the user only wants to scroll)
if(this.dragging) return;
if (this.dragging) return;

// Fire the mouse events
this.handleMouseDown(event);
Expand All @@ -306,7 +306,7 @@ const Select = React.createClass({
handleTouchEndClearValue (event) {
// Check if the view is being dragged, In this case
// we don't want to fire the click event (because the user only wants to scroll)
if(this.dragging) return;
if (this.dragging) return;

// Clear the value
this.clearValue(event);
Expand Down Expand Up @@ -399,7 +399,7 @@ const Select = React.createClass({
isPseudoFocused: this.state.isFocused && !this.props.multi,
inputValue: ''
});
} else {
} else {
this.setState({
isOpen: false,
isPseudoFocused: this.state.isFocused && !this.props.multi,
Expand Down Expand Up @@ -457,7 +457,7 @@ const Select = React.createClass({
this.setState({
isOpen: true,
isPseudoFocused: false,
inputValue: newInputValue
inputValue: newInputValue,
});
},

Expand Down Expand Up @@ -660,7 +660,7 @@ const Select = React.createClass({
}, this.focus);
},

getResetValue() {
getResetValue () {
if (this.props.resetValue !== undefined) {
return this.props.resetValue;
} else if (this.props.multi) {
Expand Down Expand Up @@ -735,14 +735,14 @@ const Select = React.createClass({
focusedIndex = options.length - 1;
} else if (dir === 'page_up') {
var potentialIndex = focusedIndex - this.props.pageSize;
if ( potentialIndex < 0 ) {
if (potentialIndex < 0) {
focusedIndex = 0;
} else {
focusedIndex = potentialIndex;
}
} else if (dir === 'page_down') {
var potentialIndex = focusedIndex + this.props.pageSize;
if ( potentialIndex > options.length - 1 ) {
if (potentialIndex > options.length - 1) {
focusedIndex = options.length - 1;
} else {
focusedIndex = potentialIndex;
Expand Down