Skip to content

Commit

Permalink
feat: align unnecessary compiler conditionals (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
okwasniewski committed Mar 6, 2024
1 parent 7c2c397 commit 57354a3
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
6 changes: 0 additions & 6 deletions packages/react-native/React/Base/RCTUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -315,23 +315,17 @@ static void RCTUnsafeExecuteOnMainQueueOnceSync(dispatch_once_t *onceToken, disp

void RCTComputeScreenScale(void)
{
#if !TARGET_OS_VISION
dispatch_once(&onceTokenScreenScale, ^{
screenScale = [UITraitCollection currentTraitCollection].displayScale;
});
#endif
}

CGFloat RCTScreenScale(void)
{
#if !TARGET_OS_VISION
RCTUnsafeExecuteOnMainQueueOnceSync(&onceTokenScreenScale, ^{
screenScale = [UITraitCollection currentTraitCollection].displayScale;
});
return screenScale;
#endif

return 2;
}

CGFloat RCTFontSizeMultiplier(void)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ - (void)loadView
[_touchHandler attachToView:self.view];
}

#if !TARGET_OS_VISION
- (UIStatusBarStyle)preferredStatusBarStyle
{
return [RCTUIStatusBarManager() statusBarStyle];
Expand All @@ -53,6 +54,7 @@ - (void)viewDidDisappear:(BOOL)animated
_lastViewBounds = CGRectZero;
}

#if !TARGET_OS_VISION
- (BOOL)prefersStatusBarHidden
{
return [RCTUIStatusBarManager() isStatusBarHidden];
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native/React/UIUtils/RCTUIUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ RCTDimensions RCTGetDimensions(CGFloat fontScale)
CGSize windowSize = mainWindow ? mainWindow.bounds.size : screenSize;
CGFloat scale;
#if TARGET_OS_VISION
scale = 2;
scale = [UITraitCollection currentTraitCollection].displayScale;
#else
scale = mainScreen.scale;
#endif
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native/React/Views/RCTModalHostView.m
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ - (void)notifyForOrientationChange
#if !TARGET_OS_VISION
UIInterfaceOrientation currentOrientation = [RCTSharedApplication() statusBarOrientation];
#else
UIInterfaceOrientation currentOrientation = UIDeviceOrientationUnknown;
UIInterfaceOrientation currentOrientation = UIInterfaceOrientationUnknown;
#endif
if (currentOrientation == _lastKnownOrientation) {
return;
Expand Down

0 comments on commit 57354a3

Please sign in to comment.