react-native-option-switch
Advanced tools
Comparing version
@@ -32,8 +32,3 @@ import React from 'react'; | ||
selectedItem: { | ||
width: 125, | ||
height: 24, | ||
borderRadius: 12, | ||
marginHorizontal: 16, | ||
backgroundColor: '#FDE08C', | ||
alignItems: 'center', | ||
@@ -69,3 +64,5 @@ }, | ||
if (props.styles) { | ||
this.styles = {...this.styles, ...props.styles}; | ||
for (const item in props.styles) { | ||
Object.assign(this.styles[item], props.styles[item]); | ||
} | ||
} | ||
@@ -102,5 +99,10 @@ } | ||
<TouchableWithoutFeedback onPress={() => this.onChange(option)} key={option.key}> | ||
<View style={option.key === this.state.selectedOption ? this.styles.selectedItem : this.styles.item}> | ||
<Text style={this.styles.label}>{option.label}</Text> | ||
</View> | ||
<View style={[ | ||
this.styles.item, | ||
this.props.styles?.item, | ||
option.key === this.state.selectedOption && this.styles.selectedItem, | ||
option.key === this.state.selectedOption && this.props.styles?.selectedItem, | ||
]}> | ||
<Text style={this.styles.label}>{option.label}</Text> | ||
</View> | ||
</TouchableWithoutFeedback> | ||
@@ -107,0 +109,0 @@ ); |
{ | ||
"name": "react-native-option-switch", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "Options switch component for React Native. It can be used as radio button or boolean switch. ", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
90748
0.1%99
2.06%