Skip to content

feat: align unnecessary compiler conditionals #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -23,7 +23,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