Skip to content

Commit 80b9d15

Browse files
committed
feat: align unnecessary compiler conditionals (#51)
1 parent d9ec053 commit 80b9d15

File tree

4 files changed

+4
-8
lines changed

4 files changed

+4
-8
lines changed

packages/react-native/React/Base/RCTUtils.m

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -315,23 +315,17 @@ static void RCTUnsafeExecuteOnMainQueueOnceSync(dispatch_once_t *onceToken, disp
315315

316316
void RCTComputeScreenScale(void)
317317
{
318-
#if !TARGET_OS_VISION
319318
dispatch_once(&onceTokenScreenScale, ^{
320319
screenScale = [UITraitCollection currentTraitCollection].displayScale;
321320
});
322-
#endif
323321
}
324322

325323
CGFloat RCTScreenScale(void)
326324
{
327-
#if !TARGET_OS_VISION
328325
RCTUnsafeExecuteOnMainQueueOnceSync(&onceTokenScreenScale, ^{
329326
screenScale = [UITraitCollection currentTraitCollection].displayScale;
330327
});
331328
return screenScale;
332-
#endif
333-
334-
return 2;
335329
}
336330

337331
CGFloat RCTFontSizeMultiplier(void)

packages/react-native/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.mm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ - (void)loadView
4242
[_touchHandler attachToView:self.view];
4343
}
4444

45+
#if !TARGET_OS_VISION
4546
- (UIStatusBarStyle)preferredStatusBarStyle
4647
{
4748
return [RCTUIStatusBarManager() statusBarStyle];
@@ -53,6 +54,7 @@ - (void)viewDidDisappear:(BOOL)animated
5354
_lastViewBounds = CGRectZero;
5455
}
5556

57+
#if !TARGET_OS_VISION
5658
- (BOOL)prefersStatusBarHidden
5759
{
5860
return [RCTUIStatusBarManager() isStatusBarHidden];

packages/react-native/React/UIUtils/RCTUIUtils.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ RCTDimensions RCTGetDimensions(CGFloat fontScale)
2222
CGSize windowSize = mainWindow ? mainWindow.bounds.size : screenSize;
2323
CGFloat scale;
2424
#if TARGET_OS_VISION
25-
scale = 2;
25+
scale = [UITraitCollection currentTraitCollection].displayScale;
2626
#else
2727
scale = mainScreen.scale;
2828
#endif

packages/react-native/React/Views/RCTModalHostView.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ - (void)notifyForOrientationChange
7878
#if !TARGET_OS_VISION
7979
UIInterfaceOrientation currentOrientation = [RCTSharedApplication() statusBarOrientation];
8080
#else
81-
UIInterfaceOrientation currentOrientation = UIDeviceOrientationUnknown;
81+
UIInterfaceOrientation currentOrientation = UIInterfaceOrientationUnknown;
8282
#endif
8383
if (currentOrientation == _lastKnownOrientation) {
8484
return;

0 commit comments

Comments
 (0)