Skip to content

Commit 2dfc5a9

Browse files
committed
Add image for the indeterminate state.
The image 'ic_indeterminate_check_box.png' is fetched from here: https://github.com/google/material-design-icons/tree/master/toggle/ios/ic_indeterminate_check_box.imageset
1 parent bcf78b5 commit 2dfc5a9

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

img/ic_indeterminate_check_box.png

118 Bytes
Loading

index.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ export default class CheckBox extends Component {
5858
}
5959

6060
_renderImage() {
61+
if (this.props.isIndeterminate){
62+
return this.props.indeterminateImage ? this.props.indeterminateImage : this.genCheckedImage();
63+
}
6164
if (this.props.isChecked) {
6265
return this.props.checkedImage ? this.props.checkedImage : this.genCheckedImage();
6366
} else {
@@ -66,7 +69,13 @@ export default class CheckBox extends Component {
6669
}
6770

6871
genCheckedImage() {
69-
var source = this.props.isChecked ? require('./img/ic_check_box.png') : require('./img/ic_check_box_outline_blank.png');
72+
var source;
73+
if (this.props.isIndeterminate) {
74+
source = require('./img/ic_indeterminate_check_box.png');
75+
}
76+
else {
77+
source = this.props.isChecked ? require('./img/ic_check_box.png') : require('./img/ic_check_box_outline_blank.png');
78+
}
7079

7180
return (
7281
<Image source={source} style={{tintColor: this.props.checkBoxColor}} />

0 commit comments

Comments
 (0)