diff --git a/Libraries/Image/RCTImageView.m b/Libraries/Image/RCTImageView.m index 4d077e371fc1b0..21c6c3c999165b 100644 --- a/Libraries/Image/RCTImageView.m +++ b/Libraries/Image/RCTImageView.m @@ -162,9 +162,11 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge name:UIApplicationDidEnterBackgroundNotification object:nil]; _imageView = [[UIImageView alloc] init]; +#else + _imageView = [[NSImageView alloc] init]; +#endif // TODO(macOS ISS#2323203) _imageView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; [self addSubview:_imageView]; -#endif // TODO(macOS ISS#2323203) } return self; } diff --git a/Libraries/react-native/react-native-implementation.macos.js b/Libraries/react-native/react-native-implementation.macos.js index 10e03041c3a69b..dbd1f64f016be0 100644 --- a/Libraries/react-native/react-native-implementation.macos.js +++ b/Libraries/react-native/react-native-implementation.macos.js @@ -187,16 +187,14 @@ module.exports = { get VirtualizedList() { return require('VirtualizedList'); }, - /* get VirtualizedSectionList() { return require('VirtualizedSectionList'); - },*/ + }, // APIs - /* get ActionSheetIOS() { return require('ActionSheetIOS'); - },*/ + }, get Alert() { return require('Alert'); }, diff --git a/React/Base/RCTUtils.m b/React/Base/RCTUtils.m index 5aefc3b462d608..a8fb2d23562e0f 100644 --- a/React/Base/RCTUtils.m +++ b/React/Base/RCTUtils.m @@ -524,7 +524,12 @@ BOOL RCTRunningInAppExtension(void) } // TODO: replace with a more robust solution - return RCTSharedApplication().keyWindow; + for (UIWindow *window in RCTSharedApplication().windows) { + if (window.keyWindow) { + return window; + } + } + return nil; } UIViewController *__nullable RCTPresentedViewController(void) @@ -835,7 +840,7 @@ BOOL RCTIsLocalAssetURL(NSURL *__nullable imageURL) #if !TARGET_OS_OSX // TODO(macOS ISS#2323203) image = [UIImage imageNamed:imageName inBundle:bundle compatibleWithTraitCollection:nil]; #else // [TODO(macOS ISS#2323203) - image = [bundle imageForResource:imageName]; + image = [bundle imageForResource:imageName]; #endif // ]TODO(macOS ISS#2323203) if (image) { RCTLogWarn(@"Image %@ not found in mainBundle, but found in %@", imageName, bundle); diff --git a/React/Modules/RCTRedBox.m b/React/Modules/RCTRedBox.m index 421d1552a68afa..eabb7508dff3b8 100644 --- a/React/Modules/RCTRedBox.m +++ b/React/Modules/RCTRedBox.m @@ -29,7 +29,8 @@ - (void)loadExtraDataViewController; @end #if !TARGET_OS_OSX // TODO(macOS ISS#2323203) -@interface RCTRedBoxWindow : UIWindow +@interface RCTRedBoxWindow : NSObject +@property (nonatomic, strong) UIViewController *rootViewController; @property (nonatomic, weak) id actionDelegate; @end @@ -42,19 +43,11 @@ @implementation RCTRedBoxWindow - (instancetype)initWithFrame:(CGRect)frame { - if ((self = [super initWithFrame:frame])) { -#if TARGET_OS_TV - self.windowLevel = UIWindowLevelAlert + 1000; -#else - self.windowLevel = UIWindowLevelStatusBar - 1; -#endif - self.backgroundColor = [UIColor colorWithRed:0.1 green:0.1 blue:0.1 alpha:1]; - self.hidden = YES; - - UIViewController *rootController = [UIViewController new]; - self.rootViewController = rootController; - UIView *rootView = rootController.view; - rootView.backgroundColor = [UIColor clearColor]; + if ((self = [super init])) { + _rootViewController = [UIViewController new]; + UIView *rootView = _rootViewController.view; + rootView.frame = frame; + rootView.backgroundColor = [UIColor blackColor]; const CGFloat buttonHeight = 60; @@ -133,8 +126,8 @@ - (instancetype)initWithFrame:(CGRect)frame [extraButton setTitleColor:[UIColor colorWithWhite:1 alpha:0.5] forState:UIControlStateHighlighted]; [extraButton addTarget:self action:@selector(showExtraDataViewController) forControlEvents:UIControlEventTouchUpInside]; - CGFloat buttonWidth = self.bounds.size.width / 4; - CGFloat bottomButtonHeight = self.bounds.size.height - buttonHeight - [self bottomSafeViewHeight]; + CGFloat buttonWidth = frame.size.width / 4; + CGFloat bottomButtonHeight = frame.size.height - buttonHeight - [self bottomSafeViewHeight]; dismissButton.frame = CGRectMake(0, bottomButtonHeight, buttonWidth, buttonHeight); reloadButton.frame = CGRectMake(buttonWidth, bottomButtonHeight, buttonWidth, buttonHeight); @@ -152,7 +145,7 @@ - (instancetype)initWithFrame:(CGRect)frame UIView *bottomSafeView = [UIView new]; bottomSafeView.backgroundColor = [UIColor colorWithRed:0.1 green:0.1 blue:0.1 alpha:1]; - bottomSafeView.frame = CGRectMake(0, self.bounds.size.height - [self bottomSafeViewHeight], self.bounds.size.width, [self bottomSafeViewHeight]); + bottomSafeView.frame = CGRectMake(0, frame.size.height - [self bottomSafeViewHeight], frame.size.width, [self bottomSafeViewHeight]); [rootView addSubview:bottomSafeView]; } @@ -190,7 +183,8 @@ - (void)showErrorMessage:(NSString *)message withStack:(NSArray