Skip to content

Commit 912c417

Browse files
committed
publish 2.1.0
1 parent 4003d6c commit 912c417

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

index.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff 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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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": {

0 commit comments

Comments
 (0)