@@ -68,7 +68,9 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge
68
68
69
69
// TODO: Turn on layer backing just to avoid https://github.com/ptmt/react-native-desktop/issues/47
70
70
// Maybe we could turn it off after the bug fixed in the future.
71
- [self setWantsLayer: YES ];
71
+ if (([self window ].styleMask & NSFullSizeContentViewWindowMask ) != NSFullSizeContentViewWindowMask ) {
72
+ [self setWantsLayer: YES ];
73
+ }
72
74
73
75
[self setNeedsLayout: NO ];
74
76
[self setMaterial: NSVisualEffectMaterialLight ];
@@ -313,6 +315,7 @@ @implementation RCTRootContentView
313
315
__weak RCTBridge *_bridge;
314
316
RCTTouchHandler *_touchHandler;
315
317
NSColor *_backgroundColor;
318
+ CFTimeInterval _lastResizingAt;
316
319
}
317
320
318
321
- (instancetype )initWithFrame : (CGRect)frame
@@ -321,6 +324,7 @@ - (instancetype)initWithFrame:(CGRect)frame
321
324
{
322
325
if ((self = [super initWithFrame: frame])) {
323
326
_bridge = bridge;
327
+ _lastResizingAt = CACurrentMediaTime ();
324
328
self.reactTag = reactTag;
325
329
_touchHandler = [[RCTTouchHandler alloc ] initWithBridge: _bridge];
326
330
[self addGestureRecognizer: _touchHandler];
@@ -367,25 +371,28 @@ - (void)mouseExited:(__unused NSEvent *)theEvent
367
371
[[self window ] setAcceptsMouseMovedEvents: NO ];
368
372
}
369
373
370
- // TODO: fire onLayout or something?
371
- // - (void)viewDidEndLiveResize
372
- // {
373
- // [self setFrame:[RCTSharedApplication() mainWindow].contentView. frame];
374
- // }
374
+ - ( void ) viewDidEndLiveResize
375
+ {
376
+ [ super viewDidEndLiveResize ];
377
+ [_bridge.uiManager setFrame: self . frame forView: self ];
378
+ }
375
379
376
380
- (void )setFrame : (CGRect)frame
377
381
{
378
382
super.frame = frame;
379
383
if (self.reactTag && _bridge.isValid ) {
380
- [_bridge.uiManager setFrame: frame forView: self ];
384
+ if (!self.inLiveResize || (self.inLiveResize && (CACurrentMediaTime () - _lastResizingAt) > 0.026 )) {
385
+ [_bridge.uiManager setFrame: frame forView: self ];
386
+ _lastResizingAt = CACurrentMediaTime ();
387
+ }
381
388
}
382
389
}
383
390
384
391
- (void )setBackgroundColor : (NSColor *)backgroundColor
385
392
{
386
393
_backgroundColor = backgroundColor;
387
394
if (self.reactTag && _bridge.isValid ) {
388
- [_bridge.uiManager setBackgroundColor: backgroundColor forView: self ];
395
+ [_bridge.uiManager setBackgroundColor: backgroundColor forView: self ];
389
396
}
390
397
}
391
398
0 commit comments