Skip to content

Commit 889a6e5

Browse files
authored
Merge pull request #23 from hirthbrian/master
Add borderRadius prop
2 parents 415e907 + 327ce25 commit 889a6e5

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ const options = [
7979
| textColor | string | '#000' | false | Color text of the not selecteds items |
8080
| backgroundColor | string | '#ffffff' | false | Color bg of the component |
8181
| borderColor | string | '#c9c9c9' | false | Border Color of the component |
82+
| borderRadius | number | 50 | false | Border Radius of the component |
8283
| hasPadding | bool | false | false | Indicate if item has padding |
8384
| animationDuration | number | 250 | false | Duration of the animation |
8485
| valuePadding | number | 1 | false | Size of padding |

index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ const styles = {
2424
alignItems: 'center'
2525
},
2626
animated: {
27-
borderRadius: 50,
2827
borderWidth: 0,
2928
position: 'absolute'
3029
}
@@ -134,6 +133,7 @@ export default class SwitchSelector extends Component {
134133
fontSize,
135134
backgroundColor,
136135
borderColor,
136+
borderRadius,
137137
hasPadding,
138138
valuePadding,
139139
height,
@@ -186,7 +186,7 @@ export default class SwitchSelector extends Component {
186186
<View {...this._panResponder.panHandlers} style={{ flex: 1 }}>
187187
<View
188188
style={{
189-
borderRadius: 50,
189+
borderRadius: borderRadius,
190190
backgroundColor: backgroundColor,
191191
height
192192
}}
@@ -201,7 +201,7 @@ export default class SwitchSelector extends Component {
201201
flex: 1,
202202
flexDirection: 'row',
203203
borderColor: borderColor || '#c9c9c9',
204-
borderRadius: 60,
204+
borderRadius: borderRadius,
205205
borderWidth: hasPadding ? 1 : 0
206206
}}>
207207
{!!this.state.sliderWidth &&
@@ -225,6 +225,7 @@ export default class SwitchSelector extends Component {
225225
}),
226226
},
227227
],
228+
borderRadius: borderRadius,
228229
marginTop: hasPadding ? valuePadding : 0
229230
},
230231
styles.animated
@@ -249,6 +250,7 @@ SwitchSelector.defaultProps = {
249250
fontSize: 14,
250251
backgroundColor: '#FFFFFF',
251252
borderColor: '#C9C9C9',
253+
borderRadius: 50,
252254
hasPadding: false,
253255
valuePadding: 1,
254256
height: 40,

0 commit comments

Comments
 (0)