@@ -32,6 +32,10 @@ export interface CheckboxProps extends TouchableOpacityProps {
32
32
* The Checkbox color
33
33
*/
34
34
color ?: string ;
35
+ /**
36
+ * alternative Checkbox outline style
37
+ */
38
+ outline ?: boolean ;
35
39
/**
36
40
* The size of the checkbox. affect both width and height
37
41
*/
@@ -172,7 +176,7 @@ class Checkbox extends Component<CheckboxProps, CheckboxState> {
172
176
}
173
177
174
178
renderCheckbox ( ) {
175
- const { selectedIcon, color, iconColor, label, disabled, testID, style, containerStyle, ...others } = this . props ;
179
+ const { selectedIcon, color, iconColor = this . props . outline ? this . getColor ( ) : DEFAULT_ICON_COLOR , label, disabled, testID, style, containerStyle, outline , ...others } = this . props ;
176
180
177
181
return (
178
182
//@ts -ignore
@@ -186,7 +190,7 @@ class Checkbox extends Component<CheckboxProps, CheckboxState> {
186
190
>
187
191
{
188
192
< Animated . View
189
- style = { [ this . styles . container , { backgroundColor : this . getColor ( ) } , { opacity : this . animationStyle . opacity } ] }
193
+ style = { [ this . styles . container , { backgroundColor : outline ? 'transparent' : this . getColor ( ) } , { opacity : this . animationStyle . opacity } ] }
190
194
>
191
195
< Animated . Image
192
196
style = { [
@@ -220,7 +224,12 @@ class Checkbox extends Component<CheckboxProps, CheckboxState> {
220
224
}
221
225
222
226
function createStyles ( props : CheckboxProps ) {
223
- const { color = DEFAULT_COLOR , iconColor = DEFAULT_ICON_COLOR , size = DEFAULT_SIZE , borderRadius} = props ;
227
+ const { color = DEFAULT_COLOR , size = DEFAULT_SIZE , borderRadius} = props ;
228
+
229
+ let iconColor = props . disabled ? DEFAULT_DISABLED_COLOR : DEFAULT_ICON_COLOR ;
230
+ if ( props . outline ) {
231
+ iconColor = props . disabled ? DEFAULT_DISABLED_COLOR : DEFAULT_COLOR ;
232
+ }
224
233
225
234
return StyleSheet . create ( {
226
235
container : {
0 commit comments