File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -49,12 +49,14 @@ export default class CheckBox extends Component {
49
49
rightTextStyle : { }
50
50
}
51
51
52
- componentWillReceiveProps ( nextProps ) {
53
- this . setState ( {
54
- isChecked : nextProps . isChecked
55
- } )
52
+ static getDerivedStateFromProps ( nextProps , prevState ) {
53
+ if ( prevState . isChecked !== nextProps . isChecked ) {
54
+ return {
55
+ isChecked : nextProps . isChecked
56
+ } ;
57
+ }
58
+ return null ;
56
59
}
57
-
58
60
onClick ( ) {
59
61
this . setState ( {
60
62
isChecked : ! this . state . isChecked
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " react-native-check-box" ,
3
- "version" : " 2.0.2 " ,
3
+ "version" : " 2.1.0 " ,
4
4
"description" : " Checkbox component for react native, it works on iOS and Android." ,
5
5
"main" : " index.js" ,
6
6
"scripts" : {
You can’t perform that action at this time.
0 commit comments