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 {
4949 rightTextStyle : { }
5050 }
5151
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 ;
5659 }
57-
5860 onClick ( ) {
5961 this . setState ( {
6062 isChecked : ! this . state . isChecked
Original file line number Diff line number Diff line change 11{
22 "name" : " react-native-check-box" ,
3- "version" : " 2.0.2 " ,
3+ "version" : " 2.1.0 " ,
44 "description" : " Checkbox component for react native, it works on iOS and Android." ,
55 "main" : " index.js" ,
66 "scripts" : {
You can’t perform that action at this time.
0 commit comments