55 * LICENSE file in the root directory of this source tree.
66 */
77
8- #if !TARGET_OS_OSX // [macOS
9-
108#import < React/RCTFPSGraph.h>
119
1210#import < React/RCTAssert.h>
11+ #import < React/RCTUIKit.h> // [macOS]
12+ #if TARGET_OS_OSX // [macOS
13+ #import < QuartzCore/QuartzCore.h>
14+ #endif // macOS]
1315
1416#if RCT_DEV
1517
1618@interface RCTFPSGraph ()
1719
1820@property (nonatomic , strong , readonly ) CAShapeLayer *graph;
19- @property (nonatomic , strong , readonly ) UILabel *label;
21+ @property (nonatomic , strong , readonly ) RCTUILabel *label; // [macOS]
2022
2123@end
2224
2325@implementation RCTFPSGraph {
2426 CAShapeLayer *_graph;
25- UILabel *_label;
27+ RCTUILabel *_label; // [macOS]
2628
2729 CGFloat *_frames;
2830 RCTUIColor *_color; // [macOS]
@@ -40,6 +42,9 @@ @implementation RCTFPSGraph {
4042- (instancetype )initWithFrame : (CGRect)frame color : (RCTUIColor *)color // [macOS]
4143{
4244 if ((self = [super initWithFrame: frame])) {
45+ #if TARGET_OS_OSX // [macOS
46+ self.wantsLayer = YES ;
47+ #endif // macOS]
4348 _frameCount = -1 ;
4449 _prevTime = -1 ;
4550 _maxFPS = 0 ;
@@ -76,10 +81,10 @@ - (CAShapeLayer *)graph
7681 return _graph;
7782}
7883
79- - (UILabel *)label
84+ - (RCTUILabel *)label // [macOS]
8085{
8186 if (!_label) {
82- _label = [[UILabel alloc ] initWithFrame: self .bounds];
87+ _label = [[RCTUILabel alloc ] initWithFrame: self .bounds];
8388 _label.font = [UIFont boldSystemFontOfSize: 13 ];
8489 _label.textAlignment = NSTextAlignmentCenter;
8590 }
@@ -128,5 +133,3 @@ - (void)onTick:(NSTimeInterval)timestamp
128133@end
129134
130135#endif
131-
132- #endif // macOS]
0 commit comments