Skip to content
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

[WIP]: implement Platform.OS for visionOS #2

Closed
wants to merge 7 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix: address issues with scale, ScrollView prop
  • Loading branch information
okwasniewski committed Oct 11, 2023
commit bb2b4386c3cca15e695ddaca55e1a0ba30c0cd45
2 changes: 1 addition & 1 deletion packages/react-native/React/Base/RCTUtils.m
Original file line number Diff line number Diff line change
@@ -317,7 +317,7 @@ CGFloat RCTScreenScale(void)
return screenScale;
#endif

return 1;
return 2;
}

CGFloat RCTFontSizeMultiplier(void)
2 changes: 0 additions & 2 deletions packages/react-native/React/Modules/RCTUIManager.m
Original file line number Diff line number Diff line change
@@ -269,8 +269,6 @@ - (void)namedOrientationDidChange
body:orientationEvent];
#pragma clang diagnostic pop
#endif
return;

}

- (dispatch_queue_t)methodQueue
2 changes: 1 addition & 1 deletion packages/react-native/React/UIUtils/RCTUIUtils.m
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ RCTDimensions RCTGetDimensions(CGFloat fontScale)
CGSize windowSize = mainWindow ? mainWindow.bounds.size : screenSize;
CGFloat scale;
#if TARGET_OS_VISION
scale = 1;
scale = 2;
#else
scale = mainScreen.scale;
#endif
Original file line number Diff line number Diff line change
@@ -12,10 +12,11 @@
#import "RCTShadowView.h"
#import "RCTUIManager.h"

#if !TARGET_OS_VISION


@implementation RCTConvert (UIScrollView)

#if !TARGET_OS_VISION
RCT_ENUM_CONVERTER(
UIScrollViewKeyboardDismissMode,
(@{
@@ -27,6 +28,7 @@ @implementation RCTConvert (UIScrollView)
}),
UIScrollViewKeyboardDismissModeNone,
integerValue)
#endif

RCT_ENUM_CONVERTER(
UIScrollViewIndicatorStyle,
@@ -51,7 +53,6 @@ @implementation RCTConvert (UIScrollView)

@end

#endif

@implementation RCTScrollViewManager

Original file line number Diff line number Diff line change
@@ -47,7 +47,10 @@ - (NSDictionary *)getConstants
__block NSDictionary *constants;
RCTUnsafeExecuteOnMainQueueSync(^{
#if TARGET_OS_VISION
CGSize screenSize = CGSizeMake(100, 100);
UIApplication *app = [[UIApplication class] performSelector:@selector(sharedApplication)];
UIWindowScene *scene = (UIWindowScene*)[app.connectedScenes anyObject];
UIWindow *window = [[UIWindow alloc] initWithWindowScene:scene];
CGSize screenSize = window.bounds.size;
#else
UIScreen *mainScreen = UIScreen.mainScreen;
CGSize screenSize = mainScreen.bounds.size;