@@ -48,10 +48,26 @@ - (NSString *)description
48
48
superDescription = [superDescription substringToIndex: superDescription.length - 1 ];
49
49
}
50
50
51
+ #if TARGET_OS_IPHONE
52
+ NSString *providerViewSafeAreaInsetsString = NSStringFromUIEdgeInsets(_providerView.safeAreaInsets );
53
+ NSString *currentSafeAreaInsetsString = NSStringFromUIEdgeInsets(_currentSafeAreaInsets);
54
+ #elif TARGET_OS_OSX
55
+ NSString *providerViewSafeAreaInsetsString = [NSString stringWithFormat: @" {%f ,%f ,%f ,%f }" ,
56
+ _providerView.safeAreaInsets.top,
57
+ _providerView.safeAreaInsets.left,
58
+ _providerView.safeAreaInsets.bottom,
59
+ _providerView.safeAreaInsets.right];
60
+ NSString *currentSafeAreaInsetsString = [NSString stringWithFormat: @" {%f ,%f ,%f ,%f }" ,
61
+ _currentSafeAreaInsets.top,
62
+ _currentSafeAreaInsets.left,
63
+ _currentSafeAreaInsets.bottom,
64
+ _currentSafeAreaInsets.right];
65
+ #endif
66
+
51
67
return [NSString stringWithFormat: @" %@ ; RNCSafeAreaInsets = %@ ; appliedRNCSafeAreaInsets = %@ >" ,
52
68
superDescription,
53
- NSStringFromUIEdgeInsets (_providerView.safeAreaInsets) ,
54
- NSStringFromUIEdgeInsets(_currentSafeAreaInsets) ];
69
+ providerViewSafeAreaInsetsString ,
70
+ currentSafeAreaInsetsString ];
55
71
}
56
72
57
73
- (void )didMoveToWindow
@@ -80,12 +96,18 @@ - (void)updateStateIfNecessary
80
96
if (_providerView == nil ) {
81
97
return ;
82
98
}
99
+ #if TARGET_OS_IPHONE
83
100
UIEdgeInsets safeAreaInsets = _providerView.safeAreaInsets ;
84
101
85
102
if (UIEdgeInsetsEqualToEdgeInsetsWithThreshold (safeAreaInsets, _currentSafeAreaInsets, 1.0 / RCTScreenScale ())) {
86
103
return ;
87
104
}
88
-
105
+ #elif TARGET_OS_OSX
106
+ NSEdgeInsets safeAreaInsets = _providerView.safeAreaInsets ;
107
+ if (NSEdgeInsetsEqualToEdgeInsetsWithThreshold(safeAreaInsets, _currentSafeAreaInsets, 1.0 / RCTScreenScale ())) {
108
+ return ;
109
+ }
110
+ #endif
89
111
_currentSafeAreaInsets = safeAreaInsets;
90
112
[self updateState ];
91
113
}
0 commit comments