Skip to content

Commit dc3d621

Browse files
committed
feat: align unnecessary compiler conditionals (#51)
1 parent 58da0a4 commit dc3d621

File tree

4 files changed

+7
-17
lines changed

4 files changed

+7
-17
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: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,29 +42,25 @@ - (void)loadView
4242
[_touchHandler attachToView:self.view];
4343
}
4444

45+
#if !TARGET_OS_VISION
4546
- (UIStatusBarStyle)preferredStatusBarStyle
4647
{
47-
#if !TARGET_OS_VISION
48-
return [RCTSharedApplication() statusBarStyle];
49-
#else
50-
return UIStatusBarStyleDefault;
51-
#endif
48+
return UIStatusBarStyleDefault;
5249
}
50+
#endif
5351

5452
- (void)viewDidDisappear:(BOOL)animated
5553
{
5654
[super viewDidDisappear:animated];
5755
_lastViewBounds = CGRectZero;
5856
}
5957

58+
#if !TARGET_OS_VISION
6059
- (BOOL)prefersStatusBarHidden
6160
{
62-
#if !TARGET_OS_VISION
6361
return [RCTSharedApplication() isStatusBarHidden];
64-
#else
65-
return false;
66-
#endif
6762
}
63+
#endif
6864

6965
#if RCT_DEV
7066
- (UIInterfaceOrientationMask)supportedInterfaceOrientations

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)