Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .nx/version-plans/version-plan-1768423600857.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
__default__: patch
---

feat: implement RCTPerfMonitor
2 changes: 2 additions & 0 deletions packages/react-native/React/Base/RCTUIKit.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ UIKIT_STATIC_INLINE CGPathRef UIBezierPathCreateCGPathRef(UIBezierPath *path)
#define RCTPlatformView UIView
#define RCTUIView UIView
#define RCTUIScrollView UIScrollView
#define RCTUIPanGestureRecognizer UIPanGestureRecognizer

UIKIT_STATIC_INLINE RCTPlatformView *RCTUIViewHitTestWithEvent(RCTPlatformView *view, CGPoint point, __unused UIEvent *__nullable event)
{
Expand Down Expand Up @@ -337,6 +338,7 @@ NS_INLINE NSEdgeInsets UIEdgeInsetsMake(CGFloat top, CGFloat left, CGFloat botto
// UIGestureRecognizer
#define UIGestureRecognizer NSGestureRecognizer
#define UIGestureRecognizerDelegate NSGestureRecognizerDelegate
#define RCTUIPanGestureRecognizer NSPanGestureRecognizer

// UIApplication
#define UIApplication NSApplication
Expand Down
2 changes: 0 additions & 2 deletions packages/react-native/React/CoreModules/RCTDevMenu.mm
Original file line number Diff line number Diff line change
Expand Up @@ -326,14 +326,12 @@ - (void)setDefaultJSBundle
}]];
}

#if !TARGET_OS_OSX // [macOS]
id perfMonitorItemOpaque = [_moduleRegistry moduleForName:"PerfMonitor"];
SEL devMenuItem = @selector(devMenuItem);
if ([perfMonitorItemOpaque respondsToSelector:devMenuItem]) {
RCTDevMenuItem *perfMonitorItem = [perfMonitorItemOpaque devMenuItem];
[items addObject:perfMonitorItem];
}
#endif // [macOS]

[items
addObject:[RCTDevMenuItem
Expand Down
19 changes: 11 additions & 8 deletions packages/react-native/React/CoreModules/RCTFPSGraph.mm
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,26 @@
* LICENSE file in the root directory of this source tree.
*/

#if !TARGET_OS_OSX // [macOS

#import <React/RCTFPSGraph.h>

#import <React/RCTAssert.h>
#import <React/RCTUIKit.h> // [macOS]
#if TARGET_OS_OSX // [macOS
#import <QuartzCore/QuartzCore.h>
#endif // macOS]

#if RCT_DEV

@interface RCTFPSGraph ()

@property (nonatomic, strong, readonly) CAShapeLayer *graph;
@property (nonatomic, strong, readonly) UILabel *label;
@property (nonatomic, strong, readonly) RCTUILabel *label; // [macOS]

@end

@implementation RCTFPSGraph {
CAShapeLayer *_graph;
UILabel *_label;
RCTUILabel *_label; // [macOS]

CGFloat *_frames;
RCTUIColor *_color; // [macOS]
Expand All @@ -40,6 +42,9 @@ @implementation RCTFPSGraph {
- (instancetype)initWithFrame:(CGRect)frame color:(RCTUIColor *)color // [macOS]
{
if ((self = [super initWithFrame:frame])) {
#if TARGET_OS_OSX // [macOS
self.wantsLayer = YES;
#endif // macOS]
_frameCount = -1;
_prevTime = -1;
_maxFPS = 0;
Expand Down Expand Up @@ -76,10 +81,10 @@ - (CAShapeLayer *)graph
return _graph;
}

- (UILabel *)label
- (RCTUILabel *)label // [macOS]
{
if (!_label) {
_label = [[UILabel alloc] initWithFrame:self.bounds];
_label = [[RCTUILabel alloc] initWithFrame:self.bounds];
_label.font = [UIFont boldSystemFontOfSize:13];
_label.textAlignment = NSTextAlignmentCenter;
}
Expand Down Expand Up @@ -128,5 +133,3 @@ - (void)onTick:(NSTimeInterval)timestamp
@end

#endif

#endif // macOS]
Loading
Loading