Skip to content

Commit f7041f1

Browse files
committed
feat: align unnecessary compiler conditionals (#51)
1 parent bb06895 commit f7041f1

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
@@ -301,23 +301,17 @@ static void RCTUnsafeExecuteOnMainQueueOnceSync(dispatch_once_t *onceToken, disp
301301

302302
void RCTComputeScreenScale(void)
303303
{
304-
#if !TARGET_OS_VISION
305304
dispatch_once(&onceTokenScreenScale, ^{
306305
screenScale = [UITraitCollection currentTraitCollection].displayScale;
307306
});
308-
#endif
309307
}
310308

311309
CGFloat RCTScreenScale(void)
312310
{
313-
#if !TARGET_OS_VISION
314311
RCTUnsafeExecuteOnMainQueueOnceSync(&onceTokenScreenScale, ^{
315312
screenScale = [UITraitCollection currentTraitCollection].displayScale;
316313
});
317314
return screenScale;
318-
#endif
319-
320-
return 2;
321315
}
322316

323317
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
@@ -23,7 +23,7 @@ RCTDimensions RCTGetDimensions(CGFloat fontScale)
2323
CGSize windowSize = mainWindow ? mainWindow.bounds.size : screenSize;
2424
CGFloat scale;
2525
#if TARGET_OS_VISION
26-
scale = 2;
26+
scale = [UITraitCollection currentTraitCollection].displayScale;
2727
#else
2828
scale = mainScreen.scale;
2929
#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)