File tree 2 files changed +11
-3
lines changed 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " react-native-calendar-strip" ,
3
- "version" : " 1.2.1 " ,
3
+ "version" : " 1.2.2 " ,
4
4
"description" : " Easy to use and visually stunning calendar component for React Native" ,
5
5
"main" : " index.js" ,
6
6
"directories" : {
Original file line number Diff line number Diff line change @@ -30,7 +30,15 @@ class WeekSelector extends Component {
30
30
} ;
31
31
32
32
shouldComponentUpdate ( nextProps ) {
33
- return JSON . stringify ( this . props ) !== JSON . stringify ( nextProps ) ;
33
+ // Extract iconComponent since JSON.stringify fails on React component circular refs
34
+ let _nextProps = Object . assign ( { } , nextProps ) ;
35
+ let _props = Object . assign ( { } , this . props ) ;
36
+
37
+ delete _nextProps . iconComponent ;
38
+ delete _props . iconComponent ;
39
+
40
+ return JSON . stringify ( _props ) !== JSON . stringify ( _nextProps ) &&
41
+ this . props . iconComponent !== nextProps . iconComponent ;
34
42
}
35
43
36
44
isEnabled ( controlDate , weekStartDate , weekEndDate ) {
@@ -63,7 +71,7 @@ class WeekSelector extends Component {
63
71
const opacity = { opacity : enabled ? 1 : 0 } ;
64
72
65
73
let component ;
66
- if ( React . Component . isPrototypeOf ( iconComponent ) ) {
74
+ if ( React . isValidElement ( iconComponent ) ) {
67
75
component = React . cloneElement ( iconComponent , {
68
76
style : [ iconComponent . props . style , { opacity : opacity . opacity } ]
69
77
} ) ;
You can’t perform that action at this time.
0 commit comments