We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4003d6c commit 912c417Copy full SHA for 912c417
2 files changed
index.js
@@ -49,12 +49,14 @@ export default class CheckBox extends Component {
49
rightTextStyle: {}
50
}
51
52
- componentWillReceiveProps(nextProps) {
53
- this.setState({
54
- isChecked: nextProps.isChecked
55
- })
+ static getDerivedStateFromProps(nextProps, prevState) {
+ if (prevState.isChecked !== nextProps.isChecked) {
+ return {
+ isChecked: nextProps.isChecked
56
+ };
57
+ }
58
+ return null;
59
-
60
onClick() {
61
this.setState({
62
isChecked: !this.state.isChecked
package.json
@@ -1,6 +1,6 @@
1
{
2
"name": "react-native-check-box",
3
- "version": "2.0.2",
+ "version": "2.1.0",
4
"description": "Checkbox component for react native, it works on iOS and Android.",
5
"main": "index.js",
6
"scripts": {
0 commit comments