diff --git a/Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h b/Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h index 873ce233db..437b6550f8 100644 --- a/Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h +++ b/Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h @@ -202,6 +202,11 @@ namespace JS { NSString *cancelButtonKey() const; NSString *destructiveButtonKey() const; NSString *keyboardType() const; +#if TARGET_OS_OSX // [TODO(macOS ISS#2323203) + bool critical() const; + bool modal() const; + folly::Optional>> defaultInputs() const; +#endif // ]TODO(macOS ISS#2323203)b Args(NSDictionary *const v) : _v(v) {} private: @@ -3040,6 +3045,23 @@ inline NSString *JS::NativeAlertManager::Args::keyboardType() const id const p = _v[@"keyboardType"]; return RCTBridgingToString(p); } +#if TARGET_OS_OSX // [TODO(macOS ISS#2323203) +inline bool JS::NativeAlertManager::Args::critical() const +{ + id const p = _v[@"critical"]; + return RCTBridgingToBool(p); +} +inline bool JS::NativeAlertManager::Args::modal() const +{ + id const p = _v[@"modal"]; + return RCTBridgingToBool(p); +} +inline folly::Optional>> JS::NativeAlertManager::Args::defaultInputs() const +{ + id const p = _v[@"defaultInputs"]; + return RCTBridgingToOptionalVec(p, ^id(id itemValue_0) { return itemValue_0; }); +} +#endif // ]TODO(macOS ISS#2323203)b inline bool JS::NativeAnimatedModule::EndResult::finished() const { id const p = _v[@"finished"]; diff --git a/Libraries/Image/RCTImageView.mm b/Libraries/Image/RCTImageView.mm index 8f82b6687c..177992d727 100644 --- a/Libraries/Image/RCTImageView.mm +++ b/Libraries/Image/RCTImageView.mm @@ -187,8 +187,8 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame) image = [image imageWithRenderingMode:_renderingMode]; } #else // [TODO(macOS ISS#2323203) - if ((_renderingMode == UIImageRenderingModeAlwaysTemplate) != image.template) { - image.template = (_renderingMode == UIImageRenderingModeAlwaysTemplate); + if ((_renderingMode == UIImageRenderingModeAlwaysTemplate) != [image isTemplate]) { + [image setTemplate:(_renderingMode == UIImageRenderingModeAlwaysTemplate)]; } #endif // ]TODO(macOS ISS#2323203) diff --git a/Libraries/LinkingIOS/React-RCTLinking.podspec b/Libraries/LinkingIOS/React-RCTLinking.podspec index 577350a435..ee64763e8f 100644 --- a/Libraries/LinkingIOS/React-RCTLinking.podspec +++ b/Libraries/LinkingIOS/React-RCTLinking.podspec @@ -31,6 +31,10 @@ Pod::Spec.new do |s| s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness' s.source = source s.source_files = "*.{m,mm}" +# [TODO(macOS ISS#2323203) + s.osx.exclude_files = "RCTLinkingManager.mm" + s.osx.source_files = "macos/RCTLinkingManager.m" +# ]TODO(macOS ISS#2323203) s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs" s.header_dir = "RCTLinking" s.pod_target_xcconfig = { diff --git a/Libraries/Network/React-RCTNetwork.podspec b/Libraries/Network/React-RCTNetwork.podspec index dc90bc9abb..2e575fec72 100644 --- a/Libraries/Network/React-RCTNetwork.podspec +++ b/Libraries/Network/React-RCTNetwork.podspec @@ -37,7 +37,7 @@ Pod::Spec.new do |s| "CLANG_CXX_LANGUAGE_STANDARD" => "c++14", "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/Folly\"" } - s.frameworks = "MobileCoreServices" + s.ios.frameworks = "MobileCoreServices" # TODO(macOS GH#214) - Restrict to iOS s.dependency "Folly", folly_version s.dependency "FBReactNativeSpec", version diff --git a/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm b/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm index e631bdb6da..e517c518e5 100644 --- a/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm +++ b/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm @@ -45,11 +45,9 @@ RCT_ENUM_CONVERTER(NSCalendarUnit, @end -#if !TARGET_OS_OSX // TODO(macOS ISS#2323203) @interface RCTPushNotificationManager () @property (nonatomic, strong) NSMutableDictionary *remoteNotificationCallbacks; @end -#endif // TODO(macOS ISS#2323203) @implementation RCTConvert (UILocalNotification) @@ -466,18 +464,14 @@ RCT_EXPORT_METHOD(requestPermissions:(JS::NativePushNotificationManagerIOS::Spec [RCTSharedApplication() registerUserNotificationSettings:notificationSettings]; #else // [TODO(macOS ISS#2323203) NSRemoteNotificationType types = NSRemoteNotificationTypeNone; - if (permissions) { - if ([RCTConvert BOOL:permissions[@"alert"]]) { - types |= NSRemoteNotificationTypeAlert; - } - if ([RCTConvert BOOL:permissions[@"badge"]]) { - types |= NSRemoteNotificationTypeBadge; - } - if ([RCTConvert BOOL:permissions[@"sound"]]) { - types |= NSRemoteNotificationTypeSound; - } - } else { - types = NSRemoteNotificationTypeAlert | NSRemoteNotificationTypeBadge | NSRemoteNotificationTypeSound; + if (permissions.alert()) { + types |= NSRemoteNotificationTypeAlert; + } + if (permissions.badge()) { + types |= NSRemoteNotificationTypeBadge; + } + if (permissions.badge()) { + types |= NSRemoteNotificationTypeSound; } [RCTSharedApplication() registerForRemoteNotificationTypes:types]; #endif // ]TODO(macOS ISS#2323203) diff --git a/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m b/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m index 8833dfb56a..b8e4d70881 100644 --- a/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m +++ b/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m @@ -103,6 +103,7 @@ static void *TextFieldSelectionObservingContext = &TextFieldSelectionObservingCo [attributedString replaceCharactersInRange:range withString:newText]; [_backedTextInputView setAttributedText:[attributedString copy]]; +#if !TARGET_OS_OSX // TODO(macOS ISS#2323203) // Setting selection to the end of the replaced text. UITextPosition *position = [_backedTextInputView positionFromPosition:_backedTextInputView.beginningOfDocument @@ -110,6 +111,7 @@ static void *TextFieldSelectionObservingContext = &TextFieldSelectionObservingCo [_backedTextInputView setSelectedTextRange:[_backedTextInputView textRangeFromPosition:position toPosition:position] notifyDelegate:YES]; +#endif // TODO(macOS ISS#2323203) [self textFieldDidChange]; return NO; @@ -325,12 +327,14 @@ static void *TextFieldSelectionObservingContext = &TextFieldSelectionObservingCo [attributedString replaceCharactersInRange:range withString:newText]; [_backedTextInputView setAttributedText:[attributedString copy]]; +#if !TARGET_OS_OSX // TODO(macOS ISS#2323203) // Setting selection to the end of the replaced text. UITextPosition *position = [_backedTextInputView positionFromPosition:_backedTextInputView.beginningOfDocument offset:(range.location + newText.length)]; [_backedTextInputView setSelectedTextRange:[_backedTextInputView textRangeFromPosition:position toPosition:position] notifyDelegate:YES]; +#endif // TODO(macOS ISS#2323203) [self textViewDidChange:_backedTextInputView]; diff --git a/Libraries/Text/TextInput/Singleline/RCTUITextField.m b/Libraries/Text/TextInput/Singleline/RCTUITextField.m index 3151e2b20e..68338ba5bd 100644 --- a/Libraries/Text/TextInput/Singleline/RCTUITextField.m +++ b/Libraries/Text/TextInput/Singleline/RCTUITextField.m @@ -230,7 +230,9 @@ static RCTUIColor *defaultPlaceholderTextColor() - (void)setDefaultTextAttributes:(NSDictionary *)defaultTextAttributes { _defaultTextAttributes = defaultTextAttributes; +#if !TARGET_OS_OSX // TODO(macOS ISS#2323203) [super setDefaultTextAttributes:defaultTextAttributes]; +#endif // TODO(macOS ISS#2323203) [self _updatePlaceholder]; } @@ -241,8 +243,13 @@ static RCTUIColor *defaultPlaceholderTextColor() - (void)_updatePlaceholder { +#if !TARGET_OS_OSX // TODO(macOS ISS#2323203) self.attributedPlaceholder = [[NSAttributedString alloc] initWithString:self.placeholder ?: @"" attributes:[self _placeholderTextAttributes]]; +#else // [TODO(macOS ISS#2323203) + self.placeholderAttributedString = [[NSAttributedString alloc] initWithString:self.placeholder ?: @"" + attributes:[self _placeholderTextAttributes]]; +#endif // ]TODO(macOS ISS#2323203) } - (BOOL)isEditable @@ -287,6 +294,9 @@ static RCTUIColor *defaultPlaceholderTextColor() self.attributedText = originalText; } +#endif // ]TODO(macOS ISS#2323203) + + #pragma mark - Placeholder - (NSDictionary *)_placeholderTextAttributes @@ -309,6 +319,8 @@ static RCTUIColor *defaultPlaceholderTextColor() #pragma mark - Context Menu +#if !TARGET_OS_OSX // [TODO(macOS ISS#2323203) + - (BOOL)canPerformAction:(SEL)action withSender:(id)sender { if (_contextMenuHidden) { diff --git a/RNTester/Podfile.lock b/RNTester/Podfile.lock index a972080ce7..a23e0d7e30 100644 --- a/RNTester/Podfile.lock +++ b/RNTester/Podfile.lock @@ -466,8 +466,8 @@ SPEC CHECKSUMS: RCTTypeSafety: ede90b8a90e0dd629d19984788d434ae23828a64 React: b8f3da30d525b068a54ac964abe933c8ca617dce React-ART: d45ff8a3eb41b11513259371573fe77100d64b79 - React-Core: bd1d31a06447d4fad4e657c6c2d99e006e6ae92e - React-CoreModules: 23c507e49f1c010f776e7e2b7f258b73835bde41 + React-Core: 33a4fc04428a5b8cb2dd73bd9ffed77e09f9fad2 + React-CoreModules: 03d31048f14293cca7076cfa5bc4ca474c128a5d React-cxxreact: c190cf3bfc4cf67f5578bd7d1875b1e027d218c7 React-jsi: 1e2cdb8a09f8dac172b58882e11229af86d4f708 React-jsiexecutor: 3d3137d20b4b1df8d2f23fc51315922fd46d13d3 @@ -476,8 +476,8 @@ SPEC CHECKSUMS: React-RCTAnimation: b65edfef9cfd54789b7ab5aab9974425dc67a983 React-RCTBlob: 01d56c23e12074993ef274a55d2c7f9d0e39dc2a React-RCTImage: 4515f301f1812f7bda3a7e0b5473be237c8cec60 - React-RCTLinking: dad12f504ec7f0539384514ecb8b83ab837acda4 - React-RCTNetwork: c5e806d73a29181a210d92f3772b255474404aa3 + React-RCTLinking: 0b6246bfbc4e6e01ebe5cca631ea2917e2ad66d2 + React-RCTNetwork: 14c6996d9c4695bd03ff94bf1aee8d2dd4eb9000 React-RCTPushNotification: 8006d2b1b0d3e1972cae2c97e6708f17ff8479d8 React-RCTSettings: 0bc4c586dd2841e6764092ff67081d1047bef8ce React-RCTTest: 537fa13cbf082a64b29fa815dde8a1e03b0e9b9b diff --git a/RNTester/RNTesterPods.xcodeproj/project.pbxproj b/RNTester/RNTesterPods.xcodeproj/project.pbxproj index 68f2c64b1d..a231082130 100644 --- a/RNTester/RNTesterPods.xcodeproj/project.pbxproj +++ b/RNTester/RNTesterPods.xcodeproj/project.pbxproj @@ -1813,6 +1813,27 @@ DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = ""; ENABLE_HARDENED_RUNTIME = YES; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + "\"${PODS_ROOT}/Headers/Public\"", + "\"${PODS_ROOT}/Headers/Public/DoubleConversion\"", + "\"${PODS_ROOT}/Headers/Public/FBLazyVector\"", + "\"${PODS_ROOT}/Headers/Public/FBReactNativeSpec\"", + "\"${PODS_ROOT}/Headers/Public/RCTRequired\"", + "\"${PODS_ROOT}/Headers/Public/RCTTypeSafety\"", + "\"${PODS_ROOT}/Headers/Public/React-Core\"", + "\"${PODS_ROOT}/Headers/Public/React-RCTTest\"", + "\"${PODS_ROOT}/Headers/Public/React-RCTText\"", + "\"${PODS_ROOT}/Headers/Public/React-cxxreact\"", + "\"${PODS_ROOT}/Headers/Public/React-jsi\"", + "\"${PODS_ROOT}/Headers/Public/React-jsiexecutor\"", + "\"${PODS_ROOT}/Headers/Public/React-jsinspector\"", + "\"${PODS_ROOT}/Headers/Public/ReactCommon\"", + "\"${PODS_ROOT}/Headers/Public/Yoga\"", + "\"${PODS_ROOT}/Headers/Public/glog\"", + "\"$(PODS_ROOT)/Headers/Private/React-Core\"", + "\"$(PODS_ROOT)/Folly\"", + ); INFOPLIST_FILE = "RNTester-macOS/Info.plist"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -1847,6 +1868,27 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = ""; ENABLE_HARDENED_RUNTIME = YES; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + "\"${PODS_ROOT}/Headers/Public\"", + "\"${PODS_ROOT}/Headers/Public/DoubleConversion\"", + "\"${PODS_ROOT}/Headers/Public/FBLazyVector\"", + "\"${PODS_ROOT}/Headers/Public/FBReactNativeSpec\"", + "\"${PODS_ROOT}/Headers/Public/RCTRequired\"", + "\"${PODS_ROOT}/Headers/Public/RCTTypeSafety\"", + "\"${PODS_ROOT}/Headers/Public/React-Core\"", + "\"${PODS_ROOT}/Headers/Public/React-RCTTest\"", + "\"${PODS_ROOT}/Headers/Public/React-RCTText\"", + "\"${PODS_ROOT}/Headers/Public/React-cxxreact\"", + "\"${PODS_ROOT}/Headers/Public/React-jsi\"", + "\"${PODS_ROOT}/Headers/Public/React-jsiexecutor\"", + "\"${PODS_ROOT}/Headers/Public/React-jsinspector\"", + "\"${PODS_ROOT}/Headers/Public/ReactCommon\"", + "\"${PODS_ROOT}/Headers/Public/Yoga\"", + "\"${PODS_ROOT}/Headers/Public/glog\"", + "\"$(PODS_ROOT)/Headers/Private/React-Core\"", + "\"$(PODS_ROOT)/Folly\"", + ); INFOPLIST_FILE = "RNTester-macOS/Info.plist"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", diff --git a/React-Core.podspec b/React-Core.podspec index 5fd9d05ab7..762f947ab6 100644 --- a/React-Core.podspec +++ b/React-Core.podspec @@ -63,12 +63,11 @@ Pod::Spec.new do |s| # [TODO(macOS ISS#2323203) "**/MacOS/*" ss.osx.exclude_files = "React/Modules/RCTRedBoxExtraDataViewController.{h,m}", - "React/Profiler/{RCTFPSGraph,RCTPerfMonitor}.*", "React/Profiler/RCTProfileTrampoline-{arm,arm64,i386}.S", "React/Base/RCTKeyCommands.*", "React/Base/RCTTV*.*", - "React/Base/RCTReloadCommand.*", - "React/Views/{RCTModal*,RCTMasked*,RCTTV*,RCTRefreshControl*,RCTWrapperViewController}.*", + "React/Views/{RCTModal*,RCTMasked*,RCTTV*,RCTWrapperViewController}.*", + "React/Views/RefreshControl/*", "React/Views/SafeAreaView/*" # ]TODO(macOS ISS#2323203) diff --git a/React/Base/RCTBridge.m b/React/Base/RCTBridge.m index c6261a3e26..8edbea05b4 100644 --- a/React/Base/RCTBridge.m +++ b/React/Base/RCTBridge.m @@ -366,10 +366,12 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init) // Sanitize the bundle URL _bundleURL = [RCTConvert NSURL:_bundleURL.absoluteString]; +#if !TARGET_OS_OSX RCTExecuteOnMainQueue(^{ RCTRegisterReloadCommandListener(self); RCTReloadCommandSetBundleURL(self->_bundleURL); }); +#endif // !TARGET_OS_OSX self.batchedBridge = [[bridgeClass alloc] initWithParentBridge:self]; [self.batchedBridge start]; diff --git a/React/Base/RCTReloadCommand.m b/React/Base/RCTReloadCommand.m index 43faf6e0bf..bd63549d2c 100644 --- a/React/Base/RCTReloadCommand.m +++ b/React/Base/RCTReloadCommand.m @@ -8,7 +8,9 @@ #import "RCTReloadCommand.h" #import "RCTAssert.h" +#if !TARGET_OS_OSX #import "RCTKeyCommands.h" +#endif #import "RCTUtils.h" static NSHashTable> *listeners; @@ -28,7 +30,7 @@ void RCTRegisterReloadCommandListener(id listener) if (!listeners) { listeners = [NSHashTable weakObjectsHashTable]; } -#if RCT_DEV +#if RCT_DEV && !TARGET_OS_OSX RCTAssertMainQueue(); // because registerKeyCommandWithInput: must be called on the main thread static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ diff --git a/React/Base/RCTUIKit.h b/React/Base/RCTUIKit.h index 8a8f6e5e2a..a0479a343f 100644 --- a/React/Base/RCTUIKit.h +++ b/React/Base/RCTUIKit.h @@ -322,6 +322,9 @@ NS_INLINE NSEdgeInsets UIEdgeInsetsMake(CGFloat top, CGFloat left, CGFloat botto // UIImage @compatibility_alias UIImage NSImage; +#ifdef __cplusplus +extern "C" +#endif CGFloat UIImageGetScale(NSImage *image); CGImageRef UIImageGetCGImageRef(NSImage *image); diff --git a/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.mm b/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.mm index 38e21b76f8..45b17317d1 100644 --- a/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.mm +++ b/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.mm @@ -211,6 +211,7 @@ RCT_NOT_IMPLEMENTED(- (nullable instancetype)initWithCoder:(NSCoder *)coder) #pragma mark - UITraitCollection updates +#if !TARGET_OS_OSX // TODO(macOS ISS#2323203) - (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection { [super traitCollectionDidChange:previousTraitCollection]; @@ -220,6 +221,7 @@ RCT_NOT_IMPLEMENTED(- (nullable instancetype)initWithCoder:(NSCoder *)coder) RCTUserInterfaceStyleDidChangeNotificationTraitCollectionKey: self.traitCollection, }]; } +#endif // TODO(macOS ISS#2323203) #pragma mark - Private stuff diff --git a/React/CoreModules/CoreModulesPlugins.mm b/React/CoreModules/CoreModulesPlugins.mm index dfd937c538..149a1970b5 100644 --- a/React/CoreModules/CoreModulesPlugins.mm +++ b/React/CoreModules/CoreModulesPlugins.mm @@ -18,8 +18,10 @@ Class RCTCoreModulesClassProvider(const char *name) { static std::unordered_map sCoreModuleClassMap = { +#if !TARGET_OS_OSX // TODO(macOS) = Do we need these? {"AccessibilityManager", RCTAccessibilityManagerCls}, {"Appearance", RCTAppearanceCls}, +#endif // TODO(macOS) {"DeviceInfo", RCTDeviceInfoCls}, {"ExceptionsManager", RCTExceptionsManagerCls}, {"PlatformConstants", RCTPlatformCls}, @@ -33,11 +35,15 @@ Class RCTCoreModulesClassProvider(const char *name) { {"StatusBarManager", RCTStatusBarManagerCls}, {"KeyboardObserver", RCTKeyboardObserverCls}, {"AppState", RCTAppStateCls}, +#if !TARGET_OS_OSX // TODO(macOS) = Do we need these? {"PerfMonitor", RCTPerfMonitorCls}, +#endif // TODO(macOS) {"DevMenu", RCTDevMenuCls}, {"DevSettings", RCTDevSettingsCls}, {"RedBox", RCTRedBoxCls}, +#if !TARGET_OS_OSX // TODO(macOS) = Do we need these? {"LogBox", RCTLogBoxCls}, +#endif // TODO(macOS) {"TVNavigationEventEmitter", RCTTVNavigationEventEmitterCls}, {"WebSocketExecutor", RCTWebSocketExecutorCls}, {"WebSocketModule", RCTWebSocketModuleCls}, diff --git a/React/CoreModules/RCTActionSheetManager.mm b/React/CoreModules/RCTActionSheetManager.mm index 4d11c79568..42660c3ade 100644 --- a/React/CoreModules/RCTActionSheetManager.mm +++ b/React/CoreModules/RCTActionSheetManager.mm @@ -37,7 +37,7 @@ NSSharingServicePickerDelegate #if TARGET_OS_OSX // [TODO(macOS ISS#2323203) NSArray *_excludedActivities; NSString *_sharingSubject; - RCTResponseErrorBlock _failureCallback; + RCTResponseSenderBlock _failureCallback; RCTResponseSenderBlock _successCallback; #endif // ]TODO(macOS ISS#2323203) } @@ -99,9 +99,11 @@ RCT_EXPORT_METHOD(showActionSheetWithOptions:(JS::NativeActionSheetManager::Spec destructiveButtonIndices = @[destructiveButtonIndex]; #endif // TODO(macOS ISS#2323203) } + + NSNumber *anchor = [RCTConvert NSNumber:options.anchor() ? @(*options.anchor()) : nil]; + #if !TARGET_OS_OSX // TODO(macOS ISS#2323203) UIViewController *controller = RCTPresentedViewController(); - NSNumber *anchor = [RCTConvert NSNumber:options.anchor() ? @(*options.anchor()) : nil]; UIColor *tintColor = [RCTConvert UIColor:options.tintColor() ? @(*options.tintColor()) : nil]; if (controller == nil) { @@ -261,26 +263,27 @@ RCT_EXPORT_METHOD(showShareActionSheetWithOptions:(JS::NativeActionSheetManager: [self presentViewController:shareController onParentViewController:controller anchorViewTag:anchorViewTag]; #else // [TODO(macOS ISS#2323203) + NSArray *excludedActivityTypes = RCTConvertOptionalVecToArray(options.excludedActivityTypes(), ^id(NSString *element) { return element; }); NSMutableArray *excludedTypes = [NSMutableArray array]; - for (NSString *excludeActivityType in [RCTConvert NSStringArray:options[@"excludedActivityTypes"]]) { + for (NSString *excludeActivityType in excludedActivityTypes) { NSSharingService *sharingService = [NSSharingService sharingServiceNamed:excludeActivityType]; if (sharingService) { [excludedTypes addObject:sharingService]; } } _excludedActivities = excludedTypes.copy; - _sharingSubject = [RCTConvert NSString:options[@"subject"]]; + _sharingSubject = options.subject(); _failureCallback = failureCallback; _successCallback = successCallback; RCTPlatformView *view = nil; - NSNumber *anchorViewTag = [RCTConvert NSNumber:options[@"anchor"]]; + NSNumber *anchorViewTag = [RCTConvert NSNumber:options.anchor() ? @(*options.anchor()) : nil]; if (anchorViewTag) { view = [self.bridge.uiManager viewForReactTag:anchorViewTag]; } NSView *contentView = view ?: NSApp.keyWindow.contentView; NSSharingServicePicker *picker = [[NSSharingServicePicker alloc] initWithItems:items]; picker.delegate = self; - [picker showRelativeToRect:contentView.bounds ofView:contentView preferredEdge:0]; + [picker showRelativeToRect:contentView.bounds ofView:contentView preferredEdge:NSRectEdgeMinX]; #endif // ]TODO(macOS ISS#2323203) } @@ -310,7 +313,7 @@ RCT_EXPORT_METHOD(showShareActionSheetWithOptions:(JS::NativeActionSheetManager: - (void)sharingService:(NSSharingService *)sharingService didFailToShareItems:(NSArray *)items error:(NSError *)error { - _failureCallback(error); + _failureCallback(@[RCTJSErrorFromNSError(error)]); } - (void)sharingService:(NSSharingService *)sharingService didShareItems:(NSArray *)items diff --git a/React/CoreModules/RCTAlertManager.mm b/React/CoreModules/RCTAlertManager.mm index 6066f3b22e..3485e70673 100644 --- a/React/CoreModules/RCTAlertManager.mm +++ b/React/CoreModules/RCTAlertManager.mm @@ -87,9 +87,9 @@ RCT_EXPORT_METHOD(alertWithArgs:(JS::NativeAlertManager::Args &)args NSString *destructiveButtonKey = [RCTConvert NSString:args.destructiveButtonKey()]; UIKeyboardType keyboardType = [RCTConvert UIKeyboardType:args.keyboardType()]; #else // [TODO(macOS ISS#2323203) - BOOL critical = [RCTConvert BOOL:args[@"critical"]]; - BOOL modal = [RCTConvert BOOL:args[@"modal"]]; - NSArray *defaultInputs = [RCTConvert NSDictionaryArray:args[@"defaultInputs"]]; + BOOL critical = args.critical(); + BOOL modal = args.modal(); + NSArray *defaultInputs = [RCTConvert NSDictionaryArray:RCTConvertOptionalVecToArray(args.defaultInputs(), ^id(id element) { return element; })]; #endif // ]TODO(macOS ISS#2323203) if (!title && !message) { diff --git a/React/CoreModules/RCTDevMenu.mm b/React/CoreModules/RCTDevMenu.mm index e5928c8504..4ed6090e51 100644 --- a/React/CoreModules/RCTDevMenu.mm +++ b/React/CoreModules/RCTDevMenu.mm @@ -267,7 +267,6 @@ RCT_EXPORT_MODULE() [RCTPresentedViewController() presentViewController:alertController animated:YES completion:NULL]; - }]]; #else // [TODO(macOS ISS#2323203) NSAlert *alert = [[NSAlert alloc] init]; [alert setMessageText:@"Remote JS Debugger Unavailable"]; @@ -276,6 +275,7 @@ RCT_EXPORT_MODULE() [alert setAlertStyle:NSWarningAlertStyle]; [alert beginSheetModalForWindow:[NSApp keyWindow] completionHandler:nil]; #endif // ]TODO(macOS ISS#2323203) + }]]; } else { [items addObject:[RCTDevMenuItem buttonItemWithTitleBlock:^NSString * { @@ -293,7 +293,7 @@ RCT_EXPORT_MODULE() if (devSettings.isNuclideDebuggingAvailable && !devSettings.isDebuggingRemotely) { [items addObject:[RCTDevMenuItem buttonItemWithTitle:@"Debug with Nuclide" handler:^{ -#if RCT_ENABLE_INSPECTOR +#if RCT_ENABLE_INSPECTOR && !TARGET_OS_OSX // TODO(macOS ISS#2323203) - No RCTPresentedViewController on macOS [RCTInspectorDevServerHelper attachDebugger:@"ReactNative" withBundleURL:bridge.bundleURL diff --git a/React/CoreModules/RCTDeviceInfo.h b/React/CoreModules/RCTDeviceInfo.h index c879321f2c..c03322da90 100644 --- a/React/CoreModules/RCTDeviceInfo.h +++ b/React/CoreModules/RCTDeviceInfo.h @@ -7,6 +7,15 @@ #import +#if !TARGET_OS_OSX // [TODO(macOS ISS#2323203) - RCTExportedDimensions is needed in RCTRootContentView +NSDictionary *RCTExportedDimensions(RCTBridge *bridge); +#else +#ifdef __cplusplus +extern "C" +#endif +NSDictionary *RCTExportedDimensions(RCTPlatformView *rootView); +#endif // ]TODO(macOS ISS#2323203) + @interface RCTDeviceInfo : NSObject @end diff --git a/React/CoreModules/RCTRedBox.mm b/React/CoreModules/RCTRedBox.mm index a13fb504c5..9a3a985009 100644 --- a/React/CoreModules/RCTRedBox.mm +++ b/React/CoreModules/RCTRedBox.mm @@ -27,6 +27,7 @@ @class RCTRedBoxWindow; +#if !TARGET_OS_OSX // TODO(macOS ISS#2323203) @interface UIButton (RCTRedBox) @property (nonatomic) RCTRedBoxButtonPressHandler rct_handler; @@ -61,6 +62,7 @@ } @end +#endif // TODO(macOS ISS#2323203) @protocol RCTRedBoxWindowActionDelegate @@ -571,7 +573,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder) }); } -- (void)showErrorMessage:(NSString *)message withStack:(NSArray *)stack isUpdate:(BOOL)isUpdate +- (void)showErrorMessage:(NSString *)message withStack:(NSArray *)stack isUpdate:(BOOL)isUpdate errorCookie:(int)errorCookie { // Show if this is a new message, or if we're updating the previous message if ((!_visible && !isUpdate) || (_visible && isUpdate && [_lastErrorMessage isEqualToString:message])) { diff --git a/React/CoreModules/RCTStatusBarManager.mm b/React/CoreModules/RCTStatusBarManager.mm index 2f74040625..4d11bc8f3a 100644 --- a/React/CoreModules/RCTStatusBarManager.mm +++ b/React/CoreModules/RCTStatusBarManager.mm @@ -12,7 +12,7 @@ #import #import -#if !TARGET_OS_TV +#if !TARGET_OS_TV && !TARGET_OS_OSX // TODO(macOS ISS#2323203) #import @implementation RCTConvert (UIStatusBar) @@ -59,7 +59,7 @@ RCT_ENUM_CONVERTER( @end #endif -#if !TARGET_OS_TV +#if !TARGET_OS_TV && !TARGET_OS_OSX // TODO(macOS ISS#2323203) @interface RCTStatusBarManager() @end @@ -93,7 +93,7 @@ RCT_EXPORT_MODULE() return @[ @"statusBarFrameDidChange", @"statusBarFrameWillChange" ]; } -#if !TARGET_OS_TV +#if !TARGET_OS_TV && !TARGET_OS_OSX // TODO(macOS ISS#2323203) - (void)startObserving { diff --git a/React/CoreModules/React-CoreModules.podspec b/React/CoreModules/React-CoreModules.podspec index ded5ff39a4..86096d40c6 100644 --- a/React/CoreModules/React-CoreModules.podspec +++ b/React/CoreModules/React-CoreModules.podspec @@ -30,6 +30,10 @@ Pod::Spec.new do |s| s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness' s.source = source s.source_files = "**/*.{c,m,mm,cpp}" + # [TODO(macOS ISS#2323203) + "**/MacOS/*" + s.osx.exclude_files = "{RCTAppearance,RCTLogBox,RCTFPSGraph,RCTPerfMonitor,RCTPlatform}.*" + # ]TODO(macOS ISS#2323203) s.header_dir = "CoreModules" s.pod_target_xcconfig = { "USE_HEADERMAP" => "YES", diff --git a/React/Views/RCTSegmentedControl.m b/React/Views/RCTSegmentedControl.m index 5e52c82eb4..801be6c84e 100644 --- a/React/Views/RCTSegmentedControl.m +++ b/React/Views/RCTSegmentedControl.m @@ -52,7 +52,8 @@ self.selectedSegmentIndex = selectedIndex; // TODO(macOS ISS#2323203) } -- (void)setTintColor:(RCTUIColor *)tintColor // TODO(macOS ISS#2323203) +#if !TARGET_OS_OSX // TODO(macOS ISS#2323203) - no concept of tintColor on macOS +- (void)setTintColor:(UIColor *)tintColor // TODO(macOS ISS#2323203) { [super setTintColor:tintColor]; #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \ @@ -66,6 +67,7 @@ } #endif } +#endif // TODO(macOS ISS#2323203) - (void)didChange { diff --git a/React/Views/RCTSlider.m b/React/Views/RCTSlider.m index f89b16de5c..a857bd8b98 100644 --- a/React/Views/RCTSlider.m +++ b/React/Views/RCTSlider.m @@ -327,6 +327,7 @@ #endif // ]TODO(macOS ISS#2323203) } +#if !TARGET_OS_OSX // TODO(macOS ISS#2323203) - accessibility on macOS is on the NSCell rather than the NSControl - (void)accessibilityIncrement { [super accessibilityIncrement]; @@ -346,5 +347,6 @@ }); } } +#endif // TODO(macOS ISS#2323203) @end diff --git a/ReactCommon/turbomodule/samples/platform/ios/RCTSampleTurboModule.mm b/ReactCommon/turbomodule/samples/platform/ios/RCTSampleTurboModule.mm index 9ab9d18675..484d1f4adb 100644 --- a/ReactCommon/turbomodule/samples/platform/ios/RCTSampleTurboModule.mm +++ b/ReactCommon/turbomodule/samples/platform/ios/RCTSampleTurboModule.mm @@ -45,8 +45,13 @@ RCT_EXPORT_MODULE() - (NSDictionary *)getConstants { +#if !TARGET_OS_OSX // TODO(macOS ISS#2323203) UIScreen *mainScreen = UIScreen.mainScreen; CGSize screenSize = mainScreen.bounds.size; +#else // [TODO(macOS ISS#2323203) + NSScreen *mainScreen = NSScreen.mainScreen; + CGSize screenSize = mainScreen.frame.size; +#endif // ]TODO(macOS ISS#2323203) return @{ @"const1" : @YES,