Skip to content

Commit 0635c8b

Browse files
committed
Make code style standard.
1 parent b409ce2 commit 0635c8b

File tree

3 files changed

+34
-42
lines changed

3 files changed

+34
-42
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ rn-spinner
33

44
[![NPM version][npm-image]][npm-url]
55
[![npm download][download-image]][download-url]
6+
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
67

78
[npm-image]: http://img.shields.io/npm/v/rn-spinner.svg?style=flat-square
89
[npm-url]: http://npmjs.org/package/rn-spinner

index.js

+28-37
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
'use strict';
2-
3-
var React = require('react-native');
4-
var styles = require('./style');
1+
var React = require('react-native')
2+
var styles = require('./style')
53

64
var {
75
View,
86
Text,
97
TouchableOpacity,
108
PropTypes
11-
} = React;
9+
} = React
1210

1311
var Spinner = React.createClass({
1412
propTypes: {
@@ -54,34 +52,35 @@ var Spinner = React.createClass({
5452
},
5553

5654
_onNumChange (num) {
57-
if (this.props.onNumChange) this.props.onNumChange(num);
55+
if (this.props.onNumChange) this.props.onNumChange(num)
5856
},
5957

6058
_increase () {
61-
if (this.props.disabled) return;
59+
if (this.props.disabled) return
6260

6361
if (this.state.max > this.state.num) {
64-
var num = this.state.num;
62+
var num = this.state.num
6563
this.setState({
6664
num: ++num
67-
});
65+
})
6866

69-
this._onNumChange(num);
67+
this._onNumChange(num)
7068
}
71-
},
69+
},
7270

73-
_decrease () {
74-
if (this.props.disabled) return;
71+
_decrease () {
72+
if (this.props.disabled) return
7573

76-
if (this.state.min < this.state.num) {
77-
var num = this.state.num;
78-
this.setState({
79-
num: --num
80-
});
74+
if (this.state.min < this.state.num) {
75+
var num = this.state.num
8176

82-
this._onNumChange(num);
83-
}
84-
},
77+
this.setState({
78+
num: --num
79+
})
80+
81+
this._onNumChange(num)
82+
}
83+
},
8584

8685
render () {
8786
return (
@@ -95,34 +94,26 @@ var Spinner = React.createClass({
9594
{ height: this.props.height } ]}
9695
onPress={this._decrease}>
9796
<Text style={[styles.btnText,
98-
{
99-
color: this.props.buttonTextColor,
100-
fontSize: this.props.btnFontSize
101-
}]}>-</Text>
97+
{ color: this.props.buttonTextColor, fontSize: this.props.btnFontSize }]}>-</Text>
10298
</TouchableOpacity>
10399
<View style={[styles.num,
104-
{
105-
borderColor: this.props.showBorder ? this.props.color : 'transparent',
106-
backgroundColor: this.props.numBgColor,
107-
height: this.props.height
100+
{ borderColor: this.props.showBorder ? this.props.color : 'transparent', backgroundColor: this.props.numBgColor, height: this.props.height
108101
}]}>
109-
<Text style={[styles.numText, {color:this.props.numColor, fontSize: this.props.fontSize}]}>{this.state.num}</Text>
102+
<Text style={[styles.numText, {color: this.props.numColor, fontSize: this.props.fontSize}]}>{this.state.num}</Text>
110103
</View>
111104
<TouchableOpacity
112105
style={[styles.btn,
113106
{ backgroundColor: this.props.color },
114107
{ borderColor: this.props.showBorder ? this.props.color : 'transparent' },
115-
{ height: this.props.height } ]}
108+
{ height: this.props.height }]}
116109
onPress={this._increase}>
117110
<Text style={[styles.btnText,
118-
{
119-
color: this.props.buttonTextColor,
120-
fontSize: this.props.btnFontSize
111+
{ color: this.props.buttonTextColor, fontSize: this.props.btnFontSize
121112
}]}>+</Text>
122113
</TouchableOpacity>
123114
</View>
124-
);
115+
)
125116
}
126-
});
117+
})
127118

128-
module.exports = Spinner;
119+
module.exports = Spinner

style.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var React = require('react-native');
1+
var React = require('react-native')
22

33
module.exports = React.StyleSheet.create({
44
container: {
@@ -11,12 +11,12 @@ module.exports = React.StyleSheet.create({
1111
btn: {
1212
flex: 1,
1313
alignItems: 'center',
14-
justifyContent: 'center',
14+
justifyContent: 'center'
1515
},
1616

1717
btnText: {
1818
color: 'white',
19-
textAlign: 'center',
19+
textAlign: 'center'
2020
},
2121

2222
num: {
@@ -26,6 +26,6 @@ module.exports = React.StyleSheet.create({
2626
},
2727

2828
numText: {
29-
textAlign:'center'
29+
textAlign: 'center'
3030
}
31-
});
31+
})

0 commit comments

Comments
 (0)