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 Jun 24, 2024
1 parent beda3f2 commit a5f8d78
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 17 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 @@ -301,23 +301,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,29 +42,25 @@ - (void)loadView
[_touchHandler attachToView:self.view];
}

#if !TARGET_OS_VISION
- (UIStatusBarStyle)preferredStatusBarStyle
{
#if !TARGET_OS_VISION
return [RCTSharedApplication() statusBarStyle];
#else
return UIStatusBarStyleDefault;
#endif
return UIStatusBarStyleDefault;
}
#endif

- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
_lastViewBounds = CGRectZero;
}

#if !TARGET_OS_VISION
- (BOOL)prefersStatusBarHidden
{
#if !TARGET_OS_VISION
return [RCTSharedApplication() isStatusBarHidden];
#else
return false;
#endif
}
#endif

#if RCT_DEV
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
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 a5f8d78

Please sign in to comment.