@@ -32,10 +32,13 @@ export default class CheckBox extends Component {
3232 unCheckedImage : PropTypes . element ,
3333 onClick : PropTypes . func . isRequired ,
3434 isChecked : PropTypes . bool . isRequired ,
35+ isIndeterminate : PropTypes . bool . isRequired ,
3536 checkBoxColor : PropTypes . string ,
37+ disabled : PropTypes . bool ,
3638 }
3739 static defaultProps = {
3840 isChecked : false ,
41+ isIndeterminate : false ,
3942 leftTextStyle : { } ,
4043 rightTextStyle : { }
4144 }
@@ -56,6 +59,9 @@ export default class CheckBox extends Component {
5659 }
5760
5861 _renderImage ( ) {
62+ if ( this . props . isIndeterminate ) {
63+ return this . props . indeterminateImage ? this . props . indeterminateImage : this . genCheckedImage ( ) ;
64+ }
5965 if ( this . props . isChecked ) {
6066 return this . props . checkedImage ? this . props . checkedImage : this . genCheckedImage ( ) ;
6167 } else {
@@ -64,7 +70,13 @@ export default class CheckBox extends Component {
6470 }
6571
6672 genCheckedImage ( ) {
67- var source = this . props . isChecked ? require ( './img/ic_check_box.png' ) : require ( './img/ic_check_box_outline_blank.png' ) ;
73+ var source ;
74+ if ( this . props . isIndeterminate ) {
75+ source = require ( './img/ic_indeterminate_check_box.png' ) ;
76+ }
77+ else {
78+ source = this . props . isChecked ? require ( './img/ic_check_box.png' ) : require ( './img/ic_check_box_outline_blank.png' ) ;
79+ }
6880
6981 return (
7082 < Image source = { source } style = { { tintColor : this . props . checkBoxColor } } />
@@ -77,6 +89,7 @@ export default class CheckBox extends Component {
7789 style = { this . props . style }
7890 onPress = { this . props . onClick }
7991 underlayColor = 'transparent'
92+ disabled = { this . props . disabled }
8093 >
8194 < View style = { styles . container } >
8295 { this . _renderLeft ( ) }
0 commit comments