From 57a3b437d248b9dc48c3e86f40662d04891b833b Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Thu, 11 Aug 2022 23:00:35 -0700 Subject: [PATCH 1/3] change tags --- .circleci/Dockerfiles/Dockerfile.android | 2 +- .circleci/config.yml | 22 +- .flowconfig | 4 +- .flowconfig.android | 6 +- .flowconfig.macos | 4 +- .github/workflows/test-docker-android.yml | 2 +- IntegrationTests/LayoutEventsTest.js | 6 +- .../React-RCTActionSheet.podspec | 2 +- Libraries/Alert/Alert.js | 20 +- Libraries/Alert/NativeAlertManager.js | 4 +- Libraries/Alert/RCTAlertManager.macos.js | 2 +- Libraries/Animated/AnimatedMock.js | 4 +- Libraries/Animated/NativeAnimatedHelper.js | 2 +- Libraries/AppState/AppState.js | 2 +- Libraries/Blob/React-RCTBlob.podspec | 2 +- .../AccessibilityInfo/AccessibilityInfo.js | 28 +- .../NativeAccessibilityManager.js | 4 +- .../legacySendAccessibilityEvent.macos.js | 2 +- Libraries/Components/Button.js | 49 ++- .../DatePicker/DatePickerIOS.macos.js | 2 +- .../DatePickerAndroid.macos.js | 2 +- .../DatePickerMacOS.android.js | 2 +- .../DatePickerMacOS/DatePickerMacOS.ios.js | 2 +- .../DatePickerMacOS/DatePickerMacOS.macos.js | 2 +- .../RCTDatePickerNativeComponentMacOS.js | 2 +- .../DrawerLayoutAndroid.macos.js | 2 +- Libraries/Components/Keyboard/Keyboard.js | 2 +- .../MaskedView/MaskedViewIOS.macos.js | 2 +- .../Components/Picker/PickerAndroid.macos.js | 2 +- .../Components/Picker/PickerIOS.macos.js | 2 +- Libraries/Components/Pressable/Pressable.js | 34 +- .../ProgressBarAndroid.macos.js | 2 +- .../ProgressViewIOS/ProgressViewIOS.macos.js | 2 +- .../Components/SafeAreaView/SafeAreaView.js | 2 +- Libraries/Components/ScrollView/ScrollView.js | 36 +- .../SegmentedControlIOS.macos.js | 2 +- Libraries/Components/Slider/Slider.js | 6 +- .../NativeStatusBarManagerAndroid.js | 2 +- Libraries/Components/StatusBar/StatusBar.js | 4 +- .../TextInput/RCTTextInputViewConfig.js | 2 +- Libraries/Components/TextInput/TextInput.js | 42 ++- .../Components/TextInput/TextInputState.js | 10 +- .../ToastAndroid/ToastAndroid.macos.js | 2 +- .../Components/Touchable/TouchableBounce.js | 8 +- .../Touchable/TouchableHighlight.js | 8 +- .../Components/Touchable/TouchableOpacity.js | 12 +- .../Touchable/TouchableWithoutFeedback.js | 22 +- Libraries/Components/View/DraggedType.js | 2 +- .../View/ReactNativeViewAttributes.js | 4 +- .../View/ReactNativeViewViewConfigMacOS.js | 2 +- Libraries/Components/View/View.js | 1 - .../Components/View/ViewAccessibility.js | 2 +- Libraries/Components/View/ViewPropTypes.js | 22 +- Libraries/Core/NativeExceptionsManager.js | 2 +- .../DeprecatedImagePropType.macos.js | 2 +- Libraries/EventEmitter/NativeEventEmitter.js | 5 +- Libraries/FBLazyVector/FBLazyVector.podspec | 2 +- Libraries/Image/Image.macos.js | 2 +- Libraries/Image/RCTAnimatedImage.h | 6 +- Libraries/Image/RCTAnimatedImage.m | 20 +- Libraries/Image/RCTDisplayWeakRefreshable.h | 6 +- Libraries/Image/RCTDisplayWeakRefreshable.m | 6 +- Libraries/Image/RCTImageBlurUtils.h | 2 +- Libraries/Image/RCTImageBlurUtils.m | 24 +- Libraries/Image/RCTImageCache.h | 2 +- Libraries/Image/RCTImageCache.m | 8 +- Libraries/Image/RCTImageDataDecoder.h | 2 +- Libraries/Image/RCTImageEditingManager.mm | 6 +- Libraries/Image/RCTImageLoader.h | 4 +- Libraries/Image/RCTImageLoader.mm | 42 +-- Libraries/Image/RCTImageLoaderProtocol.h | 2 +- .../RCTImageLoaderWithAttributionProtocol.h | 4 +- Libraries/Image/RCTImageStoreManager.h | 2 +- Libraries/Image/RCTImageStoreManager.mm | 8 +- Libraries/Image/RCTImageURLLoader.h | 2 +- .../Image/RCTImageURLLoaderWithAttribution.h | 4 +- Libraries/Image/RCTImageUtils.h | 4 +- Libraries/Image/RCTImageUtils.m | 44 +-- Libraries/Image/RCTImageView.h | 6 +- Libraries/Image/RCTImageView.mm | 110 +++---- Libraries/Image/RCTImageViewManager.mm | 4 +- Libraries/Image/RCTResizeMode.h | 6 +- Libraries/Image/RCTUIImageViewAnimated.h | 8 +- Libraries/Image/RCTUIImageViewAnimated.m | 22 +- Libraries/Image/React-RCTImage.podspec | 2 +- Libraries/Image/nativeImageSource.js | 4 +- Libraries/Linking/Linking.js | 2 +- Libraries/LinkingIOS/RCTLinkingManager.h | 12 +- Libraries/LinkingIOS/React-RCTLinking.podspec | 6 +- .../LinkingIOS/macos/RCTLinkingManager.mm | 2 +- Libraries/Lists/FlatList.js | 14 +- Libraries/Lists/SectionList.js | 2 +- Libraries/Lists/VirtualizedList.js | 70 ++-- Libraries/Lists/VirtualizedSectionList.js | 40 +-- .../Drivers/RCTDecayAnimation.m | 2 +- .../Drivers/RCTFrameAnimation.m | 2 +- .../Drivers/RCTSpringAnimation.m | 2 +- .../Nodes/RCTValueAnimatedNode.h | 2 +- .../RCTNativeAnimatedModule.mm | 4 +- .../RCTNativeAnimatedNodesManager.h | 4 +- .../RCTNativeAnimatedNodesManager.m | 6 +- .../React-RCTAnimation.podspec | 2 +- .../NativeModules/specs/NativeDevSettings.js | 4 +- Libraries/Network/RCTFileRequestHandler.mm | 6 +- Libraries/Network/RCTNetworking.macos.js | 2 +- Libraries/Network/React-RCTNetwork.podspec | 4 +- .../Network/__tests__/XMLHttpRequest-test.js | 5 +- .../components/DebugInstructions.js | 4 +- .../components/ReloadInstructions.js | 4 +- Libraries/Pressability/HoverState.js | 4 +- Libraries/Pressability/Pressability.js | 6 +- .../PushNotificationIOS.js | 4 +- .../RCTPushNotificationManager.h | 16 +- .../RCTPushNotificationManager.mm | 138 ++++---- .../React-RCTPushNotification.podspec | 2 +- Libraries/RCTRequired/RCTRequired.podspec | 2 +- Libraries/ReactNative/PaperUIManager.js | 2 +- Libraries/Settings/RCTSettingsManager.mm | 12 +- Libraries/Settings/React-RCTSettings.podspec | 2 +- Libraries/Settings/Settings.macos.js | 2 +- .../PlatformColorValueTypes.macos.js | 5 +- .../PlatformColorValueTypesMacOS.js | 5 +- .../PlatformColorValueTypesMacOS.macos.js | 5 +- Libraries/StyleSheet/StyleSheetTypes.js | 4 +- Libraries/StyleSheet/processTransform.js | 2 +- .../Text/BaseText/RCTBaseTextViewManager.m | 14 +- Libraries/Text/RCTConvert+Text.h | 4 +- Libraries/Text/RCTTextAttributes.h | 34 +- Libraries/Text/RCTTextAttributes.m | 58 ++-- Libraries/Text/RCTTextUIKit.h | 2 + Libraries/Text/RawText/RCTRawTextShadowView.m | 4 +- .../Text/RawText/RCTRawTextViewManager.m | 4 +- Libraries/Text/React-RCTText.podspec | 4 +- .../Text/Text/NSTextStorage+FontScaling.h | 2 +- .../Text/Text/NSTextStorage+FontScaling.m | 2 +- Libraries/Text/Text/RCTDynamicTypeRamp.h | 6 +- Libraries/Text/Text/RCTDynamicTypeRamp.m | 6 +- Libraries/Text/Text/RCTTextShadowView.m | 30 +- Libraries/Text/Text/RCTTextView.h | 10 +- Libraries/Text/Text/RCTTextView.m | 134 ++++---- Libraries/Text/Text/RCTTextViewManager.m | 12 +- .../Multiline/RCTMultilineTextInputView.h | 4 +- .../Multiline/RCTMultilineTextInputView.m | 30 +- .../RCTMultilineTextInputViewManager.m | 12 +- .../Text/TextInput/Multiline/RCTUITextView.h | 20 +- .../Text/TextInput/Multiline/RCTUITextView.m | 138 ++++---- .../TextInput/RCTBackedTextInputDelegate.h | 14 +- .../RCTBackedTextInputDelegateAdapter.h | 18 +- .../RCTBackedTextInputDelegateAdapter.m | 82 ++--- .../RCTBackedTextInputViewProtocol.h | 38 +-- .../TextInput/RCTBaseTextInputShadowView.m | 14 +- .../Text/TextInput/RCTBaseTextInputView.h | 18 +- .../Text/TextInput/RCTBaseTextInputView.m | 124 +++---- .../TextInput/RCTBaseTextInputViewManager.m | 62 ++-- .../TextInput/RCTInputAccessoryShadowView.m | 4 +- .../Text/TextInput/RCTInputAccessoryView.h | 4 +- .../Text/TextInput/RCTInputAccessoryView.m | 6 +- .../TextInput/RCTInputAccessoryViewContent.h | 4 +- .../TextInput/RCTInputAccessoryViewContent.m | 14 +- .../TextInput/RCTInputAccessoryViewManager.m | 2 +- .../Singleline/RCTSinglelineTextInputView.m | 14 +- .../RCTSinglelineTextInputViewManager.m | 4 +- .../TextInput/Singleline/RCTUITextField.h | 22 +- .../TextInput/Singleline/RCTUITextField.m | 118 +++---- .../Singleline/macOS/RCTUISecureTextField.h | 2 +- .../Singleline/macOS/RCTUISecureTextField.m | 2 +- Libraries/Text/TextNativeComponent.js | 2 +- Libraries/Text/TextProps.js | 2 +- .../VirtualText/RCTVirtualTextViewManager.m | 4 +- Libraries/TypeSafety/RCTTypeSafety.podspec | 2 +- Libraries/Types/CoreEventTypes.js | 12 +- Libraries/Utilities/Appearance.js | 4 +- Libraries/Utilities/BackHandler.macos.js | 2 +- Libraries/Utilities/DevSettings.js | 2 +- Libraries/Utilities/HMRClient.js | 8 +- Libraries/Utilities/LoadingView.macos.js | 2 +- Libraries/Utilities/Platform.macos.js | 2 +- .../Vibration/React-RCTVibration.podspec | 2 +- Libraries/WebSocket/RCTSRWebSocket.m | 19 +- Libraries/WebSocket/WebSocket.js | 2 +- Libraries/WebSocket/WebSocketInterceptor.js | 2 +- React-Core.podspec | 10 +- React.podspec | 2 +- React/AppSetup/RCTAppSetupUtils.h | 2 +- React/AppSetup/RCTAppSetupUtils.mm | 2 +- React/Base/RCTBridge+Cxx.h | 2 +- React/Base/RCTBridge+Cxx.mm | 2 +- React/Base/RCTBridge.h | 2 +- React/Base/RCTBridge.m | 2 +- React/Base/RCTBridgeModule.h | 8 +- React/Base/RCTBundleURLProvider.h | 2 +- React/Base/RCTBundleURLProvider.mm | 8 +- React/Base/RCTConvert.h | 28 +- React/Base/RCTConvert.m | 302 +++++++++-------- React/Base/RCTDisplayLink.m | 16 +- React/Base/RCTEventDispatcherProtocol.h | 2 +- React/Base/RCTFrameUpdate.h | 4 +- React/Base/RCTFrameUpdate.m | 4 +- React/Base/RCTImageSource.m | 4 +- React/Base/RCTJSStackFrame.m | 4 +- React/Base/RCTJSThread.h | 2 +- React/Base/RCTJavaScriptLoader.h | 2 +- React/Base/RCTJavaScriptLoader.mm | 4 +- React/Base/RCTKeyCommands.m | 4 +- React/Base/RCTModuleData.mm | 4 +- React/Base/RCTModuleMethod.mm | 4 +- React/Base/RCTMultipartDataTask.m | 10 +- React/Base/RCTPlatformDisplayLink.h | 2 +- React/Base/RCTRedBoxSetEnabled.m | 2 +- React/Base/RCTReloadCommand.m | 8 +- React/Base/RCTRootContentView.h | 2 +- React/Base/RCTRootContentView.m | 20 +- React/Base/RCTRootView.h | 8 +- React/Base/RCTRootView.m | 52 +-- React/Base/RCTTouchEvent.m | 4 +- React/Base/RCTTouchHandler.h | 10 +- React/Base/RCTTouchHandler.m | 134 ++++---- React/Base/RCTUIKit.h | 34 +- React/Base/RCTUtils.h | 24 +- React/Base/RCTUtils.m | 76 ++--- React/Base/RCTUtilsUIOverride.h | 2 +- React/Base/RCTUtilsUIOverride.m | 2 +- React/Base/RCTViewRegistry.m | 4 +- React/Base/Surface/RCTSurfaceDelegate.h | 2 +- React/Base/Surface/RCTSurfaceProtocol.h | 2 +- .../RCTSurfaceRootShadowViewDelegate.h | 2 +- React/Base/Surface/RCTSurfaceRootView.h | 2 +- React/Base/Surface/RCTSurfaceView.h | 2 +- React/Base/Surface/RCTSurfaceView.mm | 4 +- .../RCTSurfaceHostingProxyRootView.h | 6 +- .../RCTSurfaceHostingProxyRootView.mm | 10 +- .../RCTSurfaceHostingView.h | 6 +- .../RCTSurfaceHostingView.mm | 28 +- .../RCTSurfaceSizeMeasureMode.h | 2 +- .../RCTSurfaceSizeMeasureMode.mm | 2 +- React/Base/macOS/RCTPlatform.m | 2 +- React/Base/macOS/RCTPlatformDisplayLink.m | 2 +- React/Base/macOS/RCTUIKit.m | 16 +- React/CoreModules/CoreModulesPlugins.mm | 12 +- React/CoreModules/RCTAccessibilityManager.h | 2 +- React/CoreModules/RCTAccessibilityManager.mm | 4 +- React/CoreModules/RCTActionSheetManager.h | 2 +- React/CoreModules/RCTActionSheetManager.mm | 62 ++-- React/CoreModules/RCTAlertController.h | 14 +- React/CoreModules/RCTAlertController.m | 12 +- React/CoreModules/RCTAlertManager.h | 2 +- React/CoreModules/RCTAlertManager.mm | 18 +- React/CoreModules/RCTAppState.mm | 12 +- React/CoreModules/RCTAppearance.h | 8 +- React/CoreModules/RCTAppearance.mm | 32 +- React/CoreModules/RCTAsyncLocalStorage.mm | 11 +- React/CoreModules/RCTClipboard.mm | 14 +- React/CoreModules/RCTDevLoadingView.h | 2 +- React/CoreModules/RCTDevLoadingView.mm | 62 ++-- React/CoreModules/RCTDevMenu.h | 6 +- React/CoreModules/RCTDevMenu.mm | 82 +++-- React/CoreModules/RCTDevSettings.h | 8 +- React/CoreModules/RCTDevSettings.mm | 36 +- React/CoreModules/RCTDevSplitBundleLoader.h | 2 +- React/CoreModules/RCTDeviceInfo.h | 4 +- React/CoreModules/RCTDeviceInfo.mm | 44 +-- React/CoreModules/RCTFPSGraph.h | 6 +- React/CoreModules/RCTFPSGraph.m | 4 +- React/CoreModules/RCTKeyboardObserver.mm | 16 +- React/CoreModules/RCTLogBox.h | 2 +- React/CoreModules/RCTLogBox.mm | 24 +- React/CoreModules/RCTLogBoxView.h | 10 +- React/CoreModules/RCTLogBoxView.mm | 10 +- React/CoreModules/RCTPerfMonitor.mm | 2 +- React/CoreModules/RCTPlatform.mm | 2 +- React/CoreModules/RCTRedBox.h | 2 +- React/CoreModules/RCTRedBox.mm | 48 +-- React/CoreModules/RCTStatusBarManager.h | 6 +- React/CoreModules/RCTStatusBarManager.mm | 8 +- React/CoreModules/RCTTiming.mm | 4 +- React/CoreModules/RCTWebSocketModule.mm | 6 +- React/CoreModules/React-CoreModules.podspec | 6 +- React/CxxBridge/RCTCxxBridge.mm | 18 +- React/CxxModule/RCTCxxMethod.mm | 4 +- React/DevSupport/RCTDevLoadingViewProtocol.h | 4 +- .../DevSupport/RCTInspectorDevServerHelper.h | 2 +- .../DevSupport/RCTInspectorDevServerHelper.mm | 16 +- React/DevSupport/RCTPackagerConnection.mm | 2 +- .../FBReactNativeSpec.podspec | 2 +- .../RCTActivityIndicatorViewComponentView.h | 2 +- .../RCTActivityIndicatorViewComponentView.mm | 6 +- .../RCTInputAccessoryComponentView.h | 2 +- .../RCTInputAccessoryComponentView.mm | 16 +- .../RCTInputAccessoryContentView.h | 4 +- .../RCTInputAccessoryContentView.mm | 6 +- ...RCTLegacyViewManagerInteropComponentView.h | 2 +- ...CTLegacyViewManagerInteropComponentView.mm | 12 +- ...gacyViewManagerInteropCoordinatorAdapter.h | 2 +- ...acyViewManagerInteropCoordinatorAdapter.mm | 2 +- .../Modal/RCTFabricModalHostViewController.h | 2 +- .../Modal/RCTModalHostViewComponentView.h | 4 +- .../Modal/RCTModalHostViewComponentView.mm | 16 +- .../Root/RCTRootComponentView.h | 2 +- .../RCTSafeAreaViewComponentView.h | 2 +- .../ScrollView/RCTEnhancedScrollView.h | 6 +- .../ScrollView/RCTEnhancedScrollView.mm | 26 +- .../RCTPullToRefreshViewComponentView.h | 2 +- .../ScrollView/RCTScrollViewComponentView.h | 8 +- .../ScrollView/RCTScrollViewComponentView.mm | 128 ++++---- .../Slider/RCTSliderComponentView.h | 2 +- .../Slider/RCTSliderComponentView.mm | 10 +- .../Switch/RCTSwitchComponentView.h | 2 +- .../Switch/RCTSwitchComponentView.mm | 6 +- .../Text/RCTAccessibilityElement.h | 2 +- .../Text/RCTAccessibilityElement.mm | 2 +- ...TParagraphComponentAccessibilityProvider.h | 4 +- ...ParagraphComponentAccessibilityProvider.mm | 4 +- .../Text/RCTParagraphComponentView.h | 2 +- .../Text/RCTParagraphComponentView.mm | 34 +- .../TextInput/RCTTextInputComponentView.h | 2 +- .../TextInput/RCTTextInputComponentView.mm | 68 ++-- .../TextInput/RCTTextInputUtils.h | 10 +- .../TextInput/RCTTextInputUtils.mm | 26 +- .../RCTUnimplementedNativeComponentView.h | 2 +- .../RCTUnimplementedNativeComponentView.mm | 10 +- .../RCTUnimplementedViewComponentView.h | 2 +- .../RCTUnimplementedViewComponentView.mm | 24 +- .../View/RCTViewComponentView.h | 8 +- .../View/RCTViewComponentView.mm | 42 +-- .../RCTComponentViewClassDescriptor.h | 2 +- .../Mounting/RCTComponentViewDescriptor.h | 4 +- .../Fabric/Mounting/RCTComponentViewFactory.h | 2 +- .../Mounting/RCTComponentViewProtocol.h | 6 +- .../Mounting/RCTComponentViewRegistry.h | 4 +- .../Mounting/RCTComponentViewRegistry.mm | 6 +- React/Fabric/Mounting/RCTMountingManager.h | 6 +- React/Fabric/Mounting/RCTMountingManager.mm | 22 +- .../Mounting/RCTMountingManagerDelegate.h | 2 +- .../RCTMountingTransactionObserving.h | 2 +- .../Mounting/UIView+ComponentViewProtocol.h | 10 +- .../Mounting/UIView+ComponentViewProtocol.mm | 10 +- React/Fabric/RCTConversions.h | 12 +- React/Fabric/RCTImageResponseDelegate.h | 2 +- React/Fabric/RCTLocalizationProvider.h | 2 +- React/Fabric/RCTScheduler.h | 2 +- React/Fabric/RCTSurfacePresenter.h | 4 +- React/Fabric/RCTSurfacePresenter.mm | 6 +- .../Fabric/RCTSurfacePresenterBridgeAdapter.h | 2 +- React/Fabric/RCTSurfaceRegistry.h | 2 +- React/Fabric/RCTSurfaceTouchHandler.h | 6 +- React/Fabric/RCTSurfaceTouchHandler.mm | 14 +- .../RCTTouchableComponentViewProtocol.h | 2 +- .../Fabric/Utils/RCTGenericDelegateSplitter.h | 2 +- React/Modules/RCTEventEmitter.h | 14 +- React/Modules/RCTI18nUtil.m | 2 +- React/Modules/RCTLayoutAnimation.h | 2 +- React/Modules/RCTLayoutAnimation.m | 28 +- React/Modules/RCTLayoutAnimationGroup.h | 2 +- React/Modules/RCTLayoutAnimationGroup.m | 4 +- React/Modules/RCTSurfacePresenterStub.h | 4 +- React/Modules/RCTUIManager.h | 24 +- React/Modules/RCTUIManager.m | 194 +++++------ .../Modules/RCTUIManagerObserverCoordinator.h | 2 +- React/Modules/RCTUIManagerUtils.h | 2 +- React/Profiler/RCTProfile.m | 46 +-- React/React-RCTFabric.podspec | 2 +- React/UIUtils/RCTUIUtils.h | 12 +- React/UIUtils/RCTUIUtils.m | 6 +- React/Views/RCTActivityIndicatorView.h | 8 +- React/Views/RCTActivityIndicatorView.m | 8 +- React/Views/RCTActivityIndicatorViewManager.m | 8 +- React/Views/RCTAnimationType.h | 8 +- React/Views/RCTAutoInsetsProtocol.h | 2 +- React/Views/RCTBorderDrawing.h | 4 +- React/Views/RCTBorderDrawing.m | 44 +-- React/Views/RCTComponentData.h | 6 +- React/Views/RCTComponentData.m | 8 +- React/Views/RCTCursor.h | 4 +- React/Views/RCTCursor.m | 4 +- React/Views/RCTDatePicker.h | 8 +- React/Views/RCTDatePicker.m | 24 +- React/Views/RCTDatePickerManager.h | 6 +- React/Views/RCTDatePickerManager.m | 32 +- React/Views/RCTFont.h | 2 +- React/Views/RCTFont.mm | 18 +- React/Views/RCTFontSmoothing.h | 2 +- React/Views/RCTLayout.h | 2 +- React/Views/RCTMaskedView.h | 2 +- React/Views/RCTModalHostView.h | 4 +- React/Views/RCTModalHostViewController.h | 2 +- React/Views/RCTModalManager.h | 2 +- React/Views/RCTProgressView.h | 12 +- React/Views/RCTProgressView.m | 2 +- React/Views/RCTProgressViewManager.m | 26 +- React/Views/RCTSegmentedControl.h | 12 +- React/Views/RCTSegmentedControl.m | 32 +- React/Views/RCTSegmentedControlManager.m | 6 +- React/Views/RCTShadowView+Internal.h | 2 +- React/Views/RCTShadowView+Layout.h | 2 +- React/Views/RCTShadowView.h | 8 +- React/Views/RCTShadowView.m | 16 +- React/Views/RCTSlider.h | 20 +- React/Views/RCTSlider.m | 76 ++--- React/Views/RCTSliderManager.m | 18 +- React/Views/RCTSwitch.h | 2 +- React/Views/RCTSwitchManager.m | 16 +- React/Views/RCTView.h | 30 +- React/Views/RCTView.m | 235 +++++++------- React/Views/RCTViewKeyboardEvent.h | 4 +- React/Views/RCTViewKeyboardEvent.m | 6 +- React/Views/RCTViewManager.h | 10 +- React/Views/RCTViewManager.m | 100 +++--- React/Views/RCTViewUtils.h | 4 +- React/Views/RCTViewUtils.m | 6 +- React/Views/RCTWeakViewHolder.h | 2 +- React/Views/RCTWrapperViewController.h | 4 +- .../Views/RefreshControl/RCTRefreshControl.h | 4 +- .../RefreshControl/RCTRefreshableProtocol.h | 2 +- React/Views/SafeAreaView/RCTSafeAreaView.h | 2 +- React/Views/SafeAreaView/RCTSafeAreaView.m | 4 +- .../SafeAreaView/RCTSafeAreaViewLocalData.h | 2 +- .../ScrollView/RCTScrollContentShadowView.h | 2 +- .../ScrollView/RCTScrollContentShadowView.m | 8 +- React/Views/ScrollView/RCTScrollContentView.h | 6 +- React/Views/ScrollView/RCTScrollContentView.m | 18 +- .../ScrollView/RCTScrollContentViewManager.m | 2 +- React/Views/ScrollView/RCTScrollEvent.m | 6 +- React/Views/ScrollView/RCTScrollView.h | 16 +- React/Views/ScrollView/RCTScrollView.m | 307 +++++++++--------- React/Views/ScrollView/RCTScrollViewManager.h | 4 +- React/Views/ScrollView/RCTScrollViewManager.m | 54 +-- .../Views/ScrollView/RCTScrollableProtocol.h | 10 +- React/Views/UIView+Private.h | 8 +- React/Views/UIView+React.h | 24 +- React/Views/UIView+React.m | 110 +++---- ReactAndroid/.npmignore | 2 +- .../interfaces/BundleLoadCallback.java | 2 - ReactCommon/React-Fabric.podspec | 2 +- ReactCommon/React-rncore.podspec | 2 +- ReactCommon/ReactCommon.podspec | 2 +- .../callinvoker/React-callinvoker.podspec | 2 +- ReactCommon/cxxreact/React-cxxreact.podspec | 2 +- ReactCommon/jsi/React-jsi.podspec | 2 +- ReactCommon/jsi/jsi/jsi.h | 2 +- .../jsiexecutor/React-jsiexecutor.podspec | 2 +- .../jsinspector/React-jsinspector.podspec | 2 +- ReactCommon/logger/React-logger.podspec | 2 +- .../platform/ios/RCTSampleTurboModule.mm | 8 +- .../RCTLegacyViewManagerInteropCoordinator.h | 6 +- .../RCTLegacyViewManagerInteropCoordinator.mm | 6 +- .../renderer/graphics/React-graphics.podspec | 2 +- .../platform/ios/RCTPlatformColorUtils.mm | 18 +- .../platform/ios/RCTImageManager.h | 2 +- .../ios/RCTImagePrimitivesConversions.h | 2 +- .../platform/ios/RCTSyncImageManager.h | 2 +- .../platform/ios/NSTextStorage+FontScaling.h | 2 +- .../platform/ios/RCTAttributedTextUtils.h | 2 +- .../platform/ios/RCTAttributedTextUtils.mm | 14 +- .../platform/ios/RCTFontProperties.h | 2 +- .../platform/ios/RCTFontUtils.h | 2 +- .../platform/ios/RCTTextLayoutManager.h | 2 +- .../ios/RCTTextPrimitivesConversions.h | 12 +- .../reactperflogger/React-perflogger.podspec | 2 +- .../React-runtimeexecutor.podspec | 2 +- index.js | 19 +- .../ScreenshotManager.podspec | 10 +- packages/rn-tester/Podfile | 14 +- .../FBSnapshotTestCase/FBSnapshotTestCase.h | 4 +- .../FBSnapshotTestCase/FBSnapshotTestCase.m | 2 +- .../FBSnapshotTestController.h | 4 +- .../FBSnapshotTestController.m | 34 +- .../FBSnapshotTestCase/UIImage+Compare.h | 2 +- .../FBSnapshotTestCase/UIImage+Compare.m | 32 +- .../RCTTest/FBSnapshotTestCase/UIImage+Diff.h | 2 +- .../RCTTest/FBSnapshotTestCase/UIImage+Diff.m | 2 +- .../rn-tester/RCTTest/RCTSnapshotManager.m | 4 +- packages/rn-tester/RCTTest/RCTTestModule.h | 4 +- packages/rn-tester/RCTTest/RCTTestModule.mm | 4 +- packages/rn-tester/RCTTest/RCTTestRunner.m | 30 +- .../rn-tester/RCTTest/React-RCTTest.podspec | 2 +- packages/rn-tester/RNTester/AppDelegate.mm | 6 +- .../FlexibleSizeExampleView.h | 2 +- .../FlexibleSizeExampleView.m | 32 +- .../UpdatePropertiesExampleView.h | 2 +- .../UpdatePropertiesExampleView.m | 22 +- .../RCTLoggingTests.m | 20 +- .../RCTRootViewIntegrationTests.m | 2 +- .../RCTUIManagerScenarioTests.m | 28 +- .../RNTesterIntegrationTests.m | 6 +- .../RNTesterLoadAllPages.m | 2 +- .../RNTesterSnapshotTests.m | 8 +- .../RNTesterUnitTests/RCTAllocationTests.m | 2 +- .../RCTBundleURLProviderTests.m | 8 +- .../RCTComponentPropsTests.m | 16 +- .../RCTConvert_NSColorTests.m | 2 +- .../RCTConvert_UIColorTests.m | 2 +- .../RCTEventDispatcherTests.m | 2 +- .../RNTesterUnitTests/RCTFontTests.m | 28 +- .../RNTesterUnitTests/RCTImageUtilTests.m | 2 +- .../RNTesterUnitTests/RCTJSONTests.m | 4 +- .../RCTMethodArgumentTests.m | 2 +- .../RNTesterUnitTests/RCTModuleMethodTests.mm | 2 +- .../RCTNativeAnimatedNodesManagerTests.m | 4 +- .../RNTesterUnitTests/RCTUIManagerTests.m | 26 +- packages/rn-tester/js/RNTesterApp.ios.js | 12 +- packages/rn-tester/js/RNTesterApp.macos.js | 2 +- .../js/components/ListExampleShared.js | 16 +- .../rn-tester/js/components/RNTesterBlock.js | 6 +- .../js/components/RNTesterModuleContainer.js | 2 +- .../js/components/RNTesterModuleList.js | 14 +- .../Accessibility/AccessibilityExample.js | 10 +- .../AccessibilityShowMenu.js | 2 +- .../js/examples/Alert/AlertIOSExample.js | 10 +- .../examples/AnimatedGratuitousApp/AnExSet.js | 4 +- .../js/examples/Border/BorderExample.js | 2 +- .../DarkModeExample/DarkModeExample.js | 2 +- .../js/examples/FlatList/FlatList-basic.js | 24 +- .../FocusEventsExample/FocusEventsExample.js | 2 +- .../js/examples/FocusOnMount/FocusOnMount.js | 3 +- .../js/examples/FocusRing/FocusRingExample.js | 2 +- .../js/examples/Image/ImageExample.js | 6 +- .../KeyViewLoopExample/KeyViewLoopExample.js | 2 +- .../KeyboardEventsExample.js | 2 +- .../js/examples/Layout/LayoutEventsExample.js | 4 +- .../PlatformColor/PlatformColorExample.js | 28 +- .../js/examples/Pressable/PressableExample.js | 4 +- .../examples/ScrollView/ScrollViewExample.js | 4 +- .../ScrollViewIndicatorInsetsExample.macos.js | 4 +- .../js/examples/Snapshot/SnapshotExample.js | 2 +- .../js/examples/Text/TextExample.ios.js | 12 +- .../TextInput/TextInputExample.ios.js | 18 +- .../TextInput/TextInputSharedExamples.js | 6 +- .../js/examples/Touchable/TouchableExample.js | 8 +- .../TurboModule/SampleTurboModuleExample.js | 2 +- packages/rn-tester/js/types/RNTesterTypes.js | 6 +- .../rn-tester/js/utils/RNTesterList.ios.js | 48 ++- .../rn-tester/js/utils/RNTesterList.macos.js | 2 +- scripts/generate-artifacts.js | 24 +- scripts/react_native_pods.rb | 4 +- scripts/run-ci-e2e-tests.js | 4 +- scripts/set-rn-version.js | 24 +- template/_flowconfig | 2 +- third-party-podspecs/DoubleConversion.podspec | 2 +- third-party-podspecs/RCT-Folly.podspec | 2 +- third-party-podspecs/boost.podspec | 2 +- third-party-podspecs/glog.podspec | 2 +- 541 files changed, 3587 insertions(+), 3624 deletions(-) diff --git a/.circleci/Dockerfiles/Dockerfile.android b/.circleci/Dockerfiles/Dockerfile.android index 5bdb56447956d1..b3a0434dd84460 100644 --- a/.circleci/Dockerfiles/Dockerfile.android +++ b/.circleci/Dockerfiles/Dockerfile.android @@ -21,7 +21,7 @@ # Patch it to use mcr for the base ubuntu image, build the community image locally # and then build this customized step on top of it. # -# Disabeling this is okay because per (macOS GH#774) this test, which is redundant to Azure Devops test, +# Disabling this is okay because per (Github#774) this test, which is redundant to Azure Devops test, # failsin the fork because of Microsoft's V8 upgrade to Android # #FROM reactnativecommunity/react-native-android:5.2 diff --git a/.circleci/config.yml b/.circleci/config.yml index 40570f6531129a..688732101c359e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -329,7 +329,7 @@ jobs: - run: name: "Run Tests: JavaScript Tests" command: node ./scripts/run-ci-javascript-tests.js --maxWorkers 2 - # TODO(macOS GH#949): Disable this failing test + # [macOS] Github#949 Disable this failing test # - run_e2e: # platform: js @@ -904,12 +904,12 @@ workflows: run_disabled_tests: false filters: branches: - # TODO(macOS GH#774): disable this test which is redundant to Azure Devops test and it requires a CCI plan with resource-class:large. + # [macOS] disable this test which is redundant to Azure Devops test and it requires a CCI plan with resource-class:large. ignore: /.*/ - test_android_template: filters: branches: - # TODO(macOS GH#774): disable this test which is redundant to Azure Devops test and it requires a CCI plan with resource-class:large. + # [macOS] disable this test which is redundant to Azure Devops test and it requires a CCI plan with resource-class:large. ignore: /.*/ - test_ios_template: requires: @@ -941,7 +941,7 @@ workflows: # use_hermes: true # use_frameworks: true # run_unit_tests: true - # TODO(macOS GH#949): Disable this failing test + # [macOS] Github#949 Disable this failing test # - test_js: # name: test_js_prev_lts # executor: nodeprevlts @@ -951,15 +951,15 @@ workflows: - test_docker: filters: branches: - # TODO(macOS GH#774): disable this test which is redundant to Azure Devops test and in the fork it fails because of Microsoft's V8 upgrade to Android + # [macOS] disable this test which is redundant to Azure Devops test and in the fork it fails because of Microsoft's V8 upgrade to Android ignore: /.*/ - test_windows: filters: branches: - # [TODO(macOS GH#774): disable this test which requires a CCI plan. + # [macOS disable this test which requires a CCI plan. # ignore: gh-pages ignore: /.*/ - # ]TODO(macOS GH#774) + # macOS] run_disabled_tests: false # This workflow should only be triggered by release script @@ -1009,11 +1009,11 @@ workflows: # Gather coverage - js_coverage: - # [TODO(macOS GH#774): disable this test, it fails in the fork due to not being set up for coveralls + # [macOS disable this test, it fails in the fork due to not being set up for coveralls filters: branches: ignore: /.*/ - # ]TODO(macOS GH#774) + # [macOS] nightly: unless: << pipeline.parameters.run_package_release_workflow_only >> triggers: @@ -1021,11 +1021,11 @@ workflows: cron: "0 20 * * *" filters: branches: - # [TODO(macOS GH#774): disable this release. We never want to release anything from this fork via CCI. + # [macOS disable this release. We never want to release anything from this fork via CCI. ignore: /.*/ # only: # - main - # ]TODO(macOS GH#774) + # macOS] jobs: - nightly_job diff --git a/.flowconfig b/.flowconfig index 65d5294c0fb6b1..ff5a7e1fcfc793 100644 --- a/.flowconfig +++ b/.flowconfig @@ -1,7 +1,7 @@ [ignore] ; We fork some components by platform .*/*[.]android.js -; TODO(macOS GH#774): +; [macOS] .*/*[.]macos.js ; Ignore templates for 'react-native init' @@ -13,7 +13,7 @@ ; Ignore "BUCK" generated dirs /\.buckd/ -; TODO(macOS GH#774): Ignore metro.config.js +; [macOS Ignore metro.config.js /metro.config.js ; Flow doesn't support platforms diff --git a/.flowconfig.android b/.flowconfig.android index 73d3d88b70ecc2..25f04d616c9308 100644 --- a/.flowconfig.android +++ b/.flowconfig.android @@ -1,7 +1,7 @@ [ignore] ; We fork some components by platform .*/*[.]ios.js -; TODO(macOS GH#774): +; [macOS] .*/*[.]macos.js ; Ignore templates for 'react-native init' @@ -13,7 +13,7 @@ ; Ignore "BUCK" generated dirs /\.buckd/ -; TODO(macOS GH#774): Ignore metro.config.js +; [macOS Ignore metro.config.js /metro.config.js ; Flow doesn't support platforms @@ -45,7 +45,7 @@ module.file_ext=.js module.file_ext=.json module.file_ext=.android.js -# TODO(macOS GH#774): +# [macOS] module.system.haste.name_reducers='^\(.*\)\.macos$' -> '\1' munge_underscores=true diff --git a/.flowconfig.macos b/.flowconfig.macos index 917cde36317d95..bb1300f5fb9de3 100644 --- a/.flowconfig.macos +++ b/.flowconfig.macos @@ -1,5 +1,5 @@ [ignore] -; TODO(macOS GH#774) +; [macOS] ; We fork some components by platform .*/*[.]ios.js .*/*[.]android.js @@ -13,7 +13,7 @@ ; Ignore "BUCK" generated dirs /\.buckd/ -; TODO(macOS GH#774): Ignore metro.config.js +; [macOS Ignore metro.config.js /metro.config.js ; Flow doesn't support platforms diff --git a/.github/workflows/test-docker-android.yml b/.github/workflows/test-docker-android.yml index f1f18281326474..8f973823054bf4 100644 --- a/.github/workflows/test-docker-android.yml +++ b/.github/workflows/test-docker-android.yml @@ -1,4 +1,4 @@ -# TODO(macOS GH#774) - disable this test +# [macOS] disable this test # name: Test Docker Android Image # # This workflow is triggered on commits to main and pull requests. diff --git a/IntegrationTests/LayoutEventsTest.js b/IntegrationTests/LayoutEventsTest.js index 6ab053d743c413..42a8e0f2b5029d 100644 --- a/IntegrationTests/LayoutEventsTest.js +++ b/IntegrationTests/LayoutEventsTest.js @@ -13,7 +13,7 @@ const React = require('react'); const ReactNative = require('react-native'); const {Image, LayoutAnimation, StyleSheet, Text, View} = ReactNative; -const {Platform} = ReactNative; // TODO(macOS GH#774) +const {Platform} = ReactNative; // [macOS] const {TestModule} = ReactNative.NativeModules; import type {ViewStyleProp} from 'react-native/Libraries/StyleSheet/StyleSheet'; @@ -54,8 +54,8 @@ class LayoutEventsTest extends React.Component { animateViewLayout() { debug('animateViewLayout invoked'); LayoutAnimation.configureNext( - Platform.OS === 'macos' // [TODO(macOS GH#774) - ? LayoutAnimation.Presets.easeInEaseOut // ]TODO(macOS GH#774) + Platform.OS === 'macos' // [macOS + ? LayoutAnimation.Presets.easeInEaseOut // macOS] : LayoutAnimation.Presets.spring, () => { debug('animateViewLayout done'); diff --git a/Libraries/ActionSheetIOS/React-RCTActionSheet.podspec b/Libraries/ActionSheetIOS/React-RCTActionSheet.podspec index ac779874423b94..53caeb76297ea0 100644 --- a/Libraries/ActionSheetIOS/React-RCTActionSheet.podspec +++ b/Libraries/ActionSheetIOS/React-RCTActionSheet.podspec @@ -24,7 +24,7 @@ Pod::Spec.new do |s| s.documentation_url = "https://reactnative.dev/docs/actionsheetios" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "11.0", :osx => "10.15" } # TODO(macOS GH#214) + s.platforms = { :ios => "11.0", :osx => "10.15" } # [macOS] s.source = source s.source_files = "*.{m}" s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs" diff --git a/Libraries/Alert/Alert.js b/Libraries/Alert/Alert.js index ab62486bc7666a..5c55623168c0ee 100644 --- a/Libraries/Alert/Alert.js +++ b/Libraries/Alert/Alert.js @@ -24,21 +24,21 @@ export type Buttons = Array<{ style?: AlertButtonStyle, ... }>; -// [TODO(macOS GH#774) +// [macOS export type DefaultInputsArray = Array<{ default?: string, placeholder?: string, style?: AlertButtonStyle, }>; -// ]TODO(macOS GH#774) +// macOS] type Options = { cancelable?: ?boolean, onDismiss?: ?() => void, - // [TODO(macOS GH#774) + // [macOS modal?: ?boolean, critical?: ?boolean, - // ]TODO(macOS GH#774) + // macOS] ... }; @@ -56,7 +56,7 @@ class Alert { ): void { if (Platform.OS === 'ios') { Alert.prompt(title, message, buttons, 'default'); - // [TODO(macOS ISS#2323203) + // [macOS } else if (Platform.OS === 'macos') { Alert.promptMacOS( title, @@ -67,7 +67,7 @@ class Alert { options?.modal, options?.critical, ); - // ]TODO(macOS ISS#2323203) + // macOS] } else if (Platform.OS === 'android') { const NativeDialogManagerAndroid = require('../NativeModules/specs/NativeDialogManagerAndroid').default; @@ -170,15 +170,15 @@ class Alert { cb && cb(value); }, ); - // [TODO(macOS GH#774) + // [macOS } else if (Platform.OS === 'macos') { const defaultInputs = [{default: defaultValue}]; Alert.promptMacOS(title, message, callbackOrButtons, type, defaultInputs); } - // ]TODO(macOS GH#774) + // macOS] } - // [TODO(macOS GH#774) + // [macOS /** * Create and display a prompt to enter some text. * @static @@ -266,7 +266,7 @@ class Alert { }, ); } - // ]TODO(macOS GH#774) + // macOS] } module.exports = Alert; diff --git a/Libraries/Alert/NativeAlertManager.js b/Libraries/Alert/NativeAlertManager.js index 943f95410405d0..0438af72442c75 100644 --- a/Libraries/Alert/NativeAlertManager.js +++ b/Libraries/Alert/NativeAlertManager.js @@ -20,11 +20,11 @@ export type Args = {| cancelButtonKey?: string, destructiveButtonKey?: string, keyboardType?: string, - // [TODO(macOS GH#774) + // [macOS defaultInputs?: Array, modal?: ?boolean, critical?: ?boolean, - // ]TODO(macOS GH#774) + // macOS] |}; export interface Spec extends TurboModule { diff --git a/Libraries/Alert/RCTAlertManager.macos.js b/Libraries/Alert/RCTAlertManager.macos.js index 4c862a14647b98..81c3416dcf36b1 100644 --- a/Libraries/Alert/RCTAlertManager.macos.js +++ b/Libraries/Alert/RCTAlertManager.macos.js @@ -8,7 +8,7 @@ * @flow strict-local */ -// TODO(macOS GH#774) +// [macOS] /* $FlowFixMe allow macOS to share iOS file */ const alertWithArgs = require('./RCTAlertManager.ios'); diff --git a/Libraries/Animated/AnimatedMock.js b/Libraries/Animated/AnimatedMock.js index 288cfaf009ac06..b4f0608b4cfe77 100644 --- a/Libraries/Animated/AnimatedMock.js +++ b/Libraries/Animated/AnimatedMock.js @@ -98,11 +98,11 @@ const spring = function ( return { ...emptyAnimation, start: mockAnimationStart((callback?: ?EndCallback): void => { - // [TODO(macOS GH#774) - setValue can't handle AnimatedNodes + // [macOS - setValue can't handle AnimatedNodes if (config.toValue instanceof AnimatedNode) { anyValue.setValue(config.toValue.__getValue()); } else { - // ]TODO(macOS GH#774) + // [macOS] anyValue.setValue(config.toValue); } callback?.({finished: true}); diff --git a/Libraries/Animated/NativeAnimatedHelper.js b/Libraries/Animated/NativeAnimatedHelper.js index 367a166d9ea158..a8671013cbfda4 100644 --- a/Libraries/Animated/NativeAnimatedHelper.js +++ b/Libraries/Animated/NativeAnimatedHelper.js @@ -403,7 +403,7 @@ module.exports = { nativeEventEmitter = new NativeEventEmitter( // T88715063: NativeEventEmitter only used this parameter on iOS. Now it uses it on all platforms, so this code was modified automatically to preserve its behavior // If you want to use the native module on other platforms, please remove this condition and test its behavior - Platform.OS !== 'ios' && Platform.OS !== 'macos' // TODO(macOS GH#774): Also use this parameter on macOS + Platform.OS !== 'ios' && Platform.OS !== 'macos' // [macOS] Also use this parameter on macOS ? null : NativeAnimatedModule, ); diff --git a/Libraries/AppState/AppState.js b/Libraries/AppState/AppState.js index 0d8260282f857e..05143400926545 100644 --- a/Libraries/AppState/AppState.js +++ b/Libraries/AppState/AppState.js @@ -51,7 +51,7 @@ class AppState { new NativeEventEmitter( // T88715063: NativeEventEmitter only used this parameter on iOS. Now it uses it on all platforms, so this code was modified automatically to preserve its behavior // If you want to use the native module on other platforms, please remove this condition and test its behavior - Platform.OS !== 'ios' && Platform.OS !== 'macos' // TODO(macOS GH#774): Also use this parameter on macOS + Platform.OS !== 'ios' && Platform.OS !== 'macos' // [macOS] Also use this parameter on macOS ? null : NativeAppState, ); diff --git a/Libraries/Blob/React-RCTBlob.podspec b/Libraries/Blob/React-RCTBlob.podspec index c11bc0a0a64e9f..d05e7736c569a1 100644 --- a/Libraries/Blob/React-RCTBlob.podspec +++ b/Libraries/Blob/React-RCTBlob.podspec @@ -26,7 +26,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "11.0", :osx => "10.15" } # TODO(macOS GH#214) + s.platforms = { :ios => "11.0", :osx => "10.15" } # [macOS] s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness' s.source = source s.source_files = "*.{h,m,mm}" diff --git a/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js b/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js index 4b11c9547e59e2..db3f6828f3635e 100644 --- a/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +++ b/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js @@ -36,7 +36,7 @@ type AccessibilityEventDefinitionsIOS = { type AccessibilityEventDefinitions = { ...AccessibilityEventDefinitionsAndroid, ...AccessibilityEventDefinitionsIOS, - highContrastChanged: [boolean], // TODO(macOS GH#774) - highContrastChanged is used on macOS + highContrastChanged: [boolean], // [macOS] highContrastChanged is used on macOS change: [boolean], // screenReaderChanged reduceMotionChanged: [boolean], screenReaderChanged: [boolean], @@ -60,7 +60,7 @@ const EventNames: Map< ['boldTextChanged', 'boldTextChanged'], ['change', 'screenReaderChanged'], ['grayscaleChanged', 'grayscaleChanged'], - ['highContrastChanged', 'highContrastChanged'], // TODO(macOS GH#774) + ['highContrastChanged', 'highContrastChanged'], // [macOS] ['invertColorsChanged', 'invertColorsChanged'], ['reduceMotionChanged', 'reduceMotionChanged'], ['reduceTransparencyChanged', 'reduceTransparencyChanged'], @@ -86,7 +86,7 @@ const AccessibilityInfo = { * See https://reactnative.dev/docs/accessibilityinfo#isBoldTextEnabled */ isBoldTextEnabled(): Promise { - // [TODO(macOS GH#774) - rework logic to return Promise.resolve(false) on macOS + // [macOS rework logic to return Promise.resolve(false) on macOS if (Platform.OS === 'ios') { return new Promise((resolve, reject) => { if (NativeAccessibilityManagerApple != null) { @@ -101,7 +101,7 @@ const AccessibilityInfo = { } else { return Promise.resolve(false); } - // ]TODO(macOS GH#774) + // macOS] }, /** @@ -113,7 +113,7 @@ const AccessibilityInfo = { * See https://reactnative.dev/docs/accessibilityinfo#isGrayscaleEnabled */ isGrayscaleEnabled(): Promise { - // [TODO(macOS GH#774) - rework logic to return Promise.resolve(false) on macOS + // [macOS rework logic to return Promise.resolve(false) on macOS if (Platform.OS === 'ios') { return new Promise((resolve, reject) => { if (NativeAccessibilityManagerApple != null) { @@ -128,13 +128,13 @@ const AccessibilityInfo = { } else { return Promise.resolve(false); } - // ]TODO(macOS GH#774) + // macOS] }, /** * macOS only */ - // [TODO(macOS GH#774) + // [macOS isHighContrastEnabled: function (): Promise { if (Platform.OS === 'macos') { return new Promise((resolve, reject) => { @@ -151,7 +151,7 @@ const AccessibilityInfo = { return Promise.resolve(false); } }, - // ]TODO(macOS GH#774) + // macOS] /** * Query whether inverted colors are currently enabled. @@ -162,7 +162,7 @@ const AccessibilityInfo = { * See https://reactnative.dev/docs/accessibilityinfo#isInvertColorsEnabled */ isInvertColorsEnabled(): Promise { - // [TODO(macOS GH#774) - rework logic to return Promise.resolve(false) on macOS + // [macOS rework logic to return Promise.resolve(false) on macOS if (Platform.OS === 'ios') { return new Promise((resolve, reject) => { if (NativeAccessibilityManagerApple != null) { @@ -177,7 +177,7 @@ const AccessibilityInfo = { } else { return Promise.resolve(false); } - // ]TODO(macOS GH#774) + // macOS] }, /** @@ -218,7 +218,7 @@ const AccessibilityInfo = { * See https://reactnative.dev/docs/accessibilityinfo#isReduceTransparencyEnabled */ isReduceTransparencyEnabled(): Promise { - // [TODO(macOS GH#774) - rework logic to return Promise.resolve(false) on macOS + // [macOS rework logic to return Promise.resolve(false) on macOS if (Platform.OS === 'ios') { return new Promise((resolve, reject) => { if (NativeAccessibilityManagerApple != null) { @@ -233,7 +233,7 @@ const AccessibilityInfo = { } else { return Promise.resolve(false); } - // ]TODO(macOS GH#774) + // macOS] }, /** @@ -386,7 +386,7 @@ const AccessibilityInfo = { if (Platform.OS === 'android') { NativeAccessibilityInfoAndroid?.announceForAccessibility(announcement); } else { - // [TODO(GH#774) NativeAccessibilityManagerIOS -> NativeAccessibilityManagerApple + // [macOS NativeAccessibilityManagerIOS -> NativeAccessibilityManagerApple if ( NativeAccessibilityManagerApple?.announceForAccessibilityWithOptions ) { @@ -397,7 +397,7 @@ const AccessibilityInfo = { } else { NativeAccessibilityManagerApple?.announceForAccessibility(announcement); } - // ]TODO(macOS GH#774) + // macOS] } }, diff --git a/Libraries/Components/AccessibilityInfo/NativeAccessibilityManager.js b/Libraries/Components/AccessibilityInfo/NativeAccessibilityManager.js index 1e36c0dff78040..5bb2e5d8a11d24 100644 --- a/Libraries/Components/AccessibilityInfo/NativeAccessibilityManager.js +++ b/Libraries/Components/AccessibilityInfo/NativeAccessibilityManager.js @@ -20,12 +20,12 @@ export interface Spec extends TurboModule { onSuccess: (isGrayscaleEnabled: boolean) => void, onError: (error: Object) => void, ) => void; - // [TODO(macOS GH#774) + // [macOS +getCurrentHighContrastState: ( onSuccess: (isHighContrastEnabled: boolean) => void, onError: (error: Object) => void, ) => void; - // ]TODO(macOS GH#774) + // macOS] +getCurrentInvertColorsState: ( onSuccess: (isInvertColorsEnabled: boolean) => void, onError: (error: Object) => void, diff --git a/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.macos.js b/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.macos.js index 831db39d1336c1..cdeb829bbb2113 100644 --- a/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.macos.js +++ b/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.macos.js @@ -8,7 +8,7 @@ * @flow strict-local */ -// TODO(macOS GH#774) +// [macOS] /* $FlowFixMe allow macOS to share iOS file */ const legacySendAccessibilityEvent = require('./legacySendAccessibilityEvent.ios'); diff --git a/Libraries/Components/Button.js b/Libraries/Components/Button.js index 2669811fc53001..fbfca927ed6e08 100644 --- a/Libraries/Components/Button.js +++ b/Libraries/Components/Button.js @@ -19,8 +19,8 @@ import TouchableNativeFeedback from './Touchable/TouchableNativeFeedback'; import TouchableOpacity from './Touchable/TouchableOpacity'; import View from './View/View'; import invariant from 'invariant'; -import type {KeyEvent} from '../Types/CoreEventTypes'; // TODO(OSS Candidate ISS#2710739) -import type {FocusEvent, BlurEvent} from './TextInput/TextInput'; // TODO(OSS Candidate ISS#2710739) +import type {KeyEvent} from '../Types/CoreEventTypes'; // [macOS] +import type {FocusEvent, BlurEvent} from './TextInput/TextInput'; // [macOS] import type { AccessibilityState, @@ -129,13 +129,13 @@ type ButtonProps = $ReadOnly<{| */ accessibilityLabel?: ?string, - // TODO(OSS Candidate ISS#2710739) + // [macOS] /** * Custom accessibility role -- otherwise we use button */ accessibilityRole?: ?AccessibilityRole, - // TODO(OSS Candidate ISS#2710739) + // [macOS] /** * Accessibility action handlers */ @@ -153,7 +153,7 @@ type ButtonProps = $ReadOnly<{| */ testID?: ?string, - // [TODO(OSS Candidate ISS#2710739) + // [macOS /** * Handler to be called when the button receives key focus */ @@ -190,7 +190,7 @@ type ButtonProps = $ReadOnly<{| * Specifies the Tooltip for the view */ tooltip?: string, - // ]TODO(OSS Candidate ISS#2710739) + // macOS] /** * Accessibility props. @@ -328,26 +328,23 @@ class Button extends React.Component { nextFocusRight, nextFocusUp, testID, - onFocus, // TODO(OSS Candidate ISS#2710739) - onBlur, // TODO(OSS Candidate ISS#2710739) - onKeyDown, // TODO(OSS Candidate ISS#2710739) - onKeyUp, // TODO(OSS Candidate ISS#2710739) - validKeysDown, // TODO(OSS Candidate ISS#2710739) - validKeysUp, // TODO(OSS Candidate ISS#2710739) + onFocus, // [macOS + onBlur, + onKeyDown, + onKeyUp, + validKeysDown, + validKeysUp, // macOS] tooltip, accessible, accessibilityActions, accessibilityHint, - accessibilityRole, // TODO(OSS Candidate ISS#2710739) + accessibilityRole, // [macOS] onAccessibilityAction, } = this.props; const buttonStyles = [styles.button]; const textStyles = [styles.text]; if (color) { - if ( - Platform.OS === 'ios' || - Platform.OS === 'macos' /* TODO(macOS GH#774) */ - ) { + if (Platform.OS === 'ios' || Platform.OS === 'macos' /* [macOS] */) { textStyles.push({color: color}); } else { buttonStyles.push({backgroundColor: color}); @@ -385,7 +382,7 @@ class Button extends React.Component { onAccessibilityAction={onAccessibilityAction} accessibilityLabel={accessibilityLabel} accessibilityHint={accessibilityHint} - accessibilityRole={accessibilityRole || 'button'} // TODO(OSS Candidate ISS#2710739) + accessibilityRole={accessibilityRole || 'button'} // [macOS] accessibilityState={accessibilityState} hasTVPreferredFocus={hasTVPreferredFocus} nextFocusDown={nextFocusDown} @@ -396,8 +393,8 @@ class Button extends React.Component { testID={testID} disabled={disabled} onPress={onPress} - onFocus={onFocus} // TODO(OSS Candidate ISS#2710739) - onBlur={onBlur} // TODO(OSS Candidate ISS#2710739) + onFocus={onFocus} // [macOS] + onBlur={onBlur} // [macOS] onKeyDown={onKeyDown} onKeyUp={onKeyUp} validKeysDown={validKeysDown} @@ -423,7 +420,7 @@ const styles = StyleSheet.create({ backgroundColor: '#2196F3', borderRadius: 2, }, - macos: {}, // TODO(macOS GH#774) + macos: {}, // [macOS] }), text: { textAlign: 'center', @@ -439,10 +436,10 @@ const styles = StyleSheet.create({ fontWeight: '500', }, macos: { - // [TODO(macOS GH#774) + // [macOS color: '#007AFF', fontSize: 18, - }, // ]TODO(macOS GH#774) + }, // macOS] }), }, buttonDisabled: Platform.select({ @@ -451,16 +448,16 @@ const styles = StyleSheet.create({ elevation: 0, backgroundColor: '#dfdfdf', }, - macos: {}, // TODO(macOS GH#774) + macos: {}, // [macOS] }), textDisabled: Platform.select({ ios: { color: '#cdcdcd', }, macos: { - // [TODO(macOS GH#774) + // [macOS color: '#cdcdcd', - }, // ]TODO(macOS GH#774) + }, // macOS] android: { color: '#a1a1a1', }, diff --git a/Libraries/Components/DatePicker/DatePickerIOS.macos.js b/Libraries/Components/DatePicker/DatePickerIOS.macos.js index f1e51cc261c5f2..54fd1e7843dabc 100644 --- a/Libraries/Components/DatePicker/DatePickerIOS.macos.js +++ b/Libraries/Components/DatePicker/DatePickerIOS.macos.js @@ -7,7 +7,7 @@ * @format */ -// TODO(macOS GH#774) +// [macOS] 'use strict'; diff --git a/Libraries/Components/DatePickerAndroid/DatePickerAndroid.macos.js b/Libraries/Components/DatePickerAndroid/DatePickerAndroid.macos.js index de2a3d38a447c6..6aa1b6138b1212 100644 --- a/Libraries/Components/DatePickerAndroid/DatePickerAndroid.macos.js +++ b/Libraries/Components/DatePickerAndroid/DatePickerAndroid.macos.js @@ -8,7 +8,7 @@ * @flow strict-local */ -// TODO(macOS GH#774) +// [macOS] /* $FlowFixMe allow macOS to share iOS file */ const DatePickerAndroid = require('./DatePickerAndroid.ios'); diff --git a/Libraries/Components/DatePickerMacOS/DatePickerMacOS.android.js b/Libraries/Components/DatePickerMacOS/DatePickerMacOS.android.js index 2ac42b2aa056ef..c4e7453718afca 100644 --- a/Libraries/Components/DatePickerMacOS/DatePickerMacOS.android.js +++ b/Libraries/Components/DatePickerMacOS/DatePickerMacOS.android.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -// TODO(macOS GH#774) +// [macOS] 'use strict'; diff --git a/Libraries/Components/DatePickerMacOS/DatePickerMacOS.ios.js b/Libraries/Components/DatePickerMacOS/DatePickerMacOS.ios.js index 2ac42b2aa056ef..c4e7453718afca 100644 --- a/Libraries/Components/DatePickerMacOS/DatePickerMacOS.ios.js +++ b/Libraries/Components/DatePickerMacOS/DatePickerMacOS.ios.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -// TODO(macOS GH#774) +// [macOS] 'use strict'; diff --git a/Libraries/Components/DatePickerMacOS/DatePickerMacOS.macos.js b/Libraries/Components/DatePickerMacOS/DatePickerMacOS.macos.js index 5f9a4212ac9faa..7e82a0ba2c5e41 100644 --- a/Libraries/Components/DatePickerMacOS/DatePickerMacOS.macos.js +++ b/Libraries/Components/DatePickerMacOS/DatePickerMacOS.macos.js @@ -8,7 +8,7 @@ * */ -// TODO(macOS GH#774) +// [macOS] 'use strict'; diff --git a/Libraries/Components/DatePickerMacOS/RCTDatePickerNativeComponentMacOS.js b/Libraries/Components/DatePickerMacOS/RCTDatePickerNativeComponentMacOS.js index 8cca8a24a76842..7f50e6703be334 100644 --- a/Libraries/Components/DatePickerMacOS/RCTDatePickerNativeComponentMacOS.js +++ b/Libraries/Components/DatePickerMacOS/RCTDatePickerNativeComponentMacOS.js @@ -8,7 +8,7 @@ * @flow */ -// TODO(macOS GH#774) +// [macOS] 'use strict'; diff --git a/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.macos.js b/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.macos.js index f1e51cc261c5f2..54fd1e7843dabc 100644 --- a/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.macos.js +++ b/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.macos.js @@ -7,7 +7,7 @@ * @format */ -// TODO(macOS GH#774) +// [macOS] 'use strict'; diff --git a/Libraries/Components/Keyboard/Keyboard.js b/Libraries/Components/Keyboard/Keyboard.js index 0ad42d8f552d7d..06451438bd31d2 100644 --- a/Libraries/Components/Keyboard/Keyboard.js +++ b/Libraries/Components/Keyboard/Keyboard.js @@ -107,7 +107,7 @@ class Keyboard { new NativeEventEmitter( // T88715063: NativeEventEmitter only used this parameter on iOS. Now it uses it on all platforms, so this code was modified automatically to preserve its behavior // If you want to use the native module on other platforms, please remove this condition and test its behavior - Platform.OS !== 'ios' && Platform.OS !== 'macos' // TODO(macOS GH#774): Also use this parameter on macOS + Platform.OS !== 'ios' && Platform.OS !== 'macos' // [macOS] Also use this parameter on macOS ? null : NativeKeyboardObserver, ); diff --git a/Libraries/Components/MaskedView/MaskedViewIOS.macos.js b/Libraries/Components/MaskedView/MaskedViewIOS.macos.js index 90907a06431498..68df6a606a07ab 100644 --- a/Libraries/Components/MaskedView/MaskedViewIOS.macos.js +++ b/Libraries/Components/MaskedView/MaskedViewIOS.macos.js @@ -8,7 +8,7 @@ * @flow */ -// TODO(macOS GH#774) +// [macOS] 'use strict'; diff --git a/Libraries/Components/Picker/PickerAndroid.macos.js b/Libraries/Components/Picker/PickerAndroid.macos.js index f1e51cc261c5f2..54fd1e7843dabc 100644 --- a/Libraries/Components/Picker/PickerAndroid.macos.js +++ b/Libraries/Components/Picker/PickerAndroid.macos.js @@ -7,7 +7,7 @@ * @format */ -// TODO(macOS GH#774) +// [macOS] 'use strict'; diff --git a/Libraries/Components/Picker/PickerIOS.macos.js b/Libraries/Components/Picker/PickerIOS.macos.js index 656b69c5e12091..daf61279184936 100644 --- a/Libraries/Components/Picker/PickerIOS.macos.js +++ b/Libraries/Components/Picker/PickerIOS.macos.js @@ -11,7 +11,7 @@ * @flow */ -// TODO(macOS GH#774) +// [macOS] /* $FlowFixMe allow macOS to share iOS file */ const PickerIOS = require('./PickerIOS.ios'); diff --git a/Libraries/Components/Pressable/Pressable.js b/Libraries/Components/Pressable/Pressable.js index 28dfa3f253e10c..3887684a6d985c 100644 --- a/Libraries/Components/Pressable/Pressable.js +++ b/Libraries/Components/Pressable/Pressable.js @@ -27,13 +27,13 @@ import type { LayoutEvent, MouseEvent, PressEvent, - // [TODO(macOS GH#774) + // [macOS FocusEvent, BlurEvent, KeyEvent, - // ]TODO(macOS GH#774) + // macOS] } from '../../Types/CoreEventTypes'; -import type {DraggedTypesType} from '../View/DraggedType'; // TODO(macOS GH#774) +import type {DraggedTypesType} from '../View/DraggedType'; // [macOS] import View from '../View/View'; type ViewStyleProp = $ElementType, 'style'>; @@ -139,7 +139,7 @@ type Props = $ReadOnly<{| */ onPressOut?: ?(event: PressEvent) => mixed, - // [TODO(macOS GH#774) + // [macOS /** * Called after the element is focused. */ @@ -171,7 +171,7 @@ type Props = $ReadOnly<{| * For arrow keys, add "ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", */ validKeysUp?: ?Array, - // ]TODO(macOS GH#774) + // macOS] /** * Either view styles or a function that receives a boolean reflecting whether @@ -204,7 +204,7 @@ type Props = $ReadOnly<{| */ unstable_pressDelay?: ?number, - // [TODO(macOS GH#774) + // [macOS acceptsFirstMouse?: ?boolean, enableFocusRing?: ?boolean, tooltip?: ?string, @@ -212,7 +212,7 @@ type Props = $ReadOnly<{| onDragLeave?: (event: MouseEvent) => void, onDrop?: (event: MouseEvent) => void, draggedTypes?: ?DraggedTypesType, - // ]TODO(macOS GH#774) + // macOS] |}>; /** @@ -221,8 +221,8 @@ type Props = $ReadOnly<{| */ function Pressable(props: Props, forwardedRef): React.Node { const { - acceptsFirstMouse, // [TODO(macOS GH#774) - enableFocusRing, // ]TODO(macOS GH#774) + acceptsFirstMouse, // [macOS] + enableFocusRing, // [macOS] accessible, android_disableSound, android_ripple, @@ -240,12 +240,12 @@ function Pressable(props: Props, forwardedRef): React.Node { onPress, onPressIn, onPressOut, - // [TODO(macOS GH#774) + // [macOS onFocus, onBlur, onKeyDown, onKeyUp, - // ]TODO(macOS GH#774) + // macOS] pressRetentionOffset, style, testOnly_pressed, @@ -268,10 +268,10 @@ function Pressable(props: Props, forwardedRef): React.Node { const restPropsWithDefaults: React.ElementConfig = { ...restProps, ...android_rippleConfig?.viewProps, - acceptsFirstMouse: acceptsFirstMouse !== false && !disabled, // [TODO(macOS GH#774) + acceptsFirstMouse: acceptsFirstMouse !== false && !disabled, // [macOS enableFocusRing: enableFocusRing !== false && !disabled, accessible: accessible !== false, - focusable: focusable !== false && !disabled, // ]TODO(macOS GH#774) + focusable: focusable !== false && !disabled, // macOS] accessibilityState, hitSlop, }; @@ -310,12 +310,12 @@ function Pressable(props: Props, forwardedRef): React.Node { onPressOut(event); } }, - // [TODO(macOS GH#774) + // [macOS onFocus, onBlur, onKeyDown, onKeyUp, - // ]TODO(macOS GH#774) + // macOS] }), [ android_disableSound, @@ -332,12 +332,12 @@ function Pressable(props: Props, forwardedRef): React.Node { onPress, onPressIn, onPressOut, - // [TODO(macOS GH#774) + // [macOS onFocus, onBlur, onKeyDown, onKeyUp, - // ]TODO(macOS GH#774) + // macOS] pressRetentionOffset, setPressed, unstable_pressDelay, diff --git a/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.macos.js b/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.macos.js index f1e51cc261c5f2..54fd1e7843dabc 100644 --- a/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.macos.js +++ b/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.macos.js @@ -7,7 +7,7 @@ * @format */ -// TODO(macOS GH#774) +// [macOS] 'use strict'; diff --git a/Libraries/Components/ProgressViewIOS/ProgressViewIOS.macos.js b/Libraries/Components/ProgressViewIOS/ProgressViewIOS.macos.js index 2e3a44558e187b..dd8d95fda422ae 100644 --- a/Libraries/Components/ProgressViewIOS/ProgressViewIOS.macos.js +++ b/Libraries/Components/ProgressViewIOS/ProgressViewIOS.macos.js @@ -8,7 +8,7 @@ * @flow */ -// TODO(macOS GH#774) +// [macOS] /* $FlowFixMe allow macOS to share iOS file */ const ProgressViewIOSWithRef = require('./ProgressViewIOS.ios'); diff --git a/Libraries/Components/SafeAreaView/SafeAreaView.js b/Libraries/Components/SafeAreaView/SafeAreaView.js index ec350b00215c73..c79f3b9b52439a 100644 --- a/Libraries/Components/SafeAreaView/SafeAreaView.js +++ b/Libraries/Components/SafeAreaView/SafeAreaView.js @@ -35,7 +35,7 @@ let exported: React.AbstractComponent< * sensor housing area on iPhone X). */ if (Platform.OS !== 'ios') { - // TODO(macOS GH#774) + // [macOS] exported = React.forwardRef>>( function SafeAreaView(props, forwardedRef) { const {emulateUnlessSupported, ...localProps} = props; diff --git a/Libraries/Components/ScrollView/ScrollView.js b/Libraries/Components/ScrollView/ScrollView.js index 844dfcbdee080f..c3cb5e1d34a827 100644 --- a/Libraries/Components/ScrollView/ScrollView.js +++ b/Libraries/Components/ScrollView/ScrollView.js @@ -376,14 +376,14 @@ type IOSProps = $ReadOnly<{| * * @platform macos */ - horizontalLineScroll?: number, // TODO(macOS GH#774) + horizontalLineScroll?: number, // [macOS] /** * Experimental: specifies how much to adjust the content view by when using * the keyboard to scroll. This value adjusts the content's vertical offset. * * @platform macos */ - verticalLineScroll?: number, // TODO(macOS GH#774) + verticalLineScroll?: number, // [macOS] |}>; type AndroidProps = $ReadOnly<{| @@ -502,7 +502,7 @@ export type Props = $ReadOnly<{| /** * Reverses the direction of scroll. Uses native inversion on macOS and scale transforms of -1 elsewhere */ - inverted?: ?boolean, // TODO(macOS GH#774) + inverted?: ?boolean, // [macOS] /** * Determines whether the keyboard gets dismissed in response to a drag. * @@ -688,7 +688,7 @@ export type Props = $ReadOnly<{| |}>; type State = {| - contentKey: number, // TODO(macOS GH#774) + contentKey: number, // [macOS] layoutHeight: ?number, |}; @@ -774,7 +774,7 @@ class ScrollView extends React.Component { _subscriptionKeyboardDidHide: ?EventSubscription = null; state: State = { - contentKey: 1, // TODO(macOS GH#774) + contentKey: 1, // [macOS] layoutHeight: null, }; @@ -1058,10 +1058,10 @@ class ScrollView extends React.Component { animated?: boolean, // deprecated, put this inside the rect argument instead ) => { invariant( - // [TODO(macOS GH#774) + // [macOS Platform.OS === 'ios' || Platform.OS === 'macos', 'zoomToRect is not implemented', - ); // TODO [(macOS GH#774) + ); // macOS] if ('animated' in rect) { this._animated = rect.animated; delete rect.animated; @@ -1191,22 +1191,22 @@ class ScrollView extends React.Component { } } - // [TODO(macOS GH#774) + // [macOS _handlePreferredScrollerStyleDidChange = (event: ScrollEvent) => { this.setState({contentKey: this.state.contentKey + 1}); - }; // ]TODO(macOS GH#774) + }; // macOS] - // [TODO(macOS GH#774) + // [macOS _handleInvertedDidChange = () => { this.setState({contentKey: this.state.contentKey + 1}); - }; // ]TODO(macOS GH#774) + }; // macOS] _handleScroll = (e: ScrollEvent) => { if (__DEV__) { if ( this.props.onScroll && this.props.scrollEventThrottle == null && - (Platform.OS === 'ios' || Platform.OS === 'macos') // TODO(macOS GH#774) + (Platform.OS === 'ios' || Platform.OS === 'macos') // [macOS] ) { console.log( 'You specified `onScroll` on a but not ' + @@ -1724,8 +1724,8 @@ class ScrollView extends React.Component { ? false : this.props.removeClippedSubviews } - key={this.state.contentKey} // TODO(macOS GH#774) - inverted={this.props.inverted} // TODO(macOS GH#774) + key={this.state.contentKey} // [macOS] + inverted={this.props.inverted} // [macOS] collapsable={false}> {children} @@ -1753,9 +1753,9 @@ class ScrollView extends React.Component { // Override the onContentSizeChange from props, since this event can // bubble up from TextInputs onContentSizeChange: null, - onInvertedDidChange: this._handleInvertedDidChange, // TODO macOS GH#774 + onInvertedDidChange: this._handleInvertedDidChange, // [macOS] onPreferredScrollerStyleDidChange: - this._handlePreferredScrollerStyleDidChange, // TODO(macOS GH#774) + this._handlePreferredScrollerStyleDidChange, // [macOS] onLayout: this._handleLayout, onMomentumScrollBegin: this._handleMomentumScrollBegin, onMomentumScrollEnd: this._handleMomentumScrollEnd, @@ -1792,11 +1792,11 @@ class ScrollView extends React.Component { this.props.pagingEnabled === true && this.props.snapToInterval == null && this.props.snapToOffsets == null, - // [TODO(macOS GH#774) + // [macOS macos: this.props.pagingEnabled === true && this.props.snapToInterval == null && - this.props.snapToOffsets == null, // ]TODO(macOS GH#774) + this.props.snapToOffsets == null, // macOS] // on Android, pagingEnabled must be set to true to have snapToInterval / snapToOffsets work android: this.props.pagingEnabled === true || diff --git a/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.macos.js b/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.macos.js index 95b84444c6efc3..a63ed14cc1a15d 100644 --- a/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.macos.js +++ b/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.macos.js @@ -8,7 +8,7 @@ * @flow */ -// TODO(macOS GH#774) +// [macOS] /* $FlowFixMe allow macOS to share iOS file */ const SegmentedControlIOSWithRef = require('./SegmentedControlIOS.ios'); diff --git a/Libraries/Components/Slider/Slider.js b/Libraries/Components/Slider/Slider.js index 77606032999051..2feda14cde63df 100644 --- a/Libraries/Components/Slider/Slider.js +++ b/Libraries/Components/Slider/Slider.js @@ -133,12 +133,12 @@ type Props = $ReadOnly<{| */ testID?: ?string, - // [ TODO(macOS GH#774) + // [macOS /** * Specifies the tooltip. */ tooltip?: ?string, - // TODO(macOS GH#774) ] + // macOS ] /** Indicates to accessibility services that UI Component is in a specific State. @@ -276,7 +276,7 @@ const SliderWithRef: React.AbstractComponent< > = React.forwardRef(Slider); let styles; -if (Platform.OS === 'ios' || Platform.OS === 'macos' /* TODO(macOS GH#774) */) { +if (Platform.OS === 'ios' || Platform.OS === 'macos' /* [macOS] */) { styles = StyleSheet.create({ slider: { height: 40, diff --git a/Libraries/Components/StatusBar/NativeStatusBarManagerAndroid.js b/Libraries/Components/StatusBar/NativeStatusBarManagerAndroid.js index b19761d2b67a77..d5cc8d1be484d1 100644 --- a/Libraries/Components/StatusBar/NativeStatusBarManagerAndroid.js +++ b/Libraries/Components/StatusBar/NativeStatusBarManagerAndroid.js @@ -16,7 +16,7 @@ export interface Spec extends TurboModule { +HEIGHT: number, +DEFAULT_BACKGROUND_COLOR: number, |}; - +setColor: (color: number, animated: boolean) => void; // TODO(macOS GH#774) + +setColor: (color: number, animated: boolean) => void; // [macOS] +setTranslucent: (translucent: boolean) => void; /** diff --git a/Libraries/Components/StatusBar/StatusBar.js b/Libraries/Components/StatusBar/StatusBar.js index 9ccd5704336118..933aaa7d9c7870 100644 --- a/Libraries/Components/StatusBar/StatusBar.js +++ b/Libraries/Components/StatusBar/StatusBar.js @@ -28,11 +28,11 @@ export type StatusBarStyle = $Keys<{ /** * Dark background, white texts and icons */ - 'light-content': ColorValue, // TODO(macOS GH#774) + 'light-content': ColorValue, // [macOS] /** * Light background, dark texts and icons */ - 'dark-content': ColorValue, // TODO(macOS GH#774) + 'dark-content': ColorValue, // [macOS] ... }>; diff --git a/Libraries/Components/TextInput/RCTTextInputViewConfig.js b/Libraries/Components/TextInput/RCTTextInputViewConfig.js index 6b57fc751eaf92..f5802d450261b9 100644 --- a/Libraries/Components/TextInput/RCTTextInputViewConfig.js +++ b/Libraries/Components/TextInput/RCTTextInputViewConfig.js @@ -142,7 +142,7 @@ const RCTTextInputViewConfig = { autoCapitalize: true, keyboardAppearance: true, passwordRules: true, - grammarCheck: true, // TODO(macOS GH#774) + grammarCheck: true, // [macOS] spellCheck: true, selectTextOnFocus: true, text: true, diff --git a/Libraries/Components/TextInput/TextInput.js b/Libraries/Components/TextInput/TextInput.js index b2253e8b5d75be..c3abb171befca5 100644 --- a/Libraries/Components/TextInput/TextInput.js +++ b/Libraries/Components/TextInput/TextInput.js @@ -48,10 +48,7 @@ if (Platform.OS === 'android') { AndroidTextInput = require('./AndroidTextInputNativeComponent').default; AndroidTextInputCommands = require('./AndroidTextInputNativeComponent').Commands; -} else if ( - Platform.OS === 'ios' || - Platform.OS === 'macos' /* TODO(macOS GH#774) */ -) { +} else if (Platform.OS === 'ios' || Platform.OS === 'macos' /* [macOS] */) { RCTSinglelineTextInputView = require('./RCTSingelineTextInputNativeComponent').default; RCTSinglelineTextInputNativeCommands = @@ -130,7 +127,7 @@ export type EditingEvent = SyntheticEvent< |}>, >; -// macOS-only // [TODO(macOS GH#774) +// [macOS macOS-only export type SettingChangeEvent = SyntheticEvent< $ReadOnly<{| enabled: boolean, @@ -155,7 +152,7 @@ export type PasteEvent = SyntheticEvent< |}, |}>, >; -// ]TODO(macOS GH#774) +// macOS] type DataDetectorTypesType = // iOS+macOS @@ -166,7 +163,7 @@ type DataDetectorTypesType = // iOS-only | 'none' | 'all' - // macOS-only // [TODO(macOS GH#774) + // [macOS macOS-only | 'ortography' | 'spelling' | 'grammar' @@ -175,7 +172,7 @@ type DataDetectorTypesType = | 'replacement' | 'correction' | 'regularExpression' - | 'transitInformation'; // ]TODO(macOS GH#774) + | 'transitInformation'; // macOS] export type KeyboardType = // Cross Platform @@ -330,7 +327,7 @@ type IOSProps = $ReadOnly<{| */ scrollEnabled?: ?boolean, - // [TODO(macOS GH#774) + // [macOS /** * If `true`, hide vertical scrollbar on the underlying multiline scrollview * The default value is `false`. @@ -343,7 +340,7 @@ type IOSProps = $ReadOnly<{| * @platform macos */ grammarCheck?: ?boolean, - // ]TODO(macOS GH#774) + // macOS] /** * If `false`, disables spell-check style (i.e. red underlines). @@ -360,7 +357,7 @@ type IOSProps = $ReadOnly<{| textContentType?: ?TextContentType, |}>; -// [TODO(macOS GH#774) +// [macOS export type SubmitKeyEvent = $ReadOnly<{| key: string, altKey?: ?boolean, @@ -403,7 +400,7 @@ type MacOSProps = $ReadOnly<{| */ submitKeyEvents?: ?$ReadOnlyArray, |}>; -// ]TODO(macOS GH#774) +// macOS] type AndroidProps = $ReadOnly<{| /** @@ -564,13 +561,13 @@ type AndroidProps = $ReadOnly<{| underlineColorAndroid?: ?ColorValue, |}>; -export type PasteType = 'fileUrl' | 'image' | 'string'; // TODO(macOS GH#774) -export type PastedTypesType = PasteType | $ReadOnlyArray; // TODO(macOS GH#774) +export type PasteType = 'fileUrl' | 'image' | 'string'; // [macOS] +export type PastedTypesType = PasteType | $ReadOnlyArray; // [macOS] export type Props = $ReadOnly<{| ...$Diff>, ...IOSProps, - ...MacOSProps, // TODO(macOS GH#774) + ...MacOSProps, // [macOS] ...AndroidProps, /** @@ -720,7 +717,7 @@ export type Props = $ReadOnly<{| */ onChangeText?: ?(text: string) => mixed, - // [TODO(macOS GH#774) + // [macOS /** * Callback that is called when the text input's autoCorrect setting changes. * This will be called with @@ -750,7 +747,7 @@ export type Props = $ReadOnly<{| * @platform macos */ onGrammarCheckChange?: ?(e: SettingChangeEvent) => mixed, - // ]TODO(macOS GH#774) + // macOS] /** * DANGER: this API is not stable and will change in the future. @@ -924,11 +921,11 @@ export type Props = $ReadOnly<{| */ style?: ?TextStyleProp, - // [ TODO(macOS GH#774) + // [macOS /* * Specifies the tooltip. */ - tooltip?: ?string, // TODO(macOS GH#774) ] + tooltip?: ?string, // macOS ] /** * The value to show for the text input. `TextInput` is a controlled @@ -1353,8 +1350,7 @@ function InternalTextInput(props: Props): React.Node { onPressIn: props.onPressIn, onPressOut: props.onPressOut, cancelable: - Platform.OS === 'ios' || - Platform.OS === 'macos' /* TODO(macOS GH#774) */ + Platform.OS === 'ios' || Platform.OS === 'macos' /* [macOS] */ ? !props.rejectResponderTermination : null, }), @@ -1409,8 +1405,8 @@ function InternalTextInput(props: Props): React.Node { onChangeSync={useOnChangeSync === true ? _onChangeSync : null} onContentSizeChange={props.onContentSizeChange} onFocus={_onFocus} - onKeyDown={props.onKeyDown} // TODO(macOS GH#774) - onKeyUp={props.onKeyUp} // TODO(macOS GH#774) + onKeyDown={props.onKeyDown} // [macOS] + onKeyUp={props.onKeyUp} // [macOS] onScroll={_onScroll} onSelectionChange={_onSelectionChange} onSelectionChangeShouldSetResponder={emptyFunctionThatReturnsTrue} diff --git a/Libraries/Components/TextInput/TextInputState.js b/Libraries/Components/TextInput/TextInputState.js index e2d6a8bb528760..faadc83179cb00 100644 --- a/Libraries/Components/TextInput/TextInputState.js +++ b/Libraries/Components/TextInput/TextInputState.js @@ -88,10 +88,7 @@ function focusTextInput(textField: ?ComponentRef) { if (currentlyFocusedInputRef !== textField && textField != null) { focusInput(textField); - if ( - Platform.OS === 'ios' || - Platform.OS === 'macos' /* TODO(macOS GH#774) */ - ) { + if (Platform.OS === 'ios' || Platform.OS === 'macos' /* [macOS] */) { // This isn't necessarily a single line text input // But commands don't actually care as long as the thing being passed in // actually has a command with that name. So this should work with single @@ -122,10 +119,7 @@ function blurTextInput(textField: ?ComponentRef) { if (currentlyFocusedInputRef === textField && textField != null) { blurInput(textField); - if ( - Platform.OS === 'ios' || - Platform.OS === 'macos' /* TODO(macOS GH#774) */ - ) { + if (Platform.OS === 'ios' || Platform.OS === 'macos' /* [macOS] */) { // This isn't necessarily a single line text input // But commands don't actually care as long as the thing being passed in // actually has a command with that name. So this should work with single diff --git a/Libraries/Components/ToastAndroid/ToastAndroid.macos.js b/Libraries/Components/ToastAndroid/ToastAndroid.macos.js index e5382f21fdec8c..1ffdcf0ed85837 100644 --- a/Libraries/Components/ToastAndroid/ToastAndroid.macos.js +++ b/Libraries/Components/ToastAndroid/ToastAndroid.macos.js @@ -8,7 +8,7 @@ * @noflow */ -// TODO(macOS GH#774) +// [macOS] const ToastAndroid = require('./ToastAndroid.ios'); module.exports = ToastAndroid; diff --git a/Libraries/Components/Touchable/TouchableBounce.js b/Libraries/Components/Touchable/TouchableBounce.js index d67cd80ff8bfd2..5fd06a8d80ea58 100644 --- a/Libraries/Components/Touchable/TouchableBounce.js +++ b/Libraries/Components/Touchable/TouchableBounce.js @@ -131,8 +131,8 @@ class TouchableBounce extends React.Component { const { onBlur, onFocus, - onMouseEnter, // [TODO(macOS/win GH#774) - onMouseLeave, // ]TODO(macOS/win GH#774) + onMouseEnter, // [macOS] + onMouseLeave, // [macOS] ...eventHandlersWithoutBlurAndFocus } = this.state.pressability.getEventHandlers(); @@ -154,7 +154,7 @@ class TouchableBounce extends React.Component { nativeID={this.props.nativeID} testID={this.props.testID} hitSlop={this.props.hitSlop} - // [TODO(macOS GH#774) + // [macOS acceptsFirstMouse={ this.props.acceptsFirstMouse !== false && !this.props.disabled } @@ -173,7 +173,7 @@ class TouchableBounce extends React.Component { onFocus={this.props.onFocus} onBlur={this.props.onBlur} draggedTypes={this.props.draggedTypes} - // ]TODO(macOS GH#774) + // macOS] ref={this.props.hostRef} {...eventHandlersWithoutBlurAndFocus}> {this.props.children} diff --git a/Libraries/Components/Touchable/TouchableHighlight.js b/Libraries/Components/Touchable/TouchableHighlight.js index 69070319d54427..e6a1ef25f9e5c6 100644 --- a/Libraries/Components/Touchable/TouchableHighlight.js +++ b/Libraries/Components/Touchable/TouchableHighlight.js @@ -283,8 +283,8 @@ class TouchableHighlight extends React.Component { const { onBlur, onFocus, - onMouseEnter, // [TODO(macOS GH#774) - onMouseLeave, // ]TODO(macOS GH#774) + onMouseEnter, // [macOS] + onMouseLeave, // [macOS] ...eventHandlersWithoutBlurAndFocus } = this.state.pressability.getEventHandlers(); @@ -324,7 +324,7 @@ class TouchableHighlight extends React.Component { nextFocusUp={this.props.nextFocusUp} nativeID={this.props.nativeID} testID={this.props.testID} - // [TODO(macOS GH#774) + // [macOS acceptsFirstMouse={ this.props.acceptsFirstMouse !== false && !this.props.disabled } @@ -343,7 +343,7 @@ class TouchableHighlight extends React.Component { onFocus={this.props.onFocus} onBlur={this.props.onBlur} draggedTypes={this.props.draggedTypes} - // ]TODO(macOS/win GH#774) + // macOS] ref={this.props.hostRef} {...eventHandlersWithoutBlurAndFocus}> {React.cloneElement(child, { diff --git a/Libraries/Components/Touchable/TouchableOpacity.js b/Libraries/Components/Touchable/TouchableOpacity.js index 8dd118e6c8791e..f9cf6f1cf367da 100644 --- a/Libraries/Components/Touchable/TouchableOpacity.js +++ b/Libraries/Components/Touchable/TouchableOpacity.js @@ -38,7 +38,7 @@ type Props = $ReadOnly<{| hostRef?: ?React.Ref, - // [ TODO(macOS GH#774) + // [macOS /* * Array of keys to receive key down events for * For arrow keys, add "ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", @@ -50,7 +50,7 @@ type Props = $ReadOnly<{| * For arrow keys, add "ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", */ validKeysUp?: ?Array, - // TODO(macOS GH#774) ] + // macOS] |}>; type State = $ReadOnly<{| @@ -238,8 +238,8 @@ class TouchableOpacity extends React.Component { const { onBlur, onFocus, - onMouseEnter, // [TODO(macOS/win GH#774) - onMouseLeave, // ]TODO(macOS/win GH#774) + onMouseEnter, // [macOS] + onMouseLeave, // [macOS] ...eventHandlersWithoutBlurAndFocus } = this.state.pressability.getEventHandlers(); @@ -276,7 +276,7 @@ class TouchableOpacity extends React.Component { nextFocusUp={this.props.nextFocusUp} hasTVPreferredFocus={this.props.hasTVPreferredFocus} hitSlop={this.props.hitSlop} - // [TODO(macOS GH#774) + // [macOS acceptsFirstMouse={ this.props.acceptsFirstMouse !== false && !this.props.disabled } @@ -295,7 +295,7 @@ class TouchableOpacity extends React.Component { onFocus={this.props.onFocus} onBlur={this.props.onBlur} draggedTypes={this.props.draggedTypes} - // ]TODO(macOS/win GH#774) + // macOS] ref={this.props.hostRef} {...eventHandlersWithoutBlurAndFocus}> {this.props.children} diff --git a/Libraries/Components/Touchable/TouchableWithoutFeedback.js b/Libraries/Components/Touchable/TouchableWithoutFeedback.js index adb35b87914909..dd294b519cd1bb 100755 --- a/Libraries/Components/Touchable/TouchableWithoutFeedback.js +++ b/Libraries/Components/Touchable/TouchableWithoutFeedback.js @@ -26,12 +26,12 @@ import type { KeyEvent, LayoutEvent, PressEvent, - MouseEvent, // TODO(macOS GH#774) + MouseEvent, // [macOS] } from '../../Types/CoreEventTypes'; -// [TODO(macOS GH#774) +// [macOS import type {DraggedTypesType} from '../View/DraggedType'; -// ]TODO(macOS GH#774) +// macOS] import View from '../../Components/View/View'; import * as React from 'react'; @@ -68,7 +68,7 @@ type Props = $ReadOnly<{| onPress?: ?(event: PressEvent) => mixed, onPressIn?: ?(event: PressEvent) => mixed, onPressOut?: ?(event: PressEvent) => mixed, - // [TODO(macOS GH#774) + // [macOS acceptsFirstMouse?: ?boolean, enableFocusRing?: ?boolean, tooltip?: ?string, @@ -78,7 +78,7 @@ type Props = $ReadOnly<{| onDragLeave?: (event: MouseEvent) => void, onDrop?: (event: MouseEvent) => void, draggedTypes?: ?DraggedTypesType, - // ]TODO(macOS GH#774) + // macOS] pressRetentionOffset?: ?EdgeInsetsProp, rejectResponderTermination?: ?boolean, testID?: ?string, @@ -110,13 +110,13 @@ const PASSTHROUGH_PROPS = [ 'validKeysDown', 'validKeysUp', 'onLayout', - 'onMouseEnter', // [TODO(macOS GH#774) + 'onMouseEnter', // [macOS 'onMouseLeave', 'onDragEnter', 'onDragLeave', 'onDrop', 'draggedTypes', - 'tooltip', // ]TODO(macOS GH#774) + 'tooltip', // macOS] 'testID', ]; @@ -141,8 +141,8 @@ class TouchableWithoutFeedback extends React.Component { const { onBlur, onFocus, - onMouseEnter, // [TODO(macOS/win GH#774) - onMouseLeave, // ]TODO(macOS/win GH#774) + onMouseEnter, // [macOS] + onMouseLeave, // [macOS] ...eventHandlersWithoutBlurAndFocus } = this.state.pressability.getEventHandlers(); @@ -158,12 +158,12 @@ class TouchableWithoutFeedback extends React.Component { : this.props.accessibilityState, focusable: this.props.focusable !== false && this.props.onPress !== undefined, - // [TODO(macOS GH#774) + // [macOS acceptsFirstMouse: this.props.acceptsFirstMouse !== false && !this.props.disabled, enableFocusRing: this.props.enableFocusRing !== false && !this.props.disabled, - // ]TODO(macOS GH#774) + // macOS] }; for (const prop of PASSTHROUGH_PROPS) { if (this.props[prop] !== undefined) { diff --git a/Libraries/Components/View/DraggedType.js b/Libraries/Components/View/DraggedType.js index 13c31e8bda281f..dc02cf4cb6c02d 100644 --- a/Libraries/Components/View/DraggedType.js +++ b/Libraries/Components/View/DraggedType.js @@ -8,7 +8,7 @@ * @flow strict */ -// TODO(macOS GH#774) +// [macOS] 'use strict'; diff --git a/Libraries/Components/View/ReactNativeViewAttributes.js b/Libraries/Components/View/ReactNativeViewAttributes.js index 816284710ed9d6..7dee20801a5a3e 100644 --- a/Libraries/Components/View/ReactNativeViewAttributes.js +++ b/Libraries/Components/View/ReactNativeViewAttributes.js @@ -34,7 +34,7 @@ const UIView = { collapsable: true, needsOffscreenAlphaCompositing: true, style: ReactNativeStyleAttributes, - // [TODO(macOS GH#774) + // [macOS acceptsFirstMouse: true, enableFocusRing: true, focusable: true, @@ -49,7 +49,7 @@ const UIView = { validKeysUp: true, draggedTypes: true, nextKeyViewTag: true, - // ]TODO(macOS GH#774) + // macOS] }; const RCTView = { diff --git a/Libraries/Components/View/ReactNativeViewViewConfigMacOS.js b/Libraries/Components/View/ReactNativeViewViewConfigMacOS.js index af2b5ac0ef9bb7..267db8ca88148d 100644 --- a/Libraries/Components/View/ReactNativeViewViewConfigMacOS.js +++ b/Libraries/Components/View/ReactNativeViewViewConfigMacOS.js @@ -8,7 +8,7 @@ * @format */ -// TODO(macOS GH#774) +// [macOS] 'use strict'; diff --git a/Libraries/Components/View/View.js b/Libraries/Components/View/View.js index 44159cba9f8d54..0379a7ce912f97 100644 --- a/Libraries/Components/View/View.js +++ b/Libraries/Components/View/View.js @@ -13,7 +13,6 @@ import type {ViewProps} from './ViewPropTypes'; import ViewNativeComponent from './ViewNativeComponent'; import TextAncestor from '../../Text/TextAncestor'; import * as React from 'react'; -import invariant from 'invariant'; // TODO(macOS GH#774) export type Props = ViewProps; diff --git a/Libraries/Components/View/ViewAccessibility.js b/Libraries/Components/View/ViewAccessibility.js index 08f8082fcb58c7..89e07889bd14a0 100644 --- a/Libraries/Components/View/ViewAccessibility.js +++ b/Libraries/Components/View/ViewAccessibility.js @@ -44,7 +44,7 @@ export type AccessibilityRole = | 'timer' | 'list' | 'toolbar' - | 'menubutton'; // TODO(macOS GH#774) + | 'menubutton'; // [macOS] // the info associated with an accessibility action export type AccessibilityActionInfo = $ReadOnly<{ diff --git a/Libraries/Components/View/ViewPropTypes.js b/Libraries/Components/View/ViewPropTypes.js index 7a4b13cca891e6..bd0437f7b9a419 100644 --- a/Libraries/Components/View/ViewPropTypes.js +++ b/Libraries/Components/View/ViewPropTypes.js @@ -17,8 +17,8 @@ import type { PressEvent, Layout, LayoutEvent, - ScrollEvent, // TODO(macOS GH#774) - KeyEvent, // TODO(macOS GH#774) + ScrollEvent, // [macOS] + KeyEvent, // [macOS] } from '../../Types/CoreEventTypes'; import type {EdgeInsetsOrSizeProp} from '../../StyleSheet/EdgeInsetsPropType'; import type {Node} from 'react'; @@ -31,9 +31,9 @@ import type { AccessibilityActionInfo, } from './ViewAccessibility'; -// [TODO(macOS GH#774) +// [macOS import type {DraggedTypesType} from '../View/DraggedType'; -// ]TODO(macOS GH#774) +// macOS] export type ViewLayout = Layout; export type ViewLayoutEvent = LayoutEvent; @@ -41,8 +41,8 @@ export type ViewLayoutEvent = LayoutEvent; type BubblingEventProps = $ReadOnly<{| onBlur?: ?(event: BlurEvent) => mixed, onFocus?: ?(event: FocusEvent) => mixed, - onKeyDown?: ?(event: KeyEvent) => mixed, // TODO(macOS GH#774) - onKeyUp?: ?(event: KeyEvent) => mixed, // TODO(macOS GH#774) + onKeyDown?: ?(event: KeyEvent) => mixed, // [macOS] + onKeyUp?: ?(event: KeyEvent) => mixed, // [macOS] |}>; type DirectEventProps = $ReadOnly<{| @@ -61,7 +61,7 @@ type DirectEventProps = $ReadOnly<{| */ onAccessibilityTap?: ?() => mixed, - // [TODO(macOS GH#774) + // [macOS /** * When `accessible` is true, the system will try to invoke this function * when the user performs accessibility double click gesture. @@ -79,7 +79,7 @@ type DirectEventProps = $ReadOnly<{| * The `preferredScrollerStyle` key will be `legacy` or `overlay`. */ onPreferredScrollerStyleDidChange?: ?(event: ScrollEvent) => mixed, - // ]TODO(macOS GH#774) + // macOS] /** * Invoked on mount and layout changes with: @@ -404,7 +404,7 @@ type IOSViewProps = $ReadOnly<{| shouldRasterizeIOS?: ?boolean, |}>; -// [TODO(macOS GH#774) +// [macOS type MacOSViewProps = $ReadOnly<{| /** * Fired when a dragged element enters a valid drop target @@ -489,7 +489,7 @@ type MacOSViewProps = $ReadOnly<{| onDoubleClick?: ?(event: SyntheticEvent<{}>) => mixed, |}>; -// ]TODO(macOS GH#774) +// macOS] export type ViewProps = $ReadOnly<{| ...BubblingEventProps, @@ -499,7 +499,7 @@ export type ViewProps = $ReadOnly<{| ...TouchEventProps, ...AndroidViewProps, ...IOSViewProps, - ...MacOSViewProps, // TODO(macOS GH#774) + ...MacOSViewProps, // [macOS] children?: Node, style?: ?ViewStyleProp, diff --git a/Libraries/Core/NativeExceptionsManager.js b/Libraries/Core/NativeExceptionsManager.js index 115596af2ff81c..5f4ec0be216b4c 100644 --- a/Libraries/Core/NativeExceptionsManager.js +++ b/Libraries/Core/NativeExceptionsManager.js @@ -85,7 +85,7 @@ const ExceptionsManager = { dismissRedbox(): void { if ( Platform.OS !== 'ios' && - Platform.OS !== 'macos' /* TODO(macOS GH#774) */ && + Platform.OS !== 'macos' /* [macOS] */ && NativeModule.dismissRedbox ) { // TODO(T53311281): This is a noop on iOS now. Implement it. diff --git a/Libraries/DeprecatedPropTypes/DeprecatedImagePropType.macos.js b/Libraries/DeprecatedPropTypes/DeprecatedImagePropType.macos.js index 9773a9cee71377..bf33d6f2d432eb 100644 --- a/Libraries/DeprecatedPropTypes/DeprecatedImagePropType.macos.js +++ b/Libraries/DeprecatedPropTypes/DeprecatedImagePropType.macos.js @@ -8,7 +8,7 @@ * @flow */ -// TODO(macOS GH#774) +// [macOS] /* $FlowFixMe allow macOS to share iOS file */ const DeprecatedImagePropType = require('./DeprecatedImagePropType.ios.js'); diff --git a/Libraries/EventEmitter/NativeEventEmitter.js b/Libraries/EventEmitter/NativeEventEmitter.js index 14196ea93e896c..b1e3b66146bdd3 100644 --- a/Libraries/EventEmitter/NativeEventEmitter.js +++ b/Libraries/EventEmitter/NativeEventEmitter.js @@ -41,10 +41,7 @@ export default class NativeEventEmitter _nativeModule: ?NativeModule; constructor(nativeModule: ?NativeModule) { - if ( - Platform.OS === 'ios' || - Platform.OS === 'macos' /* TODO(macOS GH#774) */ - ) { + if (Platform.OS === 'ios' || Platform.OS === 'macos' /* [macOS] */) { invariant( nativeModule != null, '`new NativeEventEmitter()` requires a non-null argument.', diff --git a/Libraries/FBLazyVector/FBLazyVector.podspec b/Libraries/FBLazyVector/FBLazyVector.podspec index 5bb498699ee9f5..e7e6038bd3115a 100644 --- a/Libraries/FBLazyVector/FBLazyVector.podspec +++ b/Libraries/FBLazyVector/FBLazyVector.podspec @@ -23,7 +23,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "11.0", :osx => "10.15" } # TODO(macOS GH#774) + s.platforms = { :ios => "11.0", :osx => "10.15" } # [macOS] s.source = source s.source_files = "**/*.{c,h,m,mm,cpp}" s.header_dir = "FBLazyVector" diff --git a/Libraries/Image/Image.macos.js b/Libraries/Image/Image.macos.js index d71ca6285d6ac3..631b1b1792d471 100644 --- a/Libraries/Image/Image.macos.js +++ b/Libraries/Image/Image.macos.js @@ -8,7 +8,7 @@ * @format */ -// TODO(macOS GH#774) +// [macOS] /* $FlowFixMe allow macOS to share iOS file */ const Image = require('./Image.ios'); diff --git a/Libraries/Image/RCTAnimatedImage.h b/Libraries/Image/RCTAnimatedImage.h index 1c4094f2b920f0..a02a7dd85afbef 100644 --- a/Libraries/Image/RCTAnimatedImage.h +++ b/Libraries/Image/RCTAnimatedImage.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] @protocol RCTAnimatedImage @property (nonatomic, assign, readonly) NSUInteger animatedImageFrameCount; @@ -17,9 +17,9 @@ @end @interface RCTAnimatedImage : UIImage -// [TODO(macOS GH#774) +// [macOS // This is a known initializer for UIImage, but needs to be exposed publicly for macOS since // this is not a known initializer for NSImage - (nullable instancetype)initWithData:(NSData *)data scale:(CGFloat)scale; -// ]TODO(macOS GH#774) +// macOS] @end diff --git a/Libraries/Image/RCTAnimatedImage.m b/Libraries/Image/RCTAnimatedImage.m index e08b5e76c73195..24285dd16bab24 100644 --- a/Libraries/Image/RCTAnimatedImage.m +++ b/Libraries/Image/RCTAnimatedImage.m @@ -42,9 +42,7 @@ - (instancetype)initWithData:(NSData *)data scale:(CGFloat)scale _imageSource = imageSource; -#if TARGET_OS_OSX // [TODO(macOS GH#774) - self = [super initWithData:data]; -#else // ]TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] // grab image at the first index UIImage *image = [self animatedImageFrameAtIndex:0]; if (!image) { @@ -53,7 +51,9 @@ - (instancetype)initWithData:(NSData *)data scale:(CGFloat)scale self = [super initWithCGImage:image.CGImage scale:MAX(scale, 1) orientation:image.imageOrientation]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveMemoryWarning:) name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; -#endif // TODO(macOS GH#774) +#else // [macOS + self = [super initWithData:data]; +#endif // macOS] } return self; @@ -151,11 +151,11 @@ - (UIImage *)animatedImageFrameAtIndex:(NSUInteger)index if (!imageRef) { return nil; } -#if TARGET_OS_OSX // [TODO(macOS GH#774) - UIImage *image = [[NSImage alloc] initWithCGImage:imageRef size:CGSizeMake(CGImageGetWidth(imageRef), CGImageGetHeight(imageRef))]; -#else // ]TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UIImage *image = [[UIImage alloc] initWithCGImage:imageRef scale:_scale orientation:UIImageOrientationUp]; -#endif // TODO(macOS GH#774) +#else // [macOS + UIImage *image = [[NSImage alloc] initWithCGImage:imageRef size:CGSizeMake(CGImageGetWidth(imageRef), CGImageGetHeight(imageRef))]; +#endif // macOS] CGImageRelease(imageRef); return image; } @@ -175,9 +175,9 @@ - (void)dealloc CFRelease(_imageSource); _imageSource = NULL; } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; -#endif // TODO(macOS GH#774) +#endif // [macOS] } @end diff --git a/Libraries/Image/RCTDisplayWeakRefreshable.h b/Libraries/Image/RCTDisplayWeakRefreshable.h index a94fba16bfe5bc..3832ea1786174e 100644 --- a/Libraries/Image/RCTDisplayWeakRefreshable.h +++ b/Libraries/Image/RCTDisplayWeakRefreshable.h @@ -7,11 +7,11 @@ #import -#import // TODO(macOS GH#774) +#import // [macOS] @protocol RCTDisplayRefreshable -- (void)displayDidRefresh:(RCTPlatformDisplayLink *)displayLink; // TODO(macOS GH#774) +- (void)displayDidRefresh:(RCTPlatformDisplayLink *)displayLink; // [macOS] @end @@ -19,6 +19,6 @@ @property (nonatomic, weak) id refreshable; -+ (RCTPlatformDisplayLink *)displayLinkWithWeakRefreshable:(id)refreshable; // TODO(macOS GH#774) ++ (RCTPlatformDisplayLink *)displayLinkWithWeakRefreshable:(id)refreshable; // [macOS] @end diff --git a/Libraries/Image/RCTDisplayWeakRefreshable.m b/Libraries/Image/RCTDisplayWeakRefreshable.m index 3aad6e30316bef..7db4c1fbf23f42 100644 --- a/Libraries/Image/RCTDisplayWeakRefreshable.m +++ b/Libraries/Image/RCTDisplayWeakRefreshable.m @@ -9,9 +9,9 @@ @implementation RCTDisplayWeakRefreshable -+ (RCTPlatformDisplayLink *)displayLinkWithWeakRefreshable:(id)refreshable { // TODO(macOS GH#774) ++ (RCTPlatformDisplayLink *)displayLinkWithWeakRefreshable:(id)refreshable { // [macOS] RCTDisplayWeakRefreshable *target = [[RCTDisplayWeakRefreshable alloc] initWithRefreshable:refreshable]; - return [RCTPlatformDisplayLink displayLinkWithTarget:target selector:@selector(displayDidRefresh:)]; // TODO(macOS GH#774) + return [RCTPlatformDisplayLink displayLinkWithTarget:target selector:@selector(displayDidRefresh:)]; // [macOS] } - (instancetype)initWithRefreshable:(id)refreshable @@ -22,7 +22,7 @@ - (instancetype)initWithRefreshable:(id)refreshable return self; } -- (void)displayDidRefresh:(RCTPlatformDisplayLink *)displayLink { // TODO(macOS GH#774) +- (void)displayDidRefresh:(RCTPlatformDisplayLink *)displayLink { // [macOS] [_refreshable displayDidRefresh:displayLink]; } diff --git a/Libraries/Image/RCTImageBlurUtils.h b/Libraries/Image/RCTImageBlurUtils.h index 0ebe312c2a569f..3ee3e93e534e59 100644 --- a/Libraries/Image/RCTImageBlurUtils.h +++ b/Libraries/Image/RCTImageBlurUtils.h @@ -6,7 +6,7 @@ */ #import -#import // TODO(macOS GH#774) +#import // [macOS] #import diff --git a/Libraries/Image/RCTImageBlurUtils.m b/Libraries/Image/RCTImageBlurUtils.m index d058cd00eb6e8c..63275cc5fb7893 100644 --- a/Libraries/Image/RCTImageBlurUtils.m +++ b/Libraries/Image/RCTImageBlurUtils.m @@ -7,16 +7,16 @@ #import -#import // TODO(macOS GH#774) -#import // TODO(macOS GH#774) +#import // [macOS] +#import // [macOS] UIImage *RCTBlurredImageWithRadius(UIImage *inputImage, CGFloat radius) { - CGImageRef imageRef = UIImageGetCGImageRef(inputImage); // [TODO(macOS GH#774) - CGFloat imageScale = UIImageGetScale(inputImage); -#if !TARGET_OS_OSX // ]TODO(macOS GH#774) + CGImageRef imageRef = UIImageGetCGImageRef(inputImage); // [macOS] + CGFloat imageScale = UIImageGetScale(inputImage); // [macOS] +#if !TARGET_OS_OSX // [macOS] UIImageOrientation imageOrientation = inputImage.imageOrientation; -#endif // TODO(macOS GH#774) +#endif // [macOS] // Image must be nonzero size if (CGImageGetWidth(imageRef) * CGImageGetHeight(imageRef) == 0) { @@ -28,13 +28,13 @@ CGImageGetBitsPerComponent(imageRef) != 8 || !((CGImageGetBitmapInfo(imageRef) & kCGBitmapAlphaInfoMask))) { UIGraphicsBeginImageContextWithOptions(inputImage.size, NO, imageScale); -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [inputImage drawAtPoint:CGPointZero]; imageRef = UIGraphicsGetImageFromCurrentImageContext().CGImage; -#else // [TODO(macOS GH#774) +#else // [macOS [inputImage drawAtPoint:CGPointZero fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:1.0]; imageRef = (CGImageRef)CFAutorelease(CGBitmapContextCreateImage(UIGraphicsGetCurrentContext())); -#endif // ]TODO(macOS GH#774) +#endif // macOS] UIGraphicsEndImageContext(); } @@ -95,11 +95,11 @@ //create image from context imageRef = CGBitmapContextCreateImage(ctx); -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UIImage *outputImage = [UIImage imageWithCGImage:imageRef scale:imageScale orientation:imageOrientation]; -#else // [TODO(macOS GH#774) +#else // [macOS NSImage *outputImage = [[NSImage alloc] initWithCGImage:imageRef size:inputImage.size]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] CGImageRelease(imageRef); CGContextRelease(ctx); free(buffer1.data); diff --git a/Libraries/Image/RCTImageCache.h b/Libraries/Image/RCTImageCache.h index c2675b1bd7ac48..3b383db1e318c1 100644 --- a/Libraries/Image/RCTImageCache.h +++ b/Libraries/Image/RCTImageCache.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import diff --git a/Libraries/Image/RCTImageCache.m b/Libraries/Image/RCTImageCache.m index 1a82e291885e9a..40c486bb802c4b 100644 --- a/Libraries/Image/RCTImageCache.m +++ b/Libraries/Image/RCTImageCache.m @@ -41,7 +41,7 @@ - (instancetype)init _decodedImageCache.totalCostLimit = 20 * 1024 * 1024; // 20 MB _cacheStaleTimes = [NSMutableDictionary new]; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(clearCache) name:UIApplicationDidReceiveMemoryWarningNotification @@ -50,13 +50,13 @@ - (instancetype)init selector:@selector(clearCache) name:UIApplicationWillResignActiveNotification object:nil]; -#endif // TODO(macOS GH#774) +#endif // [macOS] } return self; } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)clearCache { [_decodedImageCache removeAllObjects]; @@ -64,7 +64,7 @@ - (void)clearCache [_cacheStaleTimes removeAllObjects]; } } -#endif // TODO(macOS GH#774) +#endif // [macOS] - (void)addImageToCache:(UIImage *)image forKey:(NSString *)cacheKey diff --git a/Libraries/Image/RCTImageDataDecoder.h b/Libraries/Image/RCTImageDataDecoder.h index 4fea3396cf7587..7c17cae21758c2 100644 --- a/Libraries/Image/RCTImageDataDecoder.h +++ b/Libraries/Image/RCTImageDataDecoder.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import diff --git a/Libraries/Image/RCTImageEditingManager.mm b/Libraries/Image/RCTImageEditingManager.mm index 32552921f64faf..7de3a3d934dce0 100644 --- a/Libraries/Image/RCTImageEditingManager.mm +++ b/Libraries/Image/RCTImageEditingManager.mm @@ -15,7 +15,7 @@ #import #import #import -#import // TODO(macOS GH#774) +#import // [macOS] #import "RCTImagePlugins.h" @@ -68,7 +68,7 @@ @implementation RCTImageEditingManager CGSize targetSize = rect.size; CGRect targetRect = {{-rect.origin.x, -rect.origin.y}, image.size}; CGAffineTransform transform = RCTTransformFromTargetRect(image.size, targetRect); - UIImage *croppedImage = RCTTransformImage(image, targetSize, UIImageGetScale(image), transform); // TODO(macOS GH#774) + UIImage *croppedImage = RCTTransformImage(image, targetSize, UIImageGetScale(image), transform); // [macOS] // Scale image if (cropDataCopy.displaySize()) { @@ -76,7 +76,7 @@ @implementation RCTImageEditingManager RCTResizeMode resizeMode = [RCTConvert RCTResizeMode:cropDataCopy.resizeMode() ?: @"contain"]; targetRect = RCTTargetRect(croppedImage.size, targetSize, 1, resizeMode); transform = RCTTransformFromTargetRect(croppedImage.size, targetRect); - croppedImage = RCTTransformImage(croppedImage, targetSize, UIImageGetScale(image), transform); // TODO(macOS GH#774) + croppedImage = RCTTransformImage(croppedImage, targetSize, UIImageGetScale(image), transform); // [macOS] } // Store image diff --git a/Libraries/Image/RCTImageLoader.h b/Libraries/Image/RCTImageLoader.h index 663fa41d077486..2c8815c70d1fa3 100644 --- a/Libraries/Image/RCTImageLoader.h +++ b/Libraries/Image/RCTImageLoader.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import @@ -23,7 +23,7 @@ - (instancetype)initWithRedirectDelegate:(id)redirectDelegate loadersProvider:(NSArray> * (^)(RCTModuleRegistry *))getLoaders decodersProvider:(NSArray> * (^)(RCTModuleRegistry *))getDecoders; -- (NSInteger)activeTasks; // TODO(OSS Candidate ISS#2710739) +- (NSInteger)activeTasks; // [macOS] @end /** diff --git a/Libraries/Image/RCTImageLoader.mm b/Libraries/Image/RCTImageLoader.mm index 92f13cd918c650..48df8d9a5750e4 100644 --- a/Libraries/Image/RCTImageLoader.mm +++ b/Libraries/Image/RCTImageLoader.mm @@ -14,7 +14,7 @@ #import #import #import -#import // TODO(macOS GH#774) - Expose DevSettings in release builds +#import // [macOS] Expose DevSettings in release builds #import #import #import @@ -42,18 +42,18 @@ void RCTEnableImageLoadingPerfInstrumentation(BOOL enabled) static NSInteger RCTImageBytesForImage(UIImage *image) { CGFloat imageScale = 1.0; -#if !TARGET_OS_OSX // [TODO(macOS GH#774) - imageScale = image.scale; // [TODO(macOS GH#774) // no .scale prop on NSImage -#endif // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] no .scale prop on NSImage + imageScale = image.scale; +#endif // [macOS] NSInteger singleImageBytes = image.size.width * image.size.height * imageScale * imageScale * 4; -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] return image.images ? image.images.count * singleImageBytes : singleImageBytes; -#else // [TODO(macOS GH#774) - return singleImageBytes; // [TODO(macOS GH#774) -#endif // [TODO(macOS GH#774) +#else // [macOS + return singleImageBytes; +#endif // macOS] } -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS /** * Github #1611 - We can't depend on RCTUIKit here, because this file's podspec (React-RCTImage) doesn't @@ -83,7 +83,7 @@ static NSInteger RCTImageBytesForImage(UIImage *image) NSBitmapImageFileTypeJPEG, @{NSImageCompressionFactor: @(compressionQuality)}); } -#endif // ]TODO(macOS GH#774) +#endif // macOS] static uint64_t monotonicTimeGetCurrentNanoseconds(void) { @@ -491,11 +491,11 @@ - (void)dequeueTasks }); } -// [TODO(OSS Candidate ISS#2710739) +// [macOS - (NSInteger)activeTasks { return _activeTasks; } -// ]TODO(OSS Candidate ISS#2710739) +// macOS] /** * This returns either an image, or raw image data, depending on the loading @@ -876,7 +876,7 @@ - (BOOL)shouldEnablePerfLoggingForRequestUrl:(NSURL *)url { return NO; } -- (void)trackURLImageVisibilityForRequest:(RCTImageURLLoaderRequest *)loaderRequest imageView:(RCTUIView *)imageView // TODO(macOS GH#774) +- (void)trackURLImageVisibilityForRequest:(RCTImageURLLoaderRequest *)loaderRequest imageView:(RCTUIView *)imageView // [macOS] { if (!loaderRequest || !imageView) { return; @@ -963,8 +963,8 @@ - (RCTImageLoaderCancellationBlock)decodeImageData:(NSData *)data // Decompress the image data (this may be CPU and memory intensive) UIImage *image = RCTDecodeImageWithData(data, size, scale, resizeMode); -#if !TARGET_OS_OSX && RCT_DEV // TODO(macOS GH#774) - CGSize imagePixelSize = RCTSizeInPixels(image.size, UIImageGetScale(image)); // TODO(macOS GH#774) +#if !TARGET_OS_OSX && RCT_DEV // [macOS] + CGSize imagePixelSize = RCTSizeInPixels(image.size, UIImageGetScale(image)); // [macOS] CGSize screenPixelSize = RCTSizeInPixels(RCTScreenSize(), RCTScreenScale()); if (imagePixelSize.width * imagePixelSize.height > screenPixelSize.width * screenPixelSize.height) { @@ -1053,15 +1053,15 @@ - (RCTImageLoaderCancellationBlock)getImageSizeForURLRequest:(NSURLRequest *)ima } } else { UIImage *image = imageOrData; - #if !TARGET_OS_OSX + #if !TARGET_OS_OSX // [macOS] CGFloat imageScale = image.scale; -#else +#else // [macOS // Trust -[NSImage size] on macOS since an image is a collection of representations instead of a thin wrapper around a CGImage CGFloat imageScale = 1.0; -#endif // TARGET_OS_OSX +#endif // macOS] size = (CGSize){ - image.size.width * imageScale, // TODO(macOS GH#774) - image.size.height * imageScale, // TODO(macOS GH#774) + image.size.width * imageScale, // [macOS] + image.size.height * imageScale, // [macOS] }; } callback(error, size); @@ -1159,7 +1159,7 @@ - (id)sendRequest:(NSURLRequest *)request withDelegate:(id // TODO(macOS GH#774) +#import // [macOS] #import #import diff --git a/Libraries/Image/RCTImageLoaderWithAttributionProtocol.h b/Libraries/Image/RCTImageLoaderWithAttributionProtocol.h index e5373f93e6d1e7..dd9e9aca26238d 100644 --- a/Libraries/Image/RCTImageLoaderWithAttributionProtocol.h +++ b/Libraries/Image/RCTImageLoaderWithAttributionProtocol.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import @@ -36,7 +36,7 @@ RCT_EXTERN void RCTEnableImageLoadingPerfInstrumentation(BOOL enabled); /** * Image instrumentation - start tracking the on-screen visibility of the native image view. */ -- (void)trackURLImageVisibilityForRequest:(RCTImageURLLoaderRequest *)loaderRequest imageView:(RCTUIView *)imageView; // TODO(macOS GH#774) +- (void)trackURLImageVisibilityForRequest:(RCTImageURLLoaderRequest *)loaderRequest imageView:(RCTUIView *)imageView; // [macOS] /** * Image instrumentation - notify that the request was cancelled. diff --git a/Libraries/Image/RCTImageStoreManager.h b/Libraries/Image/RCTImageStoreManager.h index 634cbaa23146ca..b39c9b85cff505 100644 --- a/Libraries/Image/RCTImageStoreManager.h +++ b/Libraries/Image/RCTImageStoreManager.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import diff --git a/Libraries/Image/RCTImageStoreManager.mm b/Libraries/Image/RCTImageStoreManager.mm index 83ba32621cfb19..dcd5aa187941f0 100644 --- a/Libraries/Image/RCTImageStoreManager.mm +++ b/Libraries/Image/RCTImageStoreManager.mm @@ -12,9 +12,9 @@ #import #import -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] #import -#endif // TODO(macOS GH#774) +#endif // [macOS] #import #import #import @@ -226,7 +226,7 @@ - (UIImage *)imageForTag:(NSString *)imageTag dispatch_sync(_methodQueue, ^{ imageData = self->_store[imageTag]; }); - return UIImageWithData(imageData); // TODO(macOS GH#774) + return UIImageWithData(imageData); // [macOS] } - (void)getImageForTag:(NSString *)imageTag withBlock:(void (^)(UIImage *image))block @@ -236,7 +236,7 @@ - (void)getImageForTag:(NSString *)imageTag withBlock:(void (^)(UIImage *image)) NSData *imageData = self->_store[imageTag]; dispatch_async(dispatch_get_main_queue(), ^{ // imageWithData: is not thread-safe, so we can't do this on methodQueue - block(UIImageWithData(imageData)); // TODO(macOS GH#774) + block(UIImageWithData(imageData)); // [macOS] }); }); } diff --git a/Libraries/Image/RCTImageURLLoader.h b/Libraries/Image/RCTImageURLLoader.h index 8662a777bb1834..1725ec033cfa1b 100644 --- a/Libraries/Image/RCTImageURLLoader.h +++ b/Libraries/Image/RCTImageURLLoader.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import diff --git a/Libraries/Image/RCTImageURLLoaderWithAttribution.h b/Libraries/Image/RCTImageURLLoaderWithAttribution.h index 22e4bfb7f4dcc3..2cd45c4e15e959 100644 --- a/Libraries/Image/RCTImageURLLoaderWithAttribution.h +++ b/Libraries/Image/RCTImageURLLoaderWithAttribution.h @@ -9,7 +9,7 @@ #import #import -#import // TODO(macOS GH#774) +#import // [macOS] // TODO (T61325135): Remove C++ checks #ifdef __cplusplus @@ -65,7 +65,7 @@ struct ImageURLLoaderAttribution { /** * Image instrumentation - start tracking the on-screen visibility of the native image view. */ -- (void)trackURLImageVisibilityForRequest:(RCTImageURLLoaderRequest *)loaderRequest imageView:(RCTUIView *)imageView; // TODO(macOS GH#774) +- (void)trackURLImageVisibilityForRequest:(RCTImageURLLoaderRequest *)loaderRequest imageView:(RCTUIView *)imageView; // [macOS] /** * Image instrumentation - notify that the request was destroyed. diff --git a/Libraries/Image/RCTImageUtils.h b/Libraries/Image/RCTImageUtils.h index 87a55fee770ff7..fddf76cf377329 100644 --- a/Libraries/Image/RCTImageUtils.h +++ b/Libraries/Image/RCTImageUtils.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import @@ -93,6 +93,6 @@ RCT_EXTERN BOOL RCTImageHasAlpha(CGImageRef image); /* * Return YES if image has an alpha component */ -RCT_EXTERN BOOL RCTUIImageHasAlpha(UIImage *image); // TODO(macOS GH#774) +RCT_EXTERN BOOL RCTUIImageHasAlpha(UIImage *image); // [macOS] NS_ASSUME_NONNULL_END diff --git a/Libraries/Image/RCTImageUtils.m b/Libraries/Image/RCTImageUtils.m index 061d98045f9942..140e9f667ecf82 100644 --- a/Libraries/Image/RCTImageUtils.m +++ b/Libraries/Image/RCTImageUtils.m @@ -10,9 +10,9 @@ #import #import -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] #import -#endif // TODO(macOS GH#774) +#endif // [macOS] #import #import @@ -35,7 +35,7 @@ static CGSize RCTCeilSize(CGSize size, CGFloat scale) }; } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] static CGImagePropertyOrientation CGImagePropertyOrientationFromUIImageOrientation(UIImageOrientation imageOrientation) { // see https://stackoverflow.com/a/6699649/496389 @@ -51,7 +51,7 @@ static CGImagePropertyOrientation CGImagePropertyOrientationFromUIImageOrientati default: return kCGImagePropertyOrientationUp; } } -#endif // TODO(macOS GH#774) +#endif // [macOS] CGRect RCTTargetRect(CGSize sourceSize, CGSize destSize, CGFloat destScale, RCTResizeMode resizeMode) @@ -284,11 +284,11 @@ BOOL RCTUpscalingRequired(CGSize sourceSize, CGFloat sourceScale, destScale = 1; } } else if (!destScale) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] destScale = RCTScreenScale(); -#else // [TODO(macOS GH#774) +#else // [macOS destScale = 1.0; // It's not possible to derive the correct scale on macOS, but it's not necessary for NSImage anyway -#endif // ]TODO(macOS GH#774) +#endif // macOS] } if (resizeMode == UIViewContentModeScaleToFill) { @@ -318,14 +318,14 @@ BOOL RCTUpscalingRequired(CGSize sourceSize, CGFloat sourceScale, } // Return image -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UIImage *image = [UIImage imageWithCGImage:imageRef scale:destScale orientation:UIImageOrientationUp]; -#else // [TODO(macOS GH#774) +#else // [macOS NSImage *image = [[NSImage alloc] initWithCGImage:imageRef size:targetSize]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] CGImageRelease(imageRef); return image; } @@ -343,18 +343,18 @@ BOOL RCTUpscalingRequired(CGSize sourceSize, CGFloat sourceScale, NSData *__nullable RCTGetImageData(UIImage *image, float quality) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] CGImageRef cgImage = image.CGImage; -#else // [TODO(macOS GH#774) +#else // [macOS CGImageRef cgImage = [image CGImageForProposedRect:NULL context:NULL hints:NULL]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] if (!cgImage) { return NULL; } NSMutableDictionary *properties = [[NSMutableDictionary alloc] initWithDictionary:@{ -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] (id)kCGImagePropertyOrientation : @(CGImagePropertyOrientationFromUIImageOrientation(image.imageOrientation)) -#endif // TODO(macOS GH#774) +#endif // [macOS] }]; CGImageDestinationRef destination; CFMutableDataRef imageData = CFDataCreateMutable(NULL, 0); @@ -389,15 +389,15 @@ BOOL RCTUpscalingRequired(CGSize sourceSize, CGFloat sourceScale, return nil; } - BOOL opaque = !RCTUIImageHasAlpha(image); // TODO(macOS GH#774) + BOOL opaque = !RCTUIImageHasAlpha(image); // [macOS] UIGraphicsBeginImageContextWithOptions(destSize, opaque, destScale); CGContextRef currentContext = UIGraphicsGetCurrentContext(); CGContextConcatCTM(currentContext, transform); -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [image drawAtPoint:CGPointZero]; -#else // [TODO(macOS GH#774) +#else // [macOS [image drawAtPoint:CGPointZero fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:1.0]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] UIImage *result = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return result; @@ -415,12 +415,12 @@ BOOL RCTImageHasAlpha(CGImageRef image) } } -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] BOOL RCTUIImageHasAlpha(UIImage *image) { return RCTImageHasAlpha(image.CGImage); } -#else +#else // [macOS BOOL RCTUIImageHasAlpha(UIImage *image) { for (NSImageRep *imageRep in image.representations) { @@ -430,4 +430,4 @@ BOOL RCTUIImageHasAlpha(UIImage *image) } return NO; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] diff --git a/Libraries/Image/RCTImageView.h b/Libraries/Image/RCTImageView.h index 2b568f5e9df26d..4e5736a54d1f39 100644 --- a/Libraries/Image/RCTImageView.h +++ b/Libraries/Image/RCTImageView.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import @@ -24,7 +24,7 @@ @property (nonatomic, assign) RCTResizeMode resizeMode; @property (nonatomic, copy) NSString *internal_analyticTag; -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS @property (nonatomic, copy) NSColor *tintColor; -#endif // ]TODO(macOS GH#774) +#endif // macOS] @end diff --git a/Libraries/Image/RCTImageView.mm b/Libraries/Image/RCTImageView.mm index 58792503bfa4d5..488272613b1eca 100644 --- a/Libraries/Image/RCTImageView.mm +++ b/Libraries/Image/RCTImageView.mm @@ -33,7 +33,7 @@ static BOOL RCTShouldReloadImageForSizeChange(CGSize currentSize, CGSize idealSi heightMultiplier > upscaleThreshold || heightMultiplier < downscaleThreshold; } -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS /** * Implements macOS equivalent behavior of UIViewContentModeScaleAspectFill. * Used for RCTResizeModeCover support. @@ -81,7 +81,7 @@ static BOOL RCTShouldReloadImageForSizeChange(CGSize currentSize, CGSize idealSi return newImage; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] /** * See RCTConvert (ImageSource). We want to send down the source as a similar @@ -128,34 +128,34 @@ @implementation RCTImageView // Whether the latest change of props requires the image to be reloaded BOOL _needsReload; - UIImage *_image; // TODO(macOS GH#774) + UIImage *_image; // [macOS] RCTUIImageViewAnimated *_imageView; -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS // Whether observing changes to the window's backing scale BOOL _subscribedToWindowBackingNotifications; -#endif // [TODO(macOS GH#774) +#endif // macOS] RCTImageURLLoaderRequest *_loaderRequest; } - (instancetype)initWithBridge:(RCTBridge *)bridge { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] if ((self = [super initWithFrame:CGRectZero])) { -#else // [TODO(macOS GH#774) +#else // [macOS if ((self = [super initWithFrame:NSZeroRect])) { -#endif // ]TODO(macOS GH#774) +#endif // macOS] _bridge = bridge; -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS self.wantsLayer = YES; -#endif +#endif // macOS] _imageView = [RCTUIImageViewAnimated new]; _imageView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; [self addSubview:_imageView]; -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; [center addObserver:self selector:@selector(clearImageIfDetached) @@ -174,20 +174,20 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge object:nil]; } #endif -#endif // ]TODO(macOS GH#774) +#endif // [macOS] } return self; } RCT_NOT_IMPLEMENTED(- (instancetype)init) -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)coder) RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(NSRect)frame) -#else +#else // [macOS RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder) RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame) -#endif // ]TODO(macOS GH#774) +#endif // macOS] - (void)updateWithImage:(UIImage *)image { @@ -197,38 +197,38 @@ - (void)updateWithImage:(UIImage *)image } // Apply rendering mode -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] if (_renderingMode != image.renderingMode) { image = [image imageWithRenderingMode:_renderingMode]; } -#endif // ]TODO(macOS GH#774) +#endif // [macOS] if (_resizeMode == RCTResizeModeRepeat) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] image = [image resizableImageWithCapInsets:_capInsets resizingMode:UIImageResizingModeTile]; -#else // [TODO(macOS GH#774) +#else // [macOS image.capInsets = _capInsets; image.resizingMode = NSImageResizingModeTile; } else if (_resizeMode == RCTResizeModeCover) { if (!NSEqualSizes(self.bounds.size, NSZeroSize)) { image = RCTFillImagePreservingAspectRatio(image, self.bounds.size, self.window.backingScaleFactor ?: 1.0); } -#endif // ]TODO(macOS GH#774) +#endif // macOS] } else if (!UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsZero, _capInsets)) { // Applying capInsets of 0 will switch the "resizingMode" of the image to "tile" which is undesired -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] image = [image resizableImageWithCapInsets:_capInsets resizingMode:UIImageResizingModeStretch]; -#else // [TODO(macOS GH#774) +#else // [macOS image.capInsets = _capInsets; image.resizingMode = NSImageResizingModeStretch; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS if ((_renderingMode == UIImageRenderingModeAlwaysTemplate) != [image isTemplate]) { [image setTemplate:(_renderingMode == UIImageRenderingModeAlwaysTemplate)]; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] // Apply trilinear filtering to smooth out mis-sized images _imageView.layer.minificationFilter = kCAFilterTrilinear; @@ -241,13 +241,13 @@ - (void)setImage:(UIImage *)image { image = image ?: _defaultImage; if (image != self.image) { - _image = image; // TODO(macOS GH#774) + _image = image; // [macOS] [self updateWithImage:image]; } } - (UIImage *)image { - return _image ?: _imageView.image; // TODO(macOS GH#774) + return _image ?: _imageView.image; // [macOS] } - (void)setBlurRadius:(CGFloat)blurRadius @@ -297,21 +297,21 @@ - (void)setResizeMode:(RCTResizeMode)resizeMode if (_resizeMode == RCTResizeModeRepeat) { // Repeat resize mode is handled by the UIImage. Use scale to fill // so the repeated image fills the UIImageView. -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] _imageView.contentMode = UIViewContentModeScaleToFill; -#else // [TODO(macOS GH#774) +#else // [macOS _imageView.imageScaling = NSImageScaleAxesIndependently; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } else { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] _imageView.contentMode = (UIViewContentMode)resizeMode; -#else // [TODO(macOS GH#774) +#else // [macOS // This relies on having previously resampled the image to a size that exceeds the image view. if (resizeMode == RCTResizeModeCover) { resizeMode = RCTResizeModeCenter; } _imageView.imageScaling = (NSImageScaling)resizeMode; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } if ([self shouldReloadImageSourceAfterResize]) { @@ -345,7 +345,7 @@ - (void)cancelAndClearImageLoad } } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)clearImageIfDetached { if (!self.window) { @@ -354,7 +354,7 @@ - (void)clearImageIfDetached _imageSource = nil; } } -#endif // TODO(macOS GH#774) +#endif // [macOS] - (BOOL)hasMultipleSources { @@ -372,11 +372,11 @@ - (RCTImageSource *)imageSourceForSize:(CGSize)size return nil; } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] const CGFloat scale = RCTScreenScale(); -#else // [TODO(macOS GH#774) +#else // [macOS const CGFloat scale = self.window != nil ? self.window.backingScaleFactor : [NSScreen mainScreen].backingScaleFactor; -#endif // ]TODO(macOS GH#774) +#endif // macOS] const CGFloat targetImagePixels = size.width * size.height * scale * scale; RCTImageSource *bestSource = nil; @@ -440,11 +440,11 @@ - (void)reloadImage }; CGSize imageSize = self.bounds.size; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] CGFloat imageScale = RCTScreenScale(); -#else // [TODO(macOS GH#774) +#else // [macOS CGFloat imageScale = self.window != nil ? self.window.backingScaleFactor : [NSScreen mainScreen].backingScaleFactor; -#endif // ]TODO(macOS GH#774) +#endif // macOS] if (!UIEdgeInsetsEqualToEdgeInsets(_capInsets, UIEdgeInsetsZero)) { // Don't resize images that use capInsets imageSize = CGSizeZero; @@ -560,11 +560,11 @@ - (void)reactSetFrame:(CGRect)frame [self reloadImage]; } else if ([self shouldReloadImageSourceAfterResize]) { CGSize imageSize = self.image.size; - CGFloat imageScale = UIImageGetScale(self.image); // [TODO(macOS GH#774) -#if !TARGET_OS_OSX // [TODO(macOS GH#774) + CGFloat imageScale = UIImageGetScale(self.image); // [macOS] +#if !TARGET_OS_OSX // [macOS] CGFloat windowScale = RCTScreenScale(); RCTResizeMode resizeMode = (RCTResizeMode)_imageView.contentMode; -#else // [TODO(macOS GH#774) +#else // [macOS CGFloat windowScale = self.window != nil ? self.window.backingScaleFactor : [NSScreen mainScreen].backingScaleFactor; RCTResizeMode resizeMode = self.resizeMode; @@ -572,19 +572,19 @@ - (void)reactSetFrame:(CGRect)frame if (resizeMode == RCTResizeModeRepeat) { resizeMode = RCTResizeModeStretch; } -#endif // [TODO(macOS GH#774) +#endif // macOS] CGSize idealSize = RCTTargetSize(imageSize, imageScale, frame.size, windowScale, - resizeMode, YES); // ]TODO(macOS GH#774) + resizeMode, YES); // macOS] // Don't reload if the current image or target image size is close enough if ((!RCTShouldReloadImageForSizeChange(imageSize, idealSize) || - !RCTShouldReloadImageForSizeChange(_targetSize, idealSize)) // [TODO(macOS GH#774) -#if TARGET_OS_OSX + !RCTShouldReloadImageForSizeChange(_targetSize, idealSize)) // [macOS +#if TARGET_OS_OSX // Since mac doen't suport UIViewContentModeScaleAspectFill, we have to manually resample the image // If we're in cover mode we need to ensure that the image is re-sampled to the correct size when the container size (shrinking // being the most obvious case) otherwise we will end up in a state an image will not properly scale inside its container && (resizeMode != RCTResizeModeCover || (imageSize.width == idealSize.width && imageSize.height == idealSize.height)) #endif - ) { // ]TODO(macOS GH#774) + ) { // macOS] return; } @@ -611,7 +611,7 @@ - (void)didSetProps:(NSArray *)changedProps } } -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS #define didMoveToWindow viewDidMoveToWindow #endif #if TARGET_OS_OSX @@ -626,12 +626,12 @@ - (void)viewWillMoveToWindow:(NSWindow *)newWindow _subscribedToWindowBackingNotifications = NO; } } -#endif // ]TODO(macOS GH#774) +#endif // macOS] - (void)didMoveToWindow { [super didMoveToWindow]; -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS if (!_subscribedToWindowBackingNotifications && self.window != nil) { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowDidChangeBackingProperties:) @@ -639,7 +639,7 @@ - (void)didMoveToWindow object:self.window]; _subscribedToWindowBackingNotifications = YES; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] if (!self.window) { // Cancel loading the image if we've moved offscreen. In addition to helping // prioritise image requests that are actually on-screen, this removes @@ -652,7 +652,7 @@ - (void)didMoveToWindow } } -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS - (void)windowDidChangeBackingProperties:(NSNotification *)notification { [self reloadImage]; @@ -672,7 +672,7 @@ - (void)setTintColor:(NSColor *)tintColor { _imageView.contentTintColor = tintColor; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] - (void)dealloc { [_imageLoader trackURLImageDidDestroy:_loaderRequest]; diff --git a/Libraries/Image/RCTImageViewManager.mm b/Libraries/Image/RCTImageViewManager.mm index 23f8cbe586abd5..f479a2cb8c90fa 100644 --- a/Libraries/Image/RCTImageViewManager.mm +++ b/Libraries/Image/RCTImageViewManager.mm @@ -7,7 +7,7 @@ #import -#import // TODO(macOS GH#774) +#import // [macOS] #import #import @@ -25,7 +25,7 @@ - (RCTShadowView *)shadowView return [RCTImageShadowView new]; } -- (RCTPlatformView *)view // TODO(macOS GH#774) +- (RCTPlatformView *)view // [macOS] { return [[RCTImageView alloc] initWithBridge:self.bridge]; } diff --git a/Libraries/Image/RCTResizeMode.h b/Libraries/Image/RCTResizeMode.h index 053d673310a27e..767275dd5f9691 100644 --- a/Libraries/Image/RCTResizeMode.h +++ b/Libraries/Image/RCTResizeMode.h @@ -8,17 +8,17 @@ #import typedef NS_ENUM(NSInteger, RCTResizeMode) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCTResizeModeCover = UIViewContentModeScaleAspectFill, RCTResizeModeContain = UIViewContentModeScaleAspectFit, RCTResizeModeStretch = UIViewContentModeScaleToFill, RCTResizeModeCenter = UIViewContentModeCenter, -#else // [TODO(macOS GH#774) +#else // [macOS RCTResizeModeCover = -2, // Not supported by NSImageView RCTResizeModeContain = NSImageScaleProportionallyUpOrDown, RCTResizeModeStretch = NSImageScaleAxesIndependently, RCTResizeModeCenter = NSImageScaleNone, // assumes NSImageAlignmentCenter -#endif // ]TODO(macOS GH#774) +#endif // macOS] RCTResizeModeRepeat = -1, // Use negative values to avoid conflicts with iOS enum values. }; diff --git a/Libraries/Image/RCTUIImageViewAnimated.h b/Libraries/Image/RCTUIImageViewAnimated.h index 7330795f48814d..2173bea92ae4a2 100644 --- a/Libraries/Image/RCTUIImageViewAnimated.h +++ b/Libraries/Image/RCTUIImageViewAnimated.h @@ -8,10 +8,10 @@ #import #import -#if TARGET_OS_OSX // [TODO(macOS GH#774) -@interface RCTUIImageViewAnimated : NSImageView -#else // ]TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] @interface RCTUIImageViewAnimated : UIImageView -#endif // TODO(macOS GH#774) +#else // [macOS +@interface RCTUIImageViewAnimated : NSImageView +#endif // macOS] @end diff --git a/Libraries/Image/RCTUIImageViewAnimated.m b/Libraries/Image/RCTUIImageViewAnimated.m index 231338942314f0..526f0c1c5b0174 100644 --- a/Libraries/Image/RCTUIImageViewAnimated.m +++ b/Libraries/Image/RCTUIImageViewAnimated.m @@ -44,9 +44,9 @@ @interface RCTUIImageViewAnimated () @property (nonatomic, strong) NSOperationQueue *fetchQueue; @property (nonatomic, strong) dispatch_semaphore_t lock; @property (nonatomic, assign) CGFloat animatedImageScale; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS @property (nonatomic, strong) CADisplayLink *displayLink; -#endif // TODO(macOS GH#774) +#endif // macOS] @end @@ -56,9 +56,9 @@ - (instancetype)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { self.lock = dispatch_semaphore_create(1); - #if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveMemoryWarning:) name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; - #endif // TODO(macOS GH#774) +#endif // [macOS] } return self; } @@ -89,9 +89,7 @@ - (void)setImage:(UIImage *)image return; } -#if TARGET_OS_OSX - [super setImage:image]; -#else // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [self stop]; [self resetAnimatedImage]; @@ -108,7 +106,7 @@ - (void)setImage:(UIImage *)image // Get the current frame and loop count. self.totalLoopCount = self.animatedImage.animatedImageLoopCount; - self.animatedImageScale = UIImageGetScale(image); // TODO(macOS GH#774) + self.animatedImageScale = UIImageGetScale(image); // [macOS] self.currentFrame = image; @@ -127,7 +125,9 @@ - (void)setImage:(UIImage *)image } else { super.image = image; } -#endif // TODO(macOS GH#774) +#else // [macOS + [super setImage:image]; +#endif // macOS] } #pragma mark - Private @@ -149,7 +149,7 @@ - (NSOperationQueue *)fetchQueue return _frameBuffer; } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (CADisplayLink *)displayLink { // We only need a displayLink in the case of animated images, so short-circuit this code and don't create one for most of the use cases. @@ -333,6 +333,6 @@ - (void)didReceiveMemoryWarning:(NSNotification *)notification dispatch_semaphore_signal(self.lock); }]; } -#endif // TODO(macOS GH#774) +#endif // [macOS] @end diff --git a/Libraries/Image/React-RCTImage.podspec b/Libraries/Image/React-RCTImage.podspec index a544cdbdb92347..00d2b4be316400 100644 --- a/Libraries/Image/React-RCTImage.podspec +++ b/Libraries/Image/React-RCTImage.podspec @@ -27,7 +27,7 @@ Pod::Spec.new do |s| s.documentation_url = "https://reactnative.dev/docs/image" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "11.0", :osx => "10.15" } # TODO(macOS GH#214) + s.platforms = { :ios => "11.0", :osx => "10.15" } # [macOS] s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness' s.source = source s.source_files = "*.{m,mm}" diff --git a/Libraries/Image/nativeImageSource.js b/Libraries/Image/nativeImageSource.js index 81e7f363947e66..5086ef4765d401 100644 --- a/Libraries/Image/nativeImageSource.js +++ b/Libraries/Image/nativeImageSource.js @@ -15,7 +15,7 @@ import type {ImageURISource} from './ImageSource'; type NativeImageSourceSpec = $ReadOnly<{| android?: string, ios?: string, - macos?: string, // TODO(macOS GH#774) + macos?: string, // [macOS] default?: string, // For more details on width and height, see @@ -45,7 +45,7 @@ function nativeImageSource(spec: NativeImageSourceSpec): ImageURISource { android: spec.android, default: spec.default, ios: spec.ios, - macos: spec.macos, // TODO(macOS GH#774) + macos: spec.macos, // [macOS] }); if (uri == null) { console.warn( diff --git a/Libraries/Linking/Linking.js b/Libraries/Linking/Linking.js index de607b8c37125c..543078f37ffda6 100644 --- a/Libraries/Linking/Linking.js +++ b/Libraries/Linking/Linking.js @@ -30,7 +30,7 @@ type LinkingEventDefinitions = { class Linking extends NativeEventEmitter { constructor() { super( - Platform.OS === 'ios' || Platform.OS === 'macos' // TODO(macOS GH#774 + Platform.OS === 'ios' || Platform.OS === 'macos' // [macOS] ? nullthrows(NativeLinkingManager) : undefined, ); diff --git a/Libraries/LinkingIOS/RCTLinkingManager.h b/Libraries/LinkingIOS/RCTLinkingManager.h index 130c3e3ddc8e75..64d24043b06053 100644 --- a/Libraries/LinkingIOS/RCTLinkingManager.h +++ b/Libraries/LinkingIOS/RCTLinkingManager.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= 12000) /* __IPHONE_12_0 */ #import #endif @@ -13,10 +13,7 @@ @interface RCTLinkingManager : RCTEventEmitter -#if TARGET_OS_OSX // [TODO(macOS GH#774) -+ (void)getUrlEventHandler:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent; -+ (void)setAlwaysForegroundLastWindow:(BOOL)alwaysForeground; -#else // ]TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] + (BOOL)application:(nonnull UIApplication *)app openURL:(nonnull NSURL *)URL options:(nonnull NSDictionary *)options; @@ -34,6 +31,9 @@ #else (nonnull void (^)(NSArray *_Nullable))restorationHandler; #endif -#endif // TODO(macOS GH#774) +#else // [macOS ++ (void)getUrlEventHandler:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent; ++ (void)setAlwaysForegroundLastWindow:(BOOL)alwaysForeground; +#endif // macOS] @end diff --git a/Libraries/LinkingIOS/React-RCTLinking.podspec b/Libraries/LinkingIOS/React-RCTLinking.podspec index 2453f04c3f8910..36a3d1eba5d5c2 100644 --- a/Libraries/LinkingIOS/React-RCTLinking.podspec +++ b/Libraries/LinkingIOS/React-RCTLinking.podspec @@ -27,14 +27,14 @@ Pod::Spec.new do |s| s.documentation_url = "https://reactnative.dev/docs/linking" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "11.0", :osx => "10.15" } # TODO(macOS GH#214) + s.platforms = { :ios => "11.0", :osx => "10.15" } # [macOS] s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness' s.source = source s.source_files = "*.{m,mm}" -# [TODO(macOS GH#774) +# [macOS s.osx.exclude_files = "RCTLinkingManager.mm" s.osx.source_files = "macos/RCTLinkingManager.mm" -# ]TODO(macOS GH#774) +# macOS] s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs" s.header_dir = "RCTLinking" s.pod_target_xcconfig = { diff --git a/Libraries/LinkingIOS/macos/RCTLinkingManager.mm b/Libraries/LinkingIOS/macos/RCTLinkingManager.mm index db0003bef8e3db..6b0108d8da3fc6 100644 --- a/Libraries/LinkingIOS/macos/RCTLinkingManager.mm +++ b/Libraries/LinkingIOS/macos/RCTLinkingManager.mm @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -// TODO(macOS GH#774) +// [macOS] #import "RCTLinkingManager.h" diff --git a/Libraries/Lists/FlatList.js b/Libraries/Lists/FlatList.js index 0ce78f38e8368a..2412808a938390 100644 --- a/Libraries/Lists/FlatList.js +++ b/Libraries/Lists/FlatList.js @@ -66,7 +66,7 @@ type OptionalProps = {| * Optional custom style for multi-item rows generated when numColumns > 1. */ columnWrapperStyle?: ViewStyleProp, - // [TODO(macOS GH#774) + // [macOS /** * Allows you to 'select' a row using arrow keys. The selected row will have the prop `isSelected` * passed in as true to it's renderItem / ListItemComponent. You can also imperatively select a row @@ -83,7 +83,7 @@ type OptionalProps = {| * @platform macos */ enableSelectionOnKeyPress?: ?boolean, - // ]TODO(macOS GH#774) + // macOS] /** * A marker property for telling the list to re-render (since it implements `PureComponent`). If * any of your `renderItem`, Header, Footer, etc. functions depend on anything outside of the @@ -129,12 +129,12 @@ type OptionalProps = {| * `getItemLayout` to be implemented. */ initialScrollIndex?: ?number, - // [TODO(macOS GH#774) + // [macOS /** * The initially selected row, if `enableSelectionOnKeyPress` is set. */ initialSelectedIndex?: ?number, - // ]TODO(macOS GH#774) + // macOS] /** * Reverses the direction of scroll. Uses native inversion on macOS and scale transforms of -1 elsewhere */ @@ -393,7 +393,7 @@ class FlatList extends React.PureComponent, void> { } } - // [TODO(macOS GH#750) + // [macOS /** * Move selection to the specified index * @@ -404,7 +404,7 @@ class FlatList extends React.PureComponent, void> { this._listRef.selectRowAtIndex(index); } } - // ]TODO(macOS GH#750) + // macOS] /** * Provides a handle to the underlying scroll responder. @@ -653,7 +653,7 @@ class FlatList extends React.PureComponent, void> { const element = renderer({ item: it, index: index * numColumns + kk, - isSelected: info.isSelected, // TODO(macOS GH#774) + isSelected: info.isSelected, // [macOS] separators: info.separators, }); return element != null ? ( diff --git a/Libraries/Lists/SectionList.js b/Libraries/Lists/SectionList.js index fdac70f6be3453..072452d795b7d7 100644 --- a/Libraries/Lists/SectionList.js +++ b/Libraries/Lists/SectionList.js @@ -47,7 +47,7 @@ type OptionalProps> = {| renderItem?: (info: { item: Item, index: number, - isSelected?: boolean, // TODO(macOS GH#774) + isSelected?: boolean, // [macOS] section: SectionT, separators: { highlight: () => void, diff --git a/Libraries/Lists/VirtualizedList.js b/Libraries/Lists/VirtualizedList.js index 6b21fab5cf234a..62d2adea971624 100644 --- a/Libraries/Lists/VirtualizedList.js +++ b/Libraries/Lists/VirtualizedList.js @@ -10,7 +10,7 @@ const Batchinator = require('../Interaction/Batchinator'); const FillRateHelper = require('./FillRateHelper'); -const Platform = require('../Utilities/Platform'); // TODO(macOS GH#774) +const Platform = require('../Utilities/Platform'); // [macOS] const ReactNative = require('../Renderer/shims/ReactNative'); const RefreshControl = require('../Components/RefreshControl/RefreshControl'); const ScrollView = require('../Components/ScrollView/ScrollView'); @@ -35,7 +35,7 @@ import type { ViewToken, ViewabilityConfigCallbackPair, } from './ViewabilityHelper'; -import type {KeyEvent} from '../Types/CoreEventTypes'; // TODO(macOS GH#774) +import type {KeyEvent} from '../Types/CoreEventTypes'; // [macOS] import { VirtualizedListCellContextProvider, VirtualizedListContext, @@ -56,7 +56,7 @@ export type Separators = { export type RenderItemProps = { item: ItemT, index: number, - isSelected: ?boolean, // TODO(macOS GH#774) + isSelected: ?boolean, // [macOS] separators: Separators, ... }; @@ -75,11 +75,11 @@ type ViewabilityHelperCallbackTuple = { ... }; -// [TODO(macOS GH#774) +// [macOS export type SelectedRowIndexPathType = { sectionIndex: number, rowIndex: number, -}; // ]TODO(macOS GH#774) +}; // macOS] type RequiredProps = {| /** @@ -109,7 +109,7 @@ type OptionalProps = {| * this for debugging purposes. Defaults to false. */ disableVirtualization?: ?boolean, - // [TODO(macOS GH#774) + // [macOS /** * Allows you to 'select' a row using arrow keys. The selected row will have the prop `isSelected` * passed in as true to it's renderItem / ListItemComponent. You can also imperatively select a row @@ -126,7 +126,7 @@ type OptionalProps = {| * @platform macos */ enableSelectionOnKeyPress?: ?boolean, - // ]TODO(macOS GH#774) + // macOS] /** * A marker property for telling the list to re-render (since it implements `PureComponent`). If * any of your `renderItem`, Header, Footer, etc. functions depend on anything outside of the @@ -157,12 +157,12 @@ type OptionalProps = {| * `getItemLayout` to be implemented. */ initialScrollIndex?: ?number, - // [TODO(macOS GH#774) + // [macOS /** * The initially selected row, if `enableSelectionOnKeyPress` is set. */ initialSelectedIndex?: ?number, - // ]TODO(macOS GH#774) + // macOS] /** * Reverses the direction of scroll. Uses scale transforms of -1. */ @@ -280,16 +280,16 @@ type OptionalProps = {| previousSelection: number, newSelection: number, item: ?Item, - }) => void, // TODO(macOS GH#774) + }) => void, // [macOS] /** * If provided, called when 'Enter' key is pressed on an item. * * @platform macos */ - onSelectionEntered?: ?(item: ?Item) => void, // TODO(macOS GH#774) + onSelectionEntered?: ?(item: ?Item) => void, // [macOS] - sectionIndex?: number, // TODO(macOS GH#774) - rowIndex?: number, // TODO(macOS GH#774) + sectionIndex?: number, // [macOS] + rowIndex?: number, // [macOS] /** * Called when the viewability of rows changes, as defined by the @@ -365,7 +365,7 @@ let _keylessItemComponentName: string = ''; type State = { first: number, last: number, - selectedRowIndex: number, // TODO(macOS GH#774) + selectedRowIndex: number, // [macOS] ... }; @@ -593,7 +593,7 @@ class VirtualizedList extends React.PureComponent { ); } - // [TODO(macOS GH#774) + // [macOS ensureItemAtIndexIsVisible(rowIndex: number) { const frame = this._getFrameMetricsApprox(rowIndex); const visTop = this._scrollMetrics.offset; @@ -614,7 +614,7 @@ class VirtualizedList extends React.PureComponent { selectRowAtIndex(rowIndex: number) { this._selectRowAtIndex(rowIndex); } - // ]TODO(macOS GH#774) + // macOS] recordInteraction() { this._nestedChildLists.forEach(childList => { @@ -800,7 +800,7 @@ class VirtualizedList extends React.PureComponent { (this.props.initialScrollIndex || 0) + initialNumToRenderOrDefault(this.props.initialNumToRender), ) - 1, - selectedRowIndex: this.props.initialSelectedIndex ?? -1, // TODO(macOS GH#774) + selectedRowIndex: this.props.initialSelectedIndex ?? -1, // [macOS] }; if (this._isNestedWithSameOrientation()) { @@ -862,10 +862,11 @@ class VirtualizedList extends React.PureComponent { Math.min(prevState.first, getItemCount(data) - 1 - maxToRenderPerBatch), ), last: Math.max(0, Math.min(prevState.last, getItemCount(data) - 1)), + // [macOS selectedRowIndex: Math.max( -1, // Used to indicate no row is selected Math.min(prevState.selectedRowIndex, getItemCount(data)), - ), // TODO(macOS GH#774) + ), // macOS] }; } @@ -906,13 +907,13 @@ class VirtualizedList extends React.PureComponent { index={ii} inversionStyle={inversionStyle} item={item} - // [TODO(macOS GH#774) + // [macOS isSelected={ this.props.enableSelectionOnKeyPress && this.state.selectedRowIndex === ii ? true : false - } // TODO(macOS GH#774)] + } // macOS] key={key} prevCellKey={prevCellKey} onUpdateSeparators={this._onUpdateSeparators} @@ -981,7 +982,7 @@ class VirtualizedList extends React.PureComponent { const isVirtualizationDisabled = this._isVirtualizationDisabled(); // macOS natively supports inverted lists, thus not needing an inversion style const inversionStyle = - this.props.inverted && Platform.OS !== 'macos' // TODO(macOS GH#774) + this.props.inverted && Platform.OS !== 'macos' // [macOS] ? horizontalOrDefault(this.props.horizontal) ? styles.horizontallyInverted : styles.verticallyInverted @@ -1329,7 +1330,7 @@ class VirtualizedList extends React.PureComponent { } _defaultRenderScrollComponent = props => { - // [TODO(macOS GH#774) + // [macOS const preferredScrollerStyleDidChangeHandler = this.props.onPreferredScrollerStyleDidChange; const invertedDidChange = this.props.onInvertedDidChange; @@ -1351,7 +1352,7 @@ class VirtualizedList extends React.PureComponent { validKeysDown: _validKeysDown, onKeyDown: this._handleKeyDown, }; - // ]TODO(macOS GH#774) + // macOS] const onRefresh = props.onRefresh; if (this._isNestedWithSameOrientation()) { // $FlowFixMe[prop-missing] - Typing ReactNativeComponent revealed errors @@ -1366,12 +1367,12 @@ class VirtualizedList extends React.PureComponent { return ( // $FlowFixMe[prop-missing] Invalid prop usage { return ( // $FlowFixMe Invalid prop usage ); @@ -1545,7 +1546,7 @@ class VirtualizedList extends React.PureComponent { this._headerLength = this._selectLength(e.nativeEvent.layout); }; - // [TODO(macOS GH#774) + // [macOS _selectRowAtIndex = rowIndex => { const prevIndex = this.state.selectedRowIndex; const newIndex = rowIndex; @@ -1619,7 +1620,7 @@ class VirtualizedList extends React.PureComponent { } } }; - // ]TODO(macOS GH#774) + // macOS] _renderDebugOverlay() { const normalize = @@ -2102,7 +2103,7 @@ type CellRendererProps = { horizontal: ?boolean, index: number, inversionStyle: ViewStyleProp, - isSelected: ?boolean, // TODO(macOS GH#774) + isSelected: ?boolean, // [macOS] item: Item, // This is extracted by ScrollViewStickyHeader onLayout: (event: Object) => void, @@ -2197,7 +2198,7 @@ class CellRenderer extends React.Component< ListItemComponent, item, index, - isSelected, // TODO(macOS GH#774) + isSelected, // [macOS] ) { if (renderItem && ListItemComponent) { console.warn( @@ -2225,7 +2226,7 @@ class CellRenderer extends React.Component< return renderItem({ item, index, - isSelected, // TODO(macOS GH#774) + isSelected, // [macOS] separators: this._separators, }); } @@ -2245,7 +2246,7 @@ class CellRenderer extends React.Component< item, index, inversionStyle, - isSelected, // TODO(macOS GH#774) + isSelected, // [macOS] parentProps, } = this.props; const {renderItem, getItemLayout, ListItemComponent} = parentProps; @@ -2254,7 +2255,7 @@ class CellRenderer extends React.Component< ListItemComponent, item, index, - isSelected, // TODO(macOS GH#774) + isSelected, // [macOS] ); const onLayout = @@ -2293,7 +2294,6 @@ class CellRenderer extends React.Component< {itemSeparator} ); - // TODO(macOS GH#774)] return ( diff --git a/Libraries/Lists/VirtualizedSectionList.js b/Libraries/Lists/VirtualizedSectionList.js index 2d4fe82eeec550..0750972195bb37 100644 --- a/Libraries/Lists/VirtualizedSectionList.js +++ b/Libraries/Lists/VirtualizedSectionList.js @@ -8,11 +8,11 @@ * @format */ -const Platform = require('../Utilities/Platform'); // TODO(macOS GH#774) +const Platform = require('../Utilities/Platform'); // [macOS] import invariant from 'invariant'; import type {ViewToken} from './ViewabilityHelper'; -import type {SelectedRowIndexPathType} from './VirtualizedList'; // TODO(macOS GH#774) -import type {KeyEvent} from '../Types/CoreEventTypes'; // TODO(macOS GH#774) +import type {SelectedRowIndexPathType} from './VirtualizedList'; // [macOS] +import type {KeyEvent} from '../Types/CoreEventTypes'; // [macOS] import {keyExtractor as defaultKeyExtractor} from './VirtualizeUtils'; import {View, VirtualizedList} from 'react-native'; import * as React from 'react'; @@ -33,7 +33,7 @@ export type SectionBase = { renderItem?: ?(info: { item: SectionItemT, index: number, - // isSelected?: boolean, // TODO(macOS GH#774) + // isSelected?: boolean, // [macOS] section: SectionBase, separators: { highlight: () => void, @@ -53,19 +53,21 @@ type RequiredProps> = {| |}; type OptionalProps> = {| + // [macOS /** * Handles key down events and updates selection based on the key event * * @platform macos */ - enableSelectionOnKeyPress?: ?boolean, // TODO(macOS GH#774) + enableSelectionOnKeyPress?: ?boolean, + // macOS] /** * Default renderer for every item in every section. */ renderItem?: (info: { item: Item, index: number, - isSelected?: boolean, // TODO(macOS GH#774) + isSelected?: boolean, // [macOS] section: SectionT, separators: { highlight: () => void, @@ -114,13 +116,13 @@ type OptionalProps> = {| previousSelection: Object, newSelection: Object, item: ?Item, - }) => void, // TODO(macOS GH#774) + }) => void, // [macOS] /** * If provided, called when 'Enter' key is pressed on an item. * * @platform macos */ - onSelectionEntered?: ?(item: ?Item) => void, // TODO(macOS GH#774) + onSelectionEntered?: ?(item: ?Item) => void, // [macOS] |}; type VirtualizedListProps = React.ElementConfig; @@ -145,7 +147,7 @@ export type ScrollToLocationParamsType = {| viewPosition?: number, |}; -// TODO(macOS GH#774) +// [macOS] type State = { selectedRowIndexPath: SelectedRowIndexPathType, ... @@ -187,7 +189,7 @@ class VirtualizedSectionList< return this._listRef; } - // TODO(macOS GH#774) + // [macOS] constructor(props: Props, context: Object) { super(props, context); this.state = { @@ -242,13 +244,13 @@ class VirtualizedSectionList< ? this._onViewableItemsChanged : undefined } - {...this.state.selectedRowIndexPath} // TODO(macOS GH#774) + {...this.state.selectedRowIndexPath} // [macOS] ref={this._captureRef} /> ); } - // [TODO(macOS GH#774) + // [macOS _selectRowAboveIndexPath = rowIndexPath => { let sectionIndex = rowIndexPath.sectionIndex; if (sectionIndex >= this.props.sections.length) { @@ -355,7 +357,7 @@ class VirtualizedSectionList< } } } - }; // ]TODO(macOS GH#774) + }; // macOS] _getItem( props: Props, @@ -487,7 +489,7 @@ class VirtualizedSectionList< } }; - // [TODO(macOS GH#774) + // [macOS _isItemSelected = (item: Item): boolean => { let isSelected = false; if (this.state.selectedRowIndexPath) { @@ -503,7 +505,7 @@ class VirtualizedSectionList< } return isSelected; }; - // ]TODO(macOS GH#774) + // macOS] _renderItem = (listItemCount: number) => @@ -538,7 +540,7 @@ class VirtualizedSectionList< } cellKey={info.key} index={infoIndex} - isSelected={this._isItemSelected(item)} // TODO(macOS GH#774) + isSelected={this._isItemSelected(item)} // [macOS] item={item} leadingItem={info.leadingItem} leadingSection={info.leadingSection} @@ -636,7 +638,7 @@ type ItemWithSeparatorProps = $ReadOnly<{| cellKey: string, index: number, item: Item, - isSelected: boolean, // TODO(macOS GH#774) + isSelected: boolean, // [macOS] setSelfHighlightCallback: ( cellKey: string, updateFn: ?(boolean) => void, @@ -664,7 +666,7 @@ function ItemWithSeparator(props: ItemWithSeparatorProps): React.Node { setSelfUpdatePropsCallback, updatePropsFor, item, - isSelected, // TODO(macOS GH#774) + isSelected, // [macOS] index, section, inverted, @@ -739,7 +741,7 @@ function ItemWithSeparator(props: ItemWithSeparatorProps): React.Node { const element = props.renderItem({ item, index, - isSelected, // TODO(macOS GH#774) + isSelected, // [macOS] section, separators, }); diff --git a/Libraries/NativeAnimation/Drivers/RCTDecayAnimation.m b/Libraries/NativeAnimation/Drivers/RCTDecayAnimation.m index 85fd74b2bd26a5..058dc703d4aef8 100644 --- a/Libraries/NativeAnimation/Drivers/RCTDecayAnimation.m +++ b/Libraries/NativeAnimation/Drivers/RCTDecayAnimation.m @@ -7,7 +7,7 @@ #import -#import // TODO(macOS GH#774) +#import // [macOS] #import #import diff --git a/Libraries/NativeAnimation/Drivers/RCTFrameAnimation.m b/Libraries/NativeAnimation/Drivers/RCTFrameAnimation.m index c24f0dd0eb83e9..5f3e7c4856a7cb 100644 --- a/Libraries/NativeAnimation/Drivers/RCTFrameAnimation.m +++ b/Libraries/NativeAnimation/Drivers/RCTFrameAnimation.m @@ -7,7 +7,7 @@ #import -#import // TODO(macOS GH#774) +#import // [macOS] #import #import diff --git a/Libraries/NativeAnimation/Drivers/RCTSpringAnimation.m b/Libraries/NativeAnimation/Drivers/RCTSpringAnimation.m index d34d238849bff1..cc6d0efab19176 100644 --- a/Libraries/NativeAnimation/Drivers/RCTSpringAnimation.m +++ b/Libraries/NativeAnimation/Drivers/RCTSpringAnimation.m @@ -7,7 +7,7 @@ #import -#import // TODO(macOS GH#774) +#import // [macOS] #import #import diff --git a/Libraries/NativeAnimation/Nodes/RCTValueAnimatedNode.h b/Libraries/NativeAnimation/Nodes/RCTValueAnimatedNode.h index b7791ff0efb158..aef717146eba6b 100644 --- a/Libraries/NativeAnimation/Nodes/RCTValueAnimatedNode.h +++ b/Libraries/NativeAnimation/Nodes/RCTValueAnimatedNode.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import "RCTAnimatedNode.h" diff --git a/Libraries/NativeAnimation/RCTNativeAnimatedModule.mm b/Libraries/NativeAnimation/RCTNativeAnimatedModule.mm index 28df2712f670ef..eac3e9fe009afe 100644 --- a/Libraries/NativeAnimation/RCTNativeAnimatedModule.mm +++ b/Libraries/NativeAnimation/RCTNativeAnimatedModule.mm @@ -329,12 +329,12 @@ - (void)uiManagerWillPerformMounting:(RCTUIManager *)uiManager _preOperations = [NSMutableArray new]; _operations = [NSMutableArray new]; - [uiManager prependUIBlock:^(__unused RCTUIManager *manager, __unused NSDictionary *viewRegistry) { // TODO(macOS ISS#3536887) + [uiManager prependUIBlock:^(__unused RCTUIManager *manager, __unused NSDictionary *viewRegistry) { // [macOS] for (AnimatedOperation operation in preOperations) { operation(self->_nodesManager); } }]; - [uiManager addUIBlock:^(__unused RCTUIManager *manager, __unused NSDictionary *viewRegistry) { // TODO(macOS ISS#3536887) + [uiManager addUIBlock:^(__unused RCTUIManager *manager, __unused NSDictionary *viewRegistry) { // [macOS] for (AnimatedOperation operation in operations) { operation(self->_nodesManager); } diff --git a/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.h b/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.h index f99adf475468bb..974d56ebeaf26e 100644 --- a/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.h +++ b/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.h @@ -8,7 +8,7 @@ #import #import #import -#import // TODO(macOS GH#774) +#import // [macOS] #import #import @@ -23,7 +23,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)updateAnimations; -- (void)stepAnimations:(RCTPlatformDisplayLink *)displaylink; // TODO(macOS GH#774) +- (void)stepAnimations:(RCTPlatformDisplayLink *)displaylink; // [macOS] - (BOOL)isNodeManagedByFabric:(NSNumber *)tag; diff --git a/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.m b/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.m index 9a7eebb4155b8c..802c707a2fc9a9 100644 --- a/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.m +++ b/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.m @@ -53,7 +53,7 @@ @implementation RCTNativeAnimatedNodesManager // there will be only one driver per mapping so all code code should be optimized around that. NSMutableDictionary *> *_eventDrivers; NSMutableSet> *_activeAnimations; - RCTPlatformDisplayLink *_displayLink; // TODO(macOS GH#774) + RCTPlatformDisplayLink *_displayLink; // [macOS] } - (instancetype)initWithBridge:(nullable RCTBridge *)bridge surfacePresenter:(id)surfacePresenter; @@ -431,7 +431,7 @@ - (void)stopListeningToAnimatedNodeValue:(NSNumber *)tag - (void)startAnimationLoopIfNeeded { if (!_displayLink && _activeAnimations.count > 0) { - _displayLink = [RCTPlatformDisplayLink displayLinkWithTarget:self selector:@selector(stepAnimations:)]; // TODO(macOS GH#774) + _displayLink = [RCTPlatformDisplayLink displayLinkWithTarget:self selector:@selector(stepAnimations:)]; // [macOS] [_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes]; } } @@ -451,7 +451,7 @@ - (void)stopAnimationLoop } } -- (void)stepAnimations:(RCTPlatformDisplayLink *)displaylink // TODO(macOS GH#774) +- (void)stepAnimations:(RCTPlatformDisplayLink *)displaylink // [macOS] { NSTimeInterval time = displaylink.timestamp; for (id animationDriver in _activeAnimations) { diff --git a/Libraries/NativeAnimation/React-RCTAnimation.podspec b/Libraries/NativeAnimation/React-RCTAnimation.podspec index 31fb9f925f36e5..4c7bd3746e4d91 100644 --- a/Libraries/NativeAnimation/React-RCTAnimation.podspec +++ b/Libraries/NativeAnimation/React-RCTAnimation.podspec @@ -26,7 +26,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "11.0", :osx => "10.15" } # TODO(macOS GH#214) + s.platforms = { :ios => "11.0", :osx => "10.15" } # [macOS] s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness' s.source = source s.source_files = "**/*.{h,m,mm}" diff --git a/Libraries/NativeModules/specs/NativeDevSettings.js b/Libraries/NativeModules/specs/NativeDevSettings.js index e0915a1f8ccf51..18b841c4a3ff03 100644 --- a/Libraries/NativeModules/specs/NativeDevSettings.js +++ b/Libraries/NativeModules/specs/NativeDevSettings.js @@ -28,8 +28,10 @@ export interface Spec extends TurboModule { // iOS only. +setIsShakeToShowDevMenuEnabled: (enabled: boolean) => void; + // [macOS // macOS only. - +setIsSecondaryClickToShowDevMenuEnabled: (enabled: boolean) => void; // TODO(macOS GH#774) + +setIsSecondaryClickToShowDevMenuEnabled: (enabled: boolean) => void; + // macOS] } export default (TurboModuleRegistry.getEnforcing('DevSettings'): Spec); diff --git a/Libraries/Network/RCTFileRequestHandler.mm b/Libraries/Network/RCTFileRequestHandler.mm index 218958fdd5f2fd..5aea8fee843e22 100644 --- a/Libraries/Network/RCTFileRequestHandler.mm +++ b/Libraries/Network/RCTFileRequestHandler.mm @@ -7,11 +7,11 @@ #import -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] #import -#else // [TODO(macOS GH#774) +#else // [macOS #import -#endif // ]TODO(macOS GH#774) +#endif // macOS] #import #import diff --git a/Libraries/Network/RCTNetworking.macos.js b/Libraries/Network/RCTNetworking.macos.js index 682affd1009028..a05a885a336bc4 100644 --- a/Libraries/Network/RCTNetworking.macos.js +++ b/Libraries/Network/RCTNetworking.macos.js @@ -8,7 +8,7 @@ * @flow */ -// TODO(macOS GH#774) +// [macOS] /* $FlowFixMe allow macOS to share iOS file */ const RCTNetworking = require('./RCTNetworking.ios'); diff --git a/Libraries/Network/React-RCTNetwork.podspec b/Libraries/Network/React-RCTNetwork.podspec index 9832ac2c2e2139..417137d58bd6a3 100644 --- a/Libraries/Network/React-RCTNetwork.podspec +++ b/Libraries/Network/React-RCTNetwork.podspec @@ -26,7 +26,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "11.0", :osx => "10.15" } # TODO(macOS GH#214) + s.platforms = { :ios => "11.0", :osx => "10.15" } # [macOS] s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness' s.source = source s.source_files = "*.{m,mm}" @@ -37,7 +37,7 @@ Pod::Spec.new do |s| "CLANG_CXX_LANGUAGE_STANDARD" => "c++17", "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\"" } - s.ios.frameworks = "MobileCoreServices" # TODO(macOS GH#214) - Restrict to iOS + s.ios.frameworks = "MobileCoreServices" # [macOS] Restrict to iOS s.dependency "RCT-Folly", folly_version s.dependency "React-Codegen", version diff --git a/Libraries/Network/__tests__/XMLHttpRequest-test.js b/Libraries/Network/__tests__/XMLHttpRequest-test.js index 3faa7e41cae6e7..763c103d781564 100644 --- a/Libraries/Network/__tests__/XMLHttpRequest-test.js +++ b/Libraries/Network/__tests__/XMLHttpRequest-test.js @@ -18,10 +18,7 @@ const GlobalPerformanceLogger = require('../../Utilities/GlobalPerformanceLogger let requestId = 1; function setRequestId(id) { - if ( - Platform.OS === 'ios' || - Platform.OS === 'macos' /* TODO(macOS GH#774) */ - ) { + if (Platform.OS === 'ios' || Platform.OS === 'macos' /* [macOS] */) { return; } requestId = id; diff --git a/Libraries/NewAppScreen/components/DebugInstructions.js b/Libraries/NewAppScreen/components/DebugInstructions.js index f0173189b13828..17787aaab38f13 100644 --- a/Libraries/NewAppScreen/components/DebugInstructions.js +++ b/Libraries/NewAppScreen/components/DebugInstructions.js @@ -26,13 +26,13 @@ const DebugInstructions: () => Node = Platform.select({ Native debug menu. ), - // [TODO(macOS GH#774) + // [macOS macos: () => ( Secondary click in this window to open the React Native debug menu. ), - // ]TODO(macOS GH#774) + // macOS] default: () => ( Press Cmd or Ctrl + M or{' '} diff --git a/Libraries/NewAppScreen/components/ReloadInstructions.js b/Libraries/NewAppScreen/components/ReloadInstructions.js index b60a0becca8476..ab901d5e2f1391 100644 --- a/Libraries/NewAppScreen/components/ReloadInstructions.js +++ b/Libraries/NewAppScreen/components/ReloadInstructions.js @@ -25,14 +25,14 @@ const ReloadInstructions: () => Node = Platform.select({ reload your app's code. ), - // [TODO(macOS GH#774) + // [macOS macos: () => ( Secondary click in this window and choose{' '} Reload to reload your app's code. ), - // ]TODO(macOS GH#774) + // macOS] default: () => ( Double tap R on your keyboard to diff --git a/Libraries/Pressability/HoverState.js b/Libraries/Pressability/HoverState.js index c3b40c2e5ce8c7..8e5d6aec69e631 100644 --- a/Libraries/Pressability/HoverState.js +++ b/Libraries/Pressability/HoverState.js @@ -49,10 +49,10 @@ if (Platform.OS === 'web') { document.addEventListener('touchmove', disableHover, true); document.addEventListener('mousemove', enableHover, true); } - // [TODO(macOS GH#774) + // [macOS } else if (Platform.OS === 'macos') { isEnabled = true; - // ]TODO(macOS GH#774) + // macOS] } export function isHoverEnabled(): boolean { diff --git a/Libraries/Pressability/Pressability.js b/Libraries/Pressability/Pressability.js index 7f1626239ed8b8..e24a76d4f3117c 100644 --- a/Libraries/Pressability/Pressability.js +++ b/Libraries/Pressability/Pressability.js @@ -621,7 +621,7 @@ export default class Pressability { }, }; - // [TODO(macOS GH#774) + // [macOS const keyboardEventHandlers = { onKeyDown: (event: KeyEvent): void => { const {onKeyDown} = this._config; @@ -636,13 +636,13 @@ export default class Pressability { } }, }; - // ]TODO(macOS GH#774) + // macOS] return { ...focusEventHandlers, ...responderEventHandlers, ...mouseEventHandlers, - ...keyboardEventHandlers, // [TODO(macOS GH#774)] + ...keyboardEventHandlers, // [macOS] }; } diff --git a/Libraries/PushNotificationIOS/PushNotificationIOS.js b/Libraries/PushNotificationIOS/PushNotificationIOS.js index a6637521d285ee..0ed917eecb44bc 100644 --- a/Libraries/PushNotificationIOS/PushNotificationIOS.js +++ b/Libraries/PushNotificationIOS/PushNotificationIOS.js @@ -41,7 +41,7 @@ const PushNotificationEmitter = new NativeEventEmitter( // T88715063: NativeEventEmitter only used this parameter on iOS. Now it uses it on all platforms, so this code was modified automatically to preserve its behavior // If you want to use the native module on other platforms, please remove this condition and test its behavior - Platform.OS !== 'ios' && Platform.OS !== 'macos' // TODO(macOS GH#774): Also use this parameter on macOS + Platform.OS !== 'ios' && Platform.OS !== 'macos' // [macOS] Also use this parameter on macOS ? null : NativePushNotificationManagerIOS, ); @@ -470,7 +470,7 @@ class PushNotificationIOS { !this._isRemote || !this._notificationId || this._remoteNotificationCompleteCallbackCalled || - Platform.OS === 'macos' // TODO(macOS GH#774) + Platform.OS === 'macos' // [macOS] ) { return; } diff --git a/Libraries/PushNotificationIOS/RCTPushNotificationManager.h b/Libraries/PushNotificationIOS/RCTPushNotificationManager.h index eb42f635878af5..1247dd65731b87 100644 --- a/Libraries/PushNotificationIOS/RCTPushNotificationManager.h +++ b/Libraries/PushNotificationIOS/RCTPushNotificationManager.h @@ -11,23 +11,23 @@ extern NSString *const RCTRemoteNotificationReceived; @interface RCTPushNotificationManager : RCTEventEmitter -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] typedef void (^RCTRemoteNotificationCallback)(UIBackgroundFetchResult result); -#endif // TODO(macOS GH#774) +#endif // [macOS] #if !TARGET_OS_UIKITFORMAC -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] + (void)didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings; -#endif // TODO(macOS GH#774) +#endif // [macOS] + (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken; + (void)didReceiveRemoteNotification:(NSDictionary *)notification; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] + (void)didReceiveRemoteNotification:(NSDictionary *)notification fetchCompletionHandler:(RCTRemoteNotificationCallback)completionHandler; + (void)didReceiveLocalNotification:(UILocalNotification *)notification; -#endif // [TODO(macOS GH#774) -#if TARGET_OS_OSX +#endif // [macOS] +#if TARGET_OS_OSX // [macOS + (void)didReceiveUserNotification:(NSUserNotification *)notification; -#endif // ]TODO(macOS GH#774) +#endif // macOS] + (void)didFailToRegisterForRemoteNotificationsWithError:(NSError *)error; #endif diff --git a/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm b/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm index ff779b44cd861d..72c197969dceec 100644 --- a/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm +++ b/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm @@ -47,7 +47,7 @@ @interface RCTPushNotificationManager () @implementation RCTConvert (UILocalNotification) -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] + (UILocalNotification *)UILocalNotification:(id)json { NSDictionary *details = [self NSDictionary:json]; @@ -68,7 +68,7 @@ + (UILocalNotification *)UILocalNotification:(id)json } return notification; } -#else // [TODO(macOS GH#774) +#else // [macOS + (NSUserNotification *)NSUserNotification:(id)json { NSDictionary *details = [self NSDictionary:json]; @@ -103,15 +103,15 @@ + (NSUserNotification *)NSUserNotification:(id)json notification.identifier = identifier; return notification; } -#endif +#endif // macOS] -#if !TARGET_OS_OSX // ]TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCT_ENUM_CONVERTER(UIBackgroundFetchResult, (@{ @"UIBackgroundFetchResultNewData": @(UIBackgroundFetchResultNewData), @"UIBackgroundFetchResultNoData": @(UIBackgroundFetchResultNoData), @"UIBackgroundFetchResultFailed": @(UIBackgroundFetchResultFailed), }), UIBackgroundFetchResultNoData, integerValue) -#endif // TODO(macOS GH#774) +#endif // [macOS] @end #else @@ -121,7 +121,7 @@ @interface RCTPushNotificationManager () @implementation RCTPushNotificationManager -#if !TARGET_OS_UIKITFORMAC && !TARGET_OS_OSX +#if !TARGET_OS_UIKITFORMAC && !TARGET_OS_OSX // [macOS] static NSDictionary *RCTFormatLocalNotification(UILocalNotification *notification) { @@ -166,7 +166,7 @@ @implementation RCTPushNotificationManager } #endif // TARGET_OS_UIKITFORMAC -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS static NSDictionary *RCTFormatUserNotification(NSUserNotification *notification) { @@ -185,7 +185,7 @@ @implementation RCTPushNotificationManager formattedUserNotification[@"identifier"] = notification.identifier; return formattedUserNotification; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] RCT_EXPORT_MODULE() @@ -228,11 +228,11 @@ - (void)stopObserving @"remoteNotificationRegistrationError"]; } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] + (void)didRegisterUserNotificationSettings:(__unused UIUserNotificationSettings *)notificationSettings { } -#endif // TODO(macOS GH#774) +#endif // [macOS] + (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { @@ -262,7 +262,7 @@ + (void)didReceiveRemoteNotification:(NSDictionary *)notification userInfo:userInfo]; } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] + (void)didReceiveRemoteNotification:(NSDictionary *)notification fetchCompletionHandler:(RCTRemoteNotificationCallback)completionHandler { @@ -279,7 +279,7 @@ + (void)didReceiveLocalNotification:(UILocalNotification *)notification userInfo:RCTFormatLocalNotification(notification)]; } -#else // [TODO(macOS GH#774) +#else // [macOS + (void)didReceiveUserNotification:(NSUserNotification *)notification { @@ -290,7 +290,7 @@ + (void)didReceiveUserNotification:(NSUserNotification *)notification userInfo:userInfo]; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] - (void)handleLocalNotificationReceived:(NSNotification *)notification { @@ -300,13 +300,13 @@ - (void)handleLocalNotificationReceived:(NSNotification *)notification - (void)handleRemoteNotificationReceived:(NSNotification *)notification { NSMutableDictionary *remoteNotification = [NSMutableDictionary dictionaryWithDictionary:notification.userInfo[@"notification"]]; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCTRemoteNotificationCallback completionHandler = notification.userInfo[@"completionHandler"]; -#endif // TODO(macOS GH#774) +#endif // [macOS] NSString *notificationId = [[NSUUID UUID] UUIDString]; remoteNotification[@"notificationId"] = notificationId; remoteNotification[@"remote"] = @YES; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] if (completionHandler) { if (!self.remoteNotificationCallbacks) { // Lazy initialization @@ -314,7 +314,7 @@ - (void)handleRemoteNotificationReceived:(NSNotification *)notification } self.remoteNotificationCallbacks[notificationId] = completionHandler; } -#endif // TODO(macOS GH#774) +#endif // [macOS] [self sendEventWithName:@"remoteNotificationReceived" body:remoteNotification]; } @@ -335,7 +335,7 @@ - (void)handleRemoteNotificationRegistrationError:(NSNotification *)notification [self sendEventWithName:@"remoteNotificationRegistrationError" body:errorDetails]; } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCT_EXPORT_METHOD(onFinishRemoteNotification:(NSString *)notificationId fetchResult:(NSString *)fetchResult) { UIBackgroundFetchResult result = [RCTConvert UIBackgroundFetchResult:fetchResult]; RCTRemoteNotificationCallback completionHandler = self.remoteNotificationCallbacks[notificationId]; @@ -346,20 +346,20 @@ - (void)handleRemoteNotificationRegistrationError:(NSNotification *)notification completionHandler(result); [self.remoteNotificationCallbacks removeObjectForKey:notificationId]; } -#endif // TODO(macOS GH#774) +#endif // [macOS] /** * Update the application icon badge number on the home screen */ RCT_EXPORT_METHOD(setApplicationIconBadgeNumber:(double)number) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCTSharedApplication().applicationIconBadgeNumber = number; -#else // [TODO(macOS GH#774) +#else // [macOS NSDockTile *tile = [NSApp dockTile]; tile.showsApplicationBadge = number > 0; tile.badgeLabel = number > 0 ? [NSString stringWithFormat:@"%.0lf", number] : nil; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } /** @@ -367,28 +367,28 @@ - (void)handleRemoteNotificationRegistrationError:(NSNotification *)notification */ RCT_EXPORT_METHOD(getApplicationIconBadgeNumber:(RCTResponseSenderBlock)callback) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] callback(@[@(RCTSharedApplication().applicationIconBadgeNumber)]); -#else // [TODO(macOS GH#774) +#else // [macOS callback(@[@([NSApp dockTile].badgeLabel.integerValue)]); -#endif // ]TODO(macOS GH#774) +#endif // macOS] } RCT_EXPORT_METHOD(requestPermissions:(JS::NativePushNotificationManagerIOS::SpecRequestPermissionsPermission &)permissions resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] if (RCTRunningInAppExtension()) { reject(kErrorUnableToRequestPermissions, nil, RCTErrorWithMessage(@"Requesting push notifications is currently unavailable in an app extension")); return; } -#endif // TODO(macOS GH#774) +#endif // [macOS] // Add a listener to make sure that startObserving has been called [self addListener:@"remoteNotificationsRegistered"]; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UIUserNotificationType types = UIUserNotificationTypeNone; if (permissions.alert()) { @@ -413,7 +413,7 @@ - (void)handleRemoteNotificationRegistrationError:(NSNotification *)notification }]; } }]; -#else // [TODO(macOS GH#774) +#else // [macOS NSRemoteNotificationType types = NSRemoteNotificationTypeNone; if (permissions.alert()) { types |= NSRemoteNotificationTypeAlert; @@ -425,7 +425,7 @@ - (void)handleRemoteNotificationRegistrationError:(NSNotification *)notification types |= NSRemoteNotificationTypeSound; } [RCTSharedApplication() registerForRemoteNotificationTypes:types]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } RCT_EXPORT_METHOD(abandonPermissions) @@ -435,40 +435,40 @@ - (void)handleRemoteNotificationRegistrationError:(NSNotification *)notification RCT_EXPORT_METHOD(checkPermissions:(RCTResponseSenderBlock)callback) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] if (RCTRunningInAppExtension()) { callback(@[RCTSettingsDictForUNNotificationSettings(NO, NO, NO)]); return; } -#endif // TODO(macOS GH#774) +#endif // [macOS] -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [UNUserNotificationCenter.currentNotificationCenter getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) { callback(@[RCTPromiseResolveValueForUNNotificationSettings(settings)]); }]; -#else // [TODO(macOS GH#774) +#else // [macOS NSRemoteNotificationType types = RCTSharedApplication().enabledRemoteNotificationTypes; callback(@[@{ @"alert": @((types & NSRemoteNotificationTypeAlert) > 0), @"badge": @((types & NSRemoteNotificationTypeBadge) > 0), @"sound": @((types & NSRemoteNotificationTypeSound) > 0), }]); -#endif // ]TODO(macOS GH#774) +#endif // macOS] } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] static inline NSDictionary *RCTPromiseResolveValueForUNNotificationSettings(UNNotificationSettings* _Nonnull settings) { return RCTSettingsDictForUNNotificationSettings(settings.alertSetting == UNNotificationSettingEnabled, settings.badgeSetting == UNNotificationSettingEnabled, settings.soundSetting == UNNotificationSettingEnabled); } -#endif +#endif // [macOS] static inline NSDictionary *RCTSettingsDictForUNNotificationSettings(BOOL alert, BOOL badge, BOOL sound) { return @{@"alert": @(alert), @"badge": @(badge), @"sound": @(sound)}; } -#if !TARGET_OS_OSX +#if !TARGET_OS_OSX // [macOS] RCT_EXPORT_METHOD(presentLocalNotification:(JS::NativePushNotificationManagerIOS::Notification &)notification) { NSMutableDictionary *notificationDict = [NSMutableDictionary new]; @@ -489,14 +489,14 @@ - (void)handleRemoteNotificationRegistrationError:(NSNotification *)notification } [RCTSharedApplication() presentLocalNotificationNow:[RCTConvert UILocalNotification:notificationDict]]; } -#else // [TODO(macOS GH#774) +#else // [macOS RCT_EXPORT_METHOD(presentLocalNotification:(NSUserNotification *)notification) { [[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification]; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCT_EXPORT_METHOD(scheduleLocalNotification:(JS::NativePushNotificationManagerIOS::Notification &)notification) { NSMutableDictionary *notificationDict = [NSMutableDictionary new]; @@ -517,31 +517,31 @@ - (void)handleRemoteNotificationRegistrationError:(NSNotification *)notification } [RCTSharedApplication() scheduleLocalNotification:[RCTConvert UILocalNotification:notificationDict]]; } -#else // [TODO(macOS GH#774) +#else // [macOS RCT_EXPORT_METHOD(scheduleLocalNotification:(NSUserNotification *)notification) { [[NSUserNotificationCenter defaultUserNotificationCenter] scheduleNotification:notification]; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] RCT_EXPORT_METHOD(cancelAllLocalNotifications) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [RCTSharedApplication() cancelAllLocalNotifications]; -#else // [TODO(macOS GH#774) +#else // [macOS for (NSUserNotification *notif in [NSUserNotificationCenter defaultUserNotificationCenter].scheduledNotifications) { [[NSUserNotificationCenter defaultUserNotificationCenter] removeScheduledNotification:notif]; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] } RCT_EXPORT_METHOD(cancelLocalNotifications:(NSDictionary *)userInfo) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] for (UILocalNotification *notification in RCTSharedApplication().scheduledLocalNotifications) { -#else // [TODO(macOS GH#774) +#else // [macOS for (NSUserNotification *notification in [NSUserNotificationCenter defaultUserNotificationCenter].scheduledNotifications) { -#endif // ]TODO(macOS GH#774) +#endif // macOS] __block BOOL matchesAll = YES; NSDictionary *notificationInfo = notification.userInfo; // Note: we do this with a loop instead of just `isEqualToDictionary:` @@ -554,22 +554,22 @@ - (void)handleRemoteNotificationRegistrationError:(NSNotification *)notification *stop = YES; } }]; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] if (matchesAll) { [RCTSharedApplication() cancelLocalNotification:notification]; } -#else // [TODO(macOS GH#774) +#else // [macOS if ([notification.identifier isEqualToString:userInfo[@"identifier"]] || matchesAll) { [[NSUserNotificationCenter defaultUserNotificationCenter] removeScheduledNotification:notification]; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] } } RCT_EXPORT_METHOD(getInitialNotification:(RCTPromiseResolveBlock)resolve reject:(__unused RCTPromiseRejectBlock)reject) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] NSMutableDictionary *initialNotification = [self.bridge.launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey] mutableCopy]; @@ -584,62 +584,62 @@ - (void)handleRemoteNotificationRegistrationError:(NSNotification *)notification } else { resolve((id)kCFNull); } -#else // [TODO(macOS GH#774) +#else // [macOS NSUserNotification *initialNotification = self.bridge.launchOptions[NSApplicationLaunchUserNotificationKey]; if (initialNotification) { resolve(RCTFormatUserNotification(initialNotification)); } else { resolve((id)kCFNull); } -#endif // ]TODO(macOS GH#774) +#endif // macOS] } RCT_EXPORT_METHOD(getScheduledLocalNotifications:(RCTResponseSenderBlock)callback) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] NSArray *scheduledLocalNotifications = RCTSharedApplication().scheduledLocalNotifications; -#endif // TODO(macOS GH#774) +#endif // [macOS] NSMutableArray *formattedScheduledLocalNotifications = [NSMutableArray new]; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] for (UILocalNotification *notification in scheduledLocalNotifications) { [formattedScheduledLocalNotifications addObject:RCTFormatLocalNotification(notification)]; } -#else // [TODO(macOS GH#774) +#else // [macOS for (NSUserNotification *notification in [NSUserNotificationCenter defaultUserNotificationCenter].scheduledNotifications) { [formattedScheduledLocalNotifications addObject:RCTFormatUserNotification(notification)]; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] callback(@[formattedScheduledLocalNotifications]); } RCT_EXPORT_METHOD(removeAllDeliveredNotifications) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; [center removeAllDeliveredNotifications]; -#else // [TODO(macOS GH#774) +#else // [macOS [[NSUserNotificationCenter defaultUserNotificationCenter] removeAllDeliveredNotifications]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } RCT_EXPORT_METHOD(removeDeliveredNotifications:(NSArray *)identifiers) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; [center removeDeliveredNotificationsWithIdentifiers:identifiers]; -#else // [TODO(macOS GH#774) +#else // [macOS NSArray *notificationsToRemove = [[NSUserNotificationCenter defaultUserNotificationCenter].deliveredNotifications filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(NSUserNotification* evaluatedObject, NSDictionary * _Nullable bindings) { return [identifiers containsObject:evaluatedObject.identifier]; }]]; for (NSUserNotification *notification in notificationsToRemove) { [[NSUserNotificationCenter defaultUserNotificationCenter] removeDeliveredNotification:notification]; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] } RCT_EXPORT_METHOD(getDeliveredNotifications:(RCTResponseSenderBlock)callback) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; [center getDeliveredNotificationsWithCompletionHandler:^(NSArray *_Nonnull notifications) { NSMutableArray *formattedNotifications = [NSMutableArray new]; @@ -649,13 +649,13 @@ - (void)handleRemoteNotificationRegistrationError:(NSNotification *)notification } callback(@[formattedNotifications]); }]; -#else // [TODO(macOS GH#774) +#else // [macOS NSMutableArray *formattedNotifications = [NSMutableArray new]; for (NSUserNotification *notification in [NSUserNotificationCenter defaultUserNotificationCenter].deliveredNotifications) { [formattedNotifications addObject:RCTFormatUserNotification(notification)]; } callback(@[formattedNotifications]); -#endif // ]TODO(macOS GH#774) +#endif // macOS] } RCT_EXPORT_METHOD(getAuthorizationStatus:(RCTResponseSenderBlock)callback) diff --git a/Libraries/PushNotificationIOS/React-RCTPushNotification.podspec b/Libraries/PushNotificationIOS/React-RCTPushNotification.podspec index 3d338f9734868e..41d1bc1a82b898 100644 --- a/Libraries/PushNotificationIOS/React-RCTPushNotification.podspec +++ b/Libraries/PushNotificationIOS/React-RCTPushNotification.podspec @@ -27,7 +27,7 @@ Pod::Spec.new do |s| s.documentation_url = "https://reactnative.dev/docs/pushnotificationios" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "11.0", :osx => "10.15" } # TODO(macOS GH#214) + s.platforms = { :ios => "11.0", :osx => "10.15" } # [macOS] s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness' s.source = source s.source_files = "*.{m,mm}" diff --git a/Libraries/RCTRequired/RCTRequired.podspec b/Libraries/RCTRequired/RCTRequired.podspec index 2b13fbd2381236..6a904c7f08e8cc 100644 --- a/Libraries/RCTRequired/RCTRequired.podspec +++ b/Libraries/RCTRequired/RCTRequired.podspec @@ -23,7 +23,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "11.0", :osx => "10.15" } # TODO(macOS GH#774) + s.platforms = { :ios => "11.0", :osx => "10.15" } # [macOS] s.source = source s.source_files = "**/*.{c,h,m,mm,cpp}" s.header_dir = "RCTRequired" diff --git a/Libraries/ReactNative/PaperUIManager.js b/Libraries/ReactNative/PaperUIManager.js index 6e553652d13335..227342ad3b02e7 100644 --- a/Libraries/ReactNative/PaperUIManager.js +++ b/Libraries/ReactNative/PaperUIManager.js @@ -155,7 +155,7 @@ function lazifyViewManagerConfig(viewName) { * only needed for iOS, which puts the constants in the ViewManager * namespace instead of UIManager, unlike Android. */ -if (Platform.OS === 'ios' || Platform.OS === 'macos' /* TODO(macOS GH#774) */) { +if (Platform.OS === 'ios' || Platform.OS === 'macos' /* [macOS] */) { Object.keys(getConstants()).forEach(viewName => { lazifyViewManagerConfig(viewName); }); diff --git a/Libraries/Settings/RCTSettingsManager.mm b/Libraries/Settings/RCTSettingsManager.mm index 509dc1439a8b62..f97f58eb125493 100644 --- a/Libraries/Settings/RCTSettingsManager.mm +++ b/Libraries/Settings/RCTSettingsManager.mm @@ -23,9 +23,9 @@ @implementation RCTSettingsManager BOOL _ignoringUpdates; NSUserDefaults *_defaults; -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS BOOL _isListeningForUpdates; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } @synthesize moduleRegistry = _moduleRegistry; @@ -47,12 +47,12 @@ - (instancetype)initWithUserDefaults:(NSUserDefaults *)defaults if ((self = [super init])) { _defaults = defaults; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(userDefaultsDidChange:) name:NSUserDefaultsDidChangeNotification object:_defaults]; -#endif // TODO(macOS GH#774) +#endif // [macOS] } return self; } @@ -117,7 +117,7 @@ - (void)userDefaultsDidChange:(NSNotification *)note _ignoringUpdates = NO; } -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS /** * Enable or disable monitoring of changes to NSUserDefaults */ @@ -140,7 +140,7 @@ - (void)userDefaultsDidChange:(NSNotification *)note } } } -#endif // ]TODO(macOS GH#774) +#endif // macOS] - (std::shared_ptr)getTurboModule:(const facebook::react::ObjCTurboModule::InitParams &)params { diff --git a/Libraries/Settings/React-RCTSettings.podspec b/Libraries/Settings/React-RCTSettings.podspec index 63f39da7a8e2d6..55852badde32cd 100644 --- a/Libraries/Settings/React-RCTSettings.podspec +++ b/Libraries/Settings/React-RCTSettings.podspec @@ -27,7 +27,7 @@ Pod::Spec.new do |s| s.documentation_url = "https://reactnative.dev/docs/settings" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "11.0", :osx => "10.15" } # TODO(macOS GH#214) + s.platforms = { :ios => "11.0", :osx => "10.15" } # [macOS] s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness' s.source = source s.source_files = "*.{m,mm}" diff --git a/Libraries/Settings/Settings.macos.js b/Libraries/Settings/Settings.macos.js index 239d0bba5da9de..3a97e107580975 100644 --- a/Libraries/Settings/Settings.macos.js +++ b/Libraries/Settings/Settings.macos.js @@ -8,7 +8,7 @@ * @flow */ -// TODO(macOS GH#774) +// [macOS] /* $FlowFixMe allow macOS to share iOS file */ const Settings = require('./Settings.ios'); diff --git a/Libraries/StyleSheet/PlatformColorValueTypes.macos.js b/Libraries/StyleSheet/PlatformColorValueTypes.macos.js index 58e36cde7bbd47..e66c1a24a822c8 100644 --- a/Libraries/StyleSheet/PlatformColorValueTypes.macos.js +++ b/Libraries/StyleSheet/PlatformColorValueTypes.macos.js @@ -7,7 +7,9 @@ * @format * @flow strict-local */ -// [TODO(macOS GH#774) + +// [macOS] + 'use strict'; import type {ColorValue} from './StyleSheet'; @@ -138,4 +140,3 @@ export const processColorObject = ( } return color; }; -// ]TODO(macOS GH#774) diff --git a/Libraries/StyleSheet/PlatformColorValueTypesMacOS.js b/Libraries/StyleSheet/PlatformColorValueTypesMacOS.js index 53955c5200c91d..9b9506e8a45f2f 100644 --- a/Libraries/StyleSheet/PlatformColorValueTypesMacOS.js +++ b/Libraries/StyleSheet/PlatformColorValueTypesMacOS.js @@ -7,7 +7,9 @@ * @format * @flow strict-local */ -// [TODO(macOS GH#774) + +// [macOS] + 'use strict'; import type {ColorValue} from './StyleSheet'; @@ -40,4 +42,3 @@ export const ColorWithSystemEffectMacOS = ( 'ColorWithSystemEffectMacOS is not available on this platform.', ); }; -// ]TODO(macOS GH#774) diff --git a/Libraries/StyleSheet/PlatformColorValueTypesMacOS.macos.js b/Libraries/StyleSheet/PlatformColorValueTypesMacOS.macos.js index a3d5d99d59c45c..000976bd1980a8 100644 --- a/Libraries/StyleSheet/PlatformColorValueTypesMacOS.macos.js +++ b/Libraries/StyleSheet/PlatformColorValueTypesMacOS.macos.js @@ -7,7 +7,9 @@ * @format * @flow strict-local */ -// [TODO(macOS GH#774) + +// [macOS] + 'use strict'; import type {ColorValue} from './StyleSheet'; @@ -47,4 +49,3 @@ export const ColorWithSystemEffectMacOS = ( ): ColorValue => { return ColorWithSystemEffectMacOSPrivate(color, effect); }; -// ]TODO(macOS GH#774) diff --git a/Libraries/StyleSheet/StyleSheetTypes.js b/Libraries/StyleSheet/StyleSheetTypes.js index efe943a0c07081..fad5e18ac1ffbf 100644 --- a/Libraries/StyleSheet/StyleSheetTypes.js +++ b/Libraries/StyleSheet/StyleSheetTypes.js @@ -637,11 +637,11 @@ export type ____TextStyle_Internal = $ReadOnly<{| | 'tabular-nums' | 'proportional-nums', >, - apple_fontSmoothing?: + apple_fontSmoothing?: // [macOS | 'auto' | 'none' | 'antialiased' - | 'subpixel-antialiased', // TODO(OSS Candidate ISS#2710739) + | 'subpixel-antialiased', // macOS] textShadowOffset?: $ReadOnly<{| width: number, height: number, diff --git a/Libraries/StyleSheet/processTransform.js b/Libraries/StyleSheet/processTransform.js index 89400fd0433475..a5155ee00a00af 100644 --- a/Libraries/StyleSheet/processTransform.js +++ b/Libraries/StyleSheet/processTransform.js @@ -37,7 +37,7 @@ function processTransform( if ( Platform.OS === 'android' || Platform.OS === 'ios' || - Platform.OS === 'macos' /* TODO(macOS GH#774) */ + Platform.OS === 'macos' // [macOS] ) { return transform; } diff --git a/Libraries/Text/BaseText/RCTBaseTextViewManager.m b/Libraries/Text/BaseText/RCTBaseTextViewManager.m index e1ab16e0918d46..fc4a1e87cfb6ed 100644 --- a/Libraries/Text/BaseText/RCTBaseTextViewManager.m +++ b/Libraries/Text/BaseText/RCTBaseTextViewManager.m @@ -6,15 +6,15 @@ */ #import -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS #import -#endif // ]TODO(macOS GH#774) +#endif // macOS] @implementation RCTBaseTextViewManager RCT_EXPORT_MODULE(RCTBaseText) -- (RCTUIView *)view // TODO(macOS ISS#3536887) +- (RCTUIView *)view // [macOS] { RCTAssert(NO, @"The `-[RCTBaseTextViewManager view]` property must be overridden in subclass."); return nil; @@ -39,10 +39,10 @@ - (RCTShadowView *)shadowView RCT_REMAP_SHADOW_PROPERTY(fontStyle, textAttributes.fontStyle, NSString) RCT_REMAP_SHADOW_PROPERTY(fontVariant, textAttributes.fontVariant, NSArray) RCT_REMAP_SHADOW_PROPERTY(allowFontScaling, textAttributes.allowFontScaling, BOOL) -RCT_REMAP_SHADOW_PROPERTY(dynamicTypeRamp, textAttributes.dynamicTypeRamp, RCTDynamicTypeRamp) // TODO(macOS GH#774) +RCT_REMAP_SHADOW_PROPERTY(dynamicTypeRamp, textAttributes.dynamicTypeRamp, RCTDynamicTypeRamp) // [macOS] RCT_REMAP_SHADOW_PROPERTY(maxFontSizeMultiplier, textAttributes.maxFontSizeMultiplier, CGFloat) RCT_REMAP_SHADOW_PROPERTY(letterSpacing, textAttributes.letterSpacing, CGFloat) -RCT_REMAP_SHADOW_PROPERTY(apple_fontSmoothing, textAttributes.fontSmoothing, RCTFontSmoothing) // TODO(OSS Candidate ISS#2710739) +RCT_REMAP_SHADOW_PROPERTY(apple_fontSmoothing, textAttributes.fontSmoothing, RCTFontSmoothing) // [macOS] // Paragraph Styles RCT_REMAP_SHADOW_PROPERTY(lineHeight, textAttributes.lineHeight, CGFloat) RCT_REMAP_SHADOW_PROPERTY(textAlign, textAttributes.alignment, NSTextAlignment) @@ -59,8 +59,8 @@ - (RCTShadowView *)shadowView RCT_REMAP_SHADOW_PROPERTY(isHighlighted, textAttributes.isHighlighted, BOOL) RCT_REMAP_SHADOW_PROPERTY(textTransform, textAttributes.textTransform, RCTTextTransform) -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS RCT_REMAP_SHADOW_PROPERTY(cursor, textAttributes.cursor, RCTCursor) -#endif // ]TODO(macOS GH#774) +#endif // macOS] @end diff --git a/Libraries/Text/RCTConvert+Text.h b/Libraries/Text/RCTConvert+Text.h index 8edfb4d63547bf..42693b67f17992 100644 --- a/Libraries/Text/RCTConvert+Text.h +++ b/Libraries/Text/RCTConvert+Text.h @@ -11,7 +11,7 @@ NS_ASSUME_NONNULL_BEGIN -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS typedef enum UITextAutocorrectionType : NSInteger { UITextAutocorrectionTypeDefault, UITextAutocorrectionTypeNo, @@ -23,7 +23,7 @@ typedef enum UITextSpellCheckingType : NSInteger { UITextSpellCheckingTypeNo, UITextSpellCheckingTypeYes, } UITextSpellCheckingType; -#endif // ]TODO(macOS GH#774)] +#endif // macOS] @interface RCTConvert (Text) diff --git a/Libraries/Text/RCTTextAttributes.h b/Libraries/Text/RCTTextAttributes.h index 5056db9d4699fc..3db3d9b8a87004 100644 --- a/Libraries/Text/RCTTextAttributes.h +++ b/Libraries/Text/RCTTextAttributes.h @@ -5,20 +5,20 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import -#import // TODO(macOS GH#774) -#import // TODO(macOS GH#774) +#import // [macOS] +#import // [macOS] #import "RCTTextTransform.h" -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS #import -#endif // ]TODO(macOS GH#774) +#endif // macOS] NS_ASSUME_NONNULL_BEGIN extern NSString *const RCTTextAttributesIsHighlightedAttributeName; -extern NSString *const RCTTextAttributesFontSmoothingAttributeName; // TODO(OSS Candidate ISS#2710739) +extern NSString *const RCTTextAttributesFontSmoothingAttributeName; // [macOS] extern NSString *const RCTTextAttributesTagAttributeName; /** @@ -29,8 +29,8 @@ extern NSString *const RCTTextAttributesTagAttributeName; @interface RCTTextAttributes : NSObject // Color -@property (nonatomic, strong, nullable) RCTUIColor *foregroundColor; // TODO(OSS Candidate ISS#2710739) -@property (nonatomic, strong, nullable) RCTUIColor *backgroundColor; // TODO(OSS Candidate ISS#2710739) +@property (nonatomic, strong, nullable) RCTUIColor *foregroundColor; // [macOS] +@property (nonatomic, strong, nullable) RCTUIColor *backgroundColor; // [macOS] @property (nonatomic, assign) CGFloat opacity; // Font @property (nonatomic, copy, nullable) NSString *fontFamily; @@ -41,31 +41,31 @@ extern NSString *const RCTTextAttributesTagAttributeName; @property (nonatomic, copy, nullable) NSString *fontStyle; @property (nonatomic, copy, nullable) NSArray *fontVariant; @property (nonatomic, assign) BOOL allowFontScaling; -@property (nonatomic, assign) RCTDynamicTypeRamp dynamicTypeRamp; // TODO(macOS GH#774) +@property (nonatomic, assign) RCTDynamicTypeRamp dynamicTypeRamp; // [macOS] @property (nonatomic, assign) CGFloat letterSpacing; -@property (nonatomic, assign) RCTFontSmoothing fontSmoothing; // TODO(OSS Candidate ISS#2710739) -@property (class, nonatomic, assign) RCTFontSmoothing fontSmoothingDefault; // TODO(OSS Candidate ISS#2710739) +@property (nonatomic, assign) RCTFontSmoothing fontSmoothing; // [macOS] +@property (class, nonatomic, assign) RCTFontSmoothing fontSmoothingDefault; // [macOS] // Paragraph Styles @property (nonatomic, assign) CGFloat lineHeight; @property (nonatomic, assign) NSTextAlignment alignment; @property (nonatomic, assign) NSWritingDirection baseWritingDirection; // Decoration -@property (nonatomic, strong, nullable) RCTUIColor *textDecorationColor; // TODO(OSS Candidate ISS#2710739) +@property (nonatomic, strong, nullable) RCTUIColor *textDecorationColor; // [macOS] @property (nonatomic, assign) NSUnderlineStyle textDecorationStyle; @property (nonatomic, assign) RCTTextDecorationLineType textDecorationLine; // Shadow @property (nonatomic, assign) CGSize textShadowOffset; @property (nonatomic, assign) CGFloat textShadowRadius; -@property (nonatomic, strong, nullable) RCTUIColor *textShadowColor; // TODO(OSS Candidate ISS#2710739) +@property (nonatomic, strong, nullable) RCTUIColor *textShadowColor; // [macOS] // Special @property (nonatomic, assign) BOOL isHighlighted; @property (nonatomic, strong, nullable) NSNumber *tag; @property (nonatomic, assign) UIUserInterfaceLayoutDirection layoutDirection; @property (nonatomic, assign) RCTTextTransform textTransform; -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS @property (nonatomic, assign) RCTCursor cursor; -#endif // ]TODO(macOS GH#774) +#endif // macOS] #pragma mark - Inheritance @@ -96,8 +96,8 @@ extern NSString *const RCTTextAttributesTagAttributeName; /** * Foreground and background colors with opacity and right defaults. */ -- (RCTUIColor *)effectiveForegroundColor; // TODO(OSS Candidate ISS#2710739) -- (RCTUIColor *)effectiveBackgroundColor; // TODO(OSS Candidate ISS#2710739) +- (RCTUIColor *)effectiveForegroundColor; // [macOS] +- (RCTUIColor *)effectiveBackgroundColor; // [macOS] /** * Text transformed per 'none', 'uppercase', 'lowercase', 'capitalize' diff --git a/Libraries/Text/RCTTextAttributes.m b/Libraries/Text/RCTTextAttributes.m index e682cb016b134f..897365c84ec72c 100644 --- a/Libraries/Text/RCTTextAttributes.m +++ b/Libraries/Text/RCTTextAttributes.m @@ -11,17 +11,17 @@ #import #import -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS #import -#endif // ]TODO(macOS GH#774) +#endif // macOS] NSString *const RCTTextAttributesIsHighlightedAttributeName = @"RCTTextAttributesIsHighlightedAttributeName"; -NSString *const RCTTextAttributesFontSmoothingAttributeName = @"RCTTextAttributesFontSmoothingAttributeName"; // TODO(OSS Candidate ISS#2710739) +NSString *const RCTTextAttributesFontSmoothingAttributeName = @"RCTTextAttributesFontSmoothingAttributeName"; // [macOS] NSString *const RCTTextAttributesTagAttributeName = @"RCTTextAttributesTagAttributeName"; @implementation RCTTextAttributes -// [TODO(macOS GH#774) +// [macOS + (RCTUIColor *)defaultForegroundColor { if (@available(iOS 13.0, *)) { @@ -30,7 +30,7 @@ + (RCTUIColor *)defaultForegroundColor return [RCTUIColor blackColor]; } } -// ]TODO(macOS GH#774) +// macOS] - (instancetype)init { @@ -46,12 +46,12 @@ - (instancetype)init _textShadowRadius = NAN; _opacity = NAN; _textTransform = RCTTextTransformUndefined; - // [TODO(macOS GH#774) + // [macOS _foregroundColor = [RCTTextAttributes defaultForegroundColor]; - // ]TODO(macOS GH#774) -#if TARGET_OS_OSX // [TODO(macOS GH#774) + // macOS] +#if TARGET_OS_OSX // [macOS _cursor = RCTCursorAuto; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } return self; @@ -77,9 +77,9 @@ - (void)applyTextAttributes:(RCTTextAttributes *)textAttributes _fontStyle = textAttributes->_fontStyle ?: _fontStyle; _fontVariant = textAttributes->_fontVariant ?: _fontVariant; _allowFontScaling = textAttributes->_allowFontScaling || _allowFontScaling; // * - _dynamicTypeRamp = textAttributes->_dynamicTypeRamp != RCTDynamicTypeRampUndefined ? textAttributes->_dynamicTypeRamp : _dynamicTypeRamp; // TODO(macOS GH#774) + _dynamicTypeRamp = textAttributes->_dynamicTypeRamp != RCTDynamicTypeRampUndefined ? textAttributes->_dynamicTypeRamp : _dynamicTypeRamp; // [macOS] _letterSpacing = !isnan(textAttributes->_letterSpacing) ? textAttributes->_letterSpacing : _letterSpacing; - _fontSmoothing = textAttributes->_fontSmoothing != RCTFontSmoothingAuto ? textAttributes->_fontSmoothing : _fontSmoothing; // TODO(OSS Candidate ISS#2710739) + _fontSmoothing = textAttributes->_fontSmoothing != RCTFontSmoothingAuto ? textAttributes->_fontSmoothing : _fontSmoothing; // [macOS] // Paragraph Styles _lineHeight = !isnan(textAttributes->_lineHeight) ? textAttributes->_lineHeight : _lineHeight; @@ -102,9 +102,9 @@ - (void)applyTextAttributes:(RCTTextAttributes *)textAttributes _layoutDirection = textAttributes->_layoutDirection != UIUserInterfaceLayoutDirectionLeftToRight ? textAttributes->_layoutDirection : _layoutDirection; _textTransform = textAttributes->_textTransform != RCTTextTransformUndefined ? textAttributes->_textTransform : _textTransform; -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS _cursor = textAttributes->_cursor != RCTCursorAuto ? textAttributes->_cursor : _cursor; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } - (NSParagraphStyle *)effectiveParagraphStyle @@ -157,7 +157,7 @@ - (NSParagraphStyle *)effectiveParagraphStyle } // Colors - RCTUIColor *effectiveForegroundColor = self.effectiveForegroundColor; // TODO(OSS Candidate ISS#2710739) + RCTUIColor *effectiveForegroundColor = self.effectiveForegroundColor; // [macOS] if (_foregroundColor || !isnan(_opacity)) { attributes[NSForegroundColorAttributeName] = effectiveForegroundColor; @@ -211,21 +211,21 @@ - (NSParagraphStyle *)effectiveParagraphStyle attributes[RCTTextAttributesIsHighlightedAttributeName] = @YES; } - // [TODO(macOS GH#774) + // [macOS if (_fontSmoothing != RCTFontSmoothingAuto) { attributes[RCTTextAttributesFontSmoothingAttributeName] = @(_fontSmoothing); } - // ]TODO(macOS GH#774) + // macOS] if (_tag) { attributes[RCTTextAttributesTagAttributeName] = _tag; } -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS if (_cursor != RCTCursorAuto) { attributes[NSCursorAttributeName] = [RCTConvert NSCursor:_cursor]; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] return [attributes copy]; } @@ -248,13 +248,13 @@ - (CGFloat)effectiveFontSizeMultiplier if (fontScalingEnabled) { CGFloat fontSizeMultiplier = !isnan(_fontSizeMultiplier) ? _fontSizeMultiplier : 1.0; -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] if (_dynamicTypeRamp != RCTDynamicTypeRampUndefined) { UIFontMetrics *fontMetrics = RCTUIFontMetricsForDynamicTypeRamp(_dynamicTypeRamp); CGFloat baseSize = RCTBaseSizeForDynamicTypeRamp(_dynamicTypeRamp); fontSizeMultiplier = [fontMetrics scaledValueForValue:baseSize] / baseSize; } -#endif // ]TODO(macOS GH#774) +#endif // [macOS] CGFloat maxFontSizeMultiplier = !isnan(_maxFontSizeMultiplier) ? _maxFontSizeMultiplier : 0.0; return maxFontSizeMultiplier >= 1.0 ? fminf(maxFontSizeMultiplier, fontSizeMultiplier) : fontSizeMultiplier; } else { @@ -262,9 +262,9 @@ - (CGFloat)effectiveFontSizeMultiplier } } -- (RCTUIColor *)effectiveForegroundColor // TODO(OSS Candidate ISS#2710739) +- (RCTUIColor *)effectiveForegroundColor // [macOS] { - RCTUIColor *effectiveForegroundColor = _foregroundColor ?: [RCTUIColor blackColor]; // TODO(OSS Candidate ISS#2710739) + RCTUIColor *effectiveForegroundColor = _foregroundColor ?: [RCTUIColor blackColor]; // [macOS] if (!isnan(_opacity)) { effectiveForegroundColor = [effectiveForegroundColor colorWithAlphaComponent:CGColorGetAlpha(effectiveForegroundColor.CGColor) * _opacity]; @@ -273,15 +273,15 @@ - (RCTUIColor *)effectiveForegroundColor // TODO(OSS Candidate ISS#2710739) return effectiveForegroundColor; } -- (RCTUIColor *)effectiveBackgroundColor // TODO(OSS Candidate ISS#2710739) +- (RCTUIColor *)effectiveBackgroundColor // [macOS] { - RCTUIColor *effectiveBackgroundColor = _backgroundColor;// ?: [[UIColor whiteColor] colorWithAlphaComponent:0]; // TODO(OSS Candidate ISS#2710739) + RCTUIColor *effectiveBackgroundColor = _backgroundColor;// ?: [[UIColor whiteColor] colorWithAlphaComponent:0]; // [macOS] if (effectiveBackgroundColor && !isnan(_opacity)) { effectiveBackgroundColor = [effectiveBackgroundColor colorWithAlphaComponent:CGColorGetAlpha(effectiveBackgroundColor.CGColor) * _opacity]; } - return effectiveBackgroundColor ?: [RCTUIColor clearColor]; // TODO(OSS Candidate ISS#2710739) + return effectiveBackgroundColor ?: [RCTUIColor clearColor]; // [macOS] } static NSString *capitalizeText(NSString *text) @@ -353,9 +353,9 @@ - (BOOL)isEqual:(RCTTextAttributes *)textAttributes RCTTextAttributesCompareObjects(_fontStyle) && RCTTextAttributesCompareObjects(_fontVariant) && RCTTextAttributesCompareOthers(_allowFontScaling) && - RCTTextAttributesCompareOthers(_dynamicTypeRamp) && // TODO(macOS GH#774) + RCTTextAttributesCompareOthers(_dynamicTypeRamp) && // [macOS] RCTTextAttributesCompareFloats(_letterSpacing) && - RCTTextAttributesCompareOthers(_fontSmoothing) && // TODO(OSS Candidate ISS#2710739) + RCTTextAttributesCompareOthers(_fontSmoothing) && // [macOS] // Paragraph Styles RCTTextAttributesCompareFloats(_lineHeight) && RCTTextAttributesCompareFloats(_alignment) && @@ -375,7 +375,7 @@ - (BOOL)isEqual:(RCTTextAttributes *)textAttributes RCTTextAttributesCompareOthers(_textTransform); } -// [TODO(OSS Candidate ISS#2710739) +// [macOS static RCTFontSmoothing _fontSmoothingDefault = RCTFontSmoothingAuto; + (RCTFontSmoothing)fontSmoothingDefault { @@ -385,6 +385,6 @@ + (RCTFontSmoothing)fontSmoothingDefault { + (void)setFontSmoothingDefault:(RCTFontSmoothing)fontSmoothingDefault { _fontSmoothingDefault = fontSmoothingDefault; } -// ]TODO(OSS Candidate ISS#2710739) +// macOS] @end diff --git a/Libraries/Text/RCTTextUIKit.h b/Libraries/Text/RCTTextUIKit.h index 0401156211cc3b..34c0a703926fc2 100644 --- a/Libraries/Text/RCTTextUIKit.h +++ b/Libraries/Text/RCTTextUIKit.h @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ + // [macOS] + #include #if !TARGET_OS_OSX #import diff --git a/Libraries/Text/RawText/RCTRawTextShadowView.m b/Libraries/Text/RawText/RCTRawTextShadowView.m index a5c38eed90e142..8fb9c8a4807d7f 100644 --- a/Libraries/Text/RawText/RCTRawTextShadowView.m +++ b/Libraries/Text/RawText/RCTRawTextShadowView.m @@ -24,12 +24,12 @@ - (void)dirtyLayout [self.superview dirtyLayout]; } -#if DEBUG // TODO(macOS GH#774) description is a debug-only feature +#if DEBUG // [macOS description is a debug-only feature - (NSString *)description { NSString *superDescription = super.description; return [[superDescription substringToIndex:superDescription.length - 1] stringByAppendingFormat:@"; text: %@>", self.text]; } -#endif // TODO(macOS GH#774) +#endif // macOS] @end diff --git a/Libraries/Text/RawText/RCTRawTextViewManager.m b/Libraries/Text/RawText/RCTRawTextViewManager.m index d75dcc6cf25871..d9e349eefbb17e 100644 --- a/Libraries/Text/RawText/RCTRawTextViewManager.m +++ b/Libraries/Text/RawText/RCTRawTextViewManager.m @@ -13,9 +13,9 @@ @implementation RCTRawTextViewManager RCT_EXPORT_MODULE(RCTRawText) -- (RCTUIView *)view // TODO(macOS ISS#3536887) +- (RCTUIView *)view // [macOS] { - return [RCTUIView new]; // TODO(macOS ISS#3536887) + return [RCTUIView new]; // [macOS] } - (RCTShadowView *)shadowView diff --git a/Libraries/Text/React-RCTText.podspec b/Libraries/Text/React-RCTText.podspec index 783e8a572d91ab..b25f2823ba5b38 100644 --- a/Libraries/Text/React-RCTText.podspec +++ b/Libraries/Text/React-RCTText.podspec @@ -24,10 +24,10 @@ Pod::Spec.new do |s| s.documentation_url = "https://reactnative.dev/docs/text" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "11.0", :osx => "10.15" } # TODO(macOS GH#214) + s.platforms = { :ios => "11.0", :osx => "10.15" } # [macOS] s.source = source s.source_files = "**/*.{h,m}" - s.ios.exclude_files = "**/macOS/*" # TODO(macOS GH#774) + s.ios.exclude_files = "**/macOS/*" # [macOS] s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs" s.header_dir = "RCTText" diff --git a/Libraries/Text/Text/NSTextStorage+FontScaling.h b/Libraries/Text/Text/NSTextStorage+FontScaling.h index 7c9ab641081368..5fa455d4bba336 100644 --- a/Libraries/Text/Text/NSTextStorage+FontScaling.h +++ b/Libraries/Text/Text/NSTextStorage+FontScaling.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] @interface NSTextStorage (FontScaling) diff --git a/Libraries/Text/Text/NSTextStorage+FontScaling.m b/Libraries/Text/Text/NSTextStorage+FontScaling.m index 6fa89eff83e7c5..f98c5a35b5a0b9 100644 --- a/Libraries/Text/Text/NSTextStorage+FontScaling.m +++ b/Libraries/Text/Text/NSTextStorage+FontScaling.m @@ -126,7 +126,7 @@ - (void)scaleFontSizeWithRatio:(CGFloat)ratio CGFloat fontSize = MAX(MIN(font.pointSize * ratio, maximumFontSize), minimumFontSize); [self addAttribute:NSFontAttributeName - value:UIFontWithSize(font, fontSize) // TODO(macOS GH#774) + value:UIFontWithSize(font, fontSize) // [macOS] range:range]; } ]; diff --git a/Libraries/Text/Text/RCTDynamicTypeRamp.h b/Libraries/Text/Text/RCTDynamicTypeRamp.h index b79c189ee65785..bc7109dbd93275 100644 --- a/Libraries/Text/Text/RCTDynamicTypeRamp.h +++ b/Libraries/Text/Text/RCTDynamicTypeRamp.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -// TODO(macOS GH#774) +// [macOS] #import @@ -32,9 +32,9 @@ typedef NS_ENUM(NSInteger, RCTDynamicTypeRamp) { @end -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS /// Generates a `UIFontMetrics` instance representing a particular Dynamic Type ramp. UIFontMetrics * _Nonnull RCTUIFontMetricsForDynamicTypeRamp(RCTDynamicTypeRamp dynamicTypeRamp); /// The "reference" size for a particular font scale ramp, equal to a text element's size under default text size settings. CGFloat RCTBaseSizeForDynamicTypeRamp(RCTDynamicTypeRamp dynamicTypeRamp); -#endif // ]TODO(macOS GH#774) +#endif // macOS] diff --git a/Libraries/Text/Text/RCTDynamicTypeRamp.m b/Libraries/Text/Text/RCTDynamicTypeRamp.m index bb584cd7d55771..4b4b03244cd98e 100644 --- a/Libraries/Text/Text/RCTDynamicTypeRamp.m +++ b/Libraries/Text/Text/RCTDynamicTypeRamp.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -// TODO(macOS GH#774) +// [macOS] #import @@ -27,7 +27,7 @@ @implementation RCTConvert (DynamicTypeRamp) @end -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS UIFontMetrics *RCTUIFontMetricsForDynamicTypeRamp(RCTDynamicTypeRamp dynamicTypeRamp) { static NSDictionary *mapping; static dispatch_once_t onceToken; @@ -74,4 +74,4 @@ CGFloat RCTBaseSizeForDynamicTypeRamp(RCTDynamicTypeRamp dynamicTypeRamp) { NSNumber *baseSize = mapping[@(dynamicTypeRamp)] ?: @17; // Default to body size if we don't recognize the specified ramp return CGFLOAT_IS_DOUBLE ? [baseSize doubleValue] : [baseSize floatValue]; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] diff --git a/Libraries/Text/Text/RCTTextShadowView.m b/Libraries/Text/Text/RCTTextShadowView.m index 617c0702edc2b7..9c433365e48782 100644 --- a/Libraries/Text/Text/RCTTextShadowView.m +++ b/Libraries/Text/Text/RCTTextShadowView.m @@ -99,16 +99,16 @@ - (void)uiManagerWillPerformMounting } ]; - [_bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary *viewRegistry) { // TODO(macOS ISS#3536887) + [_bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary *viewRegistry) { // [macOS] RCTTextView *textView = (RCTTextView *)viewRegistry[tag]; if (!textView) { return; } - NSMutableArray *descendantViews = // TODO(macOS ISS#3536887) + NSMutableArray *descendantViews = // [macOS] [NSMutableArray arrayWithCapacity:descendantViewTags.count]; [descendantViewTags enumerateObjectsUsingBlock:^(NSNumber *_Nonnull descendantViewTag, NSUInteger index, BOOL *_Nonnull stop) { - RCTUIView *descendantView = viewRegistry[descendantViewTag]; // TODO(macOS ISS#3536887) + RCTUIView *descendantView = viewRegistry[descendantViewTag]; // [macOS] if (!descendantView) { return; } @@ -158,11 +158,11 @@ - (void)postprocessAttributedText:(NSMutableAttributedString *)attributedText return; } - if (maximumLineHeight <= UIFontLineHeight(font)) { // TODO(macOS GH#774) + if (maximumLineHeight <= UIFontLineHeight(font)) { // [macOS] return; } - CGFloat baseLineOffset = maximumLineHeight / 2.0 - UIFontLineHeight(font) / 2.0; // TODO(macOS GH#774) + CGFloat baseLineOffset = maximumLineHeight / 2.0 - UIFontLineHeight(font) / 2.0; // [macOS] [attributedText addAttribute:NSBaselineOffsetAttributeName value:@(baseLineOffset) @@ -211,7 +211,7 @@ - (NSAttributedString *)attributedTextWithMeasuredAttachmentsThatFitSize:(CGSize - (NSTextStorage *)textStorageAndLayoutManagerThatFitsSize:(CGSize)size exclusiveOwnership:(BOOL)exclusiveOwnership { - NSValue *key = NSValueWithCGSize(size); // TODO(macOS GH#774) + NSValue *key = NSValueWithCGSize(size); // [macOS] NSTextStorage *cachedTextStorage = [_cachedTextStorages objectForKey:key]; if (cachedTextStorage) { @@ -303,21 +303,21 @@ - (void)layoutSubviewsWithContext:(RCTLayoutContext)layoutContext UIFont *font = [textStorage attribute:NSFontAttributeName atIndex:range.location effectiveRange:nil]; CGRect frame = {{ -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCTRoundPixelValue(glyphRect.origin.x), RCTRoundPixelValue(glyphRect.origin.y + glyphRect.size.height - attachmentSize.height + font.descender) -#else // [TODO(macOS GH#774) +#else // [macOS RCTRoundPixelValue(glyphRect.origin.x, [self scale]), RCTRoundPixelValue(glyphRect.origin.y + glyphRect.size.height - attachmentSize.height + font.descender, [self scale]) -#endif // ]TODO(macOS GH#774) +#endif // macOS] }, { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCTRoundPixelValue(attachmentSize.width), RCTRoundPixelValue(attachmentSize.height) -#else // [TODO(macOS GH#774) +#else // [macOS RCTRoundPixelValue(attachmentSize.width, [self scale]), RCTRoundPixelValue(attachmentSize.height, [self scale]) -#endif // ]TODO(macOS GH#774) +#endif // macOS] }}; NSRange truncatedGlyphRange = [layoutManager truncatedGlyphRangeInLineFragmentForGlyphAtIndex:range.location]; @@ -416,13 +416,13 @@ static YGSize RCTTextShadowViewMeasure(YGNodeRef node, float width, YGMeasureMod } size = (CGSize){ -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] MIN(RCTCeilPixelValue(size.width), maximumSize.width), MIN(RCTCeilPixelValue(size.height), maximumSize.height) -#else // [TODO(macOS GH#774) +#else // [macOS MIN(RCTCeilPixelValue(size.width, shadowTextView.scale), maximumSize.width), MIN(RCTCeilPixelValue(size.height, shadowTextView.scale), maximumSize.height) -#endif // ]TODO(macOS GH#774) +#endif // macOS] }; // Adding epsilon value illuminates problems with converting values from diff --git a/Libraries/Text/Text/RCTTextView.h b/Libraries/Text/Text/RCTTextView.h index 3b7bb9053c5fac..4e7b2f930def4f 100644 --- a/Libraries/Text/Text/RCTTextView.h +++ b/Libraries/Text/Text/RCTTextView.h @@ -6,21 +6,21 @@ */ #import -#import // TODO(OSS Candidate ISS#2710739) +#import // [macOS] -#import // TODO(macOS GH#774) +#import // [macOS] NS_ASSUME_NONNULL_BEGIN -@interface RCTTextView : RCTUIView // TODO(macOS ISS#3536887) +@interface RCTTextView : RCTUIView // [macOS] -- (instancetype)initWithEventDispatcher:(id)eventDispatcher; // TODO(OSS Candidate ISS#2710739) +- (instancetype)initWithEventDispatcher:(id)eventDispatcher; // [macOS] @property (nonatomic, assign) BOOL selectable; - (void)setTextStorage:(NSTextStorage *)textStorage contentFrame:(CGRect)contentFrame - descendantViews:(NSArray *)descendantViews; // TODO(macOS ISS#3536887) + descendantViews:(NSArray *)descendantViews; // [macOS] @end diff --git a/Libraries/Text/Text/RCTTextView.m b/Libraries/Text/Text/RCTTextView.m index a529681390db36..b675a16a71f7c2 100644 --- a/Libraries/Text/Text/RCTTextView.m +++ b/Libraries/Text/Text/RCTTextView.m @@ -7,20 +7,20 @@ #import -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] #import -#endif // TODO(macOS GH#774) +#endif // [macOS] -#import // TODO(macOS GH#774) +#import // [macOS] #import #import -#import // TODO(OSS Candidate ISS#2710739) +#import // [macOS] #import #import -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS // We are managing the key view loop using the RCTTextView. // Disable key view for backed NSTextView so we don't get double focus. @@ -39,25 +39,25 @@ - (BOOL)canBecomeKeyView @interface RCTTextView () @end -#endif // ]TODO(macOS GH#774) +#endif // macOS] @implementation RCTTextView { CAShapeLayer *_highlightLayer; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UILongPressGestureRecognizer *_longPressGestureRecognizer; -#else // [TODO(macOS GH#774) +#else // [macOS NSString * _accessibilityLabel; NSTextView *_textView; -#endif // ]TODO(macOS GH#774) +#endif // macOS] - id _eventDispatcher; // TODO(OSS Candidate ISS#2710739) - NSArray *_Nullable _descendantViews; // TODO(macOS ISS#3536887) + id _eventDispatcher; // [macOS] + NSArray *_Nullable _descendantViews; // [macOS] NSTextStorage *_Nullable _textStorage; CGRect _contentFrame; } -// [TODO(OSS Candidate ISS#2710739) +// [macOS - (instancetype)initWithEventDispatcher:(id)eventDispatcher { if ((self = [self initWithFrame:CGRectZero])) { @@ -65,16 +65,16 @@ - (instancetype)initWithEventDispatcher:(id)eventDis } return self; } -// ]TODO(OSS Candidate ISS#2710739) +// macOS] - (instancetype)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] self.isAccessibilityElement = YES; self.accessibilityTraits |= UIAccessibilityTraitStaticText; self.opaque = NO; -#else // [TODO(macOS GH#774) +#else // [macOS self.accessibilityRole = NSAccessibilityStaticTextRole; // Fix blurry text on non-retina displays. self.canDrawSubviewsIntoLayer = YES; @@ -90,21 +90,21 @@ - (instancetype)initWithFrame:(CGRect)frame _textView.layoutManager.usesFontLeading = NO; _textStorage = _textView.textStorage; [self addSubview:_textView]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] RCTUIViewSetContentModeRedraw(self); // TODO(macOS GH#774) and TODO(macOS ISS#3536887) } return self; } -#if DEBUG // TODO(macOS GH#774) description is a debug-only feature +#if DEBUG // [macOS description is a debug-only feature - (NSString *)description { - // [TODO(macOS GH#774): we shouldn't make assumptions on what super's description is. Just append additional content. + // [macOS we shouldn't make assumptions on what super's description is. Just append additional content. NSString *stringToAppend = [NSString stringWithFormat:@" reactTag: %@; text: %@", self.reactTag, _textStorage.string]; return [[super description] stringByAppendingString:stringToAppend]; - // TODO(macOS GH#774)] + // macOS] } -#endif // TODO(macOS GH#774) +#endif // macOS] - (void)setSelectable:(BOOL)selectable { @@ -114,22 +114,22 @@ - (void)setSelectable:(BOOL)selectable _selectable = selectable; -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] if (_selectable) { [self enableContextMenu]; } else { [self disableContextMenu]; } -#else +#else // [macOS _textView.selectable = _selectable; if (_selectable) { [self setFocusable:YES]; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)reactSetFrame:(CGRect)frame { // Text looks super weird if its frame is animated. @@ -138,7 +138,7 @@ - (void)reactSetFrame:(CGRect)frame [super reactSetFrame:frame]; }]; } -#endif // TODO(macOS GH#774) +#endif // [macOS] - (void)didUpdateReactSubviews { @@ -147,17 +147,17 @@ - (void)didUpdateReactSubviews - (void)setTextStorage:(NSTextStorage *)textStorage contentFrame:(CGRect)contentFrame - descendantViews:(NSArray *)descendantViews // TODO(macOS ISS#3536887) + descendantViews:(NSArray *)descendantViews // [macOS] { // This lets the textView own its text storage on macOS // We update and replace the text container `_textView.textStorage.attributedString` when text/layout changes -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] _textStorage = textStorage; -#endif // ]TODO(macOS GH#774) +#endif // [macOS] _contentFrame = contentFrame; -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS NSLayoutManager *layoutManager = textStorage.layoutManagers.firstObject; NSTextContainer *textContainer = layoutManager.textContainers.firstObject; @@ -178,16 +178,16 @@ - (void)setTextStorage:(NSTextStorage *)textStorage _textView.maxSize = contentFrame.size; _textView.frame = contentFrame; _textView.textStorage.attributedString = textStorage; -#endif // ]TODO(macOS GH#774) +#endif // macOS] // FIXME: Optimize this. - for (RCTUIView *view in _descendantViews) { // TODO(macOS ISS#3536887) + for (RCTUIView *view in _descendantViews) { // [macOS] [view removeFromSuperview]; } _descendantViews = descendantViews; - for (RCTUIView *view in descendantViews) { // TODO(macOS ISS#3536887) + for (RCTUIView *view in descendantViews) { // [macOS] [self addSubview:view]; } @@ -200,9 +200,9 @@ - (void)drawRect:(CGRect)rect // For iOS, UITextView api is not used for legacy performance reasons. A custom draw implementation is used instead. // On desktop, we use NSTextView to access api's for arbitrary selection, custom cursors etc... -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS return; -#endif // ]TODO(macOS GH#774) +#endif // macOS] if (!_textStorage) { return; @@ -224,7 +224,7 @@ - (void)drawRect:(CGRect)rect NSRange glyphRange = [layoutManager glyphRangeForTextContainer:textContainer]; NSRange characterRange = [layoutManager characterRangeForGlyphRange:glyphRange actualGlyphRange:NULL]; - // [TODO(OSS Candidate ISS#2710739) + // [macOS [_textStorage enumerateAttribute:RCTTextAttributesFontSmoothingAttributeName inRange:characterRange options:0 @@ -253,7 +253,7 @@ - (void)drawRect:(CGRect)rect [layoutManager drawGlyphsForGlyphRange:subGlyphRange atPoint:_contentFrame.origin]; CGContextRestoreGState(context); }]; - // ]TODO(OSS Candidate ISS#2710739) + // macOS] __block UIBezierPath *highlightPath = nil; [_textStorage enumerateAttribute:RCTTextAttributesIsHighlightedAttributeName @@ -270,13 +270,13 @@ - (void)drawRect:(CGRect)rect inTextContainer:textContainer usingBlock: ^(CGRect enclosingRect, __unused BOOL *anotherStop) { -#if !TARGET_OS_OSX // TODO(macOS ISS#3536887) +#if !TARGET_OS_OSX // [macOS] UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:CGRectInset(enclosingRect, -2, -2) cornerRadius:2]; -#else // TODO(macOS ISS#3536887) +#else // [macOS NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:CGRectInset(enclosingRect, -2, -2) xRadius:2 yRadius:2]; -#endif // TODO(macOS ISS#3536887) +#endif // macOS] if (highlightPath) { - UIBezierPathAppendPath(highlightPath, path); // TODO(macOS GH#774) + UIBezierPathAppendPath(highlightPath, path); // [macOS] } else { highlightPath = path; } @@ -287,11 +287,11 @@ - (void)drawRect:(CGRect)rect if (highlightPath) { if (!_highlightLayer) { _highlightLayer = [CAShapeLayer layer]; - _highlightLayer.fillColor = [RCTUIColor colorWithWhite:0 alpha:0.25].CGColor; // TODO(OSS Candidate ISS#2710739) + _highlightLayer.fillColor = [RCTUIColor colorWithWhite:0 alpha:0.25].CGColor; // [macOS] [self.layer addSublayer:_highlightLayer]; } _highlightLayer.position = _contentFrame.origin; - _highlightLayer.path = UIBezierPathCreateCGPathRef(highlightPath); // TODO(macOS GH#774) + _highlightLayer.path = UIBezierPathCreateCGPathRef(highlightPath); // [macOS] } else { [_highlightLayer removeFromSuperlayer]; _highlightLayer = nil; @@ -340,7 +340,16 @@ - (void)didMoveToWindow #pragma mark - Accessibility -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] +- (NSString *)accessibilityLabel +{ + NSString *superAccessibilityLabel = [super accessibilityLabel]; + if (superAccessibilityLabel) { + return superAccessibilityLabel; + } + return _textStorage.string; +} +#else // [macOS // This code is here to cover for a mismatch in the what accessibilityLabels and accessibilityValues mean in iOS versus macOS. // In macOS a text element will always read its accessibilityValue, but will only read it's accessibilityLabel if it's value is set. @@ -361,20 +370,11 @@ - (NSString *)accessibilityValue } return _textStorage.string; } -#else // ]TODO(macOS GH#774) -- (NSString *)accessibilityLabel -{ - NSString *superAccessibilityLabel = [super accessibilityLabel]; - if (superAccessibilityLabel) { - return superAccessibilityLabel; - } - return _textStorage.string; -} -#endif // TODO(macOS GH#774) +#endif // macOS] #pragma mark - Context Menu -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)enableContextMenu { _longPressGestureRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)]; @@ -405,7 +405,7 @@ - (void)handleLongPress:(UILongPressGestureRecognizer *)gesture [menuController setMenuVisible:YES animated:YES]; #endif } -#else // [TODO(macOS GH#774) +#else // [macOS - (void)rightMouseDown:(NSEvent *)event { @@ -439,25 +439,25 @@ - (void)rightMouseDown:(NSEvent *)event } } } -#endif // ]TODO(macOS GH#774) +#endif // macOS] #pragma mark - Selection -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS - (void)textDidEndEditing:(NSNotification *)notification { _textView.selectedRange = NSMakeRange(NSNotFound, 0); } -#endif // ]TODO(macOS GH#774) +#endif // macOS] #pragma mark - Responder chain -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (BOOL)canBecomeFirstResponder { return _selectable; } -#else +#else // [macOS - (BOOL)canBecomeKeyView { return self.focusable; @@ -499,9 +499,9 @@ - (BOOL)canBecomeFirstResponder { return self.focusable; } -#endif +#endif // macOS] -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (BOOL)canPerformAction:(SEL)action withSender:(id)sender { if (_selectable && action == @selector(copy:)) { @@ -510,7 +510,7 @@ - (BOOL)canPerformAction:(SEL)action withSender:(id)sender return [self.nextResponder canPerformAction:action withSender:sender]; } -#endif // TODO(macOS GH#774) +#endif // [macOS] #pragma mark - Copy/Paste @@ -521,8 +521,8 @@ - (void)copy:(id)sender NSData *rtf = [attributedText dataFromRange:NSMakeRange(0, attributedText.length) documentAttributes:@{NSDocumentTypeDocumentAttribute: NSRTFDTextDocumentType} error:nil]; -#if TARGET_OS_IPHONE // [TODO(macOS GH#774) - NSMutableDictionary *item = [NSMutableDictionary new]; // TODO(macOS GH#774) +#if TARGET_OS_IPHONE // [macOS + NSMutableDictionary *item = [NSMutableDictionary new]; // [macOS] if (rtf) { [item setObject:rtf forKey:(id)kUTTypeFlatRTFD]; @@ -532,13 +532,13 @@ - (void)copy:(id)sender UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; pasteboard.items = @[item]; -#elif TARGET_OS_OSX +#elif TARGET_OS_OSX // [macOS] [_textView copy:sender]; NSPasteboard *pasteboard = [NSPasteboard generalPasteboard]; [pasteboard clearContents]; [pasteboard setData:rtf forType:NSPasteboardTypeRTFD]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } @end diff --git a/Libraries/Text/Text/RCTTextViewManager.m b/Libraries/Text/Text/RCTTextViewManager.m index 54e63576596983..b1d7b835ec3398 100644 --- a/Libraries/Text/Text/RCTTextViewManager.m +++ b/Libraries/Text/Text/RCTTextViewManager.m @@ -43,27 +43,27 @@ - (void)setBridge:(RCTBridge *)bridge [bridge.uiManager.observerCoordinator addObserver:self]; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleDidUpdateMultiplierNotification) name:@"RCTAccessibilityManagerDidUpdateMultiplierNotification" object:[bridge moduleForName:@"AccessibilityManager" lazilyLoadIfNecessary:YES]]; -#endif // TODO(macOS GH#774) +#endif // [macOS] } -- (RCTUIView *)view // TODO(macOS ISS#3536887) +- (RCTUIView *)view // [macOS] { - return [[RCTTextView alloc] initWithEventDispatcher:self.bridge.eventDispatcher]; // TODO(OSS Candidate ISS#2710739) + return [[RCTTextView alloc] initWithEventDispatcher:self.bridge.eventDispatcher]; // [macOS] } - (RCTShadowView *)shadowView { RCTTextShadowView *shadowView = [[RCTTextShadowView alloc] initWithBridge:self.bridge]; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] shadowView.textAttributes.fontSizeMultiplier = [[[self.bridge moduleForName:@"AccessibilityManager"] valueForKey:@"multiplier"] floatValue]; -#endif // TODO(macOS GH#774) +#endif // [macOS] [_shadowViews addObject:shadowView]; return shadowView; } diff --git a/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.h b/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.h index 53edbce0a7ee48..bcfa573bfbcf46 100644 --- a/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.h +++ b/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.h @@ -11,13 +11,13 @@ NS_ASSUME_NONNULL_BEGIN @interface RCTMultilineTextInputView : RCTBaseTextInputView -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS @property (nonatomic, assign) BOOL scrollEnabled; - (void)setReadablePasteBoardTypes:(NSArray *)readablePasteboardTypes; @property (nonatomic, assign) BOOL hideVerticalScrollIndicator; -#endif // ]TODO(macOS GH#774) +#endif // macOS] @end diff --git a/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.m b/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.m index 23105bde74087e..dce0a08108b311 100644 --- a/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.m +++ b/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.m @@ -13,10 +13,10 @@ @implementation RCTMultilineTextInputView { -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS RCTUIScrollView *_scrollView; RCTClipView *_clipView; -#endif // ]TODO(macOS GH#774) +#endif // macOS] RCTUITextView *_backedTextInputView; } @@ -28,9 +28,9 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge _backedTextInputView = [[RCTUITextView alloc] initWithFrame:self.bounds]; _backedTextInputView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; -#if TARGET_OS_OSX // TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS self.hideVerticalScrollIndicator = NO; - _scrollView = [[RCTUIScrollView alloc] initWithFrame:self.bounds]; // TODO(macOS ISS#3536887) + _scrollView = [[RCTUIScrollView alloc] initWithFrame:self.bounds]; // [macOS] _scrollView.backgroundColor = [RCTUIColor clearColor]; _scrollView.drawsBackground = NO; _scrollView.borderType = NSNoBorder; @@ -46,12 +46,12 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge _backedTextInputView.horizontallyResizable = YES; _backedTextInputView.textContainer.containerSize = NSMakeSize(CGFLOAT_MAX, CGFLOAT_MAX); _backedTextInputView.textContainer.widthTracksTextView = YES; -#endif // ]TODO(macOS GH#774) +#endif // macOS] _backedTextInputView.textInputDelegate = self; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [self addSubview:_backedTextInputView]; -#else // [TODO(macOS GH#774) +#else // [macOS _scrollView.documentView = _backedTextInputView; _scrollView.contentView.postsBoundsChangedNotifications = YES; // Enable focus ring by default @@ -63,25 +63,25 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge selector:@selector(boundDidChange:) name:NSViewBoundsDidChangeNotification object:_scrollView.contentView]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } return self; } -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] - (id)backedTextInputView { return _backedTextInputView; } -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS - (void)setReactPaddingInsets:(UIEdgeInsets)reactPaddingInsets { [super setReactPaddingInsets:reactPaddingInsets]; @@ -155,11 +155,11 @@ - (void)setAttributedText:(NSAttributedString *)attributedText [_scrollView setHasVerticalScroller:[self shouldShowVerticalScrollbar]]; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] #pragma mark - UIScrollViewDelegate -- (void)scrollViewDidScroll:(RCTUIScrollView *)scrollView // TODO(macOS ISS#3536887) +- (void)scrollViewDidScroll:(RCTUIScrollView *)scrollView // [macOS] { RCTDirectEventBlock onScroll = self.onScroll; if (onScroll) { @@ -192,7 +192,7 @@ - (void)scrollViewDidScroll:(RCTUIScrollView *)scrollView // TODO(macOS ISS#3536 } } -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS #pragma mark - Notification handling @@ -208,6 +208,6 @@ - (BOOL)acceptsFirstResponder return _backedTextInputView.acceptsFirstResponder; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] @end diff --git a/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputViewManager.m b/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputViewManager.m index fe6b5d3e883d69..abafb5b1c6dda5 100644 --- a/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputViewManager.m +++ b/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputViewManager.m @@ -7,23 +7,23 @@ #import #import -#import // TODO(macOS GH#774) +#import // [macOS] @implementation RCTMultilineTextInputViewManager RCT_EXPORT_MODULE() -- (RCTUIView *)view // TODO(macOS ISS#3536887) +- (RCTUIView *)view // [macOS] { return [[RCTMultilineTextInputView alloc] initWithBridge:self.bridge]; } #pragma mark - Multiline (aka TextView) specific properties -RCT_REMAP_NOT_OSX_VIEW_PROPERTY(dataDetectorTypes, backedTextInputView.dataDetectorTypes, UIDataDetectorTypes) // TODO(macOS GH#774) -RCT_REMAP_OSX_VIEW_PROPERTY(dataDetectorTypes, backedTextInputView.enabledTextCheckingTypes, NSTextCheckingTypes) // TODO(macOS GH#774) +RCT_REMAP_NOT_OSX_VIEW_PROPERTY(dataDetectorTypes, backedTextInputView.dataDetectorTypes, UIDataDetectorTypes) // [macOS] +RCT_REMAP_OSX_VIEW_PROPERTY(dataDetectorTypes, backedTextInputView.enabledTextCheckingTypes, NSTextCheckingTypes) // [macOS] -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS RCT_EXPORT_VIEW_PROPERTY(scrollEnabled, BOOL) RCT_EXPORT_VIEW_PROPERTY(hideVerticalScrollIndicator, BOOL) RCT_CUSTOM_VIEW_PROPERTY(pastedTypes, NSArray*, RCTUITextView) @@ -33,6 +33,6 @@ - (RCTUIView *)view // TODO(macOS ISS#3536887) [view setReadablePasteBoardTypes: types]; } } -#endif // ]TODO(macOS GH#774) +#endif // macOS] @end diff --git a/Libraries/Text/TextInput/Multiline/RCTUITextView.h b/Libraries/Text/TextInput/Multiline/RCTUITextView.h index d1eed857a669a2..21a12fbe2af5ec 100644 --- a/Libraries/Text/TextInput/Multiline/RCTUITextView.h +++ b/Libraries/Text/TextInput/Multiline/RCTUITextView.h @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] -#import "RCTTextUIKit.h" // TODO(macOS GH#774) +#import "RCTTextUIKit.h" // [macOS] #import #import @@ -25,27 +25,27 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, weak) id textInputDelegate; @property (nonatomic, assign) BOOL contextMenuHidden; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] @property (nonatomic, assign, readonly) BOOL textWasPasted; -#else // [TODO(macOS GH#774) +#else // [macOS @property (nonatomic, assign) BOOL textWasPasted; -#endif // ]TODO(macOS GH#774) +#endif // macOS] @property (nonatomic, copy, nullable) NSString *placeholder; -@property (nonatomic, strong, nullable) RCTUIColor *placeholderColor; // TODO(OSS Candidate ISS#2710739) +@property (nonatomic, strong, nullable) RCTUIColor *placeholderColor; // [macOS] @property (nonatomic, assign) CGFloat preferredMaxLayoutWidth; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] // The `clearButtonMode` property actually is not supported yet; // it's declared here only to conform to the interface. @property (nonatomic, assign) UITextFieldViewMode clearButtonMode; -#endif // TODO(macOS GH#774) +#endif // [macOS] @property (nonatomic, assign) BOOL caretHidden; @property (nonatomic, strong, nullable) NSString *inputAccessoryViewID; -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS @property (nonatomic, getter=isScrollEnabled) BOOL scrollEnabled; @property (nonatomic, strong, nullable) RCTUIColor *selectionColor; // TODO(OSS Candidate ISS#2710739) @property (nonatomic, assign) UIEdgeInsets textContainerInsets; @@ -54,7 +54,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, copy, nullable) NSAttributedString *attributedText; - (NSSize)sizeThatFits:(NSSize)size; - (void)setReadablePasteBoardTypes:(NSArray *)readablePasteboardTypes; -#endif // ]TODO(macOS GH#774) +#endif // macOS] @end diff --git a/Libraries/Text/TextInput/Multiline/RCTUITextView.m b/Libraries/Text/TextInput/Multiline/RCTUITextView.m index 30292e41e17496..b9d08ccb6525d4 100644 --- a/Libraries/Text/TextInput/Multiline/RCTUITextView.m +++ b/Libraries/Text/TextInput/Multiline/RCTUITextView.m @@ -15,15 +15,15 @@ @implementation RCTUITextView { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UILabel *_placeholderView; UITextView *_detachedTextView; -#endif // TODO(macOS GH#774) +#endif // [macOS] RCTBackedTextViewDelegateAdapter *_textInputDelegateAdapter; NSDictionary *_defaultTextAttributes; -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS NSArray *_readablePasteboardTypes; -#endif // TODO(macOS GH#774) +#endif // macOS] } static UIFont *defaultPlaceholderFont() @@ -31,9 +31,9 @@ @implementation RCTUITextView return [UIFont systemFontOfSize:17]; } -static RCTUIColor *defaultPlaceholderColor() // TODO(OSS Candidate ISS#2710739) +static RCTUIColor *defaultPlaceholderColor() // [macOS] { - return [RCTUIColor placeholderTextColor]; // TODO(OSS Candidate ISS#2710739) + return [RCTUIColor placeholderTextColor]; // [macOS] } - (instancetype)initWithFrame:(CGRect)frame @@ -43,33 +43,33 @@ - (instancetype)initWithFrame:(CGRect)frame selector:@selector(textDidChange) name:UITextViewTextDidChangeNotification object:self]; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] _placeholderView = [[UILabel alloc] initWithFrame:self.bounds]; _placeholderView.isAccessibilityElement = NO; _placeholderView.numberOfLines = 0; [self addSubview:_placeholderView]; -#else // [TODO(macOS GH#774) +#else // [macOS // Fix blurry text on non-retina displays. self.canDrawSubviewsIntoLayer = YES; self.allowsUndo = YES; -#endif // ]TODO(macOS GH#774) +#endif // macOS] _textInputDelegateAdapter = [[RCTBackedTextViewDelegateAdapter alloc] initWithTextView:self]; - self.backgroundColor = [RCTUIColor clearColor]; // TODO(macOS GH#774) - self.textColor = [RCTUIColor blackColor]; // TODO(macOS GH#774) + self.backgroundColor = [RCTUIColor clearColor]; // [macOS] + self.textColor = [RCTUIColor blackColor]; // [macOS] // This line actually removes 5pt (default value) left and right padding in UITextView. -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] self.textContainer.lineFragmentPadding = 0; -#else +#else // [macOS // macOS has a bug where setting this to 0 will cause the scroll view to scroll to top when // inserting a newline at the bottom of a NSTextView when it has more rows than can be displayed // on screen. self.textContainer.lineFragmentPadding = 1; -#endif -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#endif //macOS] +#if !TARGET_OS_OSX // [macOS] self.scrollsToTop = NO; -#endif // TODO(macOS GH#774) +#endif // [macOS] self.scrollEnabled = YES; } @@ -121,13 +121,13 @@ - (void)setPlaceholder:(NSString *)placeholder [self _updatePlaceholder]; } -- (void)setPlaceholderColor:(RCTUIColor *)placeholderColor // TODO(OSS Candidate ISS#2710739) +- (void)setPlaceholderColor:(RCTUIColor *)placeholderColor // [macOS] { _placeholderColor = placeholderColor; [self _updatePlaceholder]; } -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS - (void)toggleAutomaticSpellingCorrection:(id)sender { self.automaticSpellingCorrectionEnabled = !self.isAutomaticSpellingCorrectionEnabled; @@ -225,7 +225,7 @@ - (BOOL)resignFirstResponder return success; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] - (void)setDefaultTextAttributes:(NSDictionary *)defaultTextAttributes { @@ -259,13 +259,13 @@ - (void)setFont:(UIFont *)font - (void)setTextAlignment:(NSTextAlignment)textAlignment { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [super setTextAlignment:textAlignment]; _placeholderView.textAlignment = textAlignment; -#else // [TODO(macOS GH#774) +#else // [macOS self.alignment = textAlignment; [self setNeedsDisplay:YES]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } - (void)setAttributedText:(NSAttributedString *)attributedText @@ -276,7 +276,7 @@ - (void)setAttributedText:(NSAttributedString *)attributedText // We try to avoid calling this method as much as we can. // If the text has changed, there is nothing we can do. -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] if (![super.attributedText.string isEqualToString:attributedText.string]) { [super setAttributedText:attributedText]; } else { @@ -285,7 +285,7 @@ - (void)setAttributedText:(NSAttributedString *)attributedText [self copyTextAttributesFrom:attributedText]; } } -#else // [TODO(macOS GH#774) +#else // [macOS if (![self.textStorage isEqualTo:attributedText.string]) { // Break undo coalescing when the text is changed by JS (e.g. autocomplete). [self breakUndoCoalescing]; @@ -302,17 +302,17 @@ - (void)setAttributedText:(NSAttributedString *)attributedText [self copyTextAttributesFrom:attributedText]; } } -#endif // ]TODO(macOS GH#774) +#endif // macOS] [self textDidChange]; } #pragma mark - Overrides -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)setSelectedTextRange:(UITextRange *)selectedTextRange notifyDelegate:(BOOL)notifyDelegate -#else // [TODO(macOS GH#774) +#else // [macOS - (void)setSelectedTextRange:(NSRange)selectedTextRange notifyDelegate:(BOOL)notifyDelegate -#endif // ]TODO(macOS GH#774) +#endif // macOS] { if (!notifyDelegate) { // We have to notify an adapter that following selection change was initiated programmatically, @@ -320,14 +320,14 @@ - (void)setSelectedTextRange:(NSRange)selectedTextRange notifyDelegate:(BOOL)not [_textInputDelegateAdapter skipNextTextInputDidChangeSelectionEventWithTextRange:selectedTextRange]; } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [super setSelectedTextRange:selectedTextRange]; -#else // [TODO(macOS GH#774) +#else // [macOS [super setSelectedRange:selectedTextRange]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS - (NSRange)selectedTextRange { return [super selectedRange]; @@ -359,23 +359,23 @@ - (NSArray *)readablePasteboardTypes return _readablePasteboardTypes ? _readablePasteboardTypes : [super readablePasteboardTypes]; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] - (void)paste:(id)sender { -#if TARGET_OS_OSX // TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS if ([self.textInputDelegate textInputShouldHandlePaste:self]) { -#endif +#endif // macOS] [super paste:sender]; _textWasPasted = YES; -#if TARGET_OS_OSX // TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS } -#endif +#endif // macOS] } // Turn off scroll animation to fix flaky scrolling. // This is only necessary for iOS <= 13. -// TODO(macOS GH#774) - we may not need to check for !TARGET_OS_OSX if __IPHONE_OS_VERSION_MAX_ALLOWED is defined, +// [macOS] we may not need to check for !TARGET_OS_OSX if __IPHONE_OS_VERSION_MAX_ALLOWED is defined, // but it shouldn't hurt to do so for clarity's sake. #if !TARGET_OS_OSX && defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED < 140000 - (void)setContentOffset:(CGPoint)contentOffset animated:(__unused BOOL)animated @@ -384,7 +384,7 @@ - (void)setContentOffset:(CGPoint)contentOffset animated:(__unused BOOL)animated } #endif -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS #pragma mark - Placeholder @@ -434,19 +434,19 @@ - (void)setTextContainerInsets:(UIEdgeInsets)textContainerInsets } } -#endif // ]TODO(macOS GH#774) +#endif // macOS] - (void)selectAll:(id)sender { [super selectAll:sender]; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] // `selectAll:` does not work for UITextView when it's being called inside UITextView's delegate methods. dispatch_async(dispatch_get_main_queue(), ^{ UITextRange *selectionRange = [self textRangeFromPosition:self.beginningOfDocument toPosition:self.endOfDocument]; [self setSelectedTextRange:selectionRange notifyDelegate:NO]; }); -#endif // TODO(macOS GH#774) +#endif // [macOS] } #pragma mark - Layout @@ -459,22 +459,22 @@ - (CGFloat)preferredMaxLayoutWidth - (CGSize)placeholderSize { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UIEdgeInsets textContainerInset = self.textContainerInset; -#else // [TODO(macOS GH#774) +#else // [macOS UIEdgeInsets textContainerInset = self.textContainerInsets; -#endif // ]TODO(macOS GH#774) +#endif // macOS] NSString *placeholder = self.placeholder ?: @""; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] CGSize maxPlaceholderSize = CGSizeMake(UIEdgeInsetsInsetRect(self.bounds, textContainerInset).size.width, CGFLOAT_MAX); CGSize placeholderSize = [placeholder boundingRectWithSize:maxPlaceholderSize options:NSStringDrawingUsesLineFragmentOrigin attributes:[self _placeholderTextAttributes] context:nil].size; placeholderSize = CGSizeMake(RCTCeilPixelValue(placeholderSize.width), RCTCeilPixelValue(placeholderSize.height)); -#else // [TODO(macOS GH#774) +#else // [macOS CGFloat scale = self.window.backingScaleFactor; CGSize placeholderSize = [placeholder sizeWithAttributes:[self _placeholderTextAttributes]]; placeholderSize = CGSizeMake(RCTCeilPixelValue(placeholderSize.width, scale), RCTCeilPixelValue(placeholderSize.height, scale)); -#endif // ]TODO(macOS GH#774) +#endif // macOS] placeholderSize.width += textContainerInset.left + textContainerInset.right; placeholderSize.height += textContainerInset.top + textContainerInset.bottom; // Returning size DOES contain `textContainerInset` (aka `padding`; as `sizeThatFits:` does). @@ -483,13 +483,13 @@ - (CGSize)placeholderSize - (CGSize)contentSize { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] CGSize contentSize = super.contentSize; CGSize placeholderSize = _placeholderView.isHidden ? CGSizeZero : self.placeholderSize; -#else // [TODO(macOS GH#774) +#else // [macOS CGSize contentSize = super.intrinsicContentSize; CGSize placeholderSize = self.placeholderSize; -#endif // ]TODO(macOS GH#774) +#endif // macOS] // When a text input is empty, it actually displays a placehoder. // So, we have to consider `placeholderSize` as a minimum `contentSize`. // Returning size DOES contain `textContainerInset` (aka `padding`). @@ -498,7 +498,7 @@ - (CGSize)contentSize MAX(contentSize.height, placeholderSize.height)); } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)layoutSubviews { [super layoutSubviews]; @@ -508,7 +508,7 @@ - (void)layoutSubviews textFrame.size.height = MIN(placeholderHeight, textFrame.size.height); _placeholderView.frame = textFrame; } -#endif // TODO(macOS GH#774) +#endif // [macOS] - (CGSize)intrinsicContentSize { @@ -519,13 +519,13 @@ - (CGSize)intrinsicContentSize - (CGSize)sizeThatFits:(CGSize)size { // Returned fitting size depends on text size and placeholder size. -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] CGSize textSize = [super sizeThatFits:size]; -#else +#else // [macOS [self.layoutManager glyphRangeForTextContainer:self.textContainer]; NSRect rect = [self.layoutManager usedRectForTextContainer:self.textContainer]; CGSize textSize = CGSizeMake(MIN(rect.size.width, size.width), rect.size.height); -#endif // TODO(macOS GH#774) +#endif // macOS] CGSize placeholderSize = self.placeholderSize; // Returning size DOES contain `textContainerInset` (aka `padding`). return CGSizeMake(MAX(textSize.width, placeholderSize.width), MAX(textSize.height, placeholderSize.height)); @@ -533,7 +533,7 @@ - (CGSize)sizeThatFits:(CGSize)size #pragma mark - Context Menu -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (BOOL)canPerformAction:(SEL)action withSender:(id)sender { if (_contextMenuHidden) { @@ -542,28 +542,28 @@ - (BOOL)canPerformAction:(SEL)action withSender:(id)sender return [super canPerformAction:action withSender:sender]; } -#endif // TODO(macOS GH#774) +#endif // [macOS] #pragma mark - Placeholder - (void)_invalidatePlaceholderVisibility { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] BOOL isVisible = _placeholder.length != 0 && self.attributedText.length == 0; _placeholderView.hidden = !isVisible; -#else // [TODO(macOS GH#774) +#else // [macOS [self setNeedsDisplay:YES]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } -#if !TARGET_OS_OSX // [TODO(OSS Candidate ISS#2710739) +#if !TARGET_OS_OSX // [macOS] - (void)deleteBackward { id textInputDelegate = [self textInputDelegate]; if ([textInputDelegate textInputShouldHandleDeleteBackward:self]) { [super deleteBackward]; } } -#else +#else // [macOS - (void)keyDown:(NSEvent *)event { // If has marked text, handle by native and return // Do this check before textInputShouldHandleKeyEvent as that one attempts to send the event to JS @@ -585,15 +585,15 @@ - (void)keyUp:(NSEvent *)event { [super keyUp:event]; } } -#endif // ]TODO(OSS Candidate ISS#2710739) +#endif // macOS] - (void)_updatePlaceholder { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] _placeholderView.attributedText = [[NSAttributedString alloc] initWithString:_placeholder ?: @"" attributes:[self _placeholderTextAttributes]]; -#else // [TODO(macOS GH#774) +#else // [macOS [self setNeedsDisplay:YES]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] [self _invalidatePlaceholderVisibility]; } @@ -611,7 +611,7 @@ - (void)_updatePlaceholder } #pragma mark - Caret Manipulation -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (CGRect)caretRectForPosition:(UITextPosition *)position { @@ -621,7 +621,7 @@ - (CGRect)caretRectForPosition:(UITextPosition *)position return [super caretRectForPosition:position]; } -#endif +#endif // [macOS] #pragma mark - Utility Methods diff --git a/Libraries/Text/TextInput/RCTBackedTextInputDelegate.h b/Libraries/Text/TextInput/RCTBackedTextInputDelegate.h index 30253c300c4266..e9e1f64013ff40 100644 --- a/Libraries/Text/TextInput/RCTBackedTextInputDelegate.h +++ b/Libraries/Text/TextInput/RCTBackedTextInputDelegate.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] @protocol RCTBackedTextInputViewProtocol; @@ -22,12 +22,12 @@ NS_ASSUME_NONNULL_BEGIN - (BOOL)textInputShouldReturn; // May be called right before `textInputShouldEndEditing` if "Return" button was pressed. - (void)textInputDidReturn; -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS - (void)automaticSpellingCorrectionDidChange:(BOOL)enabled; - (void)continuousSpellCheckingDidChange:(BOOL)enabled; - (void)grammarCheckingDidChange:(BOOL)enabled; - (void)submitOnKeyDownIfNeeded:(NSEvent *)event; -#endif // ]TODO(macOS GH#774) +#endif // macOS] /* * Called before any change in the TextInput. The delegate has the opportunity to change the replacement string or reject the change completely. @@ -40,8 +40,8 @@ NS_ASSUME_NONNULL_BEGIN - (void)textInputDidChangeSelection; -- (BOOL)textInputShouldHandleDeleteBackward:(id)sender; // Return `YES` to have the deleteBackward event handled normally. Return `NO` to disallow it and handle it yourself. TODO(OSS Candidate ISS#2710739) -#if TARGET_OS_OSX // [TODO(macOS GH#774) +- (BOOL)textInputShouldHandleDeleteBackward:(id)sender; // Return `YES` to have the deleteBackward event handled normally. Return `NO` to disallow it and handle it yourself. // [macOS] +#if TARGET_OS_OSX // [macOS - (BOOL)textInputShouldHandleDeleteForward:(id)sender; // Return `YES` to have the deleteForward event handled normally. Return `NO` to disallow it and handle it yourself. - (BOOL)textInputShouldHandleKeyEvent:(NSEvent *)event; // Return `YES` to have the key event handled normally. Return `NO` to disallow it and handle it yourself. - (BOOL)hasValidKeyDownOrValidKeyUp:(NSString *)key; @@ -50,10 +50,10 @@ NS_ASSUME_NONNULL_BEGIN - (BOOL)textInputShouldHandleDragOperation:(id)draggingInfo; - (void)textInputDidCancel; // Handle `Escape` key press. - (BOOL)textInputShouldHandlePaste:(id)sender; // Return `YES` to have the paste event handled normally. Return `NO` to disallow it and handle it yourself. -#endif // ]TODO(macOS GH#774) +#endif // macOS] @optional -- (void)scrollViewDidScroll:(RCTUIScrollView *)scrollView; // TODO(macOS GH#774) +- (void)scrollViewDidScroll:(RCTUIScrollView *)scrollView; // [macOS] @end diff --git a/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.h b/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.h index b9c7e1d2375aca..a8c7bfe9435027 100644 --- a/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.h +++ b/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.h @@ -5,24 +5,24 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] NS_ASSUME_NONNULL_BEGIN #pragma mark - RCTBackedTextFieldDelegateAdapter (for UITextField) -@protocol RCTBackedTextInputViewProtocol; // TODO(OSS Candidate ISS#2710739) -@protocol RCTBackedTextInputDelegate; // TODO(OSS Candidate ISS#2710739) +@protocol RCTBackedTextInputViewProtocol; // [macOS] +@protocol RCTBackedTextInputDelegate; // [macOS] @interface RCTBackedTextFieldDelegateAdapter : NSObject - (instancetype)initWithTextField:(UITextField *)backedTextInputView; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)skipNextTextInputDidChangeSelectionEventWithTextRange:(UITextRange *)textRange; -#else // [TODO(macOS GH#774) +#else // [macOS - (void)skipNextTextInputDidChangeSelectionEventWithTextRange:(NSRange)textRange; -#endif // ]TODO(macOS GH#774) +#endif // macOS] - (void)selectedTextRangeWasSet; @end @@ -33,11 +33,11 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)initWithTextView:(UITextView *)backedTextInputView; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)skipNextTextInputDidChangeSelectionEventWithTextRange:(UITextRange *)textRange; -#else // [TODO(macOS GH#774) +#else // [macOS - (void)skipNextTextInputDidChangeSelectionEventWithTextRange:(NSRange)textRange; -#endif // ]TODO(macOS GH#774) +#endif // macOS] @end diff --git a/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m b/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m index 6853065a48d038..b598d16f419dfd 100644 --- a/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m +++ b/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m @@ -6,31 +6,31 @@ */ #import -#import "RCTBackedTextInputViewProtocol.h" // TODO(OSS Candidate ISS#2710739) -#import "RCTBackedTextInputDelegate.h" // TODO(OSS Candidate ISS#2710739) -#import "../RCTTextUIKit.h" // TODO(macOS GH#774) +#import "RCTBackedTextInputViewProtocol.h" // [macOS +#import "RCTBackedTextInputDelegate.h" +#import "../RCTTextUIKit.h" // macOS] #pragma mark - RCTBackedTextFieldDelegateAdapter (for UITextField) static void *TextFieldSelectionObservingContext = &TextFieldSelectionObservingContext; @interface RCTBackedTextFieldDelegateAdapter () -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] -#else +#else // [macOS -#endif // ]TODO(macOS GH#774) +#endif // macOS] @end @implementation RCTBackedTextFieldDelegateAdapter { __weak UITextField *_backedTextInputView; BOOL _textDidChangeIsComing; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UITextRange *_previousSelectedTextRange; -#else // [TODO(macOS GH#774) +#else // [macOS NSRange _previousSelectedTextRange; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } - (instancetype)initWithTextField:(UITextField *)backedTextInputView @@ -39,10 +39,10 @@ - (instancetype)initWithTextField:(UITextField * _backedTextInputView = backedTextInputView; backedTextInputView.delegate = self; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [_backedTextInputView addTarget:self action:@selector(textFieldDidChange) forControlEvents:UIControlEventEditingChanged]; [_backedTextInputView addTarget:self action:@selector(textFieldDidEndEditingOnExit) forControlEvents:UIControlEventEditingDidEndOnExit]; -#endif // TODO(macOS GH#774) +#endif // [macOS] } return self; @@ -50,10 +50,10 @@ - (instancetype)initWithTextField:(UITextField * - (void)dealloc { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [_backedTextInputView removeTarget:self action:nil forControlEvents:UIControlEventEditingChanged]; [_backedTextInputView removeTarget:self action:nil forControlEvents:UIControlEventEditingDidEndOnExit]; -#endif // TODO(macOS GH#774) +#endif // [macOS] } #pragma mark - UITextFieldDelegate @@ -103,7 +103,7 @@ - (BOOL)textField:(__unused UITextField *)textField shouldChangeCharactersInRang [attributedString replaceCharactersInRange:range withString:newText]; [_backedTextInputView setAttributedText:[attributedString copy]]; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] // Setting selection to the end of the replaced text. UITextPosition *position = [_backedTextInputView positionFromPosition:_backedTextInputView.beginningOfDocument @@ -111,7 +111,7 @@ - (BOOL)textField:(__unused UITextField *)textField shouldChangeCharactersInRang [_backedTextInputView setSelectedTextRange:[_backedTextInputView textRangeFromPosition:position toPosition:position] notifyDelegate:YES]; -#endif // TODO(macOS GH#774) +#endif // [macOS] [self textFieldDidChange]; return NO; @@ -150,11 +150,11 @@ - (BOOL)keyboardInputShouldDelete:(__unused UITextField *)textField #pragma mark - Public Interface -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)skipNextTextInputDidChangeSelectionEventWithTextRange:(UITextRange *)textRange -#else // [TODO(macOS GH#774) +#else // [macOS - (void)skipNextTextInputDidChangeSelectionEventWithTextRange:(NSRange)textRange -#endif // ]TODO(macOS GH#774) +#endif // macOS] { _previousSelectedTextRange = textRange; } @@ -168,15 +168,15 @@ - (void)selectedTextRangeWasSet - (void)textFieldProbablyDidChangeSelection { - if (RCTTextSelectionEqual([_backedTextInputView selectedTextRange], _previousSelectedTextRange)) { // TODO(macOS GH#774) + if (RCTTextSelectionEqual([_backedTextInputView selectedTextRange], _previousSelectedTextRange)) { // [macOS] return; } - _previousSelectedTextRange = [_backedTextInputView selectedTextRange]; // TODO(OSS Candidate ISS#2710739) setter not defined for mac + _previousSelectedTextRange = [_backedTextInputView selectedTextRange]; // [macOS] setter not defined for mac [_backedTextInputView.textInputDelegate textInputDidChangeSelection]; } -#if TARGET_OS_OSX // TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS #pragma mark - NSTextFieldDelegate @@ -250,7 +250,7 @@ - (void)textFieldDidChangeSelection:(NSTextField *)textField { [self selectedTextRangeWasSet]; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] @end @@ -260,18 +260,18 @@ @interface RCTBackedTextViewDelegateAdapter () @end @implementation RCTBackedTextViewDelegateAdapter { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] __weak UITextView *_backedTextInputView; -#else // TODO(macOS GH#774) +#else // [macOS __unsafe_unretained UITextView *_backedTextInputView; -#endif // ]TODO(macOS GH#774) +#endif // macOS] BOOL _textDidChangeIsComing; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UITextRange *_previousSelectedTextRange; -#else // [TODO(macOS GH#774) +#else // [macOS NSRange _previousSelectedTextRange; NSUndoManager *_undoManager; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } - (instancetype)initWithTextView:(UITextView *)backedTextInputView @@ -315,7 +315,7 @@ - (void)textViewDidEndEditing:(__unused UITextView *)textView - (BOOL)textView:(__unused UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] // Custom implementation of `textInputShouldReturn` and `textInputDidReturn` pair for `UITextView`. if (!_backedTextInputView.textWasPasted && [text isEqualToString:@"\n"]) { if ([_backedTextInputView.textInputDelegate textInputShouldReturn]) { @@ -324,7 +324,7 @@ - (BOOL)textView:(__unused UITextView *)textView shouldChangeTextInRange:(NSRang return NO; } } -#endif // ]TODO(macOS GH#774) +#endif // [macOS] NSString *newText = [_backedTextInputView.textInputDelegate textInputShouldChangeText:text inRange:range]; @@ -342,14 +342,14 @@ - (BOOL)textView:(__unused UITextView *)textView shouldChangeTextInRange:(NSRang [attributedString replaceCharactersInRange:range withString:newText]; [_backedTextInputView setAttributedText:[attributedString copy]]; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] // 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 GH#774) +#endif // [macOS] [self textViewDidChange:_backedTextInputView]; @@ -362,7 +362,7 @@ - (void)textViewDidChange:(__unused UITextView *)textView [_backedTextInputView.textInputDelegate textInputDidChange]; } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)textViewDidChangeSelection:(__unused UITextView *)textView { @@ -378,9 +378,9 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView } } -#endif // [TODO(macOS GH#774) +#endif // [macOS] -#if TARGET_OS_OSX +#if TARGET_OS_OSX // [macOS #pragma mark - NSTextViewDelegate @@ -445,15 +445,15 @@ - (NSUndoManager *)undoManagerForTextView:(NSTextView *)textView { return _undoManager; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] #pragma mark - Public Interface -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)skipNextTextInputDidChangeSelectionEventWithTextRange:(UITextRange *)textRange -#else // [TODO(macOS GH#774) +#else // [macOS - (void)skipNextTextInputDidChangeSelectionEventWithTextRange:(NSRange)textRange -#endif // ]TODO(macOS GH#774) +#endif // macOS] { _previousSelectedTextRange = textRange; } @@ -462,11 +462,11 @@ - (void)skipNextTextInputDidChangeSelectionEventWithTextRange:(NSRange)textRange - (void)textViewProbablyDidChangeSelection { - if (RCTTextSelectionEqual([_backedTextInputView selectedTextRange], _previousSelectedTextRange)) { // TODO(macOS GH#774) + if (RCTTextSelectionEqual([_backedTextInputView selectedTextRange], _previousSelectedTextRange)) { // [macOS] return; } - _previousSelectedTextRange = [_backedTextInputView selectedTextRange]; // TODO(OSS Candidate ISS#2710739) setter not defined for mac + _previousSelectedTextRange = [_backedTextInputView selectedTextRange]; // macOS setter not defined for mac [_backedTextInputView.textInputDelegate textInputDidChangeSelection]; } diff --git a/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h b/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h index 74720372ff6ed1..6c29a8005d9b5e 100644 --- a/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h +++ b/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -#import // [TODO(macOS GH#774) +#import // [macOS] -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS NS_ASSUME_NONNULL_BEGIN @protocol RCTUITextFieldDelegate @optional @@ -18,32 +18,32 @@ NS_ASSUME_NONNULL_BEGIN - (void)textFieldDidChangeSelection:(NSTextField *)textField; @end NS_ASSUME_NONNULL_END -#endif // ]TODO(macOS GH#774) +#endif // macOS] @protocol RCTBackedTextInputDelegate; @class RCTTextAttributes; NS_ASSUME_NONNULL_BEGIN -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] @protocol RCTBackedTextInputViewProtocol -#else +#else // [macOS @protocol RCTBackedTextInputViewProtocol -#endif // ]TODO(macOS GH#774) +#endif // macOS] @property (nonatomic, copy, nullable) NSAttributedString *attributedText; @property (nonatomic, copy, nullable) NSString *placeholder; -@property (nonatomic, strong, nullable) RCTUIColor *placeholderColor; // TODO(OSS Candidate ISS#2710739) -#if !TARGET_OS_OSX // TODO(macOS GH#774) +@property (nonatomic, strong, nullable) RCTUIColor *placeholderColor; // [macOS] +#if !TARGET_OS_OSX // [macOS] @property (nonatomic, assign, readonly) BOOL textWasPasted; -#else // [TODO(macOS GH#774) +#else // [macOS @property (nonatomic, assign) BOOL textWasPasted; -#endif // ]TODO(macOS GH#774) +#endif // macOS] @property (nonatomic, assign) UIEdgeInsets textContainerInset; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] @property (nonatomic, strong, nullable) UIView *inputAccessoryView; @property (nonatomic, strong, nullable) UIView *inputView; -#endif // TODO(macOS GH#774) +#endif // [macOS] @property (nonatomic, weak, nullable) id textInputDelegate; @property (nonatomic, readonly) CGSize contentSize; @property (nonatomic, strong, nullable) NSDictionary *defaultTextAttributes; @@ -51,9 +51,9 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, assign, getter=isEditable) BOOL editable; @property (nonatomic, assign) BOOL caretHidden; @property (nonatomic, assign) BOOL enablesReturnKeyAutomatically; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] @property (nonatomic, assign) UITextFieldViewMode clearButtonMode; -#endif // TODO(macOS GH#774) +#endif // [macOS] @property (nonatomic, getter=isScrollEnabled) BOOL scrollEnabled; @property (nonatomic, strong, nullable) NSString *inputAccessoryViewID; @property (nonatomic, assign, readonly) CGFloat zoomScale; @@ -66,20 +66,20 @@ NS_ASSUME_NONNULL_BEGIN // explicitly specify should `delegate` be notified about the change or not. // If the change was initiated programmatically, we must NOT notify the delegate. // If the change was a result of user actions (like typing or touches), we MUST notify the delegate. -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)setSelectedTextRange:(nullable UITextRange *)selectedTextRange NS_UNAVAILABLE; - (void)setSelectedTextRange:(nullable UITextRange *)selectedTextRange notifyDelegate:(BOOL)notifyDelegate; -#else // [TODO(macOS GH#774) +#else // [macOS - (NSRange)selectedTextRange; - (void)setSelectedTextRange:(NSRange)selectedTextRange NS_UNAVAILABLE; - (void)setSelectedTextRange:(NSRange)selectedTextRange notifyDelegate:(BOOL)notifyDelegate; -#endif // ]TODO(macOS GH#774) +#endif // macOS] -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS - (BOOL)hasMarkedText; // UITextInput method for OSX - (CGSize)sizeThatFits:(CGSize)size; -#endif // ]TODO(macOS GH#774) +#endif // macOS] // This protocol disallows direct access to `text` property because // unwise usage of it can break the `attributeText` behavior. diff --git a/Libraries/Text/TextInput/RCTBaseTextInputShadowView.m b/Libraries/Text/TextInput/RCTBaseTextInputShadowView.m index 703d9bcdf586c8..739dc51623c3cf 100644 --- a/Libraries/Text/TextInput/RCTBaseTextInputShadowView.m +++ b/Libraries/Text/TextInput/RCTBaseTextInputShadowView.m @@ -173,7 +173,7 @@ - (void)uiManagerWillPerformMounting NSNumber *tag = self.reactTag; - [_bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary *viewRegistry) { // TODO(macOS ISS#3536887) + [_bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary *viewRegistry) { // [macOS] RCTBaseTextInputView *baseTextInputView = (RCTBaseTextInputView *)viewRegistry[tag]; if (!baseTextInputView) { return; @@ -225,9 +225,9 @@ - (CGSize)sizeThatFitsMinimumSize:(CGSize)minimumSize maximumSize:(CGSize)maximu if (!_textStorage) { _textContainer = [NSTextContainer new]; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] _textContainer.lineFragmentPadding = 0.0; // Note, the default value is 5. -#else +#else // [macOS // macOS has a bug in multiline where setting the real text view's lineFragmentPadding to 0 will // cause the scroll view to scroll to top when inserting a newline at the bottom of // a NSTextView when it has more rows than can be displayed on screen. The shadow needs to match @@ -237,7 +237,7 @@ - (CGSize)sizeThatFitsMinimumSize:(CGSize)minimumSize maximumSize:(CGSize)maximu } else { _textContainer.lineFragmentPadding = 0.0; // Note, the default value is 5. } -#endif // ]TODO(macOS GH#774) +#endif // macOS] _layoutManager = [NSLayoutManager new]; [_layoutManager addTextContainer:_textContainer]; _textStorage = [NSTextStorage new]; @@ -252,13 +252,13 @@ - (CGSize)sizeThatFitsMinimumSize:(CGSize)minimumSize maximumSize:(CGSize)maximu CGSize size = [_layoutManager usedRectForTextContainer:_textContainer].size; return (CGSize){ -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] MAX(minimumSize.width, MIN(RCTCeilPixelValue(size.width), maximumSize.width)), MAX(minimumSize.height, MIN(RCTCeilPixelValue(size.height), maximumSize.height)) -#else // [TODO(macOS GH#774) +#else // [macOS MAX(minimumSize.width, MIN(RCTCeilPixelValue(size.width, [self scale]), maximumSize.width)), MAX(minimumSize.height, MIN(RCTCeilPixelValue(size.height, [self scale]), maximumSize.height)) -#endif // ]TODO(macOS GH#774) +#endif // macOS] }; } diff --git a/Libraries/Text/TextInput/RCTBaseTextInputView.h b/Libraries/Text/TextInput/RCTBaseTextInputView.h index 559f0e8695d0a3..957e8e1e11cdff 100644 --- a/Libraries/Text/TextInput/RCTBaseTextInputView.h +++ b/Libraries/Text/TextInput/RCTBaseTextInputView.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import @@ -26,12 +26,12 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)initWithCoder:(NSCoder *)decoder NS_UNAVAILABLE; - (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE; -@property (nonatomic, readonly) RCTUIView *backedTextInputView; // TODO(macOS ISS#3536887) +@property (nonatomic, readonly) RCTUIView *backedTextInputView; // [macOS] /** Whether this text input ignores the `textAttributes` property. Defaults to `NO`. If set to `YES`, the value of `textAttributes` will be ignored in favor of standard text input behavior. */ -@property (nonatomic) BOOL ignoresTextAttributes; // TODO(OSS Candidate ISS#2710739) +@property (nonatomic) BOOL ignoresTextAttributes; // [macOS] @property (nonatomic, strong, nullable) RCTTextAttributes *textAttributes; @property (nonatomic, assign) UIEdgeInsets reactPaddingInsets; @property (nonatomic, assign) UIEdgeInsets reactBorderInsets; @@ -39,18 +39,18 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, copy, nullable) RCTDirectEventBlock onContentSizeChange; @property (nonatomic, copy, nullable) RCTDirectEventBlock onSelectionChange; @property (nonatomic, copy, nullable) RCTDirectEventBlock onChange; -@property (nonatomic, copy, nullable) RCTDirectEventBlock onPaste; // TODO(OSS Candidate GH#774) +@property (nonatomic, copy, nullable) RCTDirectEventBlock onPaste; // [macOS] @property (nonatomic, copy, nullable) RCTDirectEventBlock onChangeSync; @property (nonatomic, copy, nullable) RCTDirectEventBlock onTextInput; @property (nonatomic, copy, nullable) RCTDirectEventBlock onScroll; -#if TARGET_OS_OSX // TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS @property (nonatomic, copy, nullable) RCTBubblingEventBlock onAutoCorrectChange; @property (nonatomic, copy, nullable) RCTBubblingEventBlock onSpellCheckChange; @property (nonatomic, copy, nullable) RCTBubblingEventBlock onGrammarCheckChange; @property (nonatomic, assign) BOOL clearTextOnSubmit; @property (nonatomic, copy, nullable) RCTDirectEventBlock onSubmitEditing; @property (nonatomic, copy) NSArray *submitKeyEvents; -#endif // TODO(macOS GH#774) +#endif // macOS] @property (nonatomic, assign) NSInteger mostRecentEventCount; @property (nonatomic, assign, readonly) NSInteger nativeEventCount; @property (nonatomic, assign) BOOL autoFocus; @@ -61,12 +61,12 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, copy) RCTTextSelection *selection; @property (nonatomic, strong, nullable) NSNumber *maxLength; @property (nonatomic, copy, nullable) NSAttributedString *attributedText; -@property (nonatomic, copy) NSString *predictedText; // TODO(OSS Candidate ISS#2710739) +@property (nonatomic, copy) NSString *predictedText; // [macOS] @property (nonatomic, copy) NSString *inputAccessoryViewID; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] @property (nonatomic, assign) UIKeyboardType keyboardType; @property (nonatomic, assign) BOOL showSoftInputOnFocus; -#endif // TODO(macOS GH#774) +#endif // [macOS] /** Sets selection intext input if both start and end are within range of the text input. diff --git a/Libraries/Text/TextInput/RCTBaseTextInputView.m b/Libraries/Text/TextInput/RCTBaseTextInputView.m index 539f7e7460ac0f..e794b151bbc0ed 100644 --- a/Libraries/Text/TextInput/RCTBaseTextInputView.m +++ b/Libraries/Text/TextInput/RCTBaseTextInputView.m @@ -14,19 +14,19 @@ #import #import -#import // TODO(macOS GH#774) +#import // [macOS] #import #import #import #import -#import // TODO(macOS GH#774) -#import "../RCTTextUIKit.h" // TODO(macOS GH#774) +#import // [macOS] +#import "../RCTTextUIKit.h" // [macOS] @implementation RCTBaseTextInputView { __weak RCTBridge *_bridge; __weak id _eventDispatcher; BOOL _hasInputAccesoryView; - // TODO(OSS Candidate ISS#2710739): remove explicit _predictedText ivar declaration + // [macOS] remove explicit _predictedText ivar declaration BOOL _didMoveToWindow; } @@ -34,7 +34,7 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge { RCTAssertParam(bridge); - if (self = [super initWithEventDispatcher:bridge.eventDispatcher]) { // TODO(OSS Candidate GH#774) + if (self = [super initWithEventDispatcher:bridge.eventDispatcher]) { // [macOS] _bridge = bridge; _eventDispatcher = bridge.eventDispatcher; } @@ -45,7 +45,7 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge RCT_NOT_IMPLEMENTED(- (instancetype)init) RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)decoder) -- (RCTUIView *)backedTextInputView // TODO(macOS ISS#3536887) +- (RCTUIView *)backedTextInputView // [macOS] { RCTAssert(NO, @"-[RCTBaseTextInputView backedTextInputView] must be implemented in subclass."); return nil; @@ -68,36 +68,36 @@ - (void)setTextAttributes:(RCTTextAttributes *)textAttributes - (void)enforceTextAttributesIfNeeded { - if (![self ignoresTextAttributes]) { // TODO(OSS Candidate ISS#2710739) + if (![self ignoresTextAttributes]) { // [macOS] id backedTextInputView = self.backedTextInputView; NSDictionary *textAttributes = [[_textAttributes effectiveTextAttributes] mutableCopy]; if ([textAttributes valueForKey:NSForegroundColorAttributeName] == nil) { - [textAttributes setValue:[RCTUIColor blackColor] forKey:NSForegroundColorAttributeName]; // TODO(macOS GH#774) + [textAttributes setValue:[RCTUIColor blackColor] forKey:NSForegroundColorAttributeName]; // [macOS] } backedTextInputView.defaultTextAttributes = textAttributes; - } // TODO(OSS Candidate ISS#2710739) + } // [macOS] } - (void)setReactPaddingInsets:(UIEdgeInsets)reactPaddingInsets { _reactPaddingInsets = reactPaddingInsets; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] // We apply `paddingInsets` as `backedTextInputView`'s `textContainerInset`. self.backedTextInputView.textContainerInset = reactPaddingInsets; [self setNeedsLayout]; -#endif // TODO(macOS GH#774) +#endif // [macOS] } - (void)setReactBorderInsets:(UIEdgeInsets)reactBorderInsets { _reactBorderInsets = reactBorderInsets; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] // We apply `borderInsets` as `backedTextInputView` layout offset. self.backedTextInputView.frame = UIEdgeInsetsInsetRect(self.bounds, reactBorderInsets); [self setNeedsLayout]; -#endif // TODO(macOS GH#774) +#endif // [macOS] } - (NSAttributedString *)attributedText @@ -123,14 +123,14 @@ - (BOOL)textOf:(NSAttributedString*)newText equals:(NSAttributedString*)oldText{ }]; BOOL shouldFallbackToBareTextComparison = -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [self.backedTextInputView.textInputMode.primaryLanguage isEqualToString:@"dictation"] || self.backedTextInputView.markedTextRange || self.backedTextInputView.isSecureTextEntry || fontHasBeenUpdatedBySystem; -#else // [TODO(macOS GH#774) +#else // [macOS NO; -#endif // ]TODO(macOS GH#774) +#endif // macOS] if (shouldFallbackToBareTextComparison) { return ([newText.string isEqualToString:oldText.string]); @@ -154,19 +154,19 @@ - (void)setAttributedText:(NSAttributedString *)attributedText range:NSMakeRange(0, attributedTextCopy.length)]; textNeedsUpdate = ([self textOf:attributedTextCopy equals:backedTextInputViewTextCopy] == NO); -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS // If we are in a language that uses conversion (e.g. Japanese), ignore updates if we have unconverted text. if ([self.backedTextInputView hasMarkedText]) { textNeedsUpdate = NO; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] if (eventLag == 0 && textNeedsUpdate) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UITextRange *selection = self.backedTextInputView.selectedTextRange; -#else // [TODO(macOS GH#774) +#else // [macOS NSRange selection = [self.backedTextInputView selectedTextRange]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] NSAttributedString *oldAttributedText = [self.backedTextInputView.attributedText copy]; NSInteger oldTextLength = oldAttributedText.string.length; @@ -177,7 +177,7 @@ - (void)setAttributedText:(NSAttributedString *)attributedText self.backedTextInputView.attributedText = attributedText; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] if (selection.empty) { // Maintaining a cursor position relative to the end of the old text. NSInteger offsetStart = @@ -191,7 +191,7 @@ - (void)setAttributedText:(NSAttributedString *)attributedText [self.backedTextInputView setSelectedTextRange:[self.backedTextInputView textRangeFromPosition:position toPosition:position] notifyDelegate:YES]; } -#else // [TODO(macOS GH#774) +#else // [macOS if (selection.length == 0) { // Maintaining a cursor position relative to the end of the old text. NSInteger start = selection.location; @@ -200,7 +200,7 @@ - (void)setAttributedText:(NSAttributedString *)attributedText [self.backedTextInputView setSelectedTextRange:NSMakeRange(newOffset, 0) notifyDelegate:YES]; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] [self updateLocalData]; } else if (eventLag > RCTTextUpdateLagWarningThreshold) { @@ -211,15 +211,15 @@ - (void)setAttributedText:(NSAttributedString *)attributedText - (RCTTextSelection *)selection { id backedTextInputView = self.backedTextInputView; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UITextRange *selectedTextRange = backedTextInputView.selectedTextRange; return [[RCTTextSelection new] initWithStart:[backedTextInputView offsetFromPosition:backedTextInputView.beginningOfDocument toPosition:selectedTextRange.start] end:[backedTextInputView offsetFromPosition:backedTextInputView.beginningOfDocument toPosition:selectedTextRange.end]]; -#else // [TODO(macOS GH#774) +#else // [macOS NSRange selectedTextRange = backedTextInputView.selectedTextRange; return [[RCTTextSelection new] initWithStart:selectedTextRange.location end:selectedTextRange.location + selectedTextRange.length]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } - (void)setSelection:(RCTTextSelection *)selection @@ -230,21 +230,21 @@ - (void)setSelection:(RCTTextSelection *)selection id backedTextInputView = self.backedTextInputView; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UITextRange *previousSelectedTextRange = backedTextInputView.selectedTextRange; UITextPosition *start = [backedTextInputView positionFromPosition:backedTextInputView.beginningOfDocument offset:selection.start]; UITextPosition *end = [backedTextInputView positionFromPosition:backedTextInputView.beginningOfDocument offset:selection.end]; UITextRange *selectedTextRange = [backedTextInputView textRangeFromPosition:start toPosition:end]; -#else // [TODO(macOS GH#774) +#else // [macOS NSRange previousSelectedTextRange = backedTextInputView.selectedTextRange; NSInteger start = MIN(selection.start, selection.end); NSInteger end = MAX(selection.start, selection.end); NSInteger length = end - selection.start; NSRange selectedTextRange = NSMakeRange(start, length); -#endif // ]TODO(macOS GH#774) +#endif // macOS] NSInteger eventLag = _nativeEventCount - _mostRecentEventCount; - if (eventLag == 0 && !RCTTextSelectionEqual(previousSelectedTextRange, selectedTextRange)) { // TODO(macOS GH#774) + if (eventLag == 0 && !RCTTextSelectionEqual(previousSelectedTextRange, selectedTextRange)) { // [macOS] [backedTextInputView setSelectedTextRange:selectedTextRange notifyDelegate:NO]; } else if (eventLag > RCTTextUpdateLagWarningThreshold) { RCTLog(@"Native TextInput(%@) is %lld events ahead of JS - try to make your JS faster.", backedTextInputView.attributedText.string, (long long)eventLag); @@ -254,7 +254,7 @@ - (void)setSelection:(RCTTextSelection *)selection - (void)setSelectionStart:(NSInteger)start selectionEnd:(NSInteger)end { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UITextPosition *startPosition = [self.backedTextInputView positionFromPosition:self.backedTextInputView.beginningOfDocument offset:start]; UITextPosition *endPosition = [self.backedTextInputView positionFromPosition:self.backedTextInputView.beginningOfDocument @@ -263,11 +263,11 @@ - (void)setSelectionStart:(NSInteger)start UITextRange *range = [self.backedTextInputView textRangeFromPosition:startPosition toPosition:endPosition]; [self.backedTextInputView setSelectedTextRange:range notifyDelegate:NO]; } -#else // [TODO(macOS GH#774) +#else // [macOS NSInteger startPosition = MIN(start, end); NSInteger endPosition = MAX(start, end); [self.backedTextInputView setSelectedTextRange:NSMakeRange(startPosition, endPosition - startPosition) notifyDelegate:NO]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } - (void)setTextContentType:(NSString *)type @@ -324,7 +324,7 @@ - (void)setTextContentType:(NSString *)type #endif } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)setPasswordRules:(NSString *)descriptor { @@ -363,7 +363,7 @@ - (void)setShowSoftInputOnFocus:(BOOL)showSoftInputOnFocus self.backedTextInputView.inputView = [UIView new]; } } -#endif // TODO(macOS GH#774) +#endif // [macOS] #pragma mark - RCTBackedTextInputDelegate @@ -415,7 +415,7 @@ - (void)textInputDidEndEditing eventCount:_nativeEventCount]; } -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS - (void)automaticSpellingCorrectionDidChange:(BOOL)enabled { if (_onAutoCorrectChange) { @@ -476,7 +476,7 @@ - (void)submitOnKeyDownIfNeeded:(NSEvent *)event } } } -#endif // ]TODO(macOS GH#774) +#endif // macOS] - (BOOL)textInputShouldReturn { @@ -485,17 +485,17 @@ - (BOOL)textInputShouldReturn // `onSubmitEditing` is called when "Submit" button // (the blue key on onscreen keyboard) did pressed // (no connection to any specific "submitting" process). -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS if (_blurOnSubmit) { -#endif // ]TODO(macOS GH#774) +#endif // macOS] [_eventDispatcher sendTextEventWithType:RCTTextEventTypeSubmit reactTag:self.reactTag text:[self.backedTextInputView.attributedText.string copy] key:nil eventCount:_nativeEventCount]; -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS } -#endif // ]TODO(macOS GH#774) +#endif // macOS] return _blurOnSubmit; } @@ -541,18 +541,18 @@ - (NSString *)textInputShouldChangeText:(NSString *)text inRange:(NSRange)range [newAttributedText replaceCharactersInRange:range withString:limitedString]; } backedTextInputView.attributedText = newAttributedText; - [self setPredictedText:newAttributedText.string]; // TODO(OSS Candidate ISS#2710739) + [self setPredictedText:newAttributedText.string]; // [macOS] // Collapse selection at end of insert to match normal paste behavior. -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UITextPosition *insertEnd = [backedTextInputView positionFromPosition:backedTextInputView.beginningOfDocument offset:(range.location + allowedLength)]; [backedTextInputView setSelectedTextRange:[backedTextInputView textRangeFromPosition:insertEnd toPosition:insertEnd] notifyDelegate:YES]; -#else // [TODO(macOS GH#774) +#else // [macOS [backedTextInputView setSelectedTextRange:NSMakeRange(range.location + allowedLength, 0) notifyDelegate:YES]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] [self textInputDidChange]; } @@ -565,7 +565,7 @@ - (NSString *)textInputShouldChangeText:(NSString *)text inRange:(NSRange)range if (range.location + range.length > backedTextInputView.attributedText.string.length) { _predictedText = backedTextInputView.attributedText.string; - } else if (text != nil) { // TODO(macOS GH#774): -[NSString stringByReplacingCharactersInRange:withString:] doesn't like when the replacement string is nil + } else if (text != nil) { // [macOS] -[NSString stringByReplacingCharactersInRange:withString:] doesn't like when the replacement string is nil _predictedText = [backedTextInputView.attributedText.string stringByReplacingCharactersInRange:range withString:text]; } @@ -596,12 +596,12 @@ - (void)textInputDidChange // update the mismatched range. NSRange currentRange; NSRange predictionRange; - if (findMismatch(backedTextInputView.attributedText.string, [self predictedText], ¤tRange, &predictionRange)) { // TODO(OSS Candidate ISS#2710739) + if (findMismatch(backedTextInputView.attributedText.string, [self predictedText], ¤tRange, &predictionRange)) { // [macOS] NSString *replacement = [backedTextInputView.attributedText.string substringWithRange:currentRange]; [self textInputShouldChangeText:replacement inRange:predictionRange]; // JS will assume the selection changed based on the location of our shouldChangeTextInRange, so reset it. [self textInputDidChangeSelection]; - [self setPredictedText:backedTextInputView.attributedText.string]; // TODO(OSS Candidate ISS#2710739) + [self setPredictedText:backedTextInputView.attributedText.string]; // [macOS] } _nativeEventCount++; @@ -631,13 +631,13 @@ - (void)textInputDidChangeSelection }); } -// [TODO(OSS Candidate ISS#2710739) +// [macOS - (BOOL)textInputShouldHandleDeleteBackward:(__unused id)sender { return YES; } -// ]TODO(OSS Candidate ISS#2710739) +// macOS] -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS - (BOOL)textInputShouldHandleDeleteForward:(__unused id)sender { return YES; } @@ -698,7 +698,7 @@ - (BOOL)textInputShouldHandlePaste:(__unused id)sender // Only allow pasting text. return fileType == nil; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] - (void)updateLocalData { @@ -740,7 +740,7 @@ - (CGSize)sizeThatFits:(CGSize)size #pragma mark - Accessibility -- (RCTUIView *)reactAccessibilityElement // TODO(macOS ISS#3536887) +- (RCTUIView *)reactAccessibilityElement // [macOS] { return self.backedTextInputView; } @@ -781,7 +781,7 @@ - (void)didSetProps:(NSArray *)changedProps - (void)setCustomInputAccessoryViewWithNativeID:(NSString *)nativeID { - #if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] __weak RCTBaseTextInputView *weakSelf = self; [_bridge.uiManager rootViewForReactTag:self.reactTag withCompletion:^(UIView *rootView) { RCTBaseTextInputView *strongSelf = weakSelf; @@ -794,12 +794,12 @@ - (void)setCustomInputAccessoryViewWithNativeID:(NSString *)nativeID } } }]; - #endif /* !TARGET_OS_OSX TODO(macOS GH#774) */ +#endif // [macOS] } - (void)setDefaultInputAccessoryView { - #if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UIView *textInputView = self.backedTextInputView; UIKeyboardType keyboardType = textInputView.keyboardType; @@ -838,10 +838,10 @@ - (void)setDefaultInputAccessoryView textInputView.inputAccessoryView = nil; } [self reloadInputViewsIfNecessary]; - #endif /* !TARGET_OS_OSX TODO(macOS GH#774) */ +#endif // [macOS] } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)reloadInputViewsIfNecessary { // We have to call `reloadInputViews` for focused text inputs to update an accessory view. @@ -856,7 +856,7 @@ - (void)handleInputAccessoryDoneButton [self.backedTextInputView endEditing:YES]; } } -#endif // TODO(macOS GH#774) +#endif // [macOS] #pragma mark - Helpers @@ -889,7 +889,7 @@ static BOOL findMismatch(NSString *first, NSString *second, NSRange *firstRange, return YES; } -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS #pragma mark - NSResponder chain @@ -898,6 +898,6 @@ - (BOOL)canBecomeKeyView return NO; // Enclosed backedTextInputView can become the key view } -#endif // ]TODO(macOS GH#774) +#endif // macOS] @end diff --git a/Libraries/Text/TextInput/RCTBaseTextInputViewManager.m b/Libraries/Text/TextInput/RCTBaseTextInputViewManager.m index d1de3945f8fab7..22bc6276df9b3f 100644 --- a/Libraries/Text/TextInput/RCTBaseTextInputViewManager.m +++ b/Libraries/Text/TextInput/RCTBaseTextInputViewManager.m @@ -18,10 +18,10 @@ #import #import -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] #import -#endif // TODO(macOS GH#774) -#import // TODO(macOS GH#774) +#endif // [macOS] +#import // [macOS] @interface RCTBaseTextInputViewManager () @@ -36,29 +36,29 @@ @implementation RCTBaseTextInputViewManager #pragma mark - Unified properties -RCT_REMAP_NOT_OSX_VIEW_PROPERTY(autoCapitalize, backedTextInputView.autocapitalizationType, UITextAutocapitalizationType) // TODO(macOS GH#774) -RCT_REMAP_NOT_OSX_VIEW_PROPERTY(autoCorrect, backedTextInputView.autocorrectionType, UITextAutocorrectionType) // TODO(macOS GH#774) -RCT_REMAP_OSX_VIEW_PROPERTY(autoCorrect, backedTextInputView.automaticSpellingCorrectionEnabled, BOOL) // TODO(macOS GH#774) +RCT_REMAP_NOT_OSX_VIEW_PROPERTY(autoCapitalize, backedTextInputView.autocapitalizationType, UITextAutocapitalizationType) // [macOS] +RCT_REMAP_NOT_OSX_VIEW_PROPERTY(autoCorrect, backedTextInputView.autocorrectionType, UITextAutocorrectionType) // [macOS] +RCT_REMAP_OSX_VIEW_PROPERTY(autoCorrect, backedTextInputView.automaticSpellingCorrectionEnabled, BOOL) // [macOS] RCT_REMAP_VIEW_PROPERTY(contextMenuHidden, backedTextInputView.contextMenuHidden, BOOL) RCT_REMAP_VIEW_PROPERTY(editable, backedTextInputView.editable, BOOL) -RCT_REMAP_NOT_OSX_VIEW_PROPERTY(enablesReturnKeyAutomatically, backedTextInputView.enablesReturnKeyAutomatically, BOOL) // TODO(macOS GH#774) -RCT_REMAP_NOT_OSX_VIEW_PROPERTY(keyboardAppearance, backedTextInputView.keyboardAppearance, UIKeyboardAppearance) // TODO(macOS GH#774) +RCT_REMAP_NOT_OSX_VIEW_PROPERTY(enablesReturnKeyAutomatically, backedTextInputView.enablesReturnKeyAutomatically, BOOL) // [macOS] +RCT_REMAP_NOT_OSX_VIEW_PROPERTY(keyboardAppearance, backedTextInputView.keyboardAppearance, UIKeyboardAppearance) // [macOS] RCT_REMAP_VIEW_PROPERTY(placeholder, backedTextInputView.placeholder, NSString) RCT_REMAP_VIEW_PROPERTY(placeholderTextColor, backedTextInputView.placeholderColor, UIColor) -RCT_REMAP_NOT_OSX_VIEW_PROPERTY(returnKeyType, backedTextInputView.returnKeyType, UIReturnKeyType) // TODO(macOS GH#774) -RCT_REMAP_NOT_OSX_VIEW_PROPERTY(selectionColor, backedTextInputView.tintColor, UIColor) // TODO(macOS GH#774) -RCT_REMAP_OSX_VIEW_PROPERTY(selectionColor, backedTextInputView.selectionColor, UIColor) // TODO(macOS GH#774) -RCT_REMAP_OSX_VIEW_PROPERTY(grammarCheck, backedTextInputView.grammarCheckingEnabled, BOOL) // TODO(macOS GH#774) -RCT_REMAP_NOT_OSX_VIEW_PROPERTY(spellCheck, backedTextInputView.spellCheckingType, UITextSpellCheckingType) // TODO(macOS GH#774) -RCT_REMAP_OSX_VIEW_PROPERTY(spellCheck, backedTextInputView.continuousSpellCheckingEnabled, BOOL) // TODO(macOS GH#774) -RCT_REMAP_NOT_OSX_VIEW_PROPERTY(caretHidden, backedTextInputView.caretHidden, BOOL) // TODO(macOS GH#774) -RCT_REMAP_NOT_OSX_VIEW_PROPERTY(clearButtonMode, backedTextInputView.clearButtonMode, UITextFieldViewMode) // TODO(macOS GH#774) -RCT_REMAP_NOT_OSX_VIEW_PROPERTY(secureTextEntry, backedTextInputView.secureTextEntry, BOOL) // TODO(macOS GH#774) +RCT_REMAP_NOT_OSX_VIEW_PROPERTY(returnKeyType, backedTextInputView.returnKeyType, UIReturnKeyType) // [macOS] +RCT_REMAP_NOT_OSX_VIEW_PROPERTY(selectionColor, backedTextInputView.tintColor, UIColor) // [macOS] +RCT_REMAP_OSX_VIEW_PROPERTY(selectionColor, backedTextInputView.selectionColor, UIColor) // [macOS] +RCT_REMAP_OSX_VIEW_PROPERTY(grammarCheck, backedTextInputView.grammarCheckingEnabled, BOOL) // [macOS] +RCT_REMAP_NOT_OSX_VIEW_PROPERTY(spellCheck, backedTextInputView.spellCheckingType, UITextSpellCheckingType)// [macOS] +RCT_REMAP_OSX_VIEW_PROPERTY(spellCheck, backedTextInputView.continuousSpellCheckingEnabled, BOOL) // [macOS] +RCT_REMAP_NOT_OSX_VIEW_PROPERTY(caretHidden, backedTextInputView.caretHidden, BOOL) // [macOS] +RCT_REMAP_NOT_OSX_VIEW_PROPERTY(clearButtonMode, backedTextInputView.clearButtonMode, UITextFieldViewMode) // [macOS] +RCT_REMAP_NOT_OSX_VIEW_PROPERTY(secureTextEntry, backedTextInputView.secureTextEntry, BOOL) // [macOS] RCT_EXPORT_VIEW_PROPERTY(autoFocus, BOOL) RCT_EXPORT_VIEW_PROPERTY(blurOnSubmit, BOOL) RCT_EXPORT_VIEW_PROPERTY(clearTextOnFocus, BOOL) -RCT_REMAP_NOT_OSX_VIEW_PROPERTY(keyboardType, backedTextInputView.keyboardType, UIKeyboardType) // TODO(macOS GH#774) -RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(showSoftInputOnFocus, BOOL) // TODO(macOS GH#774) +RCT_REMAP_NOT_OSX_VIEW_PROPERTY(keyboardType, backedTextInputView.keyboardType, UIKeyboardType) // [macOS] +RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(showSoftInputOnFocus, BOOL) // [macOS] RCT_EXPORT_VIEW_PROPERTY(maxLength, NSNumber) RCT_EXPORT_VIEW_PROPERTY(selectTextOnFocus, BOOL) RCT_EXPORT_VIEW_PROPERTY(selection, RCTTextSelection) @@ -66,7 +66,7 @@ @implementation RCTBaseTextInputViewManager RCT_EXPORT_VIEW_PROPERTY(textContentType, NSString) RCT_EXPORT_VIEW_PROPERTY(passwordRules, NSString) -#if TARGET_OS_OSX // TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS RCT_EXPORT_VIEW_PROPERTY(onAutoCorrectChange, RCTBubblingEventBlock); RCT_EXPORT_VIEW_PROPERTY(onSpellCheckChange, RCTBubblingEventBlock); RCT_EXPORT_VIEW_PROPERTY(onGrammarCheckChange, RCTBubblingEventBlock); @@ -75,7 +75,7 @@ @implementation RCTBaseTextInputViewManager RCT_EXPORT_VIEW_PROPERTY(clearTextOnSubmit, BOOL); RCT_EXPORT_VIEW_PROPERTY(onSubmitEditing, RCTBubblingEventBlock); RCT_EXPORT_VIEW_PROPERTY(submitKeyEvents, NSArray); -#endif // TODO(macOS GH#774) +#endif // macOS] RCT_EXPORT_VIEW_PROPERTY(onChange, RCTBubblingEventBlock) RCT_EXPORT_VIEW_PROPERTY(onKeyPressSync, RCTDirectEventBlock) @@ -91,7 +91,7 @@ @implementation RCTBaseTextInputViewManager RCT_EXPORT_SHADOW_PROPERTY(placeholder, NSString) RCT_EXPORT_SHADOW_PROPERTY(onContentSizeChange, RCTBubblingEventBlock) -RCT_CUSTOM_VIEW_PROPERTY(multiline, BOOL, RCTUIView) // TODO(macOS GH#774) +RCT_CUSTOM_VIEW_PROPERTY(multiline, BOOL, RCTUIView) // [macOS] { // No op. // This View Manager doesn't use this prop but it must be exposed here via ViewConfig to enable Fabric component use it. @@ -100,11 +100,11 @@ @implementation RCTBaseTextInputViewManager - (RCTShadowView *)shadowView { RCTBaseTextInputShadowView *shadowView = [[RCTBaseTextInputShadowView alloc] initWithBridge:self.bridge]; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] shadowView.textAttributes.fontSizeMultiplier = [[[self.bridge moduleForName:@"AccessibilityManager" lazilyLoadIfNecessary:YES] valueForKey:@"multiplier"] floatValue]; -#endif // TODO(macOS GH#774) +#endif // [macOS] [_shadowViews addObject:shadowView]; return shadowView; } @@ -117,27 +117,27 @@ - (void)setBridge:(RCTBridge *)bridge [bridge.uiManager.observerCoordinator addObserver:self]; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleDidUpdateMultiplierNotification) name:@"RCTAccessibilityManagerDidUpdateMultiplierNotification" object:[bridge moduleForName:@"AccessibilityManager" lazilyLoadIfNecessary:YES]]; -#endif // TODO(macOS GH#774) +#endif // [macOS] } RCT_EXPORT_METHOD(focus : (nonnull NSNumber *)viewTag) { - [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary *viewRegistry) { // TODO(macOS GH#774) - RCTUIView *view = viewRegistry[viewTag]; // TODO(macOS GH#774) + [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary *viewRegistry) { // [macOS] + RCTUIView *view = viewRegistry[viewTag]; // [macOS] [view reactFocus]; }]; } RCT_EXPORT_METHOD(blur : (nonnull NSNumber *)viewTag) { - [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary *viewRegistry) { // TODO(macOS GH#774) - RCTUIView *view = viewRegistry[viewTag]; // TODO(macOS GH#774) + [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary *viewRegistry) { // [macOS] + RCTUIView *view = viewRegistry[viewTag]; // [macOS] [view reactBlur]; }]; } @@ -148,7 +148,7 @@ - (void)setBridge:(RCTBridge *)bridge start : (NSInteger)start end : (NSInteger)end) { - [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary *viewRegistry) { // TODO(macOS GH#774) + [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary *viewRegistry) { // [macOS] RCTBaseTextInputView *view = (RCTBaseTextInputView *)viewRegistry[viewTag]; NSInteger eventLag = view.nativeEventCount - mostRecentEventCount; if (eventLag != 0) { diff --git a/Libraries/Text/TextInput/RCTInputAccessoryShadowView.m b/Libraries/Text/TextInput/RCTInputAccessoryShadowView.m index 17673cd6363fd8..c1032a091ea922 100644 --- a/Libraries/Text/TextInput/RCTInputAccessoryShadowView.m +++ b/Libraries/Text/TextInput/RCTInputAccessoryShadowView.m @@ -14,9 +14,9 @@ @implementation RCTInputAccessoryShadowView - (void)insertReactSubview:(RCTShadowView *)subview atIndex:(NSInteger)atIndex { [super insertReactSubview:subview atIndex:atIndex]; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] subview.width = (YGValue) { RCTScreenSize().width, YGUnitPoint }; -#endif // TODO(macOS GH#774) +#endif // [macOS] } @end diff --git a/Libraries/Text/TextInput/RCTInputAccessoryView.h b/Libraries/Text/TextInput/RCTInputAccessoryView.h index da648a8a60e187..1c07cc81a0ac39 100644 --- a/Libraries/Text/TextInput/RCTInputAccessoryView.h +++ b/Libraries/Text/TextInput/RCTInputAccessoryView.h @@ -5,12 +5,12 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] @class RCTBridge; @class RCTInputAccessoryViewContent; -@interface RCTInputAccessoryView : RCTUIView // TODO(macOS ISS#3536887) +@interface RCTInputAccessoryView : RCTUIView // [macOS] - (instancetype)initWithBridge:(RCTBridge *)bridge; diff --git a/Libraries/Text/TextInput/RCTInputAccessoryView.m b/Libraries/Text/TextInput/RCTInputAccessoryView.m index 050def9bbd16b9..24b453c1c54d74 100644 --- a/Libraries/Text/TextInput/RCTInputAccessoryView.m +++ b/Libraries/Text/TextInput/RCTInputAccessoryView.m @@ -16,7 +16,7 @@ @interface RCTInputAccessoryView() // Overriding `inputAccessoryView` to `readwrite`. -@property (nonatomic, readwrite, retain) RCTUIView *inputAccessoryView; // TODO(macOS GH#774) +@property (nonatomic, readwrite, retain) RCTUIView *inputAccessoryView; // [macOS] @end @@ -50,13 +50,13 @@ - (void)reactSetFrame:(CGRect)frame } } -- (void)insertReactSubview:(RCTUIView *)subview atIndex:(NSInteger)index // TODO(macOS GH#774) +- (void)insertReactSubview:(RCTUIView *)subview atIndex:(NSInteger)index // [macOS] { [super insertReactSubview:subview atIndex:index]; [_inputAccessoryView insertReactSubview:subview atIndex:index]; } -- (void)removeReactSubview:(RCTUIView *)subview // TODO(macOS GH#774) +- (void)removeReactSubview:(RCTUIView *)subview // [macOS] { [super removeReactSubview:subview]; [_inputAccessoryView removeReactSubview:subview]; diff --git a/Libraries/Text/TextInput/RCTInputAccessoryViewContent.h b/Libraries/Text/TextInput/RCTInputAccessoryViewContent.h index d4ad7b5bd51ce5..e7a03df0523690 100644 --- a/Libraries/Text/TextInput/RCTInputAccessoryViewContent.h +++ b/Libraries/Text/TextInput/RCTInputAccessoryViewContent.h @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] -@interface RCTInputAccessoryViewContent : RCTUIView // TODO(macOS ISS#3536887) +@interface RCTInputAccessoryViewContent : RCTUIView // [macOS] @end diff --git a/Libraries/Text/TextInput/RCTInputAccessoryViewContent.m b/Libraries/Text/TextInput/RCTInputAccessoryViewContent.m index 65aa1920baeca8..8ae8ec73038d39 100644 --- a/Libraries/Text/TextInput/RCTInputAccessoryViewContent.m +++ b/Libraries/Text/TextInput/RCTInputAccessoryViewContent.m @@ -11,14 +11,14 @@ @implementation RCTInputAccessoryViewContent { - RCTUIView *_safeAreaContainer; // TODO(macOS GH#774) + RCTUIView *_safeAreaContainer; // [macOS] NSLayoutConstraint *_heightConstraint; } - (instancetype)init { if (self = [super init]) { - _safeAreaContainer = [RCTUIView new]; // TODO(macOS GH#774) + _safeAreaContainer = [RCTUIView new]; // [macOS] [self addSubview:_safeAreaContainer]; // Use autolayout to position the view properly and take into account @@ -30,17 +30,17 @@ - (instancetype)init _heightConstraint = [_safeAreaContainer.heightAnchor constraintEqualToConstant:0]; _heightConstraint.active = YES; -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [_safeAreaContainer.bottomAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.bottomAnchor].active = YES; [_safeAreaContainer.topAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.topAnchor].active = YES; [_safeAreaContainer.leadingAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.leadingAnchor].active = YES; [_safeAreaContainer.trailingAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.trailingAnchor].active = YES; -#else // TODO(macOS GH#774) +#else // [macOS [_safeAreaContainer.bottomAnchor constraintEqualToAnchor:self.bottomAnchor].active = YES; [_safeAreaContainer.topAnchor constraintEqualToAnchor:self.topAnchor].active = YES; [_safeAreaContainer.leadingAnchor constraintEqualToAnchor:self.leadingAnchor].active = YES; [_safeAreaContainer.trailingAnchor constraintEqualToAnchor:self.trailingAnchor].active = YES; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } return self; } @@ -64,13 +64,13 @@ - (void)reactSetFrame:(CGRect)frame [self layoutIfNeeded]; } -- (void)insertReactSubview:(RCTUIView *)subview atIndex:(NSInteger)index // TODO(macOS GH#774) +- (void)insertReactSubview:(RCTUIView *)subview atIndex:(NSInteger)index // [macOS] { [super insertReactSubview:subview atIndex:index]; [_safeAreaContainer insertSubview:subview atIndex:index]; } -- (void)removeReactSubview:(RCTUIView *)subview // TODO(macOS GH#774) +- (void)removeReactSubview:(RCTUIView *)subview // [macOS] { [super removeReactSubview:subview]; [subview removeFromSuperview]; diff --git a/Libraries/Text/TextInput/RCTInputAccessoryViewManager.m b/Libraries/Text/TextInput/RCTInputAccessoryViewManager.m index 64cbd4702043c9..8ab7f2b20cd61f 100644 --- a/Libraries/Text/TextInput/RCTInputAccessoryViewManager.m +++ b/Libraries/Text/TextInput/RCTInputAccessoryViewManager.m @@ -19,7 +19,7 @@ + (BOOL)requiresMainQueueSetup return NO; } -- (RCTUIView *)view // TODO(macOS GH#774) +- (RCTUIView *)view // [macOS] { return [[RCTInputAccessoryView alloc] initWithBridge:self.bridge]; } diff --git a/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputView.m b/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputView.m index 7b908401afa0cd..910205cfdf385a 100644 --- a/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputView.m +++ b/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputView.m @@ -10,14 +10,14 @@ #import #include -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS #include -#endif // ]TODO(macOS GH#774) +#endif // macOS] @implementation RCTSinglelineTextInputView { RCTUITextField *_backedTextInputView; - BOOL _useSecureTextField; // TODO(macOS GH#774) + BOOL _useSecureTextField; // [macOS] } - (instancetype)initWithBridge:(RCTBridge *)bridge @@ -28,10 +28,10 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge _backedTextInputView = [[RCTUITextField alloc] initWithFrame:self.bounds]; _backedTextInputView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS _backedTextInputView.cell.scrollable = YES; _backedTextInputView.cell.usesSingleLineMode = YES; -#endif // ]TODO(macOS GH#774) +#endif // macOS] _backedTextInputView.textInputDelegate = self; [self addSubview:_backedTextInputView]; @@ -45,7 +45,7 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge return _backedTextInputView; } -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS - (void)setReactPaddingInsets:(UIEdgeInsets)reactPaddingInsets { [super setReactPaddingInsets:reactPaddingInsets]; @@ -98,6 +98,6 @@ - (void)setEnableFocusRing:(BOOL)enableFocusRing { [_backedTextInputView setEnableFocusRing:enableFocusRing]; } } -#endif // ]TODO(macOS GH#774) +#endif // macOS] @end diff --git a/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputViewManager.m b/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputViewManager.m index db7cb9728dea59..651ca838049702 100644 --- a/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputViewManager.m +++ b/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputViewManager.m @@ -24,11 +24,11 @@ - (RCTShadowView *)shadowView return shadowView; } -- (RCTUIView *)view // TODO(macOS ISS#3536887) +- (RCTUIView *)view // [macOS] { return [[RCTSinglelineTextInputView alloc] initWithBridge:self.bridge]; } -RCT_REMAP_OSX_VIEW_PROPERTY(secureTextEntry, useSecureTextField, BOOL) // TODO(macOS GH#774) +RCT_REMAP_OSX_VIEW_PROPERTY(secureTextEntry, useSecureTextField, BOOL) // [macOS] @end diff --git a/Libraries/Text/TextInput/Singleline/RCTUITextField.h b/Libraries/Text/TextInput/Singleline/RCTUITextField.h index abbae748ea1e4c..f357e25585b9eb 100644 --- a/Libraries/Text/TextInput/Singleline/RCTUITextField.h +++ b/Libraries/Text/TextInput/Singleline/RCTUITextField.h @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] -#import "RCTTextUIKit.h" // TODO(macOS GH#774) +#import "RCTTextUIKit.h" // [macOS] #import #import @@ -29,25 +29,25 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, assign) BOOL caretHidden; @property (nonatomic, assign) BOOL contextMenuHidden; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] @property (nonatomic, assign, readonly) BOOL textWasPasted; -#else // [TODO(macOS GH#774) +#else // [macOS @property (nonatomic, assign) BOOL textWasPasted; -#endif // ]TODO(macOS GH#774) -@property (nonatomic, strong, nullable) RCTUIColor *placeholderColor; // TODO(OSS Candidate ISS#2710739) +#endif // macOS] +@property (nonatomic, strong, nullable) RCTUIColor *placeholderColor; // [macOS] @property (nonatomic, assign) UIEdgeInsets textContainerInset; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] @property (nonatomic, assign, getter=isEditable) BOOL editable; -#else // [TODO(macOS GH#774) +#else // [macOS @property (assign, getter=isEditable) BOOL editable; -#endif // ]TODO(macOS GH#774) +#endif // macOS] @property (nonatomic, getter=isScrollEnabled) BOOL scrollEnabled; @property (nonatomic, strong, nullable) NSString *inputAccessoryViewID; @property (nonatomic, assign, readonly) CGFloat zoomScale; @property (nonatomic, assign, readonly) CGPoint contentOffset; @property (nonatomic, assign, readonly) UIEdgeInsets contentInset; -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS @property (nonatomic, copy, nullable) NSString *text; @property (nonatomic, copy, nullable) NSAttributedString *attributedText; @property (nonatomic, copy) NSDictionary *defaultTextAttributes; @@ -59,7 +59,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, assign) BOOL enableFocusRing; @property (nonatomic, strong, nullable) RCTUIColor *selectionColor; @property (weak, nullable) id delegate; -#endif // ]TODO(macOS GH#774) +#endif // macOS] @end diff --git a/Libraries/Text/TextInput/Singleline/RCTUITextField.m b/Libraries/Text/TextInput/Singleline/RCTUITextField.m index 25e705018a992d..cf570c958782c0 100644 --- a/Libraries/Text/TextInput/Singleline/RCTUITextField.m +++ b/Libraries/Text/TextInput/Singleline/RCTUITextField.m @@ -10,11 +10,11 @@ #import #import #import -#import // TODO(OSS Candidate ISS#2710739) +#import // [macOS] #import -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS #if RCT_SUBCLASS_SECURETEXTFIELD #define RCTUITextFieldCell RCTUISecureTextFieldCell @@ -81,7 +81,7 @@ - (NSText *)setUpFieldEditorAttributes:(NSText *)textObj } @end -#endif // ]TODO(macOS GH#774) +#endif // macOS] #ifdef RCT_SUBCLASS_SECURETEXTFIELD @implementation RCTUISecureTextField { @@ -92,9 +92,9 @@ @implementation RCTUITextField { NSDictionary *_defaultTextAttributes; } -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS @dynamic delegate; -#endif // ]TODO(macOS GH#774) +#endif // macOS] - (instancetype)initWithFrame:(CGRect)frame { @@ -105,11 +105,11 @@ - (instancetype)initWithFrame:(CGRect)frame name:UITextFieldTextDidChangeNotification object:self]; -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS [self setBordered:NO]; [self setAllowsEditingTextAttributes:YES]; [self setBackgroundColor:[NSColor clearColor]]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] _textInputDelegateAdapter = [[RCTBackedTextFieldDelegateAdapter alloc] initWithTextField:self]; _scrollEnabled = YES; @@ -121,26 +121,26 @@ - (instancetype)initWithFrame:(CGRect)frame - (void)_textDidChange { _textWasPasted = NO; -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS [self setAttributedText:[[NSAttributedString alloc] initWithString:[self text] attributes:[self defaultTextAttributes]]]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS - (BOOL)hasMarkedText { return ((NSTextView *)self.currentEditor).hasMarkedText; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] #pragma mark - Accessibility -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)setIsAccessibilityElement:(BOOL)isAccessibilityElement -#else +#else // [macOS - (void)setAccessibilityElement:(BOOL)isAccessibilityElement -#endif // ]TODO(macOS GH#774) +#endif // macOS] { // UITextField is accessible by default (some nested views are) and disabling that is not supported. // On iOS accessible elements cannot be nested, therefore enabling accessibility for some container view @@ -156,9 +156,9 @@ - (void)setTextContainerInset:(UIEdgeInsets)textContainerInset } _textContainerInset = textContainerInset; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [self setNeedsLayout]; -#else // [TODO(macOS GH#774) +#else // [macOS ((RCTUITextFieldCell*)self.cell).textContainerInset = _textContainerInset; if (self.currentEditor) { @@ -172,10 +172,10 @@ - (void)setTextContainerInset:(UIEdgeInsets)textContainerInset start:selectedRange.location length:selectedRange.length]; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] } -#if TARGET_OS_OSX // TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS + (Class)cellClass { @@ -242,12 +242,12 @@ - (BOOL)isGrammarCheckingEnabled return ((RCTUITextFieldCell*)self.cell).isGrammarCheckingEnabled; } -- (void)setSelectionColor:(RCTUIColor *)selectionColor // TODO(OSS Candidate ISS#2710739) +- (void)setSelectionColor:(RCTUIColor *)selectionColor // [macOS] { ((RCTUITextFieldCell*)self.cell).selectionColor = selectionColor; } -- (RCTUIColor*)selectionColor // TODO(OSS Candidate ISS#2710739) +- (RCTUIColor*)selectionColor // [macOS] { return ((RCTUITextFieldCell*)self.cell).selectionColor; } @@ -274,28 +274,28 @@ - (void)setEnableFocusRing:(BOOL)enableFocusRing { } } -#endif // ]TODO(macOS GH#774) +#endif // macOS] - (void)setPlaceholder:(NSString *)placeholder { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [super setPlaceholder:placeholder]; -#else // [TODO(macOS GH#774) +#else // [macOS [super setPlaceholderString:placeholder]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] [self _updatePlaceholder]; } -- (NSString*)placeholder // [TODO(macOS GH#774) +- (NSString*)placeholder // [macOS { -#if !TARGET_OS_OSX +#if !TARGET_OS_OSX // [macOS] return super.placeholder; -#else +#else // [macOS return self.placeholderAttributedString.string ?: self.placeholderString; -#endif -} // ]TODO(macOS GH#774) +#endif // macOS] +} -- (void)setPlaceholderColor:(RCTUIColor *)placeholderColor // TODO(OSS Candidate ISS#2710739) +- (void)setPlaceholderColor:(RCTUIColor *)placeholderColor // [macOS] { _placeholderColor = placeholderColor; [self _updatePlaceholder]; @@ -308,15 +308,15 @@ - (void)setDefaultTextAttributes:(NSDictionary *)defa } _defaultTextAttributes = defaultTextAttributes; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [super setDefaultTextAttributes:defaultTextAttributes]; -#endif // TODO(macOS GH#774) +#endif // [macOS] [self _updatePlaceholder]; -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS [self setAttributedText:[[NSAttributedString alloc] initWithString:[self text] attributes:[self defaultTextAttributes]]]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } - (NSDictionary *)defaultTextAttributes @@ -326,13 +326,13 @@ - (void)setDefaultTextAttributes:(NSDictionary *)defa - (void)_updatePlaceholder { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] self.attributedPlaceholder = [[NSAttributedString alloc] initWithString:self.placeholder ?: @"" attributes:[self _placeholderTextAttributes]]; -#else // [TODO(macOS GH#774) +#else // [macOS self.placeholderAttributedString = [[NSAttributedString alloc] initWithString:self.placeholder ?: @"" attributes:[self _placeholderTextAttributes]]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } - (BOOL)isEditable @@ -342,14 +342,14 @@ - (BOOL)isEditable - (void)setEditable:(BOOL)editable { -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS // on macos the super must be called otherwise its NSTextFieldCell editable property doesn't get set. [super setEditable:editable]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] self.enabled = editable; } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)setSecureTextEntry:(BOOL)secureTextEntry { @@ -367,7 +367,7 @@ - (void)setSecureTextEntry:(BOOL)secureTextEntry self.attributedText = originalText; } -#endif // ]TODO(macOS GH#774) +#endif // [macOS] #pragma mark - Placeholder @@ -376,12 +376,12 @@ - (void)setSecureTextEntry:(BOOL)secureTextEntry { NSMutableDictionary *textAttributes = [_defaultTextAttributes mutableCopy] ?: [NSMutableDictionary new]; - // [TODO(OSS Candidate ISS#2710739) + // [macOS if (@available(iOS 13.0, *)) { [textAttributes setValue:self.placeholderColor ?: [RCTUIColor placeholderTextColor] forKey:NSForegroundColorAttributeName]; } else { - // ]TODO(OSS Candidate ISS#2710739) + // macOS] if (self.placeholderColor) { [textAttributes setValue:self.placeholderColor forKey:NSForegroundColorAttributeName]; } else { @@ -394,7 +394,7 @@ - (void)setSecureTextEntry:(BOOL)secureTextEntry #pragma mark - Context Menu -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (BOOL)canPerformAction:(SEL)action withSender:(id)sender { @@ -428,7 +428,7 @@ - (CGRect)editingRectForBounds:(CGRect)bounds return [self textRectForBounds:bounds]; } -#else // [TODO(macOS GH#774) +#else // [macOS #pragma mark - NSTextViewDelegate methods @@ -467,11 +467,11 @@ - (BOOL)textView:(NSTextView *)aTextView shouldChangeTextInRange:(NSRange)aRange return NO; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] #pragma mark - Overrides -#if !TARGET_OS_OSX +#if !TARGET_OS_OSX // [macOS] #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-implementations" // Overrides selectedTextRange setter to get notify when selectedTextRange changed. @@ -481,9 +481,9 @@ - (void)setSelectedTextRange:(UITextRange *)selectedTextRange [_textInputDelegateAdapter selectedTextRangeWasSet]; } #pragma clang diagnostic pop -#endif // !TARGET_OS_OSX +#endif // [macOS] -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS - (BOOL)becomeFirstResponder { BOOL isFirstResponder = [super becomeFirstResponder]; @@ -516,9 +516,9 @@ - (BOOL)performKeyEquivalent:(NSEvent *)event } return [super performKeyEquivalent:event]; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)setSelectedTextRange:(UITextRange *)selectedTextRange notifyDelegate:(BOOL)notifyDelegate { if (!notifyDelegate) { @@ -535,7 +535,7 @@ - (void)paste:(id)sender [super paste:sender]; _textWasPasted = YES; } -#else // [TODO(macOS GH#774) +#else // [macOS - (void)setSelectedTextRange:(NSRange)selectedTextRange notifyDelegate:(BOOL)notifyDelegate { if (!notifyDelegate) { @@ -551,7 +551,7 @@ - (NSRange)selectedTextRange { return [[self currentEditor] selectedRange]; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] #pragma mark - Layout @@ -565,10 +565,10 @@ - (CGSize)intrinsicContentSize { // Note: `placeholder` defines intrinsic size for ``. NSString *text = self.placeholder ?: @""; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] CGSize size = [text sizeWithAttributes:[self _placeholderTextAttributes]]; size = CGSizeMake(RCTCeilPixelValue(size.width), RCTCeilPixelValue(size.height)); -#else // [TODO(macOS GH#774) +#else // [macOS CGSize size = [text sizeWithAttributes:@{NSFontAttributeName: self.font}]; CGFloat scale = self.window.backingScaleFactor; RCTAssert(scale != 0.0, @"Layout occurs before the view is in a window?"); @@ -576,7 +576,7 @@ - (CGSize)intrinsicContentSize scale = [[NSScreen mainScreen] backingScaleFactor]; } size = CGSizeMake(RCTCeilPixelValue(size.width, scale), RCTCeilPixelValue(size.height, scale)); -#endif // ]TODO(macOS GH#774) +#endif // macOS] size.width += _textContainerInset.left + _textContainerInset.right; size.height += _textContainerInset.top + _textContainerInset.bottom; // Returning size DOES contain `textContainerInset` (aka `padding`). @@ -590,19 +590,19 @@ - (CGSize)sizeThatFits:(CGSize)size return CGSizeMake(MIN(size.width, intrinsicSize.width), MIN(size.height, intrinsicSize.height)); } -#if !TARGET_OS_OSX // [TODO(OSS Candidate ISS#2710739) +#if !TARGET_OS_OSX // [macOS] - (void)deleteBackward { id textInputDelegate = [self textInputDelegate]; if ([textInputDelegate textInputShouldHandleDeleteBackward:self]) { [super deleteBackward]; } } -#else +#else // [macOS - (void)keyUp:(NSEvent *)event { if ([self.textInputDelegate textInputShouldHandleKeyEvent:event]) { [super keyUp:event]; } } -#endif // ]TODO(OSS Candidate ISS#2710739) +#endif // macOS] @end diff --git a/Libraries/Text/TextInput/Singleline/macOS/RCTUISecureTextField.h b/Libraries/Text/TextInput/Singleline/macOS/RCTUISecureTextField.h index d456b0c82dc045..792c6703c41d58 100644 --- a/Libraries/Text/TextInput/Singleline/macOS/RCTUISecureTextField.h +++ b/Libraries/Text/TextInput/Singleline/macOS/RCTUISecureTextField.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -// TODO(macOS GH#774) +// [macOS] #define RCT_SUBCLASS_SECURETEXTFIELD 1 diff --git a/Libraries/Text/TextInput/Singleline/macOS/RCTUISecureTextField.m b/Libraries/Text/TextInput/Singleline/macOS/RCTUISecureTextField.m index aebf78858ca6be..2af429a359782c 100644 --- a/Libraries/Text/TextInput/Singleline/macOS/RCTUISecureTextField.m +++ b/Libraries/Text/TextInput/Singleline/macOS/RCTUISecureTextField.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -// TODO(macOS GH#774) +// [macOS] #define RCT_SUBCLASS_SECURETEXTFIELD 1 diff --git a/Libraries/Text/TextNativeComponent.js b/Libraries/Text/TextNativeComponent.js index eb64ec996a2841..a2401bd56835da 100644 --- a/Libraries/Text/TextNativeComponent.js +++ b/Libraries/Text/TextNativeComponent.js @@ -47,7 +47,7 @@ export const NativeText: HostComponent = onInlineViewLayout: true, dataDetectorType: true, android_hyphenationFrequency: true, - tooltip: true, // [TODO(macOS GH#774)] + tooltip: true, // [macOS] }, directEventTypes: { topTextLayout: { diff --git a/Libraries/Text/TextProps.js b/Libraries/Text/TextProps.js index aa0772f6eccd2e..262f4ba5476c8d 100644 --- a/Libraries/Text/TextProps.js +++ b/Libraries/Text/TextProps.js @@ -236,5 +236,5 @@ export type TextProps = $ReadOnly<{| * Specifies whether focus ring should be drawn when the view has the first responder status. * Only works when `focusable={true}` */ - enableFocusRing?: ?boolean, // TODO(macOS GH#774) + enableFocusRing?: ?boolean, // [macOS] |}>; diff --git a/Libraries/Text/VirtualText/RCTVirtualTextViewManager.m b/Libraries/Text/VirtualText/RCTVirtualTextViewManager.m index 7d18c5a15777f4..3419369d997024 100644 --- a/Libraries/Text/VirtualText/RCTVirtualTextViewManager.m +++ b/Libraries/Text/VirtualText/RCTVirtualTextViewManager.m @@ -13,9 +13,9 @@ @implementation RCTVirtualTextViewManager RCT_EXPORT_MODULE(RCTVirtualText) -- (RCTUIView *)view // TODO(macOS ISS#3536887) +- (RCTUIView *)view // [macOS] { - return [RCTUIView new]; // TODO(macOS ISS#3536887) + return [RCTUIView new]; // [macOS] } - (RCTShadowView *)shadowView diff --git a/Libraries/TypeSafety/RCTTypeSafety.podspec b/Libraries/TypeSafety/RCTTypeSafety.podspec index 712d61b36fcff5..4de6acb2e2c894 100644 --- a/Libraries/TypeSafety/RCTTypeSafety.podspec +++ b/Libraries/TypeSafety/RCTTypeSafety.podspec @@ -26,7 +26,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "11.0", :osx => "10.15" } # TODO(macOS GH#774) + s.platforms = { :ios => "11.0", :osx => "10.15" } # [macOS] s.compiler_flags = folly_compiler_flags s.source = source s.source_files = "**/*.{c,h,m,mm,cpp}" diff --git a/Libraries/Types/CoreEventTypes.js b/Libraries/Types/CoreEventTypes.js index 86bbaf369aa56b..03297edc4c0f7a 100644 --- a/Libraries/Types/CoreEventTypes.js +++ b/Libraries/Types/CoreEventTypes.js @@ -85,18 +85,18 @@ export type TextLayoutEvent = SyntheticEvent< export type PressEvent = ResponderSyntheticEvent< $ReadOnly<{| - altKey?: ?boolean, // TODO(macOS GH#774) - button?: ?number, // TODO(macOS GH#774) + altKey?: ?boolean, // [macOS] + button?: ?number, // [macOS] changedTouches: $ReadOnlyArray<$PropertyType>, - ctrlKey?: ?boolean, // TODO(macOS GH#774) + ctrlKey?: ?boolean, // [macOS] force?: number, identifier: number, locationX: number, locationY: number, - metaKey?: ?boolean, // TODO(macOS GH#774) + metaKey?: ?boolean, // [macOS] pageX: number, pageY: number, - shiftKey?: ?boolean, // TODO(macOS GH#774) + shiftKey?: ?boolean, // [macOS] target: ?number, timestamp: number, touches: $ReadOnlyArray<$PropertyType>, @@ -133,7 +133,7 @@ export type ScrollEvent = SyntheticEvent< |}>, zoomScale?: number, responderIgnoreScroll?: boolean, - preferredScrollerStyle?: string, // TODO(macOS GH#774) + preferredScrollerStyle?: string, // [macOS] |}>, >; diff --git a/Libraries/Utilities/Appearance.js b/Libraries/Utilities/Appearance.js index 0519f0e913c3fb..8f35c909e4c62f 100644 --- a/Libraries/Utilities/Appearance.js +++ b/Libraries/Utilities/Appearance.js @@ -34,9 +34,9 @@ if (NativeAppearance) { new NativeEventEmitter( // T88715063: NativeEventEmitter only used this parameter on iOS. Now it uses it on all platforms, so this code was modified automatically to preserve its behavior // If you want to use the native module on other platforms, please remove this condition and test its behavior - Platform.OS !== 'ios' && Platform.OS !== 'macos' + Platform.OS !== 'ios' && Platform.OS !== 'macos' // [macOS Also use this parameter on macOS ? null - : NativeAppearance, // TODO(macOS GH#774): Also use this parameter on macOS + : NativeAppearance, // macOS] ); nativeEventEmitter.addListener( 'appearanceChanged', diff --git a/Libraries/Utilities/BackHandler.macos.js b/Libraries/Utilities/BackHandler.macos.js index 1838db8c2f10d1..02d7142731af0e 100644 --- a/Libraries/Utilities/BackHandler.macos.js +++ b/Libraries/Utilities/BackHandler.macos.js @@ -11,7 +11,7 @@ * @format */ -// TODO(macOS GH#774) +// [macOS] /* $FlowFixMe allow macOS to share iOS file */ const BackHandler = require('./BackHandler.ios'); diff --git a/Libraries/Utilities/DevSettings.js b/Libraries/Utilities/DevSettings.js index a0d2c822b0d02d..d4e5ccdfcef69f 100644 --- a/Libraries/Utilities/DevSettings.js +++ b/Libraries/Utilities/DevSettings.js @@ -30,7 +30,7 @@ if (__DEV__) { const emitter = new NativeEventEmitter( // T88715063: NativeEventEmitter only used this parameter on iOS. Now it uses it on all platforms, so this code was modified automatically to preserve its behavior // If you want to use the native module on other platforms, please remove this condition and test its behavior - Platform.OS !== 'ios' && Platform.OS !== 'macos' ? null : NativeDevSettings, // TODO(macOS GH#774): Also use this parameter on macOS + Platform.OS !== 'ios' && Platform.OS !== 'macos' ? null : NativeDevSettings, // [macOS] Also use this parameter on macOS ); const subscriptions = new Map(); diff --git a/Libraries/Utilities/HMRClient.js b/Libraries/Utilities/HMRClient.js index f76fd4a5ace3d5..b6efa19baf7521 100644 --- a/Libraries/Utilities/HMRClient.js +++ b/Libraries/Utilities/HMRClient.js @@ -180,10 +180,7 @@ const HMRClient: HMRClientNativeInterface = { Try the following to fix the issue: - Ensure that Metro is running and available on the same network`; - if ( - Platform.OS === 'ios' || - Platform.OS === 'macos' /* TODO(macOS GH#774) */ - ) { + if (Platform.OS === 'ios' || Platform.OS === 'macos' /* [macOS] */) { error += ` - Ensure that the Metro URL is correctly set in AppDelegate`; } else { @@ -305,8 +302,7 @@ function flushEarlyLogs(client) { function dismissRedbox() { if ( - (Platform.OS === 'ios' || - Platform.OS === 'macos') /* TODO(macOS GH#774) */ && + (Platform.OS === 'ios' || Platform.OS === 'macos') /* [macOS] */ && NativeRedBox != null && NativeRedBox.dismiss != null ) { diff --git a/Libraries/Utilities/LoadingView.macos.js b/Libraries/Utilities/LoadingView.macos.js index 854bcdf0b92599..f2ba69cdd0130d 100644 --- a/Libraries/Utilities/LoadingView.macos.js +++ b/Libraries/Utilities/LoadingView.macos.js @@ -8,7 +8,7 @@ * @flow strict-local */ -// TODO(macOS GH#774) +// [macOS] /* $FlowFixMe allow macOS to share iOS file */ const LoadingView = require('./LoadingView.ios'); diff --git a/Libraries/Utilities/Platform.macos.js b/Libraries/Utilities/Platform.macos.js index e1baf46d4f13d1..a7bec027962ba8 100644 --- a/Libraries/Utilities/Platform.macos.js +++ b/Libraries/Utilities/Platform.macos.js @@ -8,7 +8,7 @@ * @flow strict */ -// TODO(macOS GH#774) Copied from Platform.ios.js +// macOS Copied from Platform.ios.js 'use strict'; diff --git a/Libraries/Vibration/React-RCTVibration.podspec b/Libraries/Vibration/React-RCTVibration.podspec index 583233e397c5aa..0907f4fdb97e39 100644 --- a/Libraries/Vibration/React-RCTVibration.podspec +++ b/Libraries/Vibration/React-RCTVibration.podspec @@ -27,7 +27,7 @@ Pod::Spec.new do |s| s.documentation_url = "https://reactnative.dev/docs/vibration" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "11.0", :osx => "10.15" } # TODO(macOS GH#214) + s.platforms = { :ios => "11.0", :osx => "10.15" } # [macOS] s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness' s.source = source s.source_files = "*.{m,mm}" diff --git a/Libraries/WebSocket/RCTSRWebSocket.m b/Libraries/WebSocket/RCTSRWebSocket.m index 982ad8abbcd1df..5d41cdd18f915d 100644 --- a/Libraries/WebSocket/RCTSRWebSocket.m +++ b/Libraries/WebSocket/RCTSRWebSocket.m @@ -14,10 +14,10 @@ // limitations under the License. // -#import // [TODO(macOS GH#774) -#if !TARGET_OS_OSX +#import // [macOS] +#if !TARGET_OS_OSX // [macOS] #import -#endif // ]TODO(macOS GH#774) +#endif // [macOS] #import #import @@ -530,29 +530,28 @@ - (void)_initializeStreams - (void)_connect { if (!_scheduledRunloops.count) { - // [TODO(macOS ISS#2323203): `scheduleInRunLoop:forMode:` takes in a non-null run loop parameter so let's be safe and verify that + // [macOS `scheduleInRunLoop:forMode:` takes in a non-null run loop parameter so let's be safe and verify that NSRunLoop *runLoop = [NSRunLoop RCTSR_networkRunLoop]; if (runLoop != nil) { [self scheduleInRunLoop:runLoop forMode:NSDefaultRunLoopMode]; } else { RCTSRLog(@"Failed connecting to RCTSR_networkRunLoop"); } - // ]TODO(macOS ISS#2323203) + // macOS] } - // [TODO(macOS GH#774) - // We've seen a rare ASan crash where _inputStream seems to be invalid. This is just a safety check. + // [macOS We've seen a rare ASan crash where _inputStream seems to be invalid. This is just a safety check. #if DEBUG [self _validateStream:_outputStream name:@"_outputStream"]; [self _validateStream:_inputStream name:@"_inputStream"]; #endif - // ]TODO(macOS GH#774) + // macOS] [_outputStream open]; [_inputStream open]; } -// [TODO(macOS GH#774) +// [macOS #if DEBUG - (void)_validateStream:(NSStream *)stream name:(NSString *)name { NSStreamStatus status = stream.streamStatus; @@ -565,7 +564,7 @@ - (void)_validateStream:(NSStream *)stream name:(NSString *)name { } } #endif -// ]TODO(macOS GH#774) +// macOS] - (void)scheduleInRunLoop:(NSRunLoop *)aRunLoop forMode:(NSString *)mode { diff --git a/Libraries/WebSocket/WebSocket.js b/Libraries/WebSocket/WebSocket.js index ef4b73375756df..8f8f7674661fa0 100644 --- a/Libraries/WebSocket/WebSocket.js +++ b/Libraries/WebSocket/WebSocket.js @@ -135,7 +135,7 @@ class WebSocket extends (EventTarget(...WEBSOCKET_EVENTS): any) { this._eventEmitter = new NativeEventEmitter( // T88715063: NativeEventEmitter only used this parameter on iOS. Now it uses it on all platforms, so this code was modified automatically to preserve its behavior // If you want to use the native module on other platforms, please remove this condition and test its behavior - Platform.OS !== 'ios' && Platform.OS !== 'macos' // TODO(macOS GH#774): Also use this parameter on macOS + Platform.OS !== 'ios' && Platform.OS !== 'macos' // [macOS] Also use this parameter on macOS ? null : NativeWebSocketModule, ); diff --git a/Libraries/WebSocket/WebSocketInterceptor.js b/Libraries/WebSocket/WebSocketInterceptor.js index 056a53034d0a79..a7144ffff07792 100644 --- a/Libraries/WebSocket/WebSocketInterceptor.js +++ b/Libraries/WebSocket/WebSocketInterceptor.js @@ -135,7 +135,7 @@ const WebSocketInterceptor = { eventEmitter = new NativeEventEmitter( // T88715063: NativeEventEmitter only used this parameter on iOS. Now it uses it on all platforms, so this code was modified automatically to preserve its behavior // If you want to use the native module on other platforms, please remove this condition and test its behavior - Platform.OS !== 'ios' && Platform.OS !== 'macos' // TODO(macOS GH#774): Also use this parameter on macOS + Platform.OS !== 'ios' && Platform.OS !== 'macos' // [macOS] Also use this parameter on macOS ? null : NativeWebSocketModule, ); diff --git a/React-Core.podspec b/React-Core.podspec index 7d6b6e2ef3f4d7..3eabdeddc0c347 100644 --- a/React-Core.podspec +++ b/React-Core.podspec @@ -41,7 +41,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "11.0", :osx => "10.15" } # TODO(macOS GH#774) + s.platforms = { :ios => "11.0", :osx => "10.15" } # [macOS] s.source = source s.resource_bundle = { "AccessibilityResources" => ["React/AccessibilityResources/*.lproj"]} s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags @@ -58,11 +58,11 @@ Pod::Spec.new do |s| "React/Fabric/**/*", "React/FBReactNativeSpec/**/*", "React/Tests/**/*", - "React/CxxBridge/HermesExecutorFactory.*" # TODO(macOS GH#214) + "React/CxxBridge/HermesExecutorFactory.*" # [macOS] - # [TODO(macOS GH#774) + # [macOS ss.ios.exclude_files = "**/macOS/*", - "React/Inspector/**/*" # TODO(macOS GH#214) don't exclude on macOS for hermes support + "React/Inspector/**/*" # [macOS]: don't exclude on macOS for hermes support ss.osx.exclude_files = "React/Modules/RCTRedBoxExtraDataViewController.{h,m}", "React/Modules/RCTAccessibilityManager.m", "React/Profiler/{RCTFPSGraph,RCTPerfMonitor}.*", @@ -72,7 +72,7 @@ Pod::Spec.new do |s| "React/Views/{RCTModal*,RCTMasked*,RCTTV*,RCTWrapperViewController}.*", "React/Views/RefreshControl/*", "React/Views/SafeAreaView/*" - # ]TODO(macOS GH#774) + # macOS] ss.private_header_files = "React/Cxx*/*.h" end diff --git a/React.podspec b/React.podspec index eb2bd0dd821f1b..42c0094949b794 100644 --- a/React.podspec +++ b/React.podspec @@ -36,7 +36,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "11.0", :osx => "10.15" } # TODO(macOS GH#214) + s.platforms = { :ios => "11.0", :osx => "10.15" } # [macOS] s.source = source s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs" s.cocoapods_version = ">= 1.10.1" diff --git a/React/AppSetup/RCTAppSetupUtils.h b/React/AppSetup/RCTAppSetupUtils.h index 982b3a17642e08..16b249e89143bb 100644 --- a/React/AppSetup/RCTAppSetupUtils.h +++ b/React/AppSetup/RCTAppSetupUtils.h @@ -31,7 +31,7 @@ RCT_EXTERN_C_BEGIN void RCTAppSetupPrepareApp(UIApplication *application); -RCTUIView *RCTAppSetupDefaultRootView(RCTBridge *bridge, NSString *moduleName, NSDictionary *initialProperties); // TODO(macOS GH#774) +RCTUIView *RCTAppSetupDefaultRootView(RCTBridge *bridge, NSString *moduleName, NSDictionary *initialProperties); // [macOS] RCT_EXTERN_C_END diff --git a/React/AppSetup/RCTAppSetupUtils.mm b/React/AppSetup/RCTAppSetupUtils.mm index 0f0f4c53498582..101a3c6ffa97b5 100644 --- a/React/AppSetup/RCTAppSetupUtils.mm +++ b/React/AppSetup/RCTAppSetupUtils.mm @@ -55,7 +55,7 @@ void RCTAppSetupPrepareApp(UIApplication *application) #endif } -RCTUIView *RCTAppSetupDefaultRootView(RCTBridge *bridge, NSString *moduleName, NSDictionary *initialProperties) // TODO(macOS GH#774) +RCTUIView *RCTAppSetupDefaultRootView(RCTBridge *bridge, NSString *moduleName, NSDictionary *initialProperties) // [macOS] { #if RCT_NEW_ARCH_ENABLED return [[RCTFabricSurfaceHostingProxyRootView alloc] initWithBridge:bridge diff --git a/React/Base/RCTBridge+Cxx.h b/React/Base/RCTBridge+Cxx.h index 106f2c4738d3ca..fd052c3ab3f8b4 100644 --- a/React/Base/RCTBridge+Cxx.h +++ b/React/Base/RCTBridge+Cxx.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -// TODO(OSS Candidate ISS#2710739) +// [macOS] #import #import diff --git a/React/Base/RCTBridge+Cxx.mm b/React/Base/RCTBridge+Cxx.mm index 2aca130f865e93..63ae2fffb706ea 100644 --- a/React/Base/RCTBridge+Cxx.mm +++ b/React/Base/RCTBridge+Cxx.mm @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -// TODO(OSS Candidate ISS#2710739) +// [macOS] #import "RCTBridge+Cxx.h" #import "RCTBridge+Private.h" diff --git a/React/Base/RCTBridge.h b/React/Base/RCTBridge.h index 6c4dbe79386994..03bdbf96da15b3 100644 --- a/React/Base/RCTBridge.h +++ b/React/Base/RCTBridge.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import diff --git a/React/Base/RCTBridge.m b/React/Base/RCTBridge.m index f9ab3c4f833770..5515f453c2d146 100644 --- a/React/Base/RCTBridge.m +++ b/React/Base/RCTBridge.m @@ -7,7 +7,7 @@ #import "RCTBridge.h" #import "RCTBridge+Private.h" -#import "RCTDevSettings.h" // TODO(OSS Candidate ISS#2710739) +#import "RCTDevSettings.h" // [macOS] #import diff --git a/React/Base/RCTBridgeModule.h b/React/Base/RCTBridgeModule.h index e563be66bd72b9..7b30e8c7cad568 100644 --- a/React/Base/RCTBridgeModule.h +++ b/React/Base/RCTBridgeModule.h @@ -6,7 +6,7 @@ */ #import -#import // TODO(macOS GH#774) +#import // [macOS] #import #import @@ -432,10 +432,10 @@ typedef NSURL * (^RCTBridgelessBundleURLGetter)(void); andSetter:(RCTBridgelessBundleURLSetter)setter andDefaultGetter:(RCTBridgelessBundleURLGetter)defaultGetter; - (void)resetBundleURL; -@property (strong) NSURL *bundleURL; // TODO(macOS GH#774) +@property (strong) NSURL *bundleURL; // [macOS] @end -typedef RCTPlatformView * (^RCTBridgelessComponentViewProvider)(NSNumber *); // TODO(macOS GH#774) +typedef RCTPlatformView * (^RCTBridgelessComponentViewProvider)(NSNumber *); // [macOS] /** * A class that allows NativeModules to query for views, given React Tags. @@ -444,7 +444,7 @@ typedef RCTPlatformView * (^RCTBridgelessComponentViewProvider)(NSNumber *); // - (void)setBridge:(RCTBridge *)bridge; - (void)setBridgelessComponentViewProvider:(RCTBridgelessComponentViewProvider)bridgelessComponentViewProvider; -- (RCTPlatformView *)viewForReactTag:(NSNumber *)reactTag; // TODO(macOS GH#774) +- (RCTPlatformView *)viewForReactTag:(NSNumber *)reactTag; // [macOS] @end typedef void (^RCTBridgelessJSModuleMethodInvoker)( diff --git a/React/Base/RCTBundleURLProvider.h b/React/Base/RCTBundleURLProvider.h index cfbf85789b962c..e2e07da0313990 100644 --- a/React/Base/RCTBundleURLProvider.h +++ b/React/Base/RCTBundleURLProvider.h @@ -22,7 +22,7 @@ RCT_EXTERN const NSUInteger kRCTBundleURLProviderDefaultPort; RCT_EXTERN void RCTBundleURLProviderAllowPackagerServerAccess(BOOL allowed); #endif -extern NSString *const kRCTPlatformName; // TODO(macOS GH#774) +extern NSString *const kRCTPlatformName; // [macOS] @interface RCTBundleURLProvider : NSObject diff --git a/React/Base/RCTBundleURLProvider.mm b/React/Base/RCTBundleURLProvider.mm index ac66dbef638fcc..ec296d6d1d11d4 100644 --- a/React/Base/RCTBundleURLProvider.mm +++ b/React/Base/RCTBundleURLProvider.mm @@ -15,11 +15,11 @@ const NSUInteger kRCTBundleURLProviderDefaultPort = RCT_METRO_PORT; -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] NSString *const kRCTPlatformName = @"ios"; -#else +#else // [macOS NSString *const kRCTPlatformName = @"macos"; -#endif // ]TODO(macOS GH#774) +#endif // macOS] #if RCT_DEV_MENU | RCT_PACKAGER_LOADING_FUNCTIONALITY static BOOL kRCTAllowPackagerAccess = YES; @@ -275,7 +275,7 @@ + (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot // When we support only iOS 8 and above, use queryItems for a better API. NSString *query = [NSString stringWithFormat:@"platform=%@&dev=%@&minify=%@&modulesOnly=%@&runModule=%@%@", - kRCTPlatformName, // TODO(macOS GH#774) + kRCTPlatformName, // [macOS] enableDev ? @"true" : @"false", enableMinification ? @"true" : @"false", modulesOnly ? @"true" : @"false", diff --git a/React/Base/RCTConvert.h b/React/Base/RCTConvert.h index 046aca1a1400f2..df60b01bbd07a5 100644 --- a/React/Base/RCTConvert.h +++ b/React/Base/RCTConvert.h @@ -6,7 +6,7 @@ */ #import -#import // TODO(macOS GH#774) +#import // [macOS] #import #import @@ -14,7 +14,7 @@ #import #import #import -#import // TODO(OSS Candidate ISS#2710739) +#import // [macOS] #import #if TARGET_OS_IPHONE #import @@ -65,7 +65,7 @@ typedef NSURL RCTFileURL; + (NSTextAlignment)NSTextAlignment:(id)json; + (NSUnderlineStyle)NSUnderlineStyle:(id)json; + (NSWritingDirection)NSWritingDirection:(id)json; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] + (UITextAutocapitalizationType)UITextAutocapitalizationType:(id)json; + (UITextFieldViewMode)UITextFieldViewMode:(id)json; + (UIKeyboardType)UIKeyboardType:(id)json; @@ -83,11 +83,11 @@ typedef NSURL RCTFileURL; #if !TARGET_OS_TV + (UIBarStyle)UIBarStyle:(id)json; #endif -#endif // TODO(macOS GH#774) +#endif // [macOS] -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS + (NSTextCheckingTypes)NSTextCheckingTypes:(id)json; -#endif // ]TODO(macOS GH#774) +#endif // macOS] + (CGFloat)CGFloat:(id)json; + (CGPoint)CGPoint:(id)json; @@ -100,8 +100,8 @@ typedef NSURL RCTFileURL; + (CGAffineTransform)CGAffineTransform:(id)json; -+ (RCTUIColor *)UIColor:(id)json; // TODO(OSS Candidate ISS#2710739) -+ (RCTUIColor *)NSColor:(id)json; // TODO(OSS Candidate ISS#2710739) ++ (RCTUIColor *)UIColor:(id)json; // [macOS] ++ (RCTUIColor *)NSColor:(id)json; // [macOS] + (CGColorRef)CGColor:(id)json CF_RETURNS_NOT_RETAINED; + (YGValue)YGValue:(id)json; @@ -113,10 +113,10 @@ typedef NSURL RCTFileURL; + (NSArray *)NSURLArray:(id)json; + (NSArray *)RCTFileURLArray:(id)json; + (NSArray *)NSNumberArray:(id)json; -+ (NSArray *)UIColorArray:(id)json; // TODO(OSS Candidate ISS#2710739) -#if TARGET_OS_OSX // [TODO(macOS GH#774) ++ (NSArray *)UIColorArray:(id)json; // [macOS] +#if TARGET_OS_OSX // [macOS + (NSArray *)NSPasteboardTypeArray:(id)json; -#endif // ]TODO(macOS GH#774) +#endif // macOS] typedef NSArray CGColorArray; + (CGColorArray *)CGColorArray:(id)json; @@ -142,11 +142,11 @@ typedef BOOL css_backface_visibility_t; + (RCTAnimationType)RCTAnimationType:(id)json; + (RCTBorderStyle)RCTBorderStyle:(id)json; + (RCTTextDecorationLineType)RCTTextDecorationLineType:(id)json; -+ (RCTFontSmoothing)RCTFontSmoothing:(id)json; // TODO(OSS Candidate ISS#2710739) ++ (RCTFontSmoothing)RCTFontSmoothing:(id)json; // [macOS] -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS + (NSString *)accessibilityRoleFromTraits:(id)json; -#endif // ]TODO(macOS GH#774) +#endif // macOS] @end @interface RCTConvert (Deprecated) diff --git a/React/Base/RCTConvert.m b/React/Base/RCTConvert.m index 4d6834e263a123..f0dbb12cf9ba41 100644 --- a/React/Base/RCTConvert.m +++ b/React/Base/RCTConvert.m @@ -356,7 +356,7 @@ + (NSLocale *)NSLocale:(id)json RCTTextDecorationLineTypeNone, integerValue) -// [TODO(OSS Candidate ISS#2710739) +// [macOS RCT_ENUM_CONVERTER( RCTFontSmoothing, (@{ @@ -367,7 +367,7 @@ + (NSLocale *)NSLocale:(id)json }), RCTFontSmoothingAuto, integerValue) -// ]TODO(OSS Candidate ISS#2710739) +// macOS] RCT_ENUM_CONVERTER( NSWritingDirection, @@ -379,7 +379,7 @@ + (NSLocale *)NSLocale:(id)json NSWritingDirectionNatural, integerValue) -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCT_ENUM_CONVERTER( UITextAutocapitalizationType, (@{ @@ -521,7 +521,7 @@ + (UIKeyboardType)UIKeyboardType:(id)json RCT_DYNAMIC }), UIBarStyleDefault, integerValue) -#else // [TODO(macOS GH#774) +#else // [macOS RCT_MULTI_ENUM_CONVERTER(NSTextCheckingTypes, (@{ @"ortography": @(NSTextCheckingTypeOrthography), @"spelling": @(NSTextCheckingTypeSpelling), @@ -537,7 +537,7 @@ + (UIKeyboardType)UIKeyboardType:(id)json RCT_DYNAMIC @"phoneNumber": @(NSTextCheckingTypePhoneNumber), @"transitInformation": @(NSTextCheckingTypeTransitInformation), }), NSTextCheckingTypeOrthography, unsignedLongLongValue) -#endif // ]TODO(macOS GH#774) +#endif // macOS] static void convertCGStruct(const char *type, NSArray *fields, CGFloat *result, id json) { @@ -646,88 +646,7 @@ + (UIEdgeInsets)UIEdgeInsets:(id)json static NSDictionary *colorMap = nil; if (colorMap == nil) { NSMutableDictionary *map = [@{ -#if TARGET_OS_OSX // [TODO(macOS GH#774) - // https://developer.apple.com/documentation/appkit/nscolor/ui_element_colors - // Label Colors - @"labelColor": @{}, // 10_10 - @"secondaryLabelColor": @{}, // 10_10 - @"tertiaryLabelColor": @{}, // 10_10 - @"quaternaryLabelColor": @{}, // 10_10 - // Text Colors - @"textColor": @{}, - @"placeholderTextColor": @{}, // 10_10 - @"selectedTextColor": @{}, - @"textBackgroundColor": @{}, - @"selectedTextBackgroundColor": @{}, - @"keyboardFocusIndicatorColor": @{}, - @"unemphasizedSelectedTextColor": @{ // 10_14 - RCTFallback: @"selectedTextColor" - }, - @"unemphasizedSelectedTextBackgroundColor": @{ // 10_14 - RCTFallback: @"textBackgroundColor" - }, - // Content Colors - @"linkColor": @{}, // 10_10 - @"separatorColor": @{ // 10_14: Replacement for +controlHighlightColor, +controlLightHighlightColor, +controlShadowColor, +controlDarkShadowColor - RCTFallback: @"gridColor" - }, - @"selectedContentBackgroundColor": @{ // 10_14: Alias for +alternateSelectedControlColor - RCTFallback: @"alternateSelectedControlColor" - }, - @"unemphasizedSelectedContentBackgroundColor": @{ // 10_14: Alias for +secondarySelectedControlColor - RCTFallback: @"secondarySelectedControlColor" - }, - // Menu Colors - @"selectedMenuItemTextColor": @{}, - // Table Colors - @"gridColor": @{}, - @"headerTextColor": @{}, - @"alternatingEvenContentBackgroundColor": @{ // 10_14: Alias for +controlAlternatingRowBackgroundColors - RCTSelector: @"alternatingContentBackgroundColors", - RCTIndex: @0, - RCTFallback: @"controlAlternatingRowBackgroundColors" - }, - @"alternatingOddContentBackgroundColor": @{ // 10_14: Alias for +controlAlternatingRowBackgroundColors - RCTSelector: @"alternatingContentBackgroundColors", - RCTIndex: @1, - RCTFallback: @"controlAlternatingRowBackgroundColors" - }, - // Control Colors - @"controlAccentColor": @{ // 10_14 - RCTFallback: @"controlColor" - }, - @"controlColor": @{}, - @"controlBackgroundColor": @{}, - @"controlTextColor": @{}, - @"disabledControlTextColor": @{}, - @"selectedControlColor": @{}, - @"selectedControlTextColor": @{}, - @"alternateSelectedControlTextColor": @{}, - @"scrubberTexturedBackgroundColor": @{}, // 10_12_2 - // Window Colors - @"windowBackgroundColor": @{}, - @"windowFrameTextColor": @{}, - @"underPageBackgroundColor": @{}, // 10_8 - // Highlights and Shadows - @"findHighlightColor": @{ // 10_13 - RCTFallback: @"highlightColor" - }, - @"highlightColor": @{}, - @"shadowColor": @{}, - // https://developer.apple.com/documentation/appkit/nscolor/standard_colors - // Standard Colors - @"systemBlueColor": @{}, // 10_10 - @"systemBrownColor": @{}, // 10_10 - @"systemGrayColor": @{}, // 10_10 - @"systemGreenColor": @{}, // 10_10 - @"systemOrangeColor": @{}, // 10_10 - @"systemPinkColor": @{}, // 10_10 - @"systemPurpleColor": @{}, // 10_10 - @"systemRedColor": @{}, // 10_10 - @"systemYellowColor": @{}, // 10_10 - // Transparent Color - @"clearColor" : @{}, -#else // ]TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] // https://developer.apple.com/documentation/uikit/uicolor/ui_element_colors // Label Colors @"labelColor" : @{ @@ -857,7 +776,88 @@ + (UIEdgeInsets)UIEdgeInsets:(id)json // iOS 13.0 RCTFallbackARGB : @(0x00000000) }, -#endif // TODO(macOS GH#774) +#else // [macOS + // https://developer.apple.com/documentation/appkit/nscolor/ui_element_colors + // Label Colors + @"labelColor": @{}, // 10_10 + @"secondaryLabelColor": @{}, // 10_10 + @"tertiaryLabelColor": @{}, // 10_10 + @"quaternaryLabelColor": @{}, // 10_10 + // Text Colors + @"textColor": @{}, + @"placeholderTextColor": @{}, // 10_10 + @"selectedTextColor": @{}, + @"textBackgroundColor": @{}, + @"selectedTextBackgroundColor": @{}, + @"keyboardFocusIndicatorColor": @{}, + @"unemphasizedSelectedTextColor": @{ // 10_14 + RCTFallback: @"selectedTextColor" + }, + @"unemphasizedSelectedTextBackgroundColor": @{ // 10_14 + RCTFallback: @"textBackgroundColor" + }, + // Content Colors + @"linkColor": @{}, // 10_10 + @"separatorColor": @{ // 10_14: Replacement for +controlHighlightColor, +controlLightHighlightColor, +controlShadowColor, +controlDarkShadowColor + RCTFallback: @"gridColor" + }, + @"selectedContentBackgroundColor": @{ // 10_14: Alias for +alternateSelectedControlColor + RCTFallback: @"alternateSelectedControlColor" + }, + @"unemphasizedSelectedContentBackgroundColor": @{ // 10_14: Alias for +secondarySelectedControlColor + RCTFallback: @"secondarySelectedControlColor" + }, + // Menu Colors + @"selectedMenuItemTextColor": @{}, + // Table Colors + @"gridColor": @{}, + @"headerTextColor": @{}, + @"alternatingEvenContentBackgroundColor": @{ // 10_14: Alias for +controlAlternatingRowBackgroundColors + RCTSelector: @"alternatingContentBackgroundColors", + RCTIndex: @0, + RCTFallback: @"controlAlternatingRowBackgroundColors" + }, + @"alternatingOddContentBackgroundColor": @{ // 10_14: Alias for +controlAlternatingRowBackgroundColors + RCTSelector: @"alternatingContentBackgroundColors", + RCTIndex: @1, + RCTFallback: @"controlAlternatingRowBackgroundColors" + }, + // Control Colors + @"controlAccentColor": @{ // 10_14 + RCTFallback: @"controlColor" + }, + @"controlColor": @{}, + @"controlBackgroundColor": @{}, + @"controlTextColor": @{}, + @"disabledControlTextColor": @{}, + @"selectedControlColor": @{}, + @"selectedControlTextColor": @{}, + @"alternateSelectedControlTextColor": @{}, + @"scrubberTexturedBackgroundColor": @{}, // 10_12_2 + // Window Colors + @"windowBackgroundColor": @{}, + @"windowFrameTextColor": @{}, + @"underPageBackgroundColor": @{}, // 10_8 + // Highlights and Shadows + @"findHighlightColor": @{ // 10_13 + RCTFallback: @"highlightColor" + }, + @"highlightColor": @{}, + @"shadowColor": @{}, + // https://developer.apple.com/documentation/appkit/nscolor/standard_colors + // Standard Colors + @"systemBlueColor": @{}, // 10_10 + @"systemBrownColor": @{}, // 10_10 + @"systemGrayColor": @{}, // 10_10 + @"systemGreenColor": @{}, // 10_10 + @"systemOrangeColor": @{}, // 10_10 + @"systemPinkColor": @{}, // 10_10 + @"systemPurpleColor": @{}, // 10_10 + @"systemRedColor": @{}, // 10_10 + @"systemYellowColor": @{}, // 10_10 + // Transparent Color + @"clearColor" : @{}, +#endif // macOS] } mutableCopy]; // The color names are the Objective-C UIColor selector names, // but Swift selector names are valid as well, so make aliases. @@ -897,7 +897,7 @@ + (UIEdgeInsets)UIEdgeInsets:(id)json return colorMap; } -// [TODO(macOS GH#774) +// [macOS /** Returns a UIColor based on a semantic color name. * Returns nil if the semantic color name is invalid. */ @@ -939,7 +939,7 @@ + (UIEdgeInsets)UIEdgeInsets:(id)json } return color; } -// ]TODO(macOS GH#774) +// macOS] /** Returns an alphabetically sorted comma separated list of the valid semantic color names */ @@ -958,14 +958,14 @@ + (UIEdgeInsets)UIEdgeInsets:(id)json return names; } -// [TODO(macOS GH#774) +// [macOS + (RCTUIColor *)NSColor:(id)json { return [RCTConvert UIColor:json]; } -// ]TODO(macOS GH#774) +// macOS] -// [TODO(macOS GH#750) +// [macOS #if TARGET_OS_OSX static NSColor *RCTColorWithSystemEffect(NSColor* color, NSString *systemEffectString) { NSColor *colorWithEffect = color; @@ -985,9 +985,9 @@ + (RCTUIColor *)NSColor:(id)json return colorWithEffect; } #endif //TARGET_OS_OSX -// ]TODO(macOS GH#750) +// macOS] -+ (RCTUIColor *)UIColor:(id)json // TODO(macOS GH#750) ++ (RCTUIColor *)UIColor:(id)json // [macOS] { if (!json) { return nil; @@ -995,7 +995,7 @@ + (RCTUIColor *)UIColor:(id)json // TODO(macOS GH#750) if ([json isKindOfClass:[NSArray class]]) { NSArray *components = [self NSNumberArray:json]; CGFloat alpha = components.count > 3 ? [self CGFloat:components[3]] : 1.0; - return [RCTUIColor colorWithRed:[self CGFloat:components[0]] // TODO(macOS GH#750) + return [RCTUIColor colorWithRed:[self CGFloat:components[0]] // [macOS] green:[self CGFloat:components[1]] blue:[self CGFloat:components[2]] alpha:alpha]; @@ -1005,7 +1005,7 @@ + (RCTUIColor *)UIColor:(id)json // TODO(macOS GH#750) CGFloat r = ((argb >> 16) & 0xFF) / 255.0; CGFloat g = ((argb >> 8) & 0xFF) / 255.0; CGFloat b = (argb & 0xFF) / 255.0; - return [RCTUIColor colorWithRed:r green:g blue:b alpha:a]; // TODO(macOS GH#750) + return [RCTUIColor colorWithRed:r green:g blue:b alpha:a]; // [macOS] } else if ([json isKindOfClass:[NSDictionary class]]) { NSDictionary *dictionary = json; @@ -1013,7 +1013,7 @@ + (RCTUIColor *)UIColor:(id)json // TODO(macOS GH#750) if ((value = [dictionary objectForKey:@"semantic"])) { if ([value isKindOfClass:[NSString class]]) { NSString *semanticName = value; - RCTUIColor *color = [RCTUIColor colorNamed:semanticName]; // TODO(macOS GH#750) + RCTUIColor *color = [RCTUIColor colorNamed:semanticName]; // [macOS] if (color != nil) { return color; } @@ -1026,7 +1026,7 @@ + (RCTUIColor *)UIColor:(id)json // TODO(macOS GH#750) return color; } else if ([value isKindOfClass:[NSArray class]]) { for (id name in value) { - RCTUIColor *color = [RCTUIColor colorNamed:name]; // TODO(macOS GH#750) + RCTUIColor *color = [RCTUIColor colorNamed:name]; // [macOS] if (color != nil) { return color; } @@ -1049,37 +1049,13 @@ + (RCTUIColor *)UIColor:(id)json // TODO(macOS GH#750) id light = [appearances objectForKey:@"light"]; RCTUIColor *lightColor = [RCTConvert UIColor:light]; id dark = [appearances objectForKey:@"dark"]; - RCTUIColor *darkColor = [RCTConvert UIColor:dark]; // TODO(macOS GH#750) + RCTUIColor *darkColor = [RCTConvert UIColor:dark]; // [macOS] id highContrastLight = [appearances objectForKey:@"highContrastLight"]; - RCTUIColor *highContrastLightColor = [RCTConvert UIColor:highContrastLight]; // TODO(macOS GH#750) + RCTUIColor *highContrastLightColor = [RCTConvert UIColor:highContrastLight]; // [macOS] id highContrastDark = [appearances objectForKey:@"highContrastDark"]; - RCTUIColor *highContrastDarkColor = [RCTConvert UIColor:highContrastDark]; // TODO(macOS GH#750) + RCTUIColor *highContrastDarkColor = [RCTConvert UIColor:highContrastDark]; // [macOS] if (lightColor != nil && darkColor != nil) { -#if TARGET_OS_OSX - NSColor *color = [NSColor colorWithName:nil dynamicProvider:^NSColor * _Nonnull(NSAppearance * _Nonnull appearance) { - NSMutableArray *appearances = [NSMutableArray arrayWithArray:@[NSAppearanceNameAqua,NSAppearanceNameDarkAqua]]; - if (highContrastLightColor != nil) { - [appearances addObject:NSAppearanceNameAccessibilityHighContrastAqua]; - } - if (highContrastDarkColor != nil) { - [appearances addObject:NSAppearanceNameAccessibilityHighContrastDarkAqua]; - } - NSAppearanceName bestMatchingAppearance = [appearance bestMatchFromAppearancesWithNames:appearances]; - if (bestMatchingAppearance == NSAppearanceNameAqua) { - return lightColor; - } else if (bestMatchingAppearance == NSAppearanceNameDarkAqua) { - return darkColor; - } else if (bestMatchingAppearance == NSAppearanceNameAccessibilityHighContrastAqua) { - return highContrastLightColor; - } else if (bestMatchingAppearance == NSAppearanceNameAccessibilityHighContrastDarkAqua) { - return highContrastDarkColor; - } else { - RCTLogConvertError(json, @"an NSColorColor. Could not resolve current appearance. Defaulting to light."); - return lightColor; - } - }]; - return color; -#else +#if !TARGET_OS_OSX // [macOS] #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 if (@available(iOS 13.0, *)) { UIColor *color = [UIColor colorWithDynamicProvider:^UIColor *_Nonnull( @@ -1105,14 +1081,36 @@ + (RCTUIColor *)UIColor:(id)json // TODO(macOS GH#750) #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 } #endif -#endif -// [TODO(macOS GH#774) +#else // [macOS + NSColor *color = [NSColor colorWithName:nil dynamicProvider:^NSColor * _Nonnull(NSAppearance * _Nonnull appearance) { + NSMutableArray *appearances = [NSMutableArray arrayWithArray:@[NSAppearanceNameAqua,NSAppearanceNameDarkAqua]]; + if (highContrastLightColor != nil) { + [appearances addObject:NSAppearanceNameAccessibilityHighContrastAqua]; + } + if (highContrastDarkColor != nil) { + [appearances addObject:NSAppearanceNameAccessibilityHighContrastDarkAqua]; + } + NSAppearanceName bestMatchingAppearance = [appearance bestMatchFromAppearancesWithNames:appearances]; + if (bestMatchingAppearance == NSAppearanceNameAqua) { + return lightColor; + } else if (bestMatchingAppearance == NSAppearanceNameDarkAqua) { + return darkColor; + } else if (bestMatchingAppearance == NSAppearanceNameAccessibilityHighContrastAqua) { + return highContrastLightColor; + } else if (bestMatchingAppearance == NSAppearanceNameAccessibilityHighContrastDarkAqua) { + return highContrastDarkColor; + } else { + RCTLogConvertError(json, @"an NSColorColor. Could not resolve current appearance. Defaulting to light."); + return lightColor; + } + }]; + return color; +#endif // macOS] } else { - RCTLogConvertError(json, @"a UIColor. Expected a dynamic appearance aware color."); + RCTLogConvertError(json, @"a UIColor. Expected an apple dynamic appearance aware color."); // [macOS] return nil; } -// [TODO(macOS GH#750) -#if TARGET_OS_OSX +#if TARGET_OS_OSX // [macOS } else if((value = [dictionary objectForKey:@"colorWithSystemEffect"])) { NSDictionary *colorWithSystemEffect = value; id base = [colorWithSystemEffect objectForKey:@"baseColor"]; @@ -1125,13 +1123,11 @@ + (RCTUIColor *)UIColor:(id)json // TODO(macOS GH#750) json, @"a UIColor. Expected a color with a system effect string, but got something else"); return nil; } -#endif //TARGET_OS_OSX -// ]TODO(macOS GH#750) +#endif // macOS] } else { - RCTLogConvertError(json, @"a UIColor. Expected a semantic color, dynamic appearance aware color, or color with system effect"); //TODO(macOS GH#750) + RCTLogConvertError(json, @"a UIColor. Expected an apple semantic color, dynamic appearance aware color, or color with system effect"); // [macOS] return nil; } -// ]TODO(macOS GH#774) } else { RCTLogConvertError(json, @"a UIColor. Did you forget to call processColor() on the JS side?"); return nil; @@ -1191,7 +1187,7 @@ + (YGValue)YGValue:(id)json RCT_ARRAY_CONVERTER(NSURL) RCT_ARRAY_CONVERTER(RCTFileURL) -RCT_ARRAY_CONVERTER(RCTUIColor) // TODO(OSS Candidate ISS#2710739) +RCT_ARRAY_CONVERTER(RCTUIColor) // [macOS] /** * This macro is used for creating converter functions for directly @@ -1224,7 +1220,7 @@ + (NSArray *)CGColorArray:(id)json return colors; } -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS + (NSArray *)NSPasteboardType:(id)json { NSString *type = [self NSString:json]; @@ -1255,7 +1251,7 @@ + (NSArray *)CGColorArray:(id)json } return @[]; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] static id RCTConvertPropertyListValue(id json) { @@ -1409,21 +1405,21 @@ + (NSPropertyList)NSPropertyList:(id)json RCT_ENUM_CONVERTER( RCTAnimationType, (@{ -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] @"spring" : @(RCTAnimationTypeSpring), -#endif // TODO(macOS GH#774) +#endif // [macOS] @"linear" : @(RCTAnimationTypeLinear), @"easeIn" : @(RCTAnimationTypeEaseIn), @"easeOut" : @(RCTAnimationTypeEaseOut), @"easeInEaseOut" : @(RCTAnimationTypeEaseInEaseOut), -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] @"keyboard" : @(RCTAnimationTypeKeyboard), -#endif // TODO(macOS GH#774) +#endif // [macOS] }), RCTAnimationTypeEaseInEaseOut, integerValue) -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS + (NSString*)accessibilityRoleFromTrait:(NSString*)trait { static NSDictionary *traitOrRoleToAccessibilityRole; @@ -1489,7 +1485,7 @@ + (NSString *)accessibilityRoleFromTraits:(id)json } return NSAccessibilityUnknownRole; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] @end @@ -1543,29 +1539,29 @@ + (UIImage *)UIImage:(id)json RCTLogConvertError(json, @"an image. File not found."); } } else if ([scheme isEqualToString:@"data"]) { - image = UIImageWithData([NSData dataWithContentsOfURL:URL]); // TODO(macOS GH#774) + image = UIImageWithData([NSData dataWithContentsOfURL:URL]); // [macOS] } else if ([scheme isEqualToString:@"http"] && imageSource.packagerAsset) { - image = UIImageWithData([NSData dataWithContentsOfURL:URL]); // TODO(macOS GH#774) + image = UIImageWithData([NSData dataWithContentsOfURL:URL]); // [macOS] } else { RCTLogConvertError(json, @"an image. Only local files or data URIs are supported."); return nil; } - CGImageRef imageRef = UIImageGetCGImageRef(image); // TODO(macOS GH#774) -#if !TARGET_OS_OSX // TODO(macOS GH#774) + CGImageRef imageRef = UIImageGetCGImageRef(image); // [macOS] +#if !TARGET_OS_OSX // [macOS] CGFloat scale = imageSource.scale; if (!scale && imageSource.size.width) { // If no scale provided, set scale to image width / source width - scale = CGImageGetWidth(imageRef) / imageSource.size.width; // TODO(macOS GH#774) + scale = CGImageGetWidth(imageRef) / imageSource.size.width; // [macOS] } if (scale) { image = [UIImage imageWithCGImage:imageRef scale:scale orientation:image.imageOrientation]; } -#else // [TODO(macOS GH#774) +#else // [macOS if (!CGSizeEqualToSize(image.size, imageSource.size)) { image = [[NSImage alloc] initWithCGImage:imageRef size:imageSource.size]; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] if (!CGSizeEqualToSize(imageSource.size, CGSizeZero) && !CGSizeEqualToSize(imageSource.size, image.size)) { RCTLogError( @@ -1580,7 +1576,7 @@ + (UIImage *)UIImage:(id)json + (CGImageRef)CGImage:(id)json { - return UIImageGetCGImageRef([self UIImage:json]); // TODO(macOS GH#774) + return UIImageGetCGImageRef([self UIImage:json]); // [macOS] } @end diff --git a/React/Base/RCTDisplayLink.m b/React/Base/RCTDisplayLink.m index 5cf46cdbbcc3a9..affe29fb929fe2 100644 --- a/React/Base/RCTDisplayLink.m +++ b/React/Base/RCTDisplayLink.m @@ -9,23 +9,23 @@ #import -#import "RCTPlatformDisplayLink.h" // TODO(macOS GH#774) +#import "RCTPlatformDisplayLink.h" // [macOS] #import "RCTAssert.h" #import "RCTBridgeModule.h" #import "RCTFrameUpdate.h" #import "RCTModuleData.h" #import "RCTProfile.h" -#if TARGET_OS_OSX // TODO(macOS, https://github.com/microsoft/react-native-macos/issues/533) +#if TARGET_OS_OSX // [macOS Github#533 // To compile in Xcode 12 beta 4 on macOS, we need to explicitly pull in the framework to get the definition for CACurrentMediaTime() #import -#endif // TODO(macOS, https://github.com/microsoft/react-native-macos/issues/533) +#endif // macOS] #define RCTAssertRunLoop() \ RCTAssert(_runLoop == [NSRunLoop currentRunLoop], @"This method must be called on the CADisplayLink run loop") @implementation RCTDisplayLink { - RCTPlatformDisplayLink *_jsDisplayLink; // TODO(macOS GH#774) + RCTPlatformDisplayLink *_jsDisplayLink; // [macOS] NSMutableSet *_frameUpdateObservers; NSRunLoop *_runLoop; } @@ -34,7 +34,7 @@ - (instancetype)init { if ((self = [super init])) { _frameUpdateObservers = [NSMutableSet new]; - _jsDisplayLink = [RCTPlatformDisplayLink displayLinkWithTarget:self selector:@selector(_jsThreadUpdate:)]; // TODO(macOS GH#774) + _jsDisplayLink = [RCTPlatformDisplayLink displayLinkWithTarget:self selector:@selector(_jsThreadUpdate:)]; // [macOS] } return self; @@ -100,14 +100,14 @@ - (void)dealloc - (void)invalidate { - // [TODO: GH#858 + // [macOS // ensure observer callbacks do not hold a reference to weak self via pauseCallback for (RCTModuleData *moduleData in _frameUpdateObservers) { id observer = (id)moduleData.instance; [observer setPauseCallback:nil]; } [_frameUpdateObservers removeAllObjects]; // just to be explicit - // TODO: GH#858] + // macOS] [_jsDisplayLink invalidate]; } @@ -121,7 +121,7 @@ - (void)dispatchBlock:(dispatch_block_t)block queue:(dispatch_queue_t)queue } } -- (void)_jsThreadUpdate:(RCTPlatformDisplayLink *)displayLink // TODO(macOS GH#774) +- (void)_jsThreadUpdate:(RCTPlatformDisplayLink *)displayLink // [macOS] { RCTAssertRunLoop(); diff --git a/React/Base/RCTEventDispatcherProtocol.h b/React/Base/RCTEventDispatcherProtocol.h index 75de08e5b1b7ef..889be3d93e4c86 100644 --- a/React/Base/RCTEventDispatcherProtocol.h +++ b/React/Base/RCTEventDispatcherProtocol.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(OSS Candidate ISS#2710739) +#import // [macOS] #import diff --git a/React/Base/RCTFrameUpdate.h b/React/Base/RCTFrameUpdate.h index ea7dd6137d6335..f10251bda70d75 100644 --- a/React/Base/RCTFrameUpdate.h +++ b/React/Base/RCTFrameUpdate.h @@ -6,7 +6,7 @@ */ #import -#import "RCTPlatformDisplayLink.h" // TODO(macOS GH#774) +#import "RCTPlatformDisplayLink.h" // [macOS] /** * Interface containing the information about the last screen refresh. @@ -23,7 +23,7 @@ */ @property (nonatomic, readonly) NSTimeInterval deltaTime; -- (instancetype)initWithDisplayLink:(RCTPlatformDisplayLink *)displayLink NS_DESIGNATED_INITIALIZER; // TODO(OSS Candidate ISS#2710739) +- (instancetype)initWithDisplayLink:(RCTPlatformDisplayLink *)displayLink NS_DESIGNATED_INITIALIZER; // [macOS] @end diff --git a/React/Base/RCTFrameUpdate.m b/React/Base/RCTFrameUpdate.m index 88a8dcf7795d36..232fbefed7cea2 100644 --- a/React/Base/RCTFrameUpdate.m +++ b/React/Base/RCTFrameUpdate.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import "RCTPlatformDisplayLink.h" // TODO(macOS GH#774) +#import "RCTPlatformDisplayLink.h" // [macOS] #import "RCTFrameUpdate.h" @@ -15,7 +15,7 @@ @implementation RCTFrameUpdate RCT_NOT_IMPLEMENTED(-(instancetype)init) -- (instancetype)initWithDisplayLink:(RCTPlatformDisplayLink *)displayLink // TODO(macOS GH#774) +- (instancetype)initWithDisplayLink:(RCTPlatformDisplayLink *)displayLink // [macOS] { if ((self = [super init])) { _timestamp = displayLink.timestamp; diff --git a/React/Base/RCTImageSource.m b/React/Base/RCTImageSource.m index 17031a9b552bfe..76f5182f6b333b 100644 --- a/React/Base/RCTImageSource.m +++ b/React/Base/RCTImageSource.m @@ -42,7 +42,7 @@ - (BOOL)isEqual:(RCTImageSource *)object (CGSizeEqualToSize(_size, object.size) || CGSizeEqualToSize(object.size, CGSizeZero)); } -#if DEBUG // TODO(macOS GH#774) description is a debug-only feature +#if DEBUG // [macOS description is a debug-only feature - (NSString *)description { return [NSString stringWithFormat:@"", @@ -51,7 +51,7 @@ - (NSString *)description NSStringFromCGSize(_size), _scale]; } -#endif // TODO(macOS GH#774) +#endif // macOS] @end diff --git a/React/Base/RCTJSStackFrame.m b/React/Base/RCTJSStackFrame.m index 8d961299fc2dca..ec40a38974c4e0 100644 --- a/React/Base/RCTJSStackFrame.m +++ b/React/Base/RCTJSStackFrame.m @@ -136,7 +136,7 @@ + (instancetype)stackFrameWithDictionary:(NSDictionary *)dict return stack; } -#if DEBUG // TODO(macOS GH#774) description is a debug-only feature +#if DEBUG // [macOS description is a debug-only feature - (NSString *)description { return [NSString stringWithFormat:@"<%@: %p method name: %@; file name: %@; line: %ld; column: %ld>", @@ -147,6 +147,6 @@ - (NSString *)description (long)self.lineNumber, (long)self.column]; } -#endif // TODO(macOS GH#774) +#endif // macOS] @end diff --git a/React/Base/RCTJSThread.h b/React/Base/RCTJSThread.h index fedf7a540d46c2..7c1a503572f5cd 100644 --- a/React/Base/RCTJSThread.h +++ b/React/Base/RCTJSThread.h @@ -6,7 +6,7 @@ */ #import -#import // TODO(macOS GH#774) +#import // [macOS] #import diff --git a/React/Base/RCTJavaScriptLoader.h b/React/Base/RCTJavaScriptLoader.h index a35bd655648ebf..8f946e51c864de 100755 --- a/React/Base/RCTJavaScriptLoader.h +++ b/React/Base/RCTJavaScriptLoader.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(OSS Candidate ISS#2710739) +#import // [macOS] #import diff --git a/React/Base/RCTJavaScriptLoader.mm b/React/Base/RCTJavaScriptLoader.mm index 10b71097465aa3..da836e4a1bbcba 100755 --- a/React/Base/RCTJavaScriptLoader.mm +++ b/React/Base/RCTJavaScriptLoader.mm @@ -62,7 +62,7 @@ @implementation RCTSource @implementation RCTLoadingProgress -#if DEBUG // TODO(macOS GH#774) description is a debug-only feature +#if DEBUG // [macOS description is a debug-only feature - (NSString *)description { NSMutableString *desc = [NSMutableString new]; @@ -78,7 +78,7 @@ - (NSString *)description [desc appendString:@"\u2026"]; return desc; } -#endif // TODO(macOS GH#774) +#endif // macOS] @end diff --git a/React/Base/RCTKeyCommands.m b/React/Base/RCTKeyCommands.m index 72f8a319b17052..4f15d5f39fb8f7 100644 --- a/React/Base/RCTKeyCommands.m +++ b/React/Base/RCTKeyCommands.m @@ -74,7 +74,7 @@ - (BOOL)matchesInput:(NSString *)input flags:(UIKeyModifierFlags)flags return [_key isEqual:input] && (_flags == flags || flags == 0); } -#if DEBUG // TODO(macOS GH#774) description is a debug-only feature +#if DEBUG // [macOS description is a debug-only feature - (NSString *)description { return [NSString stringWithFormat:@"<%@:%p input=\"%@\" flags=%lld hasBlock=%@>", @@ -84,7 +84,7 @@ - (NSString *)description (long long)_flags, _block ? @"YES" : @"NO"]; } -#endif // TODO(macOS GH#774) +#endif // macOS] @end diff --git a/React/Base/RCTModuleData.mm b/React/Base/RCTModuleData.mm index 56235e63ed14bb..9f1b2eae8bd525 100644 --- a/React/Base/RCTModuleData.mm +++ b/React/Base/RCTModuleData.mm @@ -570,11 +570,11 @@ - (void)invalidate _methodQueue = nil; } -#if DEBUG // TODO(macOS GH#774) description is a debug-only feature +#if DEBUG // [macOS description is a debug-only feature - (NSString *)description { return [NSString stringWithFormat:@"<%@: %p; name=\"%@\">", [self class], self, self.name]; } -#endif // TODO(macOS GH#774) +#endif // macOS] @end diff --git a/React/Base/RCTModuleMethod.mm b/React/Base/RCTModuleMethod.mm index f167ef95362544..ee0f2ed34f7403 100644 --- a/React/Base/RCTModuleMethod.mm +++ b/React/Base/RCTModuleMethod.mm @@ -602,7 +602,7 @@ - (NSString *)methodName return [NSString stringWithFormat:@"-[%@ %s]", _moduleClass, sel_getName(_selector)]; } -#if DEBUG // TODO(macOS GH#774) description is a debug-only feature +#if DEBUG // [macOS description is a debug-only feature - (NSString *)description { return [NSString stringWithFormat:@"<%@: %p; exports %@ as %s(); type: %s>", @@ -612,6 +612,6 @@ - (NSString *)description self.JSMethodName, RCTFunctionDescriptorFromType(self.functionType)]; } -#endif // TODO(macOS GH#774) +#endif // macOS] @end diff --git a/React/Base/RCTMultipartDataTask.m b/React/Base/RCTMultipartDataTask.m index b799136d649468..f5f83413f430b3 100644 --- a/React/Base/RCTMultipartDataTask.m +++ b/React/Base/RCTMultipartDataTask.m @@ -22,11 +22,11 @@ @interface RCTMultipartDataTask () diff --git a/React/Base/RCTRedBoxSetEnabled.m b/React/Base/RCTRedBoxSetEnabled.m index 5c3132ac54a834..1b7692e13d1220 100644 --- a/React/Base/RCTRedBoxSetEnabled.m +++ b/React/Base/RCTRedBoxSetEnabled.m @@ -7,7 +7,7 @@ #import "RCTRedBoxSetEnabled.h" -#if RCT_DEV && DEBUG // TODO(macOS GH#774) RCT_DEV is always on in the react-native-macos fork, so to not default to redboxing in release builds, trigger the initial value off of the scheme as well +#if RCT_DEV && DEBUG // [macOS] RCT_DEV is always on in the react-native-macos fork, so to not default to redboxing in release builds, trigger the initial value off of the scheme as well static BOOL redBoxEnabled = YES; #else static BOOL redBoxEnabled = NO; diff --git a/React/Base/RCTReloadCommand.m b/React/Base/RCTReloadCommand.m index d1f0c286039106..1aa61d526379e5 100644 --- a/React/Base/RCTReloadCommand.m +++ b/React/Base/RCTReloadCommand.m @@ -8,9 +8,9 @@ #import "RCTReloadCommand.h" #import "RCTAssert.h" -#if !TARGET_OS_OSX +#if !TARGET_OS_OSX // [macOS] #import "RCTKeyCommands.h" -#endif +#endif // [macOS] #import "RCTUtils.h" static NSHashTable> *listeners; @@ -30,7 +30,7 @@ void RCTRegisterReloadCommandListener(id listener) if (!listeners) { listeners = [NSHashTable weakObjectsHashTable]; } -#if RCT_DEV && !TARGET_OS_OSX +#if RCT_DEV && !TARGET_OS_OSX // [macOS] RCTAssertMainQueue(); // because registerKeyCommandWithInput: must be called on the main thread static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ @@ -40,7 +40,7 @@ void RCTRegisterReloadCommandListener(id listener) RCTTriggerReloadCommandListeners(@"Command + R"); }]; }); -#endif +#endif // [macOS] [listeners addObject:listener]; [listenersLock unlock]; } diff --git a/React/Base/RCTRootContentView.h b/React/Base/RCTRootContentView.h index 202fc2fca03e80..c3f58d46393059 100644 --- a/React/Base/RCTRootContentView.h +++ b/React/Base/RCTRootContentView.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import diff --git a/React/Base/RCTRootContentView.m b/React/Base/RCTRootContentView.m index aad3c4343c129e..b44bc6fe28744d 100644 --- a/React/Base/RCTRootContentView.m +++ b/React/Base/RCTRootContentView.m @@ -8,7 +8,7 @@ #import "RCTRootContentView.h" #import "RCTBridge.h" -#import "RCTDeviceInfo.h" // TODO(macOS GH#774) +#import "RCTDeviceInfo.h" // [macOS] #import "RCTPerformanceLogger.h" #import "RCTRootView.h" #import "RCTRootViewInternal.h" @@ -17,11 +17,11 @@ #import "UIView+React.h" @implementation RCTRootContentView -{ // [TODO(macOS GH#774) +{ // [macOS #if TARGET_OS_OSX BOOL _subscribedToWindowNotifications; #endif -} // ]TODO(macOS GH#774) +} // macOS] - (instancetype)initWithFrame:(CGRect)frame bridge:(RCTBridge *)bridge @@ -35,10 +35,10 @@ - (instancetype)initWithFrame:(CGRect)frame _touchHandler = [[RCTTouchHandler alloc] initWithBridge:_bridge]; [_touchHandler attachToView:self]; [_bridge.uiManager registerRootView:self]; -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS self.postsFrameChangedNotifications = YES; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sendFrameChangedEvent:) name:NSViewFrameDidChangeNotification object:self]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } return self; } @@ -46,7 +46,7 @@ - (instancetype)initWithFrame:(CGRect)frame RCT_NOT_IMPLEMENTED(-(instancetype)initWithFrame : (CGRect)frame) RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (nonnull NSCoder *)aDecoder) -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; @@ -85,7 +85,7 @@ - (void)sendFrameChangedEvent:(__unused NSNotification *)notification #pragma clang diagnostic pop } -#endif // ]TODO(macOS GH#774) +#endif // macOS] - (void)layoutSubviews { @@ -93,7 +93,7 @@ - (void)layoutSubviews [self updateAvailableSize]; } -- (void)insertReactSubview:(RCTUIView *)subview atIndex:(NSInteger)atIndex // TODO(macOS ISS#3536887) +- (void)insertReactSubview:(RCTUIView *)subview atIndex:(NSInteger)atIndex // [macOS] { [super insertReactSubview:subview atIndex:atIndex]; [_bridge.performanceLogger markStopForTag:RCTPLTTI]; @@ -132,10 +132,10 @@ - (void)updateAvailableSize [_bridge.uiManager setAvailableSize:self.availableSize forRootView:self]; } -- (RCTPlatformView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event // TODO(macOS ISS#3536887) +- (RCTPlatformView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event // [macOS] { // The root content view itself should never receive touches - RCTPlatformView *hitView = [super hitTest:point withEvent:event]; // TODO(macOS ISS#3536887) + RCTPlatformView *hitView = [super hitTest:point withEvent:event]; // [macOS] if (_passThroughTouches && hitView == self) { return nil; } diff --git a/React/Base/RCTRootView.h b/React/Base/RCTRootView.h index 992a804a81f010..6dea05e8eeac7c 100644 --- a/React/Base/RCTRootView.h +++ b/React/Base/RCTRootView.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import @@ -47,7 +47,7 @@ extern * like any ordinary UIView. You can have multiple RCTRootViews on screen at * once, all controlled by the same JavaScript application. */ -@interface RCTRootView : RCTUIView // TODO(macOS ISS#3536887) +@interface RCTRootView : RCTUIView // [macOS] /** * - Designated initializer - @@ -136,14 +136,14 @@ extern /** * The React-managed contents view of the root view. */ -@property (nonatomic, strong, readonly) RCTUIView *contentView; // TODO(macOS ISS#3536887) +@property (nonatomic, strong, readonly) RCTUIView *contentView; // [macOS] /** * A view to display while the JavaScript is loading, so users aren't presented * with a blank screen. By default this is nil, but you can override it with * (for example) a UIActivityIndicatorView or a placeholder image. */ -@property (nonatomic, strong, nullable) RCTUIView *loadingView; // TODO(macOS ISS#3536887) +@property (nonatomic, strong, nullable) RCTUIView *loadingView; // [macOS] /** * When set, any touches on the RCTRootView that are not matched up to any of the child diff --git a/React/Base/RCTRootView.m b/React/Base/RCTRootView.m index d76325d083d71d..02b6862f31ec84 100644 --- a/React/Base/RCTRootView.m +++ b/React/Base/RCTRootView.m @@ -15,8 +15,8 @@ #import "RCTBridge+Private.h" #import "RCTBridge.h" #import "RCTConstants.h" -#import "RCTDevSettings.h" // TODO(OSS Candidate ISS#2710739) -// TODO(OSS Candidate ISS#2710739): remove #import "RCTKeyCommands.h" +#import "RCTDevSettings.h" // [macOS] +// [macOS] remove #import "RCTKeyCommands.h" #import "RCTLog.h" #import "RCTPerformanceLogger.h" #import "RCTProfile.h" @@ -29,9 +29,9 @@ #import "RCTView.h" #import "UIView+React.h" -#if __has_include("RCTDevMenu.h") // [TODO(OSS Candidate ISS#2710739) +#if __has_include("RCTDevMenu.h") // [macOS #import "RCTDevMenu.h" -#endif // ]TODO(OSS Candidate ISS#2710739) +#endif // macOS] NSString *const RCTContentDidAppearNotification = @"RCTContentDidAppearNotification"; @@ -173,9 +173,9 @@ - (void)layoutSubviews { [super layoutSubviews]; _contentView.frame = self.bounds; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] _loadingView.center = (CGPoint){CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds)}; -#else // [TODO(macOS GH#774) +#else // [macOS NSRect bounds = self.bounds; NSSize loadingViewSize = _loadingView.frame.size; CGFloat scale = self.window.backingScaleFactor; @@ -185,7 +185,7 @@ - (void)layoutSubviews RCTRoundPixelValue(bounds.origin.x + ((bounds.size.width - loadingViewSize.width) / 2), scale), RCTRoundPixelValue(bounds.origin.y + ((bounds.size.height - loadingViewSize.height) / 2), scale) ); -#endif // ]TODO(macOS GH#774) +#endif // macOS] } - (void)setMinimumSize:(CGSize)minimumSize @@ -212,14 +212,14 @@ - (UIViewController *)reactViewController - (BOOL)canBecomeFirstResponder { -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] return YES; -#else +#else // [macOS return NO; // commit 01aba7e8: Merged PR 94656: Enable keyboard accessibility and support for focus ring drawing for button, textfields etc -#endif // ]TODO(macOS GH#774) +#endif // macOS] } -- (void)setLoadingView:(RCTUIView *)loadingView // TODO(macOS ISS#3536887) +- (void)setLoadingView:(RCTUIView *)loadingView // [macOS] { _loadingView = loadingView; if (!_contentView.contentHasAppeared) { @@ -243,7 +243,7 @@ - (void)hideLoadingView dispatch_time(DISPATCH_TIME_NOW, (int64_t)(_loadingViewFadeDelay * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [UIView transitionWithView:self duration:self->_loadingViewFadeDuration options:UIViewAnimationOptionTransitionCrossDissolve @@ -253,7 +253,7 @@ - (void)hideLoadingView completion:^(__unused BOOL finished) { [self->_loadingView removeFromSuperview]; }]; -#elif TARGET_OS_OSX // [TODO(macOS GH#774) +#else // [macOS [NSAnimationContext runAnimationGroup:^(__unused NSAnimationContext *context) { self->_loadingView.animator.alphaValue = 0.0; } completionHandler:^{ @@ -261,7 +261,7 @@ - (void)hideLoadingView self->_loadingView.hidden = YES; self->_loadingView.alphaValue = 1.0; }]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] }); } else { _loadingView.hidden = YES; @@ -350,10 +350,10 @@ - (void)setSizeFlexibility:(RCTRootViewSizeFlexibility)sizeFlexibility _contentView.sizeFlexibility = _sizeFlexibility; } -- (RCTPlatformView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event // TODO(macOS GH#774) +- (RCTPlatformView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event // [macOS] { // The root view itself should never receive touches - RCTPlatformView *hitView = [super hitTest:point withEvent:event]; // TODO(macOS GH#774) + RCTPlatformView *hitView = [super hitTest:point withEvent:event]; // [macOS] if (self.passThroughTouches && hitView == self) { return nil; } @@ -386,11 +386,11 @@ - (void)setIntrinsicContentSize:(CGSize)intrinsicContentSize _intrinsicContentSize = intrinsicContentSize; [self invalidateIntrinsicContentSize]; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [self.superview setNeedsLayout]; -#else // [TODO(macOS GH#774) +#else // [macOS [self.superview setNeedsLayout:YES]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] // Don't notify the delegate if the content remains invisible or its size has not changed if (bothSizesHaveAZeroDimension || sizesAreEqual) { @@ -398,11 +398,11 @@ - (void)setIntrinsicContentSize:(CGSize)intrinsicContentSize } [self invalidateIntrinsicContentSize]; - #if !TARGET_OS_OSX // TODO(macOS GH#774) + #if !TARGET_OS_OSX // [macOS] [self.superview setNeedsLayout]; - #else // [TODO(macOS GH#774) + #else // [macOS [self.superview setNeedsLayout:YES]; - #endif // ]TODO(macOS GH#774) + #endif // macOS] [_delegate rootViewDidChangeIntrinsicSize:self]; } @@ -419,7 +419,7 @@ - (void)contentViewInvalidated [self showLoadingView]; } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection { [super traitCollectionDidChange:previousTraitCollection]; @@ -431,10 +431,10 @@ - (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection RCTUserInterfaceStyleDidChangeNotificationTraitCollectionKey : self.traitCollection, }]; } -#endif // ]TODO(macOS GH#774) +#endif // [macOS] -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS - (NSMenu *)menuForEvent:(NSEvent *)event { NSMenu *menu = nil; @@ -449,7 +449,7 @@ - (NSMenu *)menuForEvent:(NSEvent *)event } return menu; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] - (void)dealloc { diff --git a/React/Base/RCTTouchEvent.m b/React/Base/RCTTouchEvent.m index 477491d02d5a8b..1c4eff1bbc2f9b 100644 --- a/React/Base/RCTTouchEvent.m +++ b/React/Base/RCTTouchEvent.m @@ -98,12 +98,12 @@ - (uint16_t)coalescingKey return _coalescingKey; } -#if DEBUG // TODO(macOS GH#774) description is a debug-only feature +#if DEBUG // [macOS description is a debug-only feature - (NSString *)description { return [NSString stringWithFormat:@"<%@: %p; name = %@; coalescing key = %hu>", [self class], self, _eventName, _coalescingKey]; } -#endif // TODO(macOS GH#774) +#endif // macOS] @end diff --git a/React/Base/RCTTouchHandler.h b/React/Base/RCTTouchHandler.h index ab50e8af2f03be..a1e6c8074f96dc 100644 --- a/React/Base/RCTTouchHandler.h +++ b/React/Base/RCTTouchHandler.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import @@ -15,12 +15,12 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge NS_DESIGNATED_INITIALIZER; -- (void)attachToView:(RCTUIView *)view; // TODO(macOS ISS#3536887) -- (void)detachFromView:(RCTUIView *)view; // TODO(macOS ISS#3536887) +- (void)attachToView:(RCTUIView *)view; // [macOS] +- (void)detachFromView:(RCTUIView *)view; // [macOS] - (void)cancel; -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS - (void)willShowMenuWithEvent:(NSEvent*)event; -#endif // ]TODO(macOS GH#774) +#endif // macOS] @end diff --git a/React/Base/RCTTouchHandler.m b/React/Base/RCTTouchHandler.m index 63809638b189be..3bfefc35db3880 100644 --- a/React/Base/RCTTouchHandler.m +++ b/React/Base/RCTTouchHandler.m @@ -7,10 +7,10 @@ #import "RCTTouchHandler.h" -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] #import -#endif // ]TODO(macOS GH#774) -#import // TODO(macOS GH#774) +#endif // [macOS] +#import // [macOS] #import "RCTAssert.h" #import "RCTBridge.h" @@ -36,16 +36,16 @@ @implementation RCTTouchHandler { * These must be kept track of because `UIKit` destroys the touch targets * if touches are canceled, and we have no other way to recover this info. */ - NSMutableOrderedSet *_nativeTouches; // TODO(macOS GH#774) + NSMutableOrderedSet *_nativeTouches; // [macOS] NSMutableArray *_reactTouches; - NSMutableArray *_touchViews; // TODO(macOS GH#774) + NSMutableArray *_touchViews; // [macOS] - __weak RCTPlatformView *_cachedRootView; // TODO(macOS GH#774) + __weak RCTPlatformView *_cachedRootView; // [macOS] uint16_t _coalescingKey; -#if TARGET_OS_OSX// [TODO(macOS GH#774) +#if TARGET_OS_OSX// [macOS BOOL _shouldSendMouseUpOnSystemBehalf; -#endif// ]TODO(macOS GH#774) +#endif// macOS] } - (instancetype)initWithBridge:(RCTBridge *)bridge @@ -59,18 +59,18 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge _reactTouches = [NSMutableArray new]; _touchViews = [NSMutableArray new]; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] // `cancelsTouchesInView` and `delaysTouches*` are needed in order to be used as a top level // event delegated recognizer. Otherwise, lower-level components not built // using RCT, will fail to recognize gestures. self.cancelsTouchesInView = NO; self.delaysTouchesBegan = NO; // This is default value. self.delaysTouchesEnded = NO; -#else // [TODO(macOS GH#774) +#else // [macOS self.delaysPrimaryMouseButtonEvents = NO; // default is NO. self.delaysSecondaryMouseButtonEvents = NO; // default is NO. self.delaysOtherMouseButtonEvents = NO; // default is NO. -#endif // ]TODO(macOS GH#774) +#endif // macOS] self.delegate = self; } @@ -79,18 +79,18 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge } RCT_NOT_IMPLEMENTED(-(instancetype)initWithTarget : (id)target action : (SEL)action) -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)coder) -#endif // ]TODO(macOS GH#774) +#endif // macOS] -- (void)attachToView:(RCTUIView *)view // TODO(macOS ISS#3536887) +- (void)attachToView:(RCTUIView *)view // [macOS] { RCTAssert(self.view == nil, @"RCTTouchHandler already has attached view."); [view addGestureRecognizer:self]; } -- (void)detachFromView:(RCTUIView *)view // TODO(macOS ISS#3536887) +- (void)detachFromView:(RCTUIView *)view // [macOS] { RCTAssertParam(view); RCTAssert(self.view == view, @"RCTTouchHandler attached to another view."); @@ -102,17 +102,17 @@ - (void)detachFromView:(RCTUIView *)view // TODO(macOS ISS#3536887) - (void)_recordNewTouches:(NSSet *)touches { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] for (UITouch *touch in touches) { -#else // [TODO(macOS GH#774) +#else // [macOS for (NSEvent *touch in touches) { -#endif // ]TODO(macOS GH#774) +#endif // macOS] RCTAssert(![_nativeTouches containsObject:touch], @"Touch is already recorded. This is a critical bug."); // Find closest React-managed touchable view -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UIView *targetView = touch.view; while (targetView) { if (targetView.reactTag && targetView.userInteractionEnabled) { @@ -125,7 +125,7 @@ - (void)_recordNewTouches:(NSSet *)touches if (!reactTag || !targetView.userInteractionEnabled) { continue; } -#else // [TODO(macOS GH#774) +#else // [macOS // -[NSView hitTest:] takes coordinates in a view's superview coordinate system. // The assumption here is that a RCTUIView/RCTSurfaceView will always have a superview. CGPoint touchLocation = [self.view.superview convertPoint:touch.locationInWindow fromView:nil]; @@ -149,8 +149,8 @@ - (void)_recordNewTouches:(NSSet *)touches while (targetView) { BOOL isUserInteractionEnabled = NO; - if ([((RCTUIView*)targetView) respondsToSelector:@selector(isUserInteractionEnabled)]) { // TODO(macOS ISS#3536887) - isUserInteractionEnabled = ((RCTUIView*)targetView).isUserInteractionEnabled; // TODO(macOS ISS#3536887) + if ([((RCTUIView*)targetView) respondsToSelector:@selector(isUserInteractionEnabled)]) { // [macOS] + isUserInteractionEnabled = ((RCTUIView*)targetView).isUserInteractionEnabled; // [macOS] } if (targetView.reactTag && isUserInteractionEnabled) { break; @@ -160,13 +160,13 @@ - (void)_recordNewTouches:(NSSet *)touches NSNumber *reactTag = [targetView reactTagAtPoint:touchLocation]; BOOL isUserInteractionEnabled = NO; - if ([((RCTUIView*)targetView) respondsToSelector:@selector(isUserInteractionEnabled)]) { // TODO(macOS ISS#3536887) - isUserInteractionEnabled = ((RCTUIView*)targetView).isUserInteractionEnabled; // TODO(macOS ISS#3536887) + if ([((RCTUIView*)targetView) respondsToSelector:@selector(isUserInteractionEnabled)]) { // [macOS] + isUserInteractionEnabled = ((RCTUIView*)targetView).isUserInteractionEnabled; // [macOS] } if (!reactTag || !isUserInteractionEnabled) { continue; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] // Get new, unique touch identifier for the react touch const NSUInteger RCTMaxTouches = 11; // This is the maximum supported by iDevices @@ -196,15 +196,15 @@ - (void)_recordNewTouches:(NSSet *)touches - (void)_recordRemovedTouches:(NSSet *)touches { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] for (UITouch *touch in touches) { NSInteger index = [_nativeTouches indexOfObject:touch]; -#else // [TODO(macOS GH#774) +#else // [macOS for (NSEvent *touch in touches) { NSInteger index = [_nativeTouches indexOfObjectPassingTest:^BOOL(NSEvent *event, __unused NSUInteger idx, __unused BOOL *stop) { return touch.eventNumber == event.eventNumber; }]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] if (index == NSNotFound) { continue; } @@ -217,7 +217,7 @@ - (void)_recordRemovedTouches:(NSSet *)touches - (void)_updateReactTouchAtIndex:(NSInteger)touchIndex { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UITouch *nativeTouch = _nativeTouches[touchIndex]; CGPoint windowLocation = [nativeTouch locationInView:nativeTouch.window]; RCTAssert(_cachedRootView, @"We were unable to find a root view for the touch"); @@ -225,14 +225,14 @@ - (void)_updateReactTouchAtIndex:(NSInteger)touchIndex UIView *touchView = _touchViews[touchIndex]; CGPoint touchViewLocation = [nativeTouch.window convertPoint:windowLocation toView:touchView]; -#else // [TODO(macOS GH#774) +#else // [macOS NSEvent *nativeTouch = _nativeTouches[touchIndex]; CGPoint location = nativeTouch.locationInWindow; RCTAssert(_cachedRootView, @"We were unable to find a root view for the touch"); CGPoint rootViewLocation = [_cachedRootView.window.contentView convertPoint:location toView:_cachedRootView]; NSView *touchView = _touchViews[touchIndex]; CGPoint touchViewLocation = [touchView convertPoint:location fromView:nil]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] NSMutableDictionary *reactTouch = _reactTouches[touchIndex]; reactTouch[@"pageX"] = @(RCTSanitizeNaNValue(rootViewLocation.x, @"touchEvent.pageX")); @@ -241,7 +241,7 @@ - (void)_updateReactTouchAtIndex:(NSInteger)touchIndex reactTouch[@"locationY"] = @(RCTSanitizeNaNValue(touchViewLocation.y, @"touchEvent.locationY")); reactTouch[@"timestamp"] = @(nativeTouch.timestamp * 1000); // in ms, for JS -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] // TODO: force for a 'normal' touch is usually 1.0; // should we expose a `normalTouchForce` constant somewhere (which would // have a value of `1.0 / nativeTouch.maximumPossibleForce`)? @@ -251,7 +251,7 @@ - (void)_updateReactTouchAtIndex:(NSInteger)touchIndex reactTouch[@"force"] = @(RCTZeroIfNaN(nativeTouch.force / nativeTouch.maximumPossibleForce)); reactTouch[@"altitudeAngle"] = @(RCTZeroIfNaN(nativeTouch.altitudeAngle)); } -#else // [TODO(macOS GH#774) +#else // [macOS NSEventModifierFlags modifierFlags = nativeTouch.modifierFlags; if (modifierFlags & NSEventModifierFlagShift) { reactTouch[@"shiftKey"] = @YES; @@ -272,7 +272,7 @@ - (void)_updateReactTouchAtIndex:(NSInteger)touchIndex } else if (type == NSEventTypeRightMouseDown || type == NSEventTypeRightMouseUp || type == NSEventTypeRightMouseDragged) { reactTouch[@"button"] = @2; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] } /** @@ -286,31 +286,31 @@ - (void)_updateReactTouchAtIndex:(NSInteger)touchIndex * (start/end/move/cancel) and the indices that represent "changed" `Touch`es * from that array. */ -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)_updateAndDispatchTouches:(NSSet *)touches eventName:(NSString *)eventName -#else // [TODO(macOS GH#774) +#else // [macOS - (void)_updateAndDispatchTouches:(NSSet *)touches eventName:(NSString *)eventName -#endif // ]TODO(macOS GH#774) +#endif // macOS] { // Update touches NSMutableArray *changedIndexes = [NSMutableArray new]; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] for (UITouch *touch in touches) { NSInteger index = [_nativeTouches indexOfObject:touch]; -#else // [TODO(macOS GH#774) +#else // [macOS for (NSEvent *touch in touches) { NSInteger index = [_nativeTouches indexOfObjectPassingTest:^BOOL(NSEvent *event, __unused NSUInteger idx, __unused BOOL *stop) { return touch.eventNumber == event.eventNumber; }]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] if (index == NSNotFound) { continue; } -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS _nativeTouches[index] = touch; -#endif // ]TODO(macOS GH#774) +#endif // macOS] [self _updateReactTouchAtIndex:index]; [changedIndexes addObject:@(index)]; @@ -363,7 +363,7 @@ - (void)_updateAndDispatchTouches:(NSSet *)touches eventName:(NSStrin */ - (void)_cacheRootView { - RCTPlatformView *rootView = self.view; // TODO(macOS ISS#3536887) + RCTPlatformView *rootView = self.view; // [macOS] while (rootView.superview && ![rootView isReactRootView] && ![rootView isKindOfClass:[RCTSurfaceView class]]) { rootView = rootView.superview; } @@ -372,8 +372,8 @@ - (void)_cacheRootView #pragma mark - Gesture Recognizer Delegate Callbacks -#if !TARGET_OS_OSX // TODO(macOS GH#774) -static BOOL RCTAllTouchesAreCancelledOrEnded(NSSet *touches) // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] +static BOOL RCTAllTouchesAreCancelledOrEnded(NSSet *touches) // [macOS] { for (UITouch *touch in touches) { if (touch.phase == UITouchPhaseBegan || touch.phase == UITouchPhaseMoved || touch.phase == UITouchPhaseStationary) { @@ -383,7 +383,7 @@ static BOOL RCTAllTouchesAreCancelledOrEnded(NSSet *touches) // TODO(macOS GH#77 return YES; } -static BOOL RCTAnyTouchesChanged(NSSet *touches) // [TODO(macOS GH#774) +static BOOL RCTAnyTouchesChanged(NSSet *touches) // [macOS] { for (UITouch *touch in touches) { if (touch.phase == UITouchPhaseBegan || touch.phase == UITouchPhaseMoved) { @@ -392,11 +392,11 @@ static BOOL RCTAnyTouchesChanged(NSSet *touches) // [TODO(macOS GH#774) } return NO; } -#endif // ]TODO(macOS GH#774) +#endif // [macOS] #pragma mark - `UIResponder`-ish touch-delivery methods -- (void)interactionsBegan:(NSSet *)touches // TODO(macOS GH#774) +- (void)interactionsBegan:(NSSet *)touches // [macOS] { [self _cacheRootView]; @@ -404,10 +404,10 @@ - (void)interactionsBegan:(NSSet *)touches // TODO(macOS GH#774) // "end"/"cancel" needs to remove the touch *after* extracting the event. [self _recordNewTouches:touches]; - // [TODO(macOS GH#774) - Filter out touches that were ignored. + // [macOS Filter out touches that were ignored. touches = [touches objectsPassingTest:^(id touch, BOOL *stop) { return [_nativeTouches containsObject:touch]; - }]; // ]TODO(macOS GH#774) + }]; // macOS] [self _updateAndDispatchTouches:touches eventName:@"touchStart"]; @@ -418,45 +418,45 @@ - (void)interactionsBegan:(NSSet *)touches // TODO(macOS GH#774) } } -- (void)interactionsMoved:(NSSet *)touches // TODO(macOS GH#774) +- (void)interactionsMoved:(NSSet *)touches // [macOS] { [self _updateAndDispatchTouches:touches eventName:@"touchMove"]; self.state = UIGestureRecognizerStateChanged; } -- (void)interactionsEnded:(NSSet *)touches withEvent:(UIEvent*)event // TODO(macOS GH#774) +- (void)interactionsEnded:(NSSet *)touches withEvent:(UIEvent*)event // [macOS] { [self _updateAndDispatchTouches:touches eventName:@"touchEnd"]; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] if (RCTAllTouchesAreCancelledOrEnded(event.allTouches)) { self.state = UIGestureRecognizerStateEnded; } else if (RCTAnyTouchesChanged(event.allTouches)) { self.state = UIGestureRecognizerStateChanged; } -#else // [TODO(macOS GH#774) +#else // [macOS self.state = UIGestureRecognizerStateEnded; -#endif // ]TODO(macOS GH#774) +#endif // macOS] [self _recordRemovedTouches:touches]; } -- (void)interactionsCancelled:(NSSet *)touches withEvent:(UIEvent*)event // TODO(macOS GH#774) +- (void)interactionsCancelled:(NSSet *)touches withEvent:(UIEvent*)event // [macOS] { [self _updateAndDispatchTouches:touches eventName:@"touchCancel"]; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] if (RCTAllTouchesAreCancelledOrEnded(event.allTouches)) { self.state = UIGestureRecognizerStateCancelled; } else if (RCTAnyTouchesChanged(event.allTouches)) { self.state = UIGestureRecognizerStateChanged; } -#else // [TODO(macOS GH#774) +#else // [macOS self.state = UIGestureRecognizerStateCancelled; -#endif // ]TODO(macOS GH#774) +#endif // macOS] [self _recordRemovedTouches:touches]; } -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesBegan:touches withEvent:event]; @@ -480,7 +480,7 @@ - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event [super touchesCancelled:touches withEvent:event]; [self interactionsCancelled:touches withEvent:event]; } -#else +#else // [macOS - (BOOL)acceptsFirstMouse:(NSEvent *)event { @@ -493,7 +493,7 @@ - (void)mouseDown:(NSEvent *)event { [super mouseDown:event]; [self interactionsBegan:[NSSet setWithObject:event]]; - // [TODO(macOS GH#774) + // [macOS if (_shouldSendMouseUpOnSystemBehalf) { _shouldSendMouseUpOnSystemBehalf = NO; @@ -507,7 +507,7 @@ - (void)mouseDown:(NSEvent *)event clickCount:[event clickCount] pressure:[event pressure]]; [self interactionsEnded:[NSSet setWithObject:newEvent] withEvent:newEvent]; - // ]TODO(macOS GH#774) + // macOS] } } @@ -541,7 +541,7 @@ - (void)rightMouseUp:(NSEvent *)event [self interactionsEnded:[NSSet setWithObject:event] withEvent:event]; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] - (BOOL)canPreventGestureRecognizer:(__unused UIGestureRecognizer *)preventedGestureRecognizer { @@ -552,7 +552,7 @@ - (BOOL)canBePreventedByGestureRecognizer:(UIGestureRecognizer *)preventingGestu { // We fail in favour of other external gesture recognizers. // iOS will ask `delegate`'s opinion about this gesture recognizer little bit later. - return !RCTUIViewIsDescendantOfView(preventingGestureRecognizer.view, self.view); // TODO(macOS GH#774) and TODO(macOS ISS#3536887) + return !RCTUIViewIsDescendantOfView(preventingGestureRecognizer.view, self.view); // macOS } - (void)reset @@ -576,14 +576,14 @@ - (void)cancel self.enabled = YES; } -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS - (void)willShowMenuWithEvent:(NSEvent*)event { if (event.type == NSEventTypeRightMouseDown) { [self interactionsEnded:[NSSet setWithObject:event] withEvent:event]; } } -#endif // ]TODO(macOS GH#774) +#endif // macOS] #pragma mark - UIGestureRecognizerDelegate diff --git a/React/Base/RCTUIKit.h b/React/Base/RCTUIKit.h index 5037b4684b2466..0514b236114210 100644 --- a/React/Base/RCTUIKit.h +++ b/React/Base/RCTUIKit.h @@ -1,11 +1,11 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -// TODO(macOS GH#774) +// [macOS] #include @@ -62,8 +62,8 @@ UIKIT_STATIC_INLINE CGPathRef UIBezierPathCreateCGPathRef(UIBezierPath *path) // UIView #define RCTPlatformView UIView -#define RCTUIView UIView // TODO(macOS ISS#3536887) -#define RCTUIScrollView UIScrollView // TODO(macOS ISS#3536887) +#define RCTUIView UIView +#define RCTUIScrollView UIScrollView #define RCTPlatformWindow UIWindow @@ -370,7 +370,7 @@ CGPathRef UIBezierPathCreateCGPathRef(UIBezierPath *path); #define RCTPlatformWindow NSWindow -@interface RCTUIView : NSView // TODO(macOS ISS#3536887) +@interface RCTUIView : NSView @property (nonatomic, readonly) BOOL canBecomeFirstResponder; - (BOOL)becomeFirstResponder; @@ -417,7 +417,7 @@ CGPathRef UIBezierPathCreateCGPathRef(UIBezierPath *path); // UIScrollView -@interface RCTUIScrollView : NSScrollView // TODO(macOS ISS#3536887) +@interface RCTUIScrollView : NSScrollView // UIScrollView properties missing in NSScrollView @property (nonatomic, assign) CGPoint contentOffset; @@ -435,11 +435,11 @@ CGPathRef UIBezierPathCreateCGPathRef(UIBezierPath *path); @end -@interface RCTClipView : NSClipView // [TODO(macOS GH#774) +@interface RCTClipView : NSClipView @property (nonatomic, assign) BOOL constrainScrolling; -@end // ]TODO(macOS GH#774) +@end NS_INLINE RCTPlatformView *RCTUIViewHitTestWithEvent(RCTPlatformView *view, CGPoint point, __unused UIEvent *__nullable event) @@ -486,7 +486,7 @@ NS_ASSUME_NONNULL_END // RCTUISlider -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX typedef UISlider RCTUISlider; #else @interface RCTUISlider : NSSlider @@ -501,20 +501,20 @@ NS_ASSUME_NONNULL_BEGIN - (void)setValue:(float)value animated:(BOOL)animated; NS_ASSUME_NONNULL_END @end -#endif // ]TODO(macOS GH#774) +#endif // RCTUILabel -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX typedef UILabel RCTUILabel; #else @interface RCTUILabel : NSTextField @end -#endif // ]TODO(macOS GH#774) +#endif // RCTUISwitch -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX typedef UISwitch RCTUISwitch; #else @interface RCTUISwitch : NSSwitch @@ -525,11 +525,11 @@ NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_END @end -#endif // ]TODO(macOS GH#774) +#endif // RCTUIActivityIndicatorView -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX typedef UIActivityIndicatorView RCTUIActivityIndicatorView; #else @interface RCTUIActivityIndicatorView : NSProgressIndicator @@ -544,4 +544,4 @@ NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_END @end -#endif // ]TODO(macOS GH#774) +#endif diff --git a/React/Base/RCTUtils.h b/React/Base/RCTUtils.h index abe565cd0f4d1d..f3c6752c0e9798 100644 --- a/React/Base/RCTUtils.h +++ b/React/Base/RCTUtils.h @@ -9,7 +9,7 @@ #import #import -#import // TODO(macOS GH#774) +#import // [macOS] #import #import @@ -50,22 +50,22 @@ RCT_EXTERN CGSize RCTScreenSize(void); RCT_EXTERN CGSize RCTViewportSize(void); // Round float coordinates to nearest whole screen pixel (not point) -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCT_EXTERN CGFloat RCTRoundPixelValue(CGFloat value); RCT_EXTERN CGFloat RCTCeilPixelValue(CGFloat value); RCT_EXTERN CGFloat RCTFloorPixelValue(CGFloat value); -#else // [TODO(macOS GH#774) +#else // [macOS RCT_EXTERN CGFloat RCTRoundPixelValue(CGFloat value, CGFloat scale); RCT_EXTERN CGFloat RCTCeilPixelValue(CGFloat value, CGFloat scale); RCT_EXTERN CGFloat RCTFloorPixelValue(CGFloat value, CGFloat scale); -#endif // ]TODO(macOS GH#774) +#endif // macOS] // Convert a size in points to pixels, rounded up to the nearest integral size RCT_EXTERN CGSize RCTSizeInPixels(CGSize pointSize, CGFloat scale); // Method swizzling -RCT_EXTERN IMP RCTSwapClassMethods(Class cls, SEL original, SEL replacement); // TODO(OSS Candidate ISS#2710739) -RCT_EXTERN IMP RCTSwapInstanceMethods(Class cls, SEL original, SEL replacement); // TODO(OSS Candidate ISS#2710739) +RCT_EXTERN IMP RCTSwapClassMethods(Class cls, SEL original, SEL replacement); // [macOS] +RCT_EXTERN IMP RCTSwapInstanceMethods(Class cls, SEL original, SEL replacement); // [macOS] RCT_EXTERN void RCTSwapInstanceMethodWithBlock(Class cls, SEL original, id replacementBlock, SEL replacementSelector); // Module subclass support @@ -87,15 +87,15 @@ RCT_EXTERN NSString *const RCTErrorUnspecified; // Returns YES if React is running in a test environment RCT_EXTERN BOOL RCTRunningInTestEnvironment(void); -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] // Returns YES if React is running in an iOS App Extension RCT_EXTERN BOOL RCTRunningInAppExtension(void); -#endif // ]TODO(macOS GH#774) +#endif // [macOS] // Returns the shared UIApplication instance, or nil if running in an App Extension RCT_EXTERN UIApplication *__nullable RCTSharedApplication(void); -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] // Returns the current main window, useful if you need to access the root view // or view controller RCT_EXTERN UIWindow *__nullable RCTKeyWindow(void); @@ -106,7 +106,7 @@ RCT_EXTERN UIViewController *__nullable RCTPresentedViewController(void); // Does this device support force touch (aka 3D Touch)? RCT_EXTERN BOOL RCTForceTouchAvailable(void); -#endif // ]TODO(macOS GH#774) +#endif // [macOS] // Create an NSError in the RCTErrorDomain RCT_EXTERN NSError *RCTErrorWithMessage(NSString *message); @@ -172,10 +172,10 @@ RCT_EXTERN void RCTGetRGBAColorComponents(CGColorRef color, CGFloat rgba[_Nonnul // Converts a CGColor to a hex string RCT_EXTERN NSString *RCTColorToHexString(CGColorRef color); -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] // Get standard localized string (if it exists) RCT_EXTERN NSString *RCTUIKitLocalizedString(NSString *string); -#endif // TODO(macOS GH#774) +#endif // [macOS] // Get a human readable type string from an NSObject. For example NSString becomes string RCT_EXTERN NSString *RCTHumanReadableType(NSObject *obj); diff --git a/React/Base/RCTUtils.m b/React/Base/RCTUtils.m index fa49b87c3e11d6..934cff2bf21bb4 100644 --- a/React/Base/RCTUtils.m +++ b/React/Base/RCTUtils.m @@ -13,7 +13,7 @@ #import #import -#import // TODO(macOS GH#774) +#import // [macOS] #import @@ -298,7 +298,7 @@ static void RCTUnsafeExecuteOnMainQueueOnceSync(dispatch_once_t *onceToken, disp } } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] static dispatch_once_t onceTokenScreenScale; static CGFloat screenScale; @@ -358,9 +358,9 @@ CGSize RCTScreenSize() return size; } -#endif // TODO(macOS GH#774) +#endif // [macOS] -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] CGSize RCTViewportSize() { UIWindow *window = RCTKeyWindow(); @@ -384,7 +384,7 @@ CGFloat RCTFloorPixelValue(CGFloat value) CGFloat scale = RCTScreenScale(); return floor(value * scale) / scale; } -#else // [TODO(macOS GH#774) +#else // [macOS CGFloat RCTRoundPixelValue(CGFloat value, CGFloat scale) { return round(value * scale) / scale; @@ -399,7 +399,7 @@ CGFloat RCTFloorPixelValue(CGFloat value, CGFloat scale) { return floor(value * scale) / scale; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] CGSize RCTSizeInPixels(CGSize pointSize, CGFloat scale) { @@ -409,7 +409,7 @@ CGSize RCTSizeInPixels(CGSize pointSize, CGFloat scale) }; } -IMP RCTSwapClassMethods(Class cls, SEL original, SEL replacement) // TODO(OSS Candidate ISS#2710739) +IMP RCTSwapClassMethods(Class cls, SEL original, SEL replacement) // [macOS] { Method originalMethod = class_getClassMethod(cls, original); IMP originalImplementation = method_getImplementation(originalMethod); @@ -425,10 +425,10 @@ IMP RCTSwapClassMethods(Class cls, SEL original, SEL replacement) // TODO(OSS Ca method_exchangeImplementations(originalMethod, replacementMethod); } - return originalImplementation; // TODO(OSS Candidate ISS#2710739) + return originalImplementation; // [macOS] } -IMP RCTSwapInstanceMethods(Class cls, SEL original, SEL replacement) // TODO(OSS Candidate ISS#2710739) +IMP RCTSwapInstanceMethods(Class cls, SEL original, SEL replacement) // [macOS] { Method originalMethod = class_getInstanceMethod(cls, original); IMP originalImplementation = method_getImplementation(originalMethod); @@ -444,7 +444,7 @@ IMP RCTSwapInstanceMethods(Class cls, SEL original, SEL replacement) // TODO(OSS method_exchangeImplementations(originalMethod, replacementMethod); } - return originalImplementation; // TODO(OSS Candidate ISS#2710739) + return originalImplementation; // [macOS] } void RCTSwapInstanceMethodWithBlock(Class cls, SEL original, id replacementBlock, SEL replacementSelector) @@ -554,26 +554,26 @@ BOOL RCTRunningInTestEnvironment(void) return isTestEnvironment; } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] BOOL RCTRunningInAppExtension(void) { return [[[[NSBundle mainBundle] bundlePath] pathExtension] isEqualToString:@"appex"]; } -#endif // TODO(macOS GH#774) +#endif // [macOS] UIApplication *__nullable RCTSharedApplication(void) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] if (RCTRunningInAppExtension()) { return nil; } return [[UIApplication class] performSelector:@selector(sharedApplication)]; -#else // [TODO(macOS GH#774) +#else // [macOS return NSApp; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UIWindow *__nullable RCTKeyWindow(void) { if (RCTRunningInAppExtension()) { @@ -617,7 +617,7 @@ BOOL RCTForceTouchAvailable(void) return forceSupported && (RCTKeyWindow() ?: [UIView new]).traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable; } -#endif // TODO(macOS GH#774) +#endif // [macOS] NSError *RCTErrorWithMessage(NSString *message) { @@ -831,7 +831,7 @@ BOOL RCTIsLocalAssetURL(NSURL *__nullable imageURL) return RCTImageFromLocalAssetURL(bundleImageUrl); } -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS static NSCache *RCTLocalImageCache() { static NSCache *imageCache; @@ -842,19 +842,19 @@ BOOL RCTIsLocalAssetURL(NSURL *__nullable imageURL) }); return imageCache; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] UIImage *__nullable RCTImageFromLocalAssetURL(NSURL *imageURL) { NSString *imageName = RCTBundlePathForURL(imageURL); -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS NSURL *bundleImageURL = nil; UIImage *cachedImage = [RCTLocalImageCache() objectForKey:imageURL]; if (cachedImage) { return cachedImage; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] NSBundle *bundle = nil; NSArray *imagePathComponents = [imageName pathComponents]; @@ -863,7 +863,7 @@ BOOL RCTIsLocalAssetURL(NSURL *__nullable imageURL) NSString *bundlePath = [imagePathComponents firstObject]; bundle = bundleForPath([bundlePath stringByDeletingPathExtension]); imageName = [imageName substringFromIndex:(bundlePath.length + 1)]; -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS // Bundle structure under macOS uses Contents/Resources structure unlike iOS to store the assets. // If the image asset is placed under a sub-directory inside of Resources folder, then first // get the URL path to the image and then use this URL to load the image. @@ -875,21 +875,21 @@ BOOL RCTIsLocalAssetURL(NSURL *__nullable imageURL) NSString *imageExtension = [imageName pathExtension]; NSString *imageNameWithoutExt = [[imageName lastPathComponent] stringByDeletingPathExtension]; bundleImageURL = [bundle URLForResource:imageNameWithoutExt withExtension:imageExtension subdirectory:subDirectory]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS imageName = [imageName stringByDeletingPathExtension]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] UIImage *image = nil; if (imageName) { if (bundle) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] image = [UIImage imageNamed:imageName inBundle:bundle compatibleWithTraitCollection:nil]; -#else // [TODO(macOS GH#774) +#else // [macOS image = (bundleImageURL == nil) ? [bundle imageForResource:imageName] : [[NSImage alloc] initWithContentsOfURL:bundleImageURL]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } else { image = [UIImage imageNamed:imageName]; } @@ -903,14 +903,14 @@ BOOL RCTIsLocalAssetURL(NSURL *__nullable imageURL) if (filePath.pathExtension.length == 0) { filePath = [filePath stringByAppendingPathExtension:@"png"]; } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] image = [UIImage imageWithContentsOfFile:filePath]; -#else // [TODO(macOS GH#774) +#else // [macOS // macOS keeps file handles in open state for lifetime of image if "initWithContentsOfFile:" is used with path inside app bundle // Workaround is to load file in data and then convert data to image NSData *data = [NSData dataWithContentsOfFile:filePath]; image = [[NSImage alloc] initWithData:data]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } } @@ -923,11 +923,11 @@ BOOL RCTIsLocalAssetURL(NSURL *__nullable imageURL) error:nil]; for (NSURL *frameworkURL in possibleFrameworks) { bundle = [NSBundle bundleWithURL:frameworkURL]; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] image = [UIImage imageNamed:imageName inBundle:bundle compatibleWithTraitCollection:nil]; -#else // [TODO(macOS GH#774) +#else // [macOS image = [bundle imageForResource:imageName]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] if (image) { RCTLogWarn(@"Image %@ not found in mainBundle, but found in %@", imageName, bundle); break; @@ -935,11 +935,11 @@ BOOL RCTIsLocalAssetURL(NSURL *__nullable imageURL) } } -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS if (image) { [RCTLocalImageCache() setObject:image forKey:imageURL]; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] return image; } @@ -1045,14 +1045,14 @@ RCT_EXTERN void RCTGetRGBAColorComponents(CGColorRef color, CGFloat rgba[4]) } } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] // (https://github.com/0xced/XCDFormInputAccessoryView/blob/master/XCDFormInputAccessoryView/XCDFormInputAccessoryView.m#L10-L14) NSString *RCTUIKitLocalizedString(NSString *string) { NSBundle *UIKitBundle = [NSBundle bundleForClass:[UIApplication class]]; return UIKitBundle ? [UIKitBundle localizedStringForKey:string value:string table:nil] : string; } -#endif // TODO(macOS GH#774) +#endif // [macOS] NSString *RCTHumanReadableType(NSObject *obj) { diff --git a/React/Base/RCTUtilsUIOverride.h b/React/Base/RCTUtilsUIOverride.h index ed4661f1357756..2e8cdc5783c5e8 100644 --- a/React/Base/RCTUtilsUIOverride.h +++ b/React/Base/RCTUtilsUIOverride.h @@ -6,7 +6,7 @@ */ #import -#import // TODO(macOS GH#774) +#import // [macOS] @interface RCTUtilsUIOverride : NSObject /** diff --git a/React/Base/RCTUtilsUIOverride.m b/React/Base/RCTUtilsUIOverride.m index 6f105b29f72ccb..fc9c6545de4d62 100644 --- a/React/Base/RCTUtilsUIOverride.m +++ b/React/Base/RCTUtilsUIOverride.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import "RCTUtilsUIOverride.h" @implementation RCTUtilsUIOverride diff --git a/React/Base/RCTViewRegistry.m b/React/Base/RCTViewRegistry.m index 8c26b31392f358..7087305f0406ac 100644 --- a/React/Base/RCTViewRegistry.m +++ b/React/Base/RCTViewRegistry.m @@ -26,9 +26,9 @@ - (void)setBridgelessComponentViewProvider:(RCTBridgelessComponentViewProvider)b _bridgelessComponentViewProvider = bridgelessComponentViewProvider; } -- (RCTPlatformView *)viewForReactTag:(NSNumber *)reactTag // TODO(macOS GH#774) +- (RCTPlatformView *)viewForReactTag:(NSNumber *)reactTag // [macOS] { - RCTPlatformView *view = nil; // TODO(macOS GH#774) + RCTPlatformView *view = nil; // [macOS] RCTBridge *bridge = _bridge; if (bridge) { diff --git a/React/Base/Surface/RCTSurfaceDelegate.h b/React/Base/Surface/RCTSurfaceDelegate.h index 382487d4cf680e..caf2fb43d19877 100644 --- a/React/Base/Surface/RCTSurfaceDelegate.h +++ b/React/Base/Surface/RCTSurfaceDelegate.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import diff --git a/React/Base/Surface/RCTSurfaceProtocol.h b/React/Base/Surface/RCTSurfaceProtocol.h index 77a5550fd7959c..239ef98530e0af 100644 --- a/React/Base/Surface/RCTSurfaceProtocol.h +++ b/React/Base/Surface/RCTSurfaceProtocol.h @@ -6,7 +6,7 @@ */ #import -#import // TODO(macOS GH#774) +#import // [macOS] NS_ASSUME_NONNULL_BEGIN diff --git a/React/Base/Surface/RCTSurfaceRootShadowViewDelegate.h b/React/Base/Surface/RCTSurfaceRootShadowViewDelegate.h index b949751259705c..856f46c326d741 100644 --- a/React/Base/Surface/RCTSurfaceRootShadowViewDelegate.h +++ b/React/Base/Surface/RCTSurfaceRootShadowViewDelegate.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] NS_ASSUME_NONNULL_BEGIN diff --git a/React/Base/Surface/RCTSurfaceRootView.h b/React/Base/Surface/RCTSurfaceRootView.h index 904dbb6df51251..82b42e1381cab5 100644 --- a/React/Base/Surface/RCTSurfaceRootView.h +++ b/React/Base/Surface/RCTSurfaceRootView.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import diff --git a/React/Base/Surface/RCTSurfaceView.h b/React/Base/Surface/RCTSurfaceView.h index 7c27a372254226..73dcfc03bb716c 100644 --- a/React/Base/Surface/RCTSurfaceView.h +++ b/React/Base/Surface/RCTSurfaceView.h @@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN /** * UIView instance which represents the Surface */ -@interface RCTSurfaceView : RCTUIView // TODO(macOS ISS#3536887) +@interface RCTSurfaceView : RCTUIView // [macOS] - (instancetype)initWithSurface:(RCTSurface *)surface NS_DESIGNATED_INITIALIZER; diff --git a/React/Base/Surface/RCTSurfaceView.mm b/React/Base/Surface/RCTSurfaceView.mm index 37aa98deedd84d..6b49277e058cd8 100644 --- a/React/Base/Surface/RCTSurfaceView.mm +++ b/React/Base/Surface/RCTSurfaceView.mm @@ -31,12 +31,12 @@ - (instancetype)initWithSurface:(RCTSurface *)surface return self; } -#if TARGET_OS_OSX +#if TARGET_OS_OSX // [macOS - (BOOL)isFlipped { return YES; } -#endif +#endif // macOS] #pragma mark - Internal Interface diff --git a/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.h b/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.h index 86c7c880843b50..88186fd8ea7f93 100644 --- a/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.h +++ b/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import @@ -34,8 +34,8 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, assign) RCTRootViewSizeFlexibility sizeFlexibility; @property (nonatomic, weak) id delegate; @property (nonatomic, weak) UIViewController *reactViewController; -@property (nonatomic, strong, readonly) RCTUIView *contentView; // TODO(macOS GH#774) -@property (nonatomic, strong) RCTUIView *loadingView; // TODO(macOS GH#774) +@property (nonatomic, strong, readonly) RCTUIView *contentView; // [macOS] +@property (nonatomic, strong) RCTUIView *loadingView; // [macOS] @property (nonatomic, assign) BOOL passThroughTouches; @property (nonatomic, assign) NSTimeInterval loadingViewFadeDelay; @property (nonatomic, assign) NSTimeInterval loadingViewFadeDuration; diff --git a/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.mm b/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.mm index 4e22f317c16df0..46ae9c88d4e4c1 100644 --- a/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.mm +++ b/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.mm @@ -78,7 +78,7 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge initialProperties:initialProperties]; [surface start]; if (self = [super initWithSurface:surface sizeMeasureMode:sizeMeasureMode]) { - self.backgroundColor = [RCTUIColor whiteColor]; // TODO(macOS GH#774) + self.backgroundColor = [RCTUIColor whiteColor]; // [macOS] // Nothing specific to do. } @@ -138,7 +138,7 @@ - (NSString *)moduleName return super.surface.moduleName; } -- (RCTUIView *)contentView // TODO(macOS GH#774) +- (RCTUIView *)contentView // [macOS] { return self; } @@ -168,14 +168,14 @@ - (void)setAppProperties:(NSDictionary *)appProperties [super.surface setProperties:appProperties]; } -- (RCTUIView *)loadingView // TODO(macOS GH#774) +- (RCTUIView *)loadingView // [macOS] { return super.activityIndicatorViewFactory ? super.activityIndicatorViewFactory() : nil; } -- (void)setLoadingView:(RCTUIView *)loadingView // TODO(macOS GH#774) +- (void)setLoadingView:(RCTUIView *)loadingView // [macOS] { - super.activityIndicatorViewFactory = ^RCTUIView *(void) // TODO(macOS GH#774) + super.activityIndicatorViewFactory = ^RCTUIView *(void) // [macOS] { return loadingView; }; diff --git a/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.h b/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.h index cf15cbcf429cf3..a61829c0278e9b 100644 --- a/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.h +++ b/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import @@ -15,7 +15,7 @@ @class RCTBridge; @class RCTSurface; -typedef RCTUIView *_Nullable (^RCTSurfaceHostingViewActivityIndicatorViewFactory)(void); // TODO(macOS GH#774) +typedef RCTUIView *_Nullable (^RCTSurfaceHostingViewActivityIndicatorViewFactory)(void); // [macOS] NS_ASSUME_NONNULL_BEGIN @@ -25,7 +25,7 @@ NS_ASSUME_NONNULL_BEGIN * This class can be used as easy-to-use general purpose integration point * of ReactNative-powered experiences in UIKit based apps. */ -@interface RCTSurfaceHostingView : RCTUIView // TODO(macOS GH#774) +@interface RCTSurfaceHostingView : RCTUIView // [macOS] /** * Create an instance of RCTSurface to be hosted. diff --git a/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.mm b/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.mm index b0b1b4ac60a30b..287c786bb89ab7 100644 --- a/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.mm +++ b/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.mm @@ -21,8 +21,8 @@ @interface RCTSurfaceHostingView () @end @implementation RCTSurfaceHostingView { - RCTUIView *_Nullable _activityIndicatorView; // TODO(macOS GH#774) - RCTUIView *_Nullable _surfaceView; // TODO(macOS GH#774) + RCTUIView *_Nullable _activityIndicatorView; // [macOS] + RCTUIView *_Nullable _surfaceView; // [macOS] RCTSurfaceStage _stage; } @@ -61,7 +61,7 @@ - (instancetype)initWithSurface:(id)surface [self _updateViews]; // For backward compatibility with RCTRootView, set a color here instead of transparent (OS default). - self.backgroundColor = [RCTUIColor whiteColor]; // TODO(macOS GH#774) + self.backgroundColor = [RCTUIColor whiteColor]; // [macOS] } return self; @@ -81,11 +81,11 @@ - (void)setFrame:(CGRect)frame RCTSurfaceMinimumSizeAndMaximumSizeFromSizeAndSizeMeasureMode( self.bounds.size, _sizeMeasureMode, &minimumSize, &maximumSize); -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] CGRect windowFrame = [self.window convertRect:self.frame fromView:self.superview]; -#else // [TODO(macOS GH#774) +#else // [macOS CGRect windowFrame = [self.window.contentView convertRect:self.frame toView:self.superview]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] [_surface setMinimumSize:minimumSize maximumSize:maximumSize viewportOffset:windowFrame.origin]; } @@ -107,11 +107,11 @@ - (CGSize)sizeThatFits:(CGSize)size { if (RCTSurfaceStageIsPreparing(_stage)) { if (_activityIndicatorView) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] return [_activityIndicatorView sizeThatFits:size]; -#else // [TODO(macOS GH#774) +#else // [macOS return [_activityIndicatorView fittingSize]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } return CGSizeZero; @@ -209,7 +209,7 @@ - (void)setActivityIndicatorViewFactory:(RCTSurfaceHostingViewActivityIndicatorV #pragma mark - UITraitCollection updates -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection { [super traitCollectionDidChange:previousTraitCollection]; @@ -220,18 +220,18 @@ - (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection RCTUserInterfaceStyleDidChangeNotificationTraitCollectionKey : self.traitCollection, }]; } -#endif // TODO(macOS GH#774) +#endif // [macOS] #pragma mark - Private stuff - (void)_invalidateLayout { [self invalidateIntrinsicContentSize]; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [self.superview setNeedsLayout]; -#else // [TODO(macOS GH#774) +#else // [macOS [self.superview setNeedsLayout:YES]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } - (void)_updateViews diff --git a/React/Base/Surface/SurfaceHostingView/RCTSurfaceSizeMeasureMode.h b/React/Base/Surface/SurfaceHostingView/RCTSurfaceSizeMeasureMode.h index 4cca9ef92fb90f..891c42088a10be 100644 --- a/React/Base/Surface/SurfaceHostingView/RCTSurfaceSizeMeasureMode.h +++ b/React/Base/Surface/SurfaceHostingView/RCTSurfaceSizeMeasureMode.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import diff --git a/React/Base/Surface/SurfaceHostingView/RCTSurfaceSizeMeasureMode.mm b/React/Base/Surface/SurfaceHostingView/RCTSurfaceSizeMeasureMode.mm index 678edd67098c1b..e7a2844d76eff1 100644 --- a/React/Base/Surface/SurfaceHostingView/RCTSurfaceSizeMeasureMode.mm +++ b/React/Base/Surface/SurfaceHostingView/RCTSurfaceSizeMeasureMode.mm @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import "RCTSurfaceSizeMeasureMode.h" diff --git a/React/Base/macOS/RCTPlatform.m b/React/Base/macOS/RCTPlatform.m index 729b4c553c3505..67313b86efe5e2 100644 --- a/React/Base/macOS/RCTPlatform.m +++ b/React/Base/macOS/RCTPlatform.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -// TODO(macOS GH#774) +// [macOS] #import "RCTPlatform.h" diff --git a/React/Base/macOS/RCTPlatformDisplayLink.m b/React/Base/macOS/RCTPlatformDisplayLink.m index b0f358b22cf9d8..caf1f648a65eca 100644 --- a/React/Base/macOS/RCTPlatformDisplayLink.m +++ b/React/Base/macOS/RCTPlatformDisplayLink.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -// TODO(macOS GH#774) +// [macOS] #import "RCTPlatformDisplayLink.h" diff --git a/React/Base/macOS/RCTUIKit.m b/React/Base/macOS/RCTUIKit.m index 2388ba7c9b72b4..0f00e983023ec7 100644 --- a/React/Base/macOS/RCTUIKit.m +++ b/React/Base/macOS/RCTUIKit.m @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -// TODO(macOS GH#774) +// [macOS] -#import // TODO(macOS GH#774) +#import #import @@ -202,7 +202,7 @@ CGPathRef UIBezierPathCreateCGPathRef(UIBezierPath *bezierPath) // UIView -@implementation RCTUIView // TODO(macOS ISS#3536887) +@implementation RCTUIView { @private NSColor *_backgroundColor; @@ -428,7 +428,7 @@ - (void)setCursor:(NSInteger)cursor // RCTUIScrollView -@implementation RCTUIScrollView // TODO(macOS ISS#3536887) +@implementation RCTUIScrollView - (instancetype)initWithFrame:(CGRect)frame { @@ -586,19 +586,19 @@ - (NSRect)constrainBoundsRect:(NSRect)proposedBounds // RCTUISlider -@implementation RCTUISlider {} // [TODO(macOS GH#774) +@implementation RCTUISlider {} - (void)setValue:(float)value animated:(__unused BOOL)animated { self.animator.floatValue = value; } -@end // ]TODO(macOS GH#774) +@end // RCTUILabel -@implementation RCTUILabel {} // [TODO(macOS GH#774) +@implementation RCTUILabel {} - (instancetype)initWithFrame:(NSRect)frameRect { @@ -613,7 +613,7 @@ - (instancetype)initWithFrame:(NSRect)frameRect return self; } -@end // ]TODO(macOS GH#774) +@end @implementation RCTUISwitch diff --git a/React/CoreModules/CoreModulesPlugins.mm b/React/CoreModules/CoreModulesPlugins.mm index c86d8cbe11e713..8cf136300e7997 100644 --- a/React/CoreModules/CoreModulesPlugins.mm +++ b/React/CoreModules/CoreModulesPlugins.mm @@ -19,10 +19,10 @@ Class RCTCoreModulesClassProvider(const char *name) { // Intentionally leak to avoid crashing after static destructors are run. static const auto sCoreModuleClassMap = new const std::unordered_map{ -#if !TARGET_OS_OSX // TODO(macOS) = Do we need these? +#if !TARGET_OS_OSX // [macOS] Do we need these? {"AccessibilityManager", RCTAccessibilityManagerCls}, {"Appearance", RCTAppearanceCls}, -#endif // TODO(macOS) +#endif // [macOS] {"DeviceInfo", RCTDeviceInfoCls}, {"ExceptionsManager", RCTExceptionsManagerCls}, {"PlatformConstants", RCTPlatformCls}, @@ -36,15 +36,15 @@ Class RCTCoreModulesClassProvider(const char *name) { {"StatusBarManager", RCTStatusBarManagerCls}, {"KeyboardObserver", RCTKeyboardObserverCls}, {"AppState", RCTAppStateCls}, -#if !TARGET_OS_OSX // TODO(macOS) = Do we need these? +#if !TARGET_OS_OSX // [macOS] Do we need these? {"PerfMonitor", RCTPerfMonitorCls}, -#endif // TODO(macOS) +#endif // [macOS] {"DevMenu", RCTDevMenuCls}, {"DevSettings", RCTDevSettingsCls}, {"RedBox", RCTRedBoxCls}, -#if !TARGET_OS_OSX // TODO(macOS) = Do we need these? +#if !TARGET_OS_OSX // [macOS] Do we need these? {"LogBox", RCTLogBoxCls}, -#endif // TODO(macOS) +#endif // [macOS] {"WebSocketExecutor", RCTWebSocketExecutorCls}, {"WebSocketModule", RCTWebSocketModuleCls}, {"DevLoadingView", RCTDevLoadingViewCls}, diff --git a/React/CoreModules/RCTAccessibilityManager.h b/React/CoreModules/RCTAccessibilityManager.h index cfd08986656a92..b5144fd4408a9c 100644 --- a/React/CoreModules/RCTAccessibilityManager.h +++ b/React/CoreModules/RCTAccessibilityManager.h @@ -21,7 +21,7 @@ extern NSString *const RCTAccessibilityManagerDidUpdateMultiplierNotification; / @property (nonatomic, assign) BOOL isBoldTextEnabled; @property (nonatomic, assign) BOOL isGrayscaleEnabled; -@property (nonatomic, assign) BOOL isHighContrastEnabled; // TODO(macOS GH#774) - maps to shouldIncreaseContrast on macOS +@property (nonatomic, assign) BOOL isHighContrastEnabled; // [macOS] maps to shouldIncreaseContrast on macOS @property (nonatomic, assign) BOOL isInvertColorsEnabled; @property (nonatomic, assign) BOOL isReduceMotionEnabled; @property (nonatomic, assign) BOOL isReduceTransparencyEnabled; diff --git a/React/CoreModules/RCTAccessibilityManager.mm b/React/CoreModules/RCTAccessibilityManager.mm index 180073c1f74a4b..4f32a369f83e41 100644 --- a/React/CoreModules/RCTAccessibilityManager.mm +++ b/React/CoreModules/RCTAccessibilityManager.mm @@ -17,7 +17,7 @@ #import "CoreModulesPlugins.h" -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] NSString *const RCTAccessibilityManagerDidUpdateMultiplierNotification = @"RCTAccessibilityManagerDidUpdateMultiplierNotification"; @@ -404,4 +404,4 @@ Class RCTAccessibilityManagerCls(void) { return RCTAccessibilityManager.class; } -#endif // TODO(macOS GH#774) +#endif // [macOS] diff --git a/React/CoreModules/RCTActionSheetManager.h b/React/CoreModules/RCTActionSheetManager.h index c631cf808469e3..98a882f12932dd 100644 --- a/React/CoreModules/RCTActionSheetManager.h +++ b/React/CoreModules/RCTActionSheetManager.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import diff --git a/React/CoreModules/RCTActionSheetManager.mm b/React/CoreModules/RCTActionSheetManager.mm index 53a6810903007a..defe2f78ca2cff 100644 --- a/React/CoreModules/RCTActionSheetManager.mm +++ b/React/CoreModules/RCTActionSheetManager.mm @@ -21,11 +21,11 @@ using namespace facebook::react; @interface RCTActionSheetManager () < -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UIActionSheetDelegate -#else +#else // [macOS NSSharingServicePickerDelegate -#endif // ]TODO(macOS GH#774) +#endif // macOS] , NativeActionSheetManagerSpec> @end @@ -33,28 +33,28 @@ @implementation RCTActionSheetManager { // Use NSMapTable, as UIAlertViews do not implement // which is required for NSDictionary keys NSMapTable *_callbacks; -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS NSArray *_excludedActivities; NSString *_sharingSubject; RCTResponseSenderBlock _failureCallback; RCTResponseSenderBlock _successCallback; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } RCT_EXPORT_MODULE() -#if TARGET_OS_OSX // [TODO(macOS GH#774) -@synthesize bridge = _bridge; -#else // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] @synthesize viewRegistry_DEPRECATED = _viewRegistry_DEPRECATED; -#endif // ]TODO(macOS GH#774) +#else // [macOS +@synthesize bridge = _bridge; +#endif // macOS] - (dispatch_queue_t)methodQueue { return dispatch_get_main_queue(); } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)presentViewController:(UIViewController *)alertController onParentViewController:(UIViewController *)parentViewController anchorViewTag:(NSNumber *)anchorViewTag @@ -71,27 +71,27 @@ - (void)presentViewController:(UIViewController *)alertController alertController.popoverPresentationController.sourceRect = sourceView.bounds; [parentViewController presentViewController:alertController animated:YES completion:nil]; } -#endif // TODO(macOS GH#774) +#endif // [macOS] RCT_EXPORT_METHOD(showActionSheetWithOptions : (JS::NativeActionSheetManager::SpecShowActionSheetWithOptionsOptions &)options callback : (RCTResponseSenderBlock)callback) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] if (RCTRunningInAppExtension()) { RCTLogError(@"Unable to show action sheet from app extension"); return; } -#endif // TODO(macOS GH#774) +#endif // [macOS] if (!_callbacks) { _callbacks = [NSMapTable strongToStrongObjectsMapTable]; } NSString *title = options.title(); -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] NSString *message = options.message(); -#endif // TODO(macOS GH#774) +#endif // [macOS] NSArray *buttons = RCTConvertOptionalVecToArray(options.options(), ^id(NSString *element) { return element; }); @@ -109,15 +109,15 @@ - (void)presentViewController:(UIViewController *)alertController return @(element); }); } else { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] NSNumber *destructiveButtonIndex = @-1; destructiveButtonIndices = @[ destructiveButtonIndex ]; -#endif // TODO(macOS GH#774) +#endif // [macOS] } NSNumber *anchor = [RCTConvert NSNumber:options.anchor() ? @(*options.anchor()) : nil]; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UIViewController *controller = RCTPresentedViewController(); UIColor *tintColor = [RCTConvert UIColor:options.tintColor() ? @(*options.tintColor()) : nil]; UIColor *cancelButtonTintColor = @@ -125,7 +125,7 @@ - (void)presentViewController:(UIViewController *)alertController if (controller == nil) { RCTLogError( - @"Tried to display action sheet but there is no application window. options: %@", @{ /* // [ TODO(macOS GH#774): nil check our dict values before inserting them or we may crash */ + @"Tried to display action sheet but there is no application window. options: %@", @{ /* [macOS nil check our dict values before inserting them or we may crash */ @"title" : title ?: [NSNull null], @"message" : message ?: [NSNull null], @"options" : buttons ?: [NSNull null], @@ -135,10 +135,10 @@ - (void)presentViewController:(UIViewController *)alertController @"tintColor" : tintColor ?: [NSNull null], @"cancelButtonTintColor" : cancelButtonTintColor ?: [NSNull null], @"disabledButtonIndices" : disabledButtonIndices ?: [NSNull null], - }); /* // TODO(macOS GH#774): nil check our dict values before inserting them or we may crash ] */ + }); /* [macOS] nil check our dict values before inserting them or we may crash ] */ return; } -#endif // TODO(macOS GH#774) +#endif // [macOS] /* * The `anchor` option takes a view to set as the anchor for the share * popup to point to, on iPads running iOS 8. If it is not passed, it @@ -146,7 +146,7 @@ - (void)presentViewController:(UIViewController *)alertController */ NSNumber *anchorViewTag = anchor; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleActionSheet]; @@ -208,7 +208,7 @@ - (void)presentViewController:(UIViewController *)alertController [self presentViewController:alertController onParentViewController:controller anchorViewTag:anchorViewTag]; -#else // [TODO(macOS GH#774) +#else // [macOS NSMenu *menu = [[NSMenu alloc] initWithTitle:title ?: @""]; [_callbacks setObject:callback forKey:menu]; for (NSInteger index = 0; index < buttons.count; index++) { @@ -240,7 +240,7 @@ - (void)presentViewController:(UIViewController *)alertController location = [NSEvent mouseLocation]; } [menu popUpMenuPositioningItem:menu.itemArray.firstObject atLocation:location inView:view]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } RCT_EXPORT_METHOD(showShareActionSheetWithOptions @@ -248,12 +248,12 @@ - (void)presentViewController:(UIViewController *)alertController : (RCTResponseSenderBlock)failureCallback successCallback : (RCTResponseSenderBlock)successCallback) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] if (RCTRunningInAppExtension()) { RCTLogError(@"Unable to show action sheet from app extension"); return; } -#endif // TODO(macOS GH#774) +#endif // [macOS] NSMutableArray *items = [NSMutableArray array]; NSString *message = options.message(); @@ -279,7 +279,7 @@ - (void)presentViewController:(UIViewController *)alertController return; } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UIActivityViewController *shareController = [[UIActivityViewController alloc] initWithActivityItems:items applicationActivities:nil]; @@ -325,7 +325,7 @@ - (void)presentViewController:(UIViewController *)alertController #endif [self presentViewController:shareController onParentViewController:controller anchorViewTag:anchorViewTag]; -#else // [TODO(macOS GH#774) +#else // [macOS NSArray *excludedActivityTypes = RCTConvertOptionalVecToArray(options.excludedActivityTypes(), ^id(NSString *element) { return element; }); NSMutableArray *excludedTypes = [NSMutableArray array]; for (NSString *excludeActivityType in excludedActivityTypes) { @@ -347,10 +347,10 @@ - (void)presentViewController:(UIViewController *)alertController NSSharingServicePicker *picker = [[NSSharingServicePicker alloc] initWithItems:items]; picker.delegate = self; [picker showRelativeToRect:contentView.bounds ofView:contentView preferredEdge:NSRectEdgeMinX]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS #pragma mark - NSSharingServicePickerDelegate methods @@ -399,7 +399,7 @@ - (void)sharingService:(NSSharingService *)sharingService didShareItems:(NSArray }]]; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] - (std::shared_ptr)getTurboModule:(const ObjCTurboModule::InitParams &)params { diff --git a/React/CoreModules/RCTAlertController.h b/React/CoreModules/RCTAlertController.h index 8669fc72f7158f..f9a5d6580d0a71 100644 --- a/React/CoreModules/RCTAlertController.h +++ b/React/CoreModules/RCTAlertController.h @@ -5,17 +5,17 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] -#if TARGET_OS_OSX // [TODO(macOS GH#774) -@interface RCTAlertController : NSViewController -#else +#if !TARGET_OS_OSX // [macOS] @interface RCTAlertController : UIAlertController -#endif // ]TODO(macOS GH#774) +#else // [macOS +@interface RCTAlertController : NSViewController +#endif // macOS] -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)show:(BOOL)animated completion:(void (^)(void))completion; - (void)hide; -#endif // ]TODO(macOS GH#774) +#endif // [macOS] @end diff --git a/React/CoreModules/RCTAlertController.m b/React/CoreModules/RCTAlertController.m index e1438e6623fc4e..eda484dfd69d7e 100644 --- a/React/CoreModules/RCTAlertController.m +++ b/React/CoreModules/RCTAlertController.m @@ -11,15 +11,15 @@ @interface RCTAlertController () -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] @property (nonatomic, strong) UIWindow *alertWindow; -#endif // ]TODO(macOS GH#774) +#endif // [macOS] @end @implementation RCTAlertController -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (UIWindow *)alertWindow { if (_alertWindow == nil) { @@ -32,7 +32,7 @@ - (UIWindow *)alertWindow - (void)show:(BOOL)animated completion:(void (^)(void))completion { - // [TODO(macOS GH#774) + // [macOS // Call self.alertWindow to ensure that it gets populated UIWindow *alertWindow = self.alertWindow; @@ -46,7 +46,7 @@ - (void)show:(BOOL)animated completion:(void (^)(void))completion // When using Scenes, we must present the alert from a view controller associated with a window in the Scene. A fresh window (i.e. _alertWindow) cannot show the alert. [RCTPresentedViewController() presentViewController:self animated:animated completion:completion]; } - // TODO(macOS GH#774)] + // macOS] } - (void)hide @@ -59,6 +59,6 @@ - (void)hide _alertWindow = nil; } -#endif // ]TODO(macOS GH#774) +#endif // [macOS] @end diff --git a/React/CoreModules/RCTAlertManager.h b/React/CoreModules/RCTAlertManager.h index 5219f37d2d86b2..25f63bd6d55cd6 100644 --- a/React/CoreModules/RCTAlertManager.h +++ b/React/CoreModules/RCTAlertManager.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import diff --git a/React/CoreModules/RCTAlertManager.mm b/React/CoreModules/RCTAlertManager.mm index 336e05cece28ae..e1047f69d72054 100644 --- a/React/CoreModules/RCTAlertManager.mm +++ b/React/CoreModules/RCTAlertManager.mm @@ -49,11 +49,11 @@ - (dispatch_queue_t)methodQueue - (void)invalidate { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] for (UIAlertController *alertController in _alertControllers) { [alertController.presentingViewController dismissViewControllerAnimated:YES completion:nil]; } -#else // [TODO(macOS GH#774) +#else // [macOS for (NSAlert *alert in _alertControllers) { if (alert.window.sheetParent) { [alert.window.sheetParent endSheet:alert.window]; @@ -61,7 +61,7 @@ - (void)invalidate [alert.window close]; } } -#endif // ]TODO(macOS GH#774) +#endif // macOS] } /** @@ -87,22 +87,22 @@ - (void)invalidate [RCTConvert NSDictionaryArray:RCTConvertOptionalVecToArray(args.buttons(), ^id(id element) { return element; })]; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] NSString *defaultValue = [RCTConvert NSString:args.defaultValue()]; NSString *cancelButtonKey = [RCTConvert NSString:args.cancelButtonKey()]; NSString *destructiveButtonKey = [RCTConvert NSString:args.destructiveButtonKey()]; UIKeyboardType keyboardType = [RCTConvert UIKeyboardType:args.keyboardType()]; -#else // [TODO(macOS GH#774) +#else // [macOS BOOL critical = args.critical().value_or(NO); BOOL modal = args.modal().value_or(NO); NSArray *defaultInputs = [RCTConvert NSDictionaryArray:RCTConvertOptionalVecToArray(args.defaultInputs(), ^id(id element) { return element; })]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] if (!title && !message) { RCTLogError(@"Must specify either an alert title, or message, or both"); return; } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] if (buttons.count == 0) { if (type == RCTAlertViewStyleDefault) { buttons = @[ @{@"0" : RCTUIKitLocalizedString(@"OK")} ]; @@ -204,7 +204,7 @@ - (void)invalidate dispatch_async(dispatch_get_main_queue(), ^{ [alertController show:YES completion:nil]; }); -#else // [TODO(macOS GH#774) +#else // [macOS NSAlert *alert = [NSAlert new]; if (title.length > 0) { @@ -296,7 +296,7 @@ - (void)invalidate } else { [alert beginSheetModalForWindow:[NSApp keyWindow] completionHandler:callbacksHandlers]; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] } - (std::shared_ptr)getTurboModule: diff --git a/React/CoreModules/RCTAppState.mm b/React/CoreModules/RCTAppState.mm index 736b3f7088fe99..1a23d2860da9e9 100644 --- a/React/CoreModules/RCTAppState.mm +++ b/React/CoreModules/RCTAppState.mm @@ -7,7 +7,7 @@ #import "RCTAppState.h" -#import // TODO(macOS GH#774) +#import // [macOS] #import #import #import @@ -18,7 +18,7 @@ static NSString *RCTCurrentAppState() { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] static NSDictionary *states; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ @@ -28,7 +28,7 @@ return @"extension"; } return states[@(RCTSharedApplication().applicationState)] ?: @"unknown"; -#else // [TODO(macOS GH#774) +#else // [macOS if (RCTSharedApplication().isActive) { return @"active"; @@ -37,7 +37,7 @@ } return @"unknown"; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } @@ -99,12 +99,12 @@ - (void)startObserving object:nil]; } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleMemoryWarning) name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; -#endif // TODO(macOS GH#774) +#endif // [macOS] } - (void)stopObserving diff --git a/React/CoreModules/RCTAppearance.h b/React/CoreModules/RCTAppearance.h index 6af37d84412701..94441ffe24e5c4 100644 --- a/React/CoreModules/RCTAppearance.h +++ b/React/CoreModules/RCTAppearance.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import @@ -13,11 +13,11 @@ RCT_EXTERN void RCTEnableAppearancePreference(BOOL enabled); RCT_EXTERN void RCTOverrideAppearancePreference(NSString *const); RCT_EXTERN NSString *RCTCurrentOverrideAppearancePreference(); -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCT_EXTERN NSString *RCTColorSchemePreference(UITraitCollection *traitCollection); -#else // [TODO(macOS GH#774) +#else // [macOS RCT_EXTERN NSString *RCTColorSchemePreference(NSAppearance *appearance); -#endif // ]TODO(macOS GH#774) +#endif // macOS] @interface RCTAppearance : RCTEventEmitter @end diff --git a/React/CoreModules/RCTAppearance.mm b/React/CoreModules/RCTAppearance.mm index bac91467a8e885..49bafd581163ad 100644 --- a/React/CoreModules/RCTAppearance.mm +++ b/React/CoreModules/RCTAppearance.mm @@ -35,7 +35,7 @@ void RCTOverrideAppearancePreference(NSString *const colorSchemeOverride) return sColorSchemeOverride; } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] NSString *RCTColorSchemePreference(UITraitCollection *traitCollection) { #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \ @@ -68,7 +68,7 @@ void RCTOverrideAppearancePreference(NSString *const colorSchemeOverride) // Default to light on older OS version - same behavior as Android. return RCTAppearanceColorSchemeLight; } -#else // [TODO(macOS GH#774) +#else // [macOS NSString *RCTColorSchemePreference(NSAppearance *appearance) { static NSDictionary *appearances; @@ -91,7 +91,7 @@ void RCTOverrideAppearancePreference(NSString *const colorSchemeOverride) NSAppearanceName appearanceName = [appearance bestMatchFromAppearancesWithNames:@[NSAppearanceNameAqua, NSAppearanceNameDarkAqua]]; return appearances[appearanceName] ?: RCTAppearanceColorSchemeLight; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] @interface RCTAppearance () @end @@ -117,7 +117,7 @@ - (dispatch_queue_t)methodQueue return std::make_shared(params); } -#if TARGET_OS_OSX // [TODO(macOS GH#774): on macOS don't lazy init _currentColorScheme because [NSApp effectiveAppearance] cannot be executed on background thread. +#if TARGET_OS_OSX // [macOS on macOS don't lazy init _currentColorScheme because [NSApp effectiveAppearance] cannot be executed on background thread. - (instancetype)init { if (self = [super init]) { @@ -125,19 +125,19 @@ - (instancetype)init } return self; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSString *, getColorScheme) { -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] if (_currentColorScheme == nil) { _currentColorScheme = RCTColorSchemePreference(nil); } -#endif // ]TODO(macOS GH#774) +#endif // [macOS] return _currentColorScheme; } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)appearanceChanged:(NSNotification *)notification { NSDictionary *userInfo = [notification userInfo]; @@ -146,7 +146,7 @@ - (void)appearanceChanged:(NSNotification *)notification traitCollection = userInfo[RCTUserInterfaceStyleDidChangeNotificationTraitCollectionKey]; } NSString *newColorScheme = RCTColorSchemePreference(traitCollection); -#else // [TODO(macOS GH#774) +#else // [macOS - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change @@ -157,7 +157,7 @@ - (void)observeValueForKeyPath:(NSString *)keyPath return; } NSString *newColorScheme = RCTColorSchemePreference(nil); -#endif // ]TODO(macOS GH#774) +#endif // macOS] if (![_currentColorScheme isEqualToString:newColorScheme]) { _currentColorScheme = newColorScheme; [self sendEventWithName:@"appearanceChanged" body:@{@"colorScheme" : newColorScheme}]; @@ -173,30 +173,30 @@ - (void)observeValueForKeyPath:(NSString *)keyPath - (void)startObserving { -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] if (@available(iOS 13.0, *)) { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appearanceChanged:) name:RCTUserInterfaceStyleDidChangeNotification object:nil]; } -#else +#else // [macOS [NSApp addObserver:self forKeyPath:@"effectiveAppearance" options:NSKeyValueObservingOptionNew context:nil]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } - (void)stopObserving { -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] if (@available(iOS 13.0, *)) { [[NSNotificationCenter defaultCenter] removeObserver:self]; } -#else +#else // [macOS [NSApp removeObserver:self forKeyPath:@"effectiveAppearance" context:nil]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } @end diff --git a/React/CoreModules/RCTAsyncLocalStorage.mm b/React/CoreModules/RCTAsyncLocalStorage.mm index c2734cde63310c..3619559c504418 100644 --- a/React/CoreModules/RCTAsyncLocalStorage.mm +++ b/React/CoreModules/RCTAsyncLocalStorage.mm @@ -76,12 +76,12 @@ static void RCTAppendError(NSDictionary *error, NSMutableArray * static NSString *storageDirectory = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] // iOS to use Caches folder. // Don't use NSDocumentsDirectory otherwise the RCTAsyncLocalStorage_V1 will appear in apps that // expose the User's Documents folder such as Microsoft Office apps. storageDirectory = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES).firstObject; -#else // [TODO(macOS GH#774) +#else // [macOS // Apps on macos may not be sandboxed and using NSDocumentsDirectory with NSSearchPathForDirectoriesInDomains // will return the User's Document folder which is not what we want. Instead, we will query NSFileManager for // NSApplicationSupportDirectory which returns the correct URL path based on whether the app is sandboxed or not @@ -98,8 +98,7 @@ static void RCTAppendError(NSDictionary *error, NSMutableArray * } else { RCTLogError(@"Unable to access storage directory for RCTAsyncLocalStorage. %@", [error description]); } -// ]TODO(macOS GH#774) -#endif +#endif // macOS] storageDirectory = [storageDirectory stringByAppendingPathComponent:RCTStorageDirectory]; }); return storageDirectory; @@ -162,7 +161,7 @@ static dispatch_queue_t RCTGetMethodQueue() dispatch_once(&onceToken, ^{ cache = [NSCache new]; cache.totalCostLimit = 2 * 1024 * 1024; // 2MB -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS // Clear cache in the event of a memory warning [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidReceiveMemoryWarningNotification object:nil @@ -170,7 +169,7 @@ static dispatch_queue_t RCTGetMethodQueue() usingBlock:^(__unused NSNotification *note) { [cache removeAllObjects]; }]; -#endif // TODO(macOS GH#774) +#endif // macOS] }); return cache; } diff --git a/React/CoreModules/RCTClipboard.mm b/React/CoreModules/RCTClipboard.mm index 32c543fb028d17..dab2dffe39b571 100644 --- a/React/CoreModules/RCTClipboard.mm +++ b/React/CoreModules/RCTClipboard.mm @@ -8,7 +8,7 @@ #import "RCTClipboard.h" #import -#import // TODO(macOS GH#774) +#import // [macOS] #import "CoreModulesPlugins.h" @@ -28,25 +28,25 @@ - (dispatch_queue_t)methodQueue RCT_EXPORT_METHOD(setString : (NSString *)content) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UIPasteboard *clipboard = [UIPasteboard generalPasteboard]; clipboard.string = (content ?: @""); -#else // [TODO(macOS GH#774) +#else // [macOS NSPasteboard *pasteboard = [NSPasteboard generalPasteboard]; [pasteboard clearContents]; [pasteboard setString:(content ? : @"") forType:NSPasteboardTypeString]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } RCT_EXPORT_METHOD(getString : (RCTPromiseResolveBlock)resolve reject : (__unused RCTPromiseRejectBlock)reject) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UIPasteboard *clipboard = [UIPasteboard generalPasteboard]; resolve((clipboard.string ?: @"")); -#else // [TODO(macOS GH#774) +#else // [macOS NSPasteboard *pasteboard = [NSPasteboard generalPasteboard]; resolve(([pasteboard stringForType:NSPasteboardTypeString] ? : @"")); -#endif // ]TODO(macOS GH#774) +#endif // macOS] } - (std::shared_ptr)getTurboModule:(const ObjCTurboModule::InitParams &)params diff --git a/React/CoreModules/RCTDevLoadingView.h b/React/CoreModules/RCTDevLoadingView.h index c9ef64fea39434..b519734135cc95 100644 --- a/React/CoreModules/RCTDevLoadingView.h +++ b/React/CoreModules/RCTDevLoadingView.h @@ -7,7 +7,7 @@ #import #import -// TODO(OSS Candidate ISS#2710739) +// [macOS] // Remove #import @interface RCTDevLoadingView : NSObject diff --git a/React/CoreModules/RCTDevLoadingView.mm b/React/CoreModules/RCTDevLoadingView.mm index d722c125d395f9..bff0533d21ba2f 100644 --- a/React/CoreModules/RCTDevLoadingView.mm +++ b/React/CoreModules/RCTDevLoadingView.mm @@ -14,10 +14,10 @@ #import #import #import -#import // TODO(OSS Candidate ISS#2710739) +#import // [macOS] #import #import -#import // TODO(macOS GH#774) +#import // [macOS] #import "CoreModulesPlugins.h" @@ -29,13 +29,13 @@ @interface RCTDevLoadingView () #if RCT_DEV | RCT_ENABLE_LOADING_VIEW @implementation RCTDevLoadingView { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UIWindow *_window; UILabel *_label; -#else // [TODO(macOS GH#774) +#else // [macOS NSWindow *_window; NSTextField *_label; -#endif // ]TODO(macOS GH#774) +#endif // macOS] NSDate *_showDate; BOOL _hiding; dispatch_block_t _initialMessageBlock; @@ -91,7 +91,7 @@ - (void)showInitialMessageDelayed:(void (^)())initialMessage dispatch_time(DISPATCH_TIME_NOW, 0.2 * NSEC_PER_SEC), dispatch_get_main_queue(), self->_initialMessageBlock); } -#if 0 // TODO(macOS GH#774) +#if 0 // [macOS // Blocked out because -[(NS|UI)Color getHue:saturation:brightness:alpha:] has // different return values on macOS and iOS. // The call to dimColor: was removed with f0dfd35108dd3f092d46b65e77560c35477bf6ba, @@ -104,7 +104,7 @@ - (RCTUIColor *)dimColor:(RCTUIColor *)c return [RCTUIColor colorWithHue:h saturation:s brightness:b < 0.5 ? b * 1.25 : b * 0.75 alpha:a]; return nil; } -#endif // TODO(macOS GH#774) +#endif // macOS] - (NSString *)getTextForHost { @@ -116,7 +116,7 @@ - (NSString *)getTextForHost return [NSString stringWithFormat:@"%@:%@", bundleURL.host, bundleURL.port]; } -- (void)showMessage:(NSString *)message color:(RCTUIColor *)color backgroundColor:(RCTUIColor *)backgroundColor // TODO(OSS Candidate ISS#2710739) +- (void)showMessage:(NSString *)message color:(RCTUIColor *)color backgroundColor:(RCTUIColor *)backgroundColor // [macOS] { if (!RCTDevLoadingViewGetEnabled() || self->_hiding) { return; @@ -125,7 +125,7 @@ - (void)showMessage:(NSString *)message color:(RCTUIColor *)color backgroundColo dispatch_async(dispatch_get_main_queue(), ^{ self->_showDate = [NSDate date]; if (!self->_window && !RCTRunningInTestEnvironment()) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] CGSize screenSize = [UIScreen mainScreen].bounds.size; UIWindow *window = RCTSharedApplication().keyWindow; @@ -141,7 +141,7 @@ - (void)showMessage:(NSString *)message color:(RCTUIColor *)color backgroundColo self->_label.font = [UIFont monospacedDigitSystemFontOfSize:12.0 weight:UIFontWeightRegular]; self->_label.textAlignment = NSTextAlignmentCenter; -#elif TARGET_OS_OSX // [TODO(macOS GH#774) +#else // [macOS NSRect screenFrame = [NSScreen mainScreen].visibleFrame; self->_window = [[NSPanel alloc] initWithContentRect:NSMakeRect(screenFrame.origin.x + round((screenFrame.size.width - 375) / 2), screenFrame.size.height - 20, 375, 19) styleMask:NSWindowStyleMaskBorderless @@ -159,21 +159,21 @@ - (void)showMessage:(NSString *)message color:(RCTUIColor *)color backgroundColo label.layer.cornerRadius = label.frame.size.height / 3; self->_label = label; [[self->_window contentView] addSubview:label]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] self->_label.text = message; self->_label.textColor = color; self->_window.backgroundColor = backgroundColor; self->_window.hidden = NO; -#else // [TODO(macOS GH#774) +#else // [macOS self->_label.stringValue = message; self->_label.textColor = color; self->_label.backgroundColor = backgroundColor; [self->_window orderFront:nil]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \ __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0 @@ -207,7 +207,7 @@ - (void)showMessage:(NSString *)message color:(RCTUIColor *)color backgroundColo const NSTimeInterval MIN_PRESENTED_TIME = 0.6; NSTimeInterval presentedTime = [[NSDate date] timeIntervalSinceDate:self->_showDate]; NSTimeInterval delay = MAX(0, MIN_PRESENTED_TIME - presentedTime); -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] CGRect windowFrame = self->_window.frame; [UIView animateWithDuration:0.25 delay:delay @@ -221,7 +221,7 @@ - (void)showMessage:(NSString *)message color:(RCTUIColor *)color backgroundColo self->_window = nil; self->_hiding = false; }]; -#elif TARGET_OS_OSX // [TODO(macOS GH#774) +#else // [macOS] dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delay * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [NSAnimationContext runAnimationGroup:^(__unused NSAnimationContext *context) { self->_window.animator.alphaValue = 0.0; @@ -230,7 +230,7 @@ - (void)showMessage:(NSString *)message color:(RCTUIColor *)color backgroundColo self->_window = nil; }]; }); -#endif // ]TODO(macOS GH#774) +#endif // macOS] }); } @@ -240,20 +240,20 @@ - (void)showProgressMessage:(NSString *)message // This is an optimization. Since the progress can come in quickly, // we want to do the minimum amount of work to update the UI, // which is to only update the label text. -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] self->_label.text = message; -#else // [TODO(macOS GH#774) +#else // [macOS self->_label.stringValue = message; -#endif // ]TODO(macOS GH#774) +#endif // macOS] return; } - RCTUIColor *color = [RCTUIColor whiteColor]; // TODO(macOS GH#774) - RCTUIColor *backgroundColor = [RCTUIColor colorWithHue:105 saturation:0 brightness:.25 alpha:1]; // TODO(macOS GH#774) + RCTUIColor *color = [RCTUIColor whiteColor]; // [macOS] + RCTUIColor *backgroundColor = [RCTUIColor colorWithHue:105 saturation:0 brightness:.25 alpha:1]; // [macOS] if ([self isDarkModeEnabled]) { - color = [RCTUIColor colorWithHue:208 saturation:0.03 brightness:.14 alpha:1]; // TODO(macOS GH#774) - backgroundColor = [RCTUIColor colorWithHue:0 saturation:0 brightness:0.98 alpha:1]; // TODO(macOS GH#774) + color = [RCTUIColor colorWithHue:208 saturation:0.03 brightness:.14 alpha:1]; // [macOS] + backgroundColor = [RCTUIColor colorWithHue:0 saturation:0 brightness:0.98 alpha:1]; // [macOS] } [self showMessage:message color:color backgroundColor:backgroundColor]; @@ -261,21 +261,21 @@ - (void)showProgressMessage:(NSString *)message - (void)showOfflineMessage { - // [TODO(macOS GH#774) - isDarkModeEnabled should only be run on the main thread + // [macOS isDarkModeEnabled should only be run on the main thread __weak __typeof(self) weakSelf = self; RCTExecuteOnMainQueue(^{ - RCTUIColor *color = [RCTUIColor whiteColor]; // TODO(macOS GH#774) - RCTUIColor *backgroundColor = [RCTUIColor blackColor]; // TODO(macOS GH#774) + RCTUIColor *color = [RCTUIColor whiteColor]; // [macOS] + RCTUIColor *backgroundColor = [RCTUIColor blackColor]; // [macOS] if ([weakSelf isDarkModeEnabled]) { - color = [RCTUIColor blackColor]; // TODO(macOS GH#774) - backgroundColor = [RCTUIColor whiteColor]; // TODO(macOS GH#774) + color = [RCTUIColor blackColor]; // [macOS] + backgroundColor = [RCTUIColor whiteColor]; // [macOS] } NSString *message = [NSString stringWithFormat:@"Connect to %@ to develop JavaScript.", RCT_PACKAGER_NAME]; [weakSelf showMessage:message color:color backgroundColor:backgroundColor]; }); - // ]TODO(macOS GH#774) + // macOS] } - (BOOL)isDarkModeEnabled @@ -334,7 +334,7 @@ + (NSString *)moduleName + (void)setEnabled:(BOOL)enabled { } -- (void)showMessage:(NSString *)message color:(RCTUIColor *)color backgroundColor:(RCTUIColor *)backgroundColor // TODO(macOS GH#774) RCTUIColor +- (void)showMessage:(NSString *)message color:(RCTUIColor *)color backgroundColor:(RCTUIColor *)backgroundColor // [macOS] RCTUIColor { } - (void)showMessage:(NSString *)message withColor:(NSNumber *)color withBackgroundColor:(NSNumber *)backgroundColor diff --git a/React/CoreModules/RCTDevMenu.h b/React/CoreModules/RCTDevMenu.h index 4ee61c8884d553..d4f1306ffe1f2a 100644 --- a/React/CoreModules/RCTDevMenu.h +++ b/React/CoreModules/RCTDevMenu.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import @@ -70,12 +70,12 @@ RCT_EXTERN NSString *const RCTShowDevMenuNotification; */ - (void)addItem:(RCTDevMenuItem *)item; -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS /** * Creates the NSMenu for macOS. */ - (NSMenu *)menu; -#endif // ]TODO(macOS GH#774) +#endif // macOS] @end diff --git a/React/CoreModules/RCTDevMenu.mm b/React/CoreModules/RCTDevMenu.mm index 351f0128b9d940..0ebf1e4a116476 100644 --- a/React/CoreModules/RCTDevMenu.mm +++ b/React/CoreModules/RCTDevMenu.mm @@ -12,9 +12,9 @@ #import #import #import -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] #import -#endif // TODO(macOS GH#774) +#endif // [macOS] #import #import #import @@ -27,18 +27,18 @@ NSString *const RCTShowDevMenuNotification = @"RCTShowDevMenuNotification"; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] -// [TODO(OSS Candidate ISS#2710739) +// [macOS typedef void (*MotionEndedWithEventImpType)(id self, SEL selector, UIEventSubtype motion, UIEvent *event); static MotionEndedWithEventImpType RCTOriginalUIWindowMotionEndedWithEventImp = nil; -// ]TODO(OSS Candidate ISS#2710739) +// macOS] @implementation UIWindow (RCTDevMenu) - (void)RCT_motionEnded:(__unused UIEventSubtype)motion withEvent:(UIEvent *)event { - RCTOriginalUIWindowMotionEndedWithEventImp(self, @selector(motionEnded:withEvent:), motion, event); // TODO(OSS Candidate ISS#2710739) + RCTOriginalUIWindowMotionEndedWithEventImp(self, @selector(motionEnded:withEvent:), motion, event); // [macOS] if (event.subtype == UIEventSubtypeMotionShake) { [[NSNotificationCenter defaultCenter] postNotificationName:RCTShowDevMenuNotification object:nil]; } @@ -46,7 +46,7 @@ - (void)RCT_motionEnded:(__unused UIEventSubtype)motion withEvent:(UIEvent *)eve @end -#endif // TODO(macOS GH#774) +#endif // [macOS] @implementation RCTDevMenuItem { RCTDevMenuItemTitleBlock _titleBlock; @@ -95,20 +95,20 @@ - (NSString *)title @end -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] typedef void (^RCTDevMenuAlertActionHandler)(UIAlertAction *action); -#endif // TODO(macOS GH#774) +#endif // [macOS] @interface RCTDevMenu () @end @implementation RCTDevMenu { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UIAlertController *_actionSheet; -#endif // TODO(macOS GH#774) +#endif // [macOS] NSMutableArray *_extraMenuItems; } @@ -121,10 +121,10 @@ @implementation RCTDevMenu { + (void)initialize { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] // We're swizzling here because it's poor form to override methods in a category, - RCTOriginalUIWindowMotionEndedWithEventImp = (MotionEndedWithEventImpType) RCTSwapInstanceMethods([UIWindow class], @selector(motionEnded:withEvent:), @selector(RCT_motionEnded:withEvent:)); // TODO(OSS Candidate ISS#2710739) -#endif // TODO(macOS GH#774) + RCTOriginalUIWindowMotionEndedWithEventImp = (MotionEndedWithEventImpType) RCTSwapInstanceMethods([UIWindow class], @selector(motionEnded:withEvent:), @selector(RCT_motionEnded:withEvent:)); // [macOS] +#endif // [macOS] } + (BOOL)requiresMainQueueSetup @@ -180,11 +180,11 @@ - (dispatch_queue_t)methodQueue - (void)invalidate { _presentedItems = nil; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [_actionSheet dismissViewControllerAnimated:YES completion:^(void){ }]; -#endif // TODO(macOS GH#774) +#endif // [macOS] } - (void)showOnShake @@ -200,7 +200,7 @@ - (void)showOnShake } } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)toggle { if (_actionSheet) { @@ -217,7 +217,7 @@ - (BOOL)isActionSheetShown { return _actionSheet != nil; } -#endif // TODO(macOS GH#774) +#endif // [macOS] - (void)addItem:(NSString *)title handler:(void (^)(void))handler { @@ -299,7 +299,7 @@ - (void)setDefaultJSBundle NSString *message = RCTTurboModuleEnabled() ? @"Debugging with Chrome is not supported when TurboModules are enabled." : @"Include the RCTWebSocket library to enable JavaScript debugging."; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Debugger Unavailable" message:message @@ -316,14 +316,14 @@ - (void)setDefaultJSBundle [RCTPresentedViewController() presentViewController:alertController animated:YES completion:NULL]; -#else // [TODO(macOS GH#774) +#else // [macOS NSAlert *alert = [NSAlert new]; [alert setMessageText:@"Debugger Unavailable"]; [alert setInformativeText:message]; [alert addButtonWithTitle:@"OK"]; [alert setAlertStyle:NSAlertStyleWarning]; [alert beginSheetModalForWindow:[NSApp keyWindow] completionHandler:nil]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] }]]; } } @@ -353,7 +353,7 @@ - (void)setDefaultJSBundle return @"Configure Bundler"; } handler:^{ -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Configure Bundler" message:@"Provide a custom bundler address, port, and entrypoint." @@ -410,14 +410,14 @@ - (void)setDefaultJSBundle return; }]]; [RCTPresentedViewController() presentViewController:alertController animated:YES completion:NULL]; -#else // [TODO(macOS GH#774) +#else // [macOS NSAlert *alert = [NSAlert new]; [alert setMessageText:@"Change packager location"]; [alert setInformativeText:@"Input packager IP, port and entrypoint"]; [alert addButtonWithTitle:@"Use bundled JS"]; [alert setAlertStyle:NSWarningAlertStyle]; [alert beginSheetModalForWindow:[NSApp keyWindow] completionHandler:nil]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] }]]; [items addObjectsFromArray:_extraMenuItems]; @@ -426,7 +426,7 @@ - (void)setDefaultJSBundle RCT_EXPORT_METHOD(show) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] if (_actionSheet || RCTRunningInAppExtension()) { return; } @@ -459,17 +459,28 @@ - (void)setDefaultJSBundle _presentedItems = items; [RCTPresentedViewController() presentViewController:_actionSheet animated:YES completion:nil]; -#else // [TODO(macOS GH#774) +#else // [macOS NSMenu *menu = [self menu]; NSWindow *window = [NSApp keyWindow]; NSEvent *event = [NSEvent mouseEventWithType:NSLeftMouseUp location:CGPointMake(0, 0) modifierFlags:0 timestamp:NSTimeIntervalSince1970 windowNumber:[window windowNumber] context:nil eventNumber:0 clickCount:0 pressure:0.1]; [NSMenu popUpContextMenu:menu withEvent:event forView:[window contentView]]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] [_callableJSModules invokeModule:@"RCTNativeAppEventEmitter" method:@"emit" withArgs:@[ @"RCTDevMenuShown" ]]; } -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] +- (RCTDevMenuAlertActionHandler)alertActionHandlerForDevItem:(RCTDevMenuItem *__nullable)item +{ + return ^(__unused UIAlertAction *action) { + if (item) { + [item callHandler]; + } + + self->_actionSheet = nil; + }; +} +#else // [macOS - (NSMenu *)menu { if ([_bridge.devSettings isSecondaryClickToShowDevMenuEnabled]) { @@ -515,20 +526,7 @@ - (void)setSecondaryClickToShow:(BOOL)secondaryClickToShow { _bridge.devSettings.isSecondaryClickToShowDevMenuEnabled = secondaryClickToShow; } - -#else // ]TODO(macOS GH#774) - -- (RCTDevMenuAlertActionHandler)alertActionHandlerForDevItem:(RCTDevMenuItem *__nullable)item -{ - return ^(__unused UIAlertAction *action) { - if (item) { - [item callHandler]; - } - - self->_actionSheet = nil; - }; -} -#endif // TODO(macOS GH#774) +#endif // macOS] #pragma mark - deprecated methods and properties diff --git a/React/CoreModules/RCTDevSettings.h b/React/CoreModules/RCTDevSettings.h index 6c61cfcbf2c684..638b656c1085f8 100644 --- a/React/CoreModules/RCTDevSettings.h +++ b/React/CoreModules/RCTDevSettings.h @@ -29,12 +29,12 @@ */ - (id)settingForKey:(NSString *)key; -// [TODO(macOS GH#774) +// [macOS /** * Returns all keys that are overridden */ - (NSArray *)overridenKeys; -// ]TODO(macOS GH#774) +// macOS] @end @@ -68,13 +68,13 @@ */ @property (nonatomic, assign) BOOL isShakeToShowDevMenuEnabled; -// [TODO(macOS GH#774) +// [macOS /* * Whether secondary click will show RCTDevMenu. The menu is enabled by default if RCT_DEV=1, but * you may wish to disable it so that you can provide your own contextual menu. */ @property (nonatomic, assign) BOOL isSecondaryClickToShowDevMenuEnabled; -// ]TODO(macOS GH#774) +// macOS] /** * Whether performance profiling is enabled. diff --git a/React/CoreModules/RCTDevSettings.mm b/React/CoreModules/RCTDevSettings.mm index a3570b1b1c2299..7b5ddc055275c8 100644 --- a/React/CoreModules/RCTDevSettings.mm +++ b/React/CoreModules/RCTDevSettings.mm @@ -18,12 +18,12 @@ #import #import #import -#import // TODO(macOS GH#774) +#import // [macOS] #import #import "CoreModulesPlugins.h" -static NSString *const kRCTDevSettingDevModeEnabled = @"devModeEnabled"; // TODO(OSS Candidate ISS#2710739) +static NSString *const kRCTDevSettingDevModeEnabled = @"devModeEnabled"; // [macOS] static NSString *const kRCTDevSettingProfilingEnabled = @"profilingEnabled"; static NSString *const kRCTDevSettingHotLoadingEnabled = @"hotLoadingEnabled"; static NSString *const kRCTDevSettingIsInspectorShown = @"showInspector"; @@ -31,7 +31,7 @@ static NSString *const kRCTDevSettingExecutorOverrideClass = @"executor-override"; static NSString *const kRCTDevSettingShakeToShowDevMenu = @"shakeToShow"; static NSString *const kRCTDevSettingIsPerfMonitorShown = @"RCTPerfMonitorKey"; -static NSString *const kRCTDevSettingSecondClickToShowDevMenu = @"secondClickToShow"; // TODO(macOS GH#774) +static NSString *const kRCTDevSettingSecondClickToShowDevMenu = @"secondClickToShow"; // [macOS] static NSString *const kRCTDevSettingsUserDefaultsKey = @"RCTDevMenu"; @@ -103,12 +103,12 @@ - (id)settingForKey:(NSString *)key return _settings[key]; } -// [TODO(macOS GH#774) +// [macOS - (NSArray *)overridenKeys { return [_settings allKeys]; } -// ]TODO(macOS GH#774) +// macOS] - (void)_reloadWithDefaults:(NSDictionary *)defaultValues { @@ -120,7 +120,7 @@ - (void)_reloadWithDefaults:(NSDictionary *)defaultValues } } - // TODO(macOS GH#774): protect against race conditions where another thread holds a mutext trying to set this at the same time + // [macOS] protect against race conditions where another thread holds a mutext trying to set this at the same time RCTExecuteOnMainQueue(^{ [self->_userDefaults setObject:self->_settings forKey:kRCTDevSettingsUserDefaultsKey]; }); @@ -141,7 +141,7 @@ @interface RCTDevSettings () dataSource; // TODO(OSS Candidate ISS#2710739): protect against race conditions where another thread changes the _dataSource +@property (atomic, readwrite, strong) id dataSource; // [macOS] protect against race conditions where another thread changes the _dataSource @end @@ -156,12 +156,12 @@ - (instancetype)init { // Default behavior is to use NSUserDefaults with shake and hot loading enabled. NSDictionary *defaultValues = @{ -#if DEBUG // [TODO(OSS Candidate ISS#2710739) +#if DEBUG // [macOS kRCTDevSettingDevModeEnabled: @YES, -#endif // ]TODO(OSS Candidate ISS#2710739) +#endif // macOS] kRCTDevSettingShakeToShowDevMenu : @YES, kRCTDevSettingHotLoadingEnabled : @YES, - kRCTDevSettingSecondClickToShowDevMenu: @YES, // TODO(macOS GH#774) + kRCTDevSettingSecondClickToShowDevMenu: @YES, // [macOS] }; RCTDevSettingsUserDefaultsDataSource *dataSource = [[RCTDevSettingsUserDefaultsDataSource alloc] initWithDefaultValues:defaultValues]; @@ -192,7 +192,7 @@ - (instancetype)initWithDataSource:(id)dataSource - (void)initialize { -#if DEBUG && RCT_DEV_SETTINGS_ENABLE_PACKAGER_CONNECTION // TODO(OSS Candidate ISS#2710739) +#if DEBUG && RCT_DEV_SETTINGS_ENABLE_PACKAGER_CONNECTION // [macOS] if (self.bridge) { RCTBridge *__weak weakBridge = self.bridge; _bridgeExecutorOverrideToken = [[RCTPackagerConnection sharedPackagerConnection] @@ -215,7 +215,7 @@ - (void)initialize } #endif -#if RCT_ENABLE_INSPECTOR && !TARGET_OS_UIKITFORMAC && DEBUG // TODO(OSS Candidate ISS#2710739) +#if RCT_ENABLE_INSPECTOR && !TARGET_OS_UIKITFORMAC && DEBUG // [macOS] if (self.bridge) { // We need this dispatch to the main thread because the bridge is not yet // finished with its initialisation. By the time it relinquishes control of @@ -274,12 +274,12 @@ - (void)invalidate - (void)_updateSettingWithValue:(id)value forKey:(NSString *)key { - [[self dataSource] updateSettingWithValue:value forKey:key]; // TODO(OSS Candidate ISS#2710739): protect against race conditions where another thread changes the _dataSource + [[self dataSource] updateSettingWithValue:value forKey:key]; // [macOS] protect against race conditions where another thread changes the _dataSource } - (id)settingForKey:(NSString *)key { - return [[self dataSource] settingForKey:key]; // TODO(OSS Candidate ISS#2710739): protect against race conditions where another thread changes the _dataSource + return [[self dataSource] settingForKey:key]; // [macOS] protect against race conditions where another thread changes the _dataSource } - (BOOL)isDeviceDebuggingAvailable @@ -337,7 +337,7 @@ - (BOOL)isShakeToShowDevMenuEnabled return [[self settingForKey:kRCTDevSettingShakeToShowDevMenu] boolValue]; } -// [TODO(macOS GH#774) +// [macOS RCT_EXPORT_METHOD(setIsSecondaryClickToShowDevMenuEnabled:(BOOL)enabled) { [self _updateSettingWithValue:@(enabled) forKey:kRCTDevSettingSecondClickToShowDevMenu]; @@ -347,7 +347,7 @@ - (BOOL)isSecondaryClickToShowDevMenuEnabled { return [[self settingForKey:kRCTDevSettingSecondClickToShowDevMenu] boolValue]; } -// ]TODO(macOS GH#774) +// macOS] RCT_EXPORT_METHOD(setIsDebuggingRemotely:(BOOL)enabled) { @@ -503,7 +503,7 @@ - (void)setupHMRClientWithBundleURL:(NSURL *)bundleURL if (self.callableJSModules) { [self.callableJSModules invokeModule:@"HMRClient" method:@"setup" - withArgs:@[ kRCTPlatformName, path, host, RCTNullIfNil(port), @(isHotLoadingEnabled), scheme ]]; // TODO(macOS GH#774)- we could perhaps infer the platform from the bundleURL's query parameters, instead of hardcoding + withArgs:@[ kRCTPlatformName, path, host, RCTNullIfNil(port), @(isHotLoadingEnabled), scheme ]]; // [macOS] we could perhaps infer the platform from the bundleURL's query parameters, instead of hardcoding } } } @@ -576,7 +576,7 @@ @interface RCTDevSettings () @implementation RCTDevSettings -RCT_EXPORT_MODULE() // TODO(macOS GH#774) +RCT_EXPORT_MODULE() // [macOS] - (instancetype)initWithDataSource:(id)dataSource { diff --git a/React/CoreModules/RCTDevSplitBundleLoader.h b/React/CoreModules/RCTDevSplitBundleLoader.h index 2a3ffd16662336..77c336e2980a73 100644 --- a/React/CoreModules/RCTDevSplitBundleLoader.h +++ b/React/CoreModules/RCTDevSplitBundleLoader.h @@ -7,7 +7,7 @@ #import #import -#import // TODO(macOS GH#774) +#import // [macOS] @interface RCTDevSplitBundleLoader : NSObject @end diff --git a/React/CoreModules/RCTDeviceInfo.h b/React/CoreModules/RCTDeviceInfo.h index 87e68d5235e6e1..cb1e856e078763 100644 --- a/React/CoreModules/RCTDeviceInfo.h +++ b/React/CoreModules/RCTDeviceInfo.h @@ -7,12 +7,12 @@ #import -#if TARGET_OS_OSX // [TODO(macOS GH#774) - RCTExportedDimensions is needed in RCTRootContentView +#if TARGET_OS_OSX // [macOS RCTExportedDimensions is needed in RCTRootContentView #ifdef __cplusplus extern "C" #endif NSDictionary *RCTExportedDimensions(RCTPlatformView *rootView); -#endif // ]TODO(macOS GH#774) +#endif // macOS] @interface RCTDeviceInfo : NSObject diff --git a/React/CoreModules/RCTDeviceInfo.mm b/React/CoreModules/RCTDeviceInfo.mm index 92a1f0820d2ffe..eb208ae6e6bf54 100644 --- a/React/CoreModules/RCTDeviceInfo.mm +++ b/React/CoreModules/RCTDeviceInfo.mm @@ -13,10 +13,10 @@ #import #import #import -#import // TODO(macOS GH#774) +#import // [macOS] #import #import -#import "UIView+React.h" // TODO(macOS GH#774) +#import "UIView+React.h" // [macOS] #import "CoreModulesPlugins.h" @@ -26,10 +26,10 @@ @interface RCTDeviceInfo () @end @implementation RCTDeviceInfo { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UIInterfaceOrientation _currentInterfaceOrientation; NSDictionary *_currentInterfaceDimensions; -#endif +#endif // [macOS] } @synthesize moduleRegistry = _moduleRegistry; @@ -48,7 +48,7 @@ - (dispatch_queue_t)methodQueue - (void)initialize { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveNewContentSizeMultiplier) name:RCTAccessibilityManagerDidUpdateMultiplierNotification @@ -72,13 +72,13 @@ - (void)initialize selector:@selector(interfaceFrameDidChange) name:RCTUserInterfaceStyleDidChangeNotification object:nil]; -#endif // TODO(macOS GH#774) +#endif // [macOS] } static BOOL RCTIsIPhoneX() { static BOOL isIPhoneX = NO; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ @@ -98,19 +98,19 @@ static BOOL RCTIsIPhoneX() CGSizeEqualToSize(screenSize, iPhone12ProMaxScreenSize); ; }); -#endif // TODO(macOS GH#774) +#endif // [macOS] return isIPhoneX; } -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] static NSDictionary *RCTExportedDimensions(RCTModuleRegistry *moduleRegistry) -#else +#else // [macOS NSDictionary *RCTExportedDimensions(RCTPlatformView *rootView) -#endif // ]TODO(macOS GH#774) +#endif // macOS] { RCTAssertMainQueue(); -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCTDimensions dimensions; if (moduleRegistry) { dimensions = RCTGetDimensions( @@ -118,9 +118,9 @@ static BOOL RCTIsIPhoneX() } else { RCTAssert(false, @"ModuleRegistry must be set to properly init dimensions."); } -#else // [TODO(macOS GH#774) +#else // [macOS RCTDimensions dimensions = RCTGetDimensions(rootView); -#endif // ]TODO(macOS GH#774) +#endif // macOS] __typeof(dimensions.window) window = dimensions.window; NSDictionary *dimsWindow = @{ @@ -150,11 +150,11 @@ static BOOL RCTIsIPhoneX() RCTModuleRegistry *moduleRegistry = _moduleRegistry; RCTUnsafeExecuteOnMainQueueSync(^{ constants = @{ -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] @"Dimensions" : RCTExportedDimensions(moduleRegistry), -#else // [TODO(macOS GH#774) +#else // [macOS @"Dimensions": RCTExportedDimensions(nil), -#endif // ]TODO(macOS GH#774) +#endif // macOS] // Note: // This prop is deprecated and will be removed in a future release. // Please use this only for a quick and temporary solution. @@ -174,16 +174,16 @@ - (void)didReceiveNewContentSizeMultiplier #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" [[moduleRegistry moduleForName:"EventDispatcher"] sendDeviceEventWithName:@"didUpdateDimensions" -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] body:RCTExportedDimensions(moduleRegistry)]; -#else // [TODO(macOS GH#774) +#else // [macOS body:RCTExportedDimensions(nil)]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] #pragma clang diagnostic pop }); } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)interfaceOrientationDidChange { @@ -234,7 +234,7 @@ - (void)_interfaceFrameDidChange _currentInterfaceDimensions = nextInterfaceDimensions; } -#endif // TODO(macOS GH#774) +#endif // [macOS] - (std::shared_ptr)getTurboModule:(const ObjCTurboModule::InitParams &)params { diff --git a/React/CoreModules/RCTFPSGraph.h b/React/CoreModules/RCTFPSGraph.h index ef6ef1284aa198..73c141d53b2ba1 100644 --- a/React/CoreModules/RCTFPSGraph.h +++ b/React/CoreModules/RCTFPSGraph.h @@ -5,19 +5,19 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #if RCT_DEV -@interface RCTFPSGraph : RCTPlatformView // TODO(macOS GH#774) +@interface RCTFPSGraph : RCTPlatformView // [macOS] @property (nonatomic, assign, readonly) NSUInteger FPS; @property (nonatomic, assign, readonly) NSUInteger maxFPS; @property (nonatomic, assign, readonly) NSUInteger minFPS; -- (instancetype)initWithFrame:(CGRect)frame color:(RCTUIColor *)color NS_DESIGNATED_INITIALIZER; // TODO(macOS GH#774) +- (instancetype)initWithFrame:(CGRect)frame color:(RCTUIColor *)color NS_DESIGNATED_INITIALIZER; // [macOS] - (void)onTick:(NSTimeInterval)timestamp; diff --git a/React/CoreModules/RCTFPSGraph.m b/React/CoreModules/RCTFPSGraph.m index 4394a71ffe6b50..cda766abf0c3a2 100644 --- a/React/CoreModules/RCTFPSGraph.m +++ b/React/CoreModules/RCTFPSGraph.m @@ -23,7 +23,7 @@ @implementation RCTFPSGraph { UILabel *_label; CGFloat *_frames; - RCTUIColor *_color; // TODO(macOS GH#774) + RCTUIColor *_color; // [macOS] NSTimeInterval _prevTime; NSUInteger _frameCount; @@ -34,7 +34,7 @@ @implementation RCTFPSGraph { NSUInteger _height; } -- (instancetype)initWithFrame:(CGRect)frame color:(RCTUIColor *)color // TODO(macOS GH#774) +- (instancetype)initWithFrame:(CGRect)frame color:(RCTUIColor *)color // [macOS] { if ((self = [super initWithFrame:frame])) { _frameCount = -1; diff --git a/React/CoreModules/RCTKeyboardObserver.mm b/React/CoreModules/RCTKeyboardObserver.mm index 82e6139317e9d1..8031e9741979ce 100644 --- a/React/CoreModules/RCTKeyboardObserver.mm +++ b/React/CoreModules/RCTKeyboardObserver.mm @@ -23,7 +23,7 @@ @implementation RCTKeyboardObserver - (void)startObserving { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; @@ -37,7 +37,7 @@ - (void)startObserving ADD_KEYBOARD_HANDLER(UIKeyboardDidChangeFrameNotification, keyboardDidChangeFrame); #undef ADD_KEYBOARD_HANDLER -#endif // TODO(macOS GH#774) +#endif // [macOS] } - (NSArray *)supportedEvents @@ -93,7 +93,7 @@ -(void)EVENT : (NSNotification *)notification @"height" : @(rect.size.height), }; } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] static NSString *RCTAnimationNameForCurve(UIViewAnimationCurve curve) { switch (curve) { @@ -109,13 +109,11 @@ -(void)EVENT : (NSNotification *)notification return @"keyboard"; } } -#endif // TODO(macOS GH#774) +#endif // [macOS] static NSDictionary *RCTParseKeyboardNotification(NSNotification *notification) { -#if TARGET_OS_OSX // TODO(macOS GH#774) - return @{}; -#else +#if !TARGET_OS_OSX // [macOS] NSDictionary *userInfo = notification.userInfo; CGRect beginFrame = [userInfo[UIKeyboardFrameBeginUserInfoKey] CGRectValue]; CGRect endFrame = [userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue]; @@ -131,7 +129,9 @@ -(void)EVENT : (NSNotification *)notification @"easing" : RCTAnimationNameForCurve(curve), @"isEventFromThisApp" : isLocalUserInfoKey == 1 ? @YES : @NO, }; -#endif // TODO(macOS GH#774) +#else // [macOS + return @{}; +#endif // macOS] } Class RCTKeyboardObserverCls(void) diff --git a/React/CoreModules/RCTLogBox.h b/React/CoreModules/RCTLogBox.h index 11711661209a88..a02cc5309899cb 100644 --- a/React/CoreModules/RCTLogBox.h +++ b/React/CoreModules/RCTLogBox.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import "RCTLogBoxView.h" @interface RCTLogBox : NSObject diff --git a/React/CoreModules/RCTLogBox.mm b/React/CoreModules/RCTLogBox.mm index d0ddff7f1627d3..01f3cfed06bb34 100644 --- a/React/CoreModules/RCTLogBox.mm +++ b/React/CoreModules/RCTLogBox.mm @@ -55,26 +55,26 @@ - (void)setSurfacePresenter:(id)surfacePresenter } if (strongSelf->_bridgelessSurfacePresenter) { -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] strongSelf->_view = [[RCTLogBoxView alloc] initWithFrame:RCTKeyWindow().frame surfacePresenter:strongSelf->_bridgelessSurfacePresenter]; -#else - strongSelf->_view = [[RCTLogBoxView alloc] initWithSurfacePresenter:strongSelf->_bridgelessSurfacePresenter]; // TODO(macOS GH#774) -#endif // ]TODO(macOS GH#774) +#else // [macOS + strongSelf->_view = [[RCTLogBoxView alloc] initWithSurfacePresenter:strongSelf->_bridgelessSurfacePresenter]; // [macOS] +#endif // macOS] } else if (strongSelf->_bridge && strongSelf->_bridge.valid) { if (strongSelf->_bridge.surfacePresenter) { -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] strongSelf->_view = [[RCTLogBoxView alloc] initWithFrame:RCTKeyWindow().frame surfacePresenter:strongSelf->_bridge.surfacePresenter]; -#else // TODO(macOS GH#774) - strongSelf->_view = [[RCTLogBoxView alloc] initWithSurfacePresenter:strongSelf->_bridge.surfacePresenter]; // TODO(macOS GH#774) -#endif // ]TODO(macOS GH#774) +#else // [macOS + strongSelf->_view = [[RCTLogBoxView alloc] initWithSurfacePresenter:strongSelf->_bridge.surfacePresenter]; // [macOS] +#endif // macOS] } else { -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] strongSelf->_view = [[RCTLogBoxView alloc] initWithWindow:RCTKeyWindow() bridge:strongSelf->_bridge]; -#else // TODO(macOS GH#774) - strongSelf->_view = [[RCTLogBoxView alloc] initWithBridge:self->_bridge]; // TODO(macOS GH#774) -#endif // ]TODO(macOS GH#774) +#else // [macOS + strongSelf->_view = [[RCTLogBoxView alloc] initWithBridge:self->_bridge]; // [macOS] +#endif // macOS] } } diff --git a/React/CoreModules/RCTLogBoxView.h b/React/CoreModules/RCTLogBoxView.h index f1f7c54e7ecef3..d422279e98abee 100644 --- a/React/CoreModules/RCTLogBoxView.h +++ b/React/CoreModules/RCTLogBoxView.h @@ -8,9 +8,9 @@ #import #import #import -#import // TODO(macOS GH#774) +#import // [macOS] -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] @interface RCTLogBoxView : UIWindow @@ -26,9 +26,9 @@ @end -#else // [TODO(macOS GH#774) +#else // [macOS -@interface RCTLogBoxView : NSWindow // TODO(macOS GH#774) +@interface RCTLogBoxView : NSWindow - (instancetype)initWithSurfacePresenter:(id)surfacePresenter; @@ -40,4 +40,4 @@ @end -#endif // ]TODO(macOS GH#774) +#endif // macOS] diff --git a/React/CoreModules/RCTLogBoxView.mm b/React/CoreModules/RCTLogBoxView.mm index 706827c438601d..63db305fe99ba6 100644 --- a/React/CoreModules/RCTLogBoxView.mm +++ b/React/CoreModules/RCTLogBoxView.mm @@ -11,7 +11,7 @@ #import #import -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] @implementation RCTLogBoxView { RCTSurface *_surface; @@ -91,7 +91,7 @@ - (void)show @end -#else // [TODO(macOS GH#774) +#else // [macOS @implementation RCTLogBoxView { RCTSurface *_surface; @@ -139,7 +139,7 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge return self; } -- (void)setHidden:(BOOL)hidden // [TODO(macOS GH#774) +- (void)setHidden:(BOOL)hidden // [macOS { if (hidden) { if (NSApp.modalWindow == self) { @@ -147,7 +147,7 @@ - (void)setHidden:(BOOL)hidden // [TODO(macOS GH#774) } [self orderOut:nil]; } -} // ]TODO(macOS GH#774) +} // macOS] - (void)show { @@ -175,4 +175,4 @@ - (void)_showModal @end -#endif // ]TODO(macOS GH#774) +#endif // macOS] diff --git a/React/CoreModules/RCTPerfMonitor.mm b/React/CoreModules/RCTPerfMonitor.mm index cf15403344f9c2..3a1085f501fb0e 100644 --- a/React/CoreModules/RCTPerfMonitor.mm +++ b/React/CoreModules/RCTPerfMonitor.mm @@ -176,7 +176,7 @@ - (RCTDevMenuItem *)devMenuItem { if (!_devMenuItem) { __weak __typeof__(self) weakSelf = self; - __weak RCTDevSettings *devSettings = [[self bridge] devSettings]; // TODO(macOS GH#774) + __weak RCTDevSettings *devSettings = [[self bridge] devSettings]; // [macOS] if (devSettings.isPerfMonitorShown) { [weakSelf show]; } diff --git a/React/CoreModules/RCTPlatform.mm b/React/CoreModules/RCTPlatform.mm index 543d543fa19d50..b0097265100194 100644 --- a/React/CoreModules/RCTPlatform.mm +++ b/React/CoreModules/RCTPlatform.mm @@ -7,7 +7,7 @@ #import "RCTPlatform.h" -#import // TODO(macOS GH#774) +#import // [macOS] #import #import diff --git a/React/CoreModules/RCTRedBox.h b/React/CoreModules/RCTRedBox.h index ccb4140c760691..7ff209d04c4927 100644 --- a/React/CoreModules/RCTRedBox.h +++ b/React/CoreModules/RCTRedBox.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(OSS Candidate ISS#2710739) +#import // [macOS] #import #import diff --git a/React/CoreModules/RCTRedBox.mm b/React/CoreModules/RCTRedBox.mm index 3162457a639c9b..66502e459c0d5a 100644 --- a/React/CoreModules/RCTRedBox.mm +++ b/React/CoreModules/RCTRedBox.mm @@ -14,9 +14,9 @@ #import #import #import -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] #import -#endif +#endif // [macOS] #import #import #import @@ -29,7 +29,7 @@ @class RCTRedBoxWindow; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] @interface UIButton (RCTRedBox) @property (nonatomic) RCTRedBoxButtonPressHandler rct_handler; @@ -64,7 +64,7 @@ - (void)rct_addBlock:(RCTRedBoxButtonPressHandler)handler forControlEvents:(UICo } @end -#endif // TODO(macOS GH#774) +#endif // [macOS] @protocol RCTRedBoxWindowActionDelegate @@ -74,7 +74,7 @@ - (void)loadExtraDataViewController; @end -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] @interface RCTRedBoxWindow : NSObject @property (nonatomic, strong) UIViewController *rootViewController; @property (nonatomic, weak) id actionDelegate; @@ -436,7 +436,7 @@ - (BOOL)canBecomeFirstResponder } @end -#elif TARGET_OS_OSX // [TODO(macOS GH#774) +#else // [macOS @interface RCTRedBoxScrollView : NSScrollView @end @@ -782,23 +782,23 @@ - (NSAttributedString *)attributedStringForRow:(NSUInteger)row @end -#endif // ]TODO(macOS GH#774) +#endif // macOS] @interface RCTRedBox () < RCTInvalidating, RCTRedBoxWindowActionDelegate, -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCTRedBoxExtraDataActionDelegate, -#endif +#endif // [macOS] NativeRedBoxSpec> @end @implementation RCTRedBox { RCTRedBoxWindow *_window; NSMutableArray> *_errorCustomizers; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCTRedBoxExtraDataViewController *_extraDataViewController; -#endif +#endif // [macOS] NSMutableArray *_customButtonTitles; NSMutableArray *_customButtonHandlers; } @@ -934,12 +934,12 @@ - (void)showErrorMessage:(NSString *)message errorCookie:(int)errorCookie { dispatch_async(dispatch_get_main_queue(), ^{ -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] if (self->_extraDataViewController == nil) { self->_extraDataViewController = [RCTRedBoxExtraDataViewController new]; self->_extraDataViewController.actionDelegate = self; } -#endif // TODO(macOS GH#774) +#endif // [macOS] #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" @@ -948,13 +948,13 @@ - (void)showErrorMessage:(NSString *)message #pragma clang diagnostic pop if (!self->_window) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] self->_window = [[RCTRedBoxWindow alloc] initWithFrame:[UIScreen mainScreen].bounds customButtonTitles:self->_customButtonTitles customButtonHandlers:self->_customButtonHandlers]; -#else // [TODO(macOS GH#774) +#else // [macOS self->_window = [RCTRedBoxWindow new]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] self->_window.actionDelegate = self; } @@ -968,7 +968,7 @@ - (void)showErrorMessage:(NSString *)message } - (void)loadExtraDataViewController { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] dispatch_async(dispatch_get_main_queue(), ^{ // Make sure the CMD+E shortcut doesn't call this twice if (self->_extraDataViewController != nil && ![self->_window.rootViewController presentedViewController]) { @@ -977,25 +977,25 @@ - (void)loadExtraDataViewController { completion:nil]; } }); -#endif +#endif // [macOS] } RCT_EXPORT_METHOD(setExtraData:(NSDictionary *)extraData forIdentifier:(NSString *)identifier) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [_extraDataViewController addExtraData:extraData forIdentifier:identifier]; -#endif +#endif // [macOS] } RCT_EXPORT_METHOD(dismiss) { -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS [self->_window performSelectorOnMainThread:@selector(dismiss) withObject:nil waitUntilDone:NO]; -#else // ]TODO(macOS GH#774) +#else // [macOS dispatch_async(dispatch_get_main_queue(), ^{ [self->_window dismiss]; - self->_window = nil; // TODO(OSS Candidate ISS#2710739): release _window now to ensure its UIKit ivars are dealloc'd on the main thread as the RCTRedBox can be dealloc'd on a background thread. + self->_window = nil; // [macOS] release _window now to ensure its UIKit ivars are dealloc'd on the main thread as the RCTRedBox can be dealloc'd on a background thread. }); -#endif // TODO(macOS GH#774) +#endif // macOS] } - (void)invalidate diff --git a/React/CoreModules/RCTStatusBarManager.h b/React/CoreModules/RCTStatusBarManager.h index c2b0f75d3c3c94..0f20f4da8a95e3 100644 --- a/React/CoreModules/RCTStatusBarManager.h +++ b/React/CoreModules/RCTStatusBarManager.h @@ -5,17 +5,17 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import @interface RCTConvert (UIStatusBar) -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] + (UIStatusBarStyle)UIStatusBarStyle:(id)json; + (UIStatusBarAnimation)UIStatusBarAnimation:(id)json; -#endif // TODO(macOS GH#774) +#endif // [macOS] @end diff --git a/React/CoreModules/RCTStatusBarManager.mm b/React/CoreModules/RCTStatusBarManager.mm index 2f48422c39d92e..54262f894f24e8 100644 --- a/React/CoreModules/RCTStatusBarManager.mm +++ b/React/CoreModules/RCTStatusBarManager.mm @@ -12,7 +12,7 @@ #import #import -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] #import @implementation RCTConvert (UIStatusBar) @@ -62,7 +62,7 @@ + (UIStatusBarStyle)UIStatusBarStyle:(id)json RCT_DYNAMIC @interface RCTStatusBarManager () @end -#endif // TODO(macOS GH#774) +#endif // [macOS] @implementation RCTStatusBarManager @@ -91,7 +91,7 @@ + (BOOL)requiresMainQueueSetup return @[ @"statusBarFrameDidChange", @"statusBarFrameWillChange" ]; } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)startObserving { @@ -204,7 +204,7 @@ - (void)applicationWillChangeStatusBarFrame:(NSNotification *)notification return std::make_shared(params); } -#endif // TODO(macOS GH#774) +#endif // [macOS] @end diff --git a/React/CoreModules/RCTTiming.mm b/React/CoreModules/RCTTiming.mm index af1d962b369e4e..8200311a9f6c5a 100644 --- a/React/CoreModules/RCTTiming.mm +++ b/React/CoreModules/RCTTiming.mm @@ -129,7 +129,7 @@ - (void)setup _timers = [NSMutableDictionary new]; _inBackground = NO; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] for (NSString *name in @[ UIApplicationWillResignActiveNotification, UIApplicationDidEnterBackgroundNotification, @@ -147,7 +147,7 @@ - (void)setup name:name object:nil]; } -#endif // TODO(macOS GH#774) +#endif // [macOS] } - (void)dealloc diff --git a/React/CoreModules/RCTWebSocketModule.mm b/React/CoreModules/RCTWebSocketModule.mm index 4aa7c60875b553..509e56bb1437b1 100644 --- a/React/CoreModules/RCTWebSocketModule.mm +++ b/React/CoreModules/RCTWebSocketModule.mm @@ -68,8 +68,8 @@ - (void)invalidate : (JS::NativeWebSocketModule::SpecConnectOptions &)options socketID : (double)socketID) { - RCTAssertParam(URL); // TODO: GH#774, prevent crashes when URL is erroneously nil - if (URL != nil) { // TODO: GH#774, prevent crashes when URL is erroneously nil + RCTAssertParam(URL); // [macOS] prevent crashes when URL is erroneously nil + if (URL != nil) { // [macOS] prevent crashes when URL is erroneously nil NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:URL]; // We load cookies from sharedHTTPCookieStorage (shared with XHR and @@ -101,7 +101,7 @@ - (void)invalidate } _sockets[@(socketID)] = webSocket; [webSocket open]; - } // TODO: GH#774, prevent crashes when URL is erroneously nil + } // [macOS] prevent crashes when URL is erroneously nil } RCT_EXPORT_METHOD(send : (NSString *)message forSocketID : (double)socketID) diff --git a/React/CoreModules/React-CoreModules.podspec b/React/CoreModules/React-CoreModules.podspec index 48b059e44941a8..3a5ef0e623c01f 100644 --- a/React/CoreModules/React-CoreModules.podspec +++ b/React/CoreModules/React-CoreModules.podspec @@ -26,14 +26,14 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "11.0", :osx => "10.15" } # TODO(macOS GH#774) + s.platforms = { :ios => "11.0", :osx => "10.15" } # [macOS] s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness' s.source = source s.source_files = "**/*.{c,m,mm,cpp}" - # [TODO(macOS GH#774) + # [macOS "**/MacOS/*" s.osx.exclude_files = "{RCTFPSGraph,RCTPerfMonitor,RCTPlatform}.*" - # ]TODO(macOS GH#774) + # macOS] s.header_dir = "CoreModules" s.pod_target_xcconfig = { "USE_HEADERMAP" => "YES", diff --git a/React/CxxBridge/RCTCxxBridge.mm b/React/CxxBridge/RCTCxxBridge.mm index b466b4a0bd1f73..c6337344633dfe 100644 --- a/React/CxxBridge/RCTCxxBridge.mm +++ b/React/CxxBridge/RCTCxxBridge.mm @@ -29,7 +29,7 @@ #import #import #import -#import // TODO(macOS GH#774) +#import // [macOS] #import #import #import @@ -305,12 +305,12 @@ - (void)attachBridgeAPIsToTurboModule:(id)module return _jsMessageThread; } -// [TODO(OSS Candidate ISS#2710739) +// [macOS - (std::weak_ptr)reactInstance { return _reactInstance; } -// ]TODO(OSS Candidate ISS#2710739) +// macOS] - (BOOL)isInspectable { @@ -352,21 +352,21 @@ - (instancetype)initWithParentBridge:(RCTBridge *)bridge [RCTBridge setCurrentBridge:self]; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleMemoryWarning) name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; -#endif // TODO(macOS GH#774) +#endif // [macOS] } return self; } - (void)dealloc { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [[NSNotificationCenter defaultCenter] removeObserver:self]; -#endif // TODO(macOS GH#774) +#endif // [macOS] } + (void)runRunLoop @@ -546,13 +546,13 @@ - (void)start } onProgress:^(RCTLoadingProgress *progressData) { #if (RCT_DEV | RCT_ENABLE_LOADING_VIEW) && __has_include() - // [TODO(OSS Candidate ISS#2710739) + // [macOS // Note: RCTDevLoadingView should have been loaded at this point, so no need to allow lazy loading. if ([weakSelf isValid]) { id loadingView = [weakSelf moduleForName:@"DevLoadingView" lazilyLoadIfNecessary:YES]; [loadingView updateProgress:progressData]; - } // ]TODO(OSS Candidate ISS#2710739) + } // macOS] #endif }]; diff --git a/React/CxxModule/RCTCxxMethod.mm b/React/CxxModule/RCTCxxMethod.mm index 4155b79da5ed7b..929f135d1074a8 100644 --- a/React/CxxModule/RCTCxxMethod.mm +++ b/React/CxxModule/RCTCxxMethod.mm @@ -131,11 +131,11 @@ - (id)invokeWithBridge:(RCTBridge *)bridge module:(id)module arguments:(NSArray } } -#if DEBUG // TODO(macOS GH#774) description is a debug-only feature +#if DEBUG // [macOS description is a debug-only feature - (NSString *)description { return [NSString stringWithFormat:@"<%@: %p; name = %s>", [self class], self, self.JSMethodName]; } -#endif // TODO(macOS GH#774) +#endif // macOS] @end diff --git a/React/DevSupport/RCTDevLoadingViewProtocol.h b/React/DevSupport/RCTDevLoadingViewProtocol.h index a23725e557fb36..976b7ba421f20e 100644 --- a/React/DevSupport/RCTDevLoadingViewProtocol.h +++ b/React/DevSupport/RCTDevLoadingViewProtocol.h @@ -5,13 +5,13 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] @class RCTLoadingProgress; @protocol RCTDevLoadingViewProtocol + (void)setEnabled:(BOOL)enabled; -- (void)showMessage:(NSString *)message color:(RCTUIColor *)color backgroundColor:(RCTUIColor *)backgroundColor; // TODO(OSS Candidate ISS#2710739) +- (void)showMessage:(NSString *)message color:(RCTUIColor *)color backgroundColor:(RCTUIColor *)backgroundColor; // [macOS] - (void)showWithURL:(NSURL *)URL; - (void)updateProgress:(RCTLoadingProgress *)progress; - (void)hide; diff --git a/React/DevSupport/RCTInspectorDevServerHelper.h b/React/DevSupport/RCTInspectorDevServerHelper.h index b2a1d0a577d28c..7caaae68984386 100644 --- a/React/DevSupport/RCTInspectorDevServerHelper.h +++ b/React/DevSupport/RCTInspectorDevServerHelper.h @@ -6,7 +6,7 @@ */ #import -#import // TODO(macOS GH#774) +#import // [macOS] #import #import diff --git a/React/DevSupport/RCTInspectorDevServerHelper.mm b/React/DevSupport/RCTInspectorDevServerHelper.mm index dff10de03efa01..bc903334fc8dd0 100644 --- a/React/DevSupport/RCTInspectorDevServerHelper.mm +++ b/React/DevSupport/RCTInspectorDevServerHelper.mm @@ -10,7 +10,7 @@ #if RCT_DEV #import -#import // TODO(macOS GH#774) +#import // [macOS] #import #import @@ -42,12 +42,12 @@ static NSURL *getInspectorDeviceUrl(NSURL *bundleURL) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] NSString *escapedDeviceName = [[[UIDevice currentDevice] name] stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLQueryAllowedCharacterSet]; -#else // [TODO(macOS GH#774) +#else // [macOS NSString *escapedDeviceName = @""; -#endif // ]TODO(macOS GH#774) +#endif // macOS] NSString *escapedAppName = [[[NSBundle mainBundle] bundleIdentifier] stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLQueryAllowedCharacterSet]; return [NSURL URLWithString:[NSString stringWithFormat:@"http://%@/inspector/device?name=%@&app=%@", @@ -110,21 +110,21 @@ + (RCTInspectorPackagerConnection *)connectWithBundleURL:(NSURL *)bundleURL } NSString *key = [inspectorURL absoluteString]; - // [TODO(macOS GH#774) - safety check to avoid a crash + // [macOS safety check to avoid a crash if (key == nil) { RCTLogError(@"failed to get inspector URL"); return nil; } - // ]TODO(macOS GH#774) + // macOS] RCTInspectorPackagerConnection *connection = socketConnections[key]; if (!connection || !connection.isConnected) { connection = [[RCTInspectorPackagerConnection alloc] initWithURL:inspectorURL]; - // [TODO(macOS GH#774) - safety check to avoid a crash + // [macOS safety check to avoid a crash if (connection == nil) { RCTLogError(@"failed to initialize RCTInspectorPackagerConnection"); return nil; } - // ]TODO(macOS GH#774) + // macOS] socketConnections[key] = connection; [connection connect]; } diff --git a/React/DevSupport/RCTPackagerConnection.mm b/React/DevSupport/RCTPackagerConnection.mm index 892586b00d7689..0685a4e2a94c80 100644 --- a/React/DevSupport/RCTPackagerConnection.mm +++ b/React/DevSupport/RCTPackagerConnection.mm @@ -100,7 +100,7 @@ - (instancetype)init components.scheme = scheme; components.port = serverPort ? @(serverPort.integerValue) : @(kRCTBundleURLProviderDefaultPort); components.path = @"/message"; - components.queryItems = @[ [NSURLQueryItem queryItemWithName:@"role" value:kRCTPlatformName] ]; // TODO(macOS GH#774) + components.queryItems = @[ [NSURLQueryItem queryItemWithName:@"role" value:kRCTPlatformName] ]; // [macOS] static dispatch_queue_t queue; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ diff --git a/React/FBReactNativeSpec/FBReactNativeSpec.podspec b/React/FBReactNativeSpec/FBReactNativeSpec.podspec index 73bc75b02e99b5..fa8d0736209f2e 100644 --- a/React/FBReactNativeSpec/FBReactNativeSpec.podspec +++ b/React/FBReactNativeSpec/FBReactNativeSpec.podspec @@ -30,7 +30,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "11.0", :osx => "10.15" } # TODO(macOS GH#774) + s.platforms = { :ios => "11.0", :osx => "10.15" } # [macOS] s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness' s.source = source # This podspec is used to trigger the codegen, and built files are generated in a different location. diff --git a/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.h b/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.h index 1a2b1b14459027..ee6444ffc6f1ea 100644 --- a/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.h +++ b/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import diff --git a/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.mm index d77e22a8d15b7e..33675569fcd48a 100644 --- a/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.mm @@ -8,7 +8,7 @@ #import "RCTActivityIndicatorViewComponentView.h" #import -#import // TODO(macOS GH#774) +#import // [macOS] #import #import @@ -29,7 +29,7 @@ static UIActivityIndicatorViewStyle convertActivityIndicatorViewStyle(const Acti } @implementation RCTActivityIndicatorViewComponentView { - RCTUIActivityIndicatorView *_activityIndicatorView; // TODO(macOS GH#774) + RCTUIActivityIndicatorView *_activityIndicatorView; // [macOS] } #pragma mark - RCTComponentViewProtocol @@ -45,7 +45,7 @@ - (instancetype)initWithFrame:(CGRect)frame static const auto defaultProps = std::make_shared(); _props = defaultProps; - _activityIndicatorView = [[RCTUIActivityIndicatorView alloc] initWithFrame:self.bounds]; // TODO(macOS GH#774) + _activityIndicatorView = [[RCTUIActivityIndicatorView alloc] initWithFrame:self.bounds]; // [macOS] _activityIndicatorView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; if (defaultProps->animating) { diff --git a/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.h b/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.h index 45c477397bd9e2..37201c3502d19f 100644 --- a/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.h +++ b/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import diff --git a/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.mm b/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.mm index 78d78b4d9731dc..364ea6c26b3773 100644 --- a/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.mm @@ -20,18 +20,18 @@ using namespace facebook::react; -static RCTUIView *_Nullable RCTFindTextInputWithNativeId(RCTUIView *view, NSString *nativeId) // TODO(macOS GH#774) +static RCTUIView *_Nullable RCTFindTextInputWithNativeId(RCTUIView *view, NSString *nativeId) // [macOS] { if ([view respondsToSelector:@selector(inputAccessoryViewID)] && [view respondsToSelector:@selector(setInputAccessoryView:)]) { - RCTUIView *typed = (RCTUIView *)view; // TODO(macOS GH#774) + RCTUIView *typed = (RCTUIView *)view; // [macOS] if (!nativeId || [typed.inputAccessoryViewID isEqualToString:nativeId]) { return typed; } } - for (RCTUIView *subview in view.subviews) { // TODO(macOS GH#774) - RCTUIView *result = RCTFindTextInputWithNativeId(subview, nativeId); // TODO(macOS GH#774) + for (RCTUIView *subview in view.subviews) { // [macOS] + RCTUIView *result = RCTFindTextInputWithNativeId(subview, nativeId); // [macOS] if (result) { return result; } @@ -44,7 +44,7 @@ @implementation RCTInputAccessoryComponentView { InputAccessoryShadowNode::ConcreteState::Shared _state; RCTInputAccessoryContentView *_contentView; RCTSurfaceTouchHandler *_touchHandler; - RCTUIView __weak *_textInput; // TODO(macOS GH#774) + RCTUIView __weak *_textInput; // [macOS] } - (instancetype)initWithFrame:(CGRect)frame @@ -83,7 +83,7 @@ - (BOOL)canBecomeFirstResponder return true; } -- (RCTUIView *)inputAccessoryView // TODO(macOS GH#774) +- (RCTUIView *)inputAccessoryView // [macOS] { return _contentView; } @@ -95,12 +95,12 @@ + (ComponentDescriptorProvider)componentDescriptorProvider return concreteComponentDescriptorProvider(); } -- (void)mountChildComponentView:(RCTUIView *)childComponentView index:(NSInteger)index // TODO(macOS GH#774) +- (void)mountChildComponentView:(RCTUIView *)childComponentView index:(NSInteger)index // [macOS] { [_contentView insertSubview:childComponentView atIndex:index]; } -- (void)unmountChildComponentView:(RCTUIView *)childComponentView index:(NSInteger)index // TODO(macOS GH#774) +- (void)unmountChildComponentView:(RCTUIView *)childComponentView index:(NSInteger)index // [macOS] { [childComponentView removeFromSuperview]; } diff --git a/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryContentView.h b/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryContentView.h index 56d776887957bd..f26111542fbbc6 100644 --- a/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryContentView.h +++ b/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryContentView.h @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] -@interface RCTInputAccessoryContentView : RCTUIView // TODO(macOS GH#774) +@interface RCTInputAccessoryContentView : RCTUIView // [macOS] @end diff --git a/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryContentView.mm b/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryContentView.mm index f24f61be44e84d..9d790fb4c495c7 100644 --- a/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryContentView.mm +++ b/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryContentView.mm @@ -8,7 +8,7 @@ #import "RCTInputAccessoryContentView.h" @implementation RCTInputAccessoryContentView { - RCTUIView *_safeAreaContainer; // TODO(macOS GH#774) + RCTUIView *_safeAreaContainer; // [macOS] NSLayoutConstraint *_heightConstraint; } @@ -17,7 +17,7 @@ - (instancetype)init if (self = [super init]) { self.autoresizingMask = UIViewAutoresizingFlexibleHeight; - _safeAreaContainer = [RCTUIView new]; // TODO(macOS GH#774) + _safeAreaContainer = [RCTUIView new]; // [macOS] _safeAreaContainer.translatesAutoresizingMaskIntoConstraints = NO; [self addSubview:_safeAreaContainer]; @@ -40,7 +40,7 @@ - (CGSize)intrinsicContentSize return CGSizeZero; } -- (void)insertSubview:(RCTUIView *)view atIndex:(NSInteger)index // TODO(macOS GH#774) +- (void)insertSubview:(RCTUIView *)view atIndex:(NSInteger)index // [macOS] { [_safeAreaContainer insertSubview:view atIndex:index]; } diff --git a/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.h b/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.h index ef23fa36221caa..5585dde4dd166e 100644 --- a/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.h +++ b/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import diff --git a/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm b/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm index 3bc381b6cfed05..26fdcf49318622 100644 --- a/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm @@ -22,7 +22,7 @@ @implementation RCTLegacyViewManagerInteropComponentView { NSMutableArray *_viewsToBeMounted; - NSMutableArray *_viewsToBeUnmounted; // TODO(macOS GH#774) + NSMutableArray *_viewsToBeUnmounted; // [macOS] RCTLegacyViewManagerInteropCoordinatorAdapter *_adapter; LegacyViewManagerInteropShadowNode::ConcreteState::Shared _state; BOOL _hasInvokedForwardingWarning; @@ -41,9 +41,9 @@ - (instancetype)initWithFrame:(CGRect)frame return self; } -- (RCTUIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event // TODO(macOS GH#774) +- (RCTUIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event // [macOS] { - RCTUIView *result = [super hitTest:point withEvent:event]; // TODO(macOS GH#774) + RCTUIView *result = [super hitTest:point withEvent:event]; // [macOS] if (result == _adapter.paperView) { return self; @@ -149,7 +149,7 @@ - (void)prepareForRecycle [super prepareForRecycle]; } -- (void)mountChildComponentView:(RCTUIView *)childComponentView index:(NSInteger)index // TODO(macOS GH#774) +- (void)mountChildComponentView:(RCTUIView *)childComponentView index:(NSInteger)index // [macOS] { [_viewsToBeMounted addObject:@{ kRCTLegacyInteropChildIndexKey : [NSNumber numberWithInteger:index], @@ -157,7 +157,7 @@ - (void)mountChildComponentView:(RCTUIView *)childComp }]; } -- (void)unmountChildComponentView:(RCTUIView *)childComponentView index:(NSInteger)index // TODO(macOS GH#774) +- (void)unmountChildComponentView:(RCTUIView *)childComponentView index:(NSInteger)index // [macOS] { if (_adapter) { [_adapter.paperView removeReactSubview:childComponentView]; @@ -208,7 +208,7 @@ - (void)finalizeUpdates:(RNComponentViewUpdateMask)updateMask [_viewsToBeMounted removeAllObjects]; - for (RCTUIView *view in _viewsToBeUnmounted) { // TODO(macOS GH#774) + for (RCTUIView *view in _viewsToBeUnmounted) { // [macOS] [_adapter.paperView removeReactSubview:view]; } diff --git a/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropCoordinatorAdapter.h b/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropCoordinatorAdapter.h index fa5a263e1870cb..ec31ef3d7bc6c9 100644 --- a/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropCoordinatorAdapter.h +++ b/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropCoordinatorAdapter.h @@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)initWithCoordinator:(RCTLegacyViewManagerInteropCoordinator *)coordinator reactTag:(NSInteger)tag; -@property (strong, nonatomic) RCTUIView *paperView; // TODO(macOS GH#774) +@property (strong, nonatomic) RCTUIView *paperView; // [macOS] @property (nonatomic, copy, nullable) void (^eventInterceptor)(std::string eventName, folly::dynamic event); diff --git a/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropCoordinatorAdapter.mm b/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropCoordinatorAdapter.mm index 22d151d9e8b8a1..7ec57d5c1d4537 100644 --- a/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropCoordinatorAdapter.mm +++ b/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropCoordinatorAdapter.mm @@ -28,7 +28,7 @@ - (void)dealloc [_coordinator removeObserveForTag:_tag]; } -- (RCTUIView *)paperView // TODO(macOS GH#774) +- (RCTUIView *)paperView // [macOS] { if (!_paperView) { _paperView = [_coordinator createPaperViewWithTag:_tag]; diff --git a/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.h b/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.h index 4bd66b48a468b4..cf3b82e99f9619 100644 --- a/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.h +++ b/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] @protocol RCTFabricModalHostViewControllerDelegate - (void)boundsDidChange:(CGRect)newBounds; diff --git a/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.h b/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.h index db994d742ad88f..8dc36ee547f5b7 100644 --- a/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.h +++ b/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.h @@ -13,7 +13,7 @@ */ @interface RCTModalHostViewComponentView : RCTViewComponentView -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] /** * Subclasses may override this method and present the modal on different view controller. * Default implementation presents the modal on `[self reactViewController]`. @@ -29,6 +29,6 @@ - (void)dismissViewController:(UIViewController *)modalViewController animated:(BOOL)animated completion:(void (^)(void))completion; -#endif // ]TODO(macOS GH#774) +#endif // [macOS] @end diff --git a/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm index 1a01fc728f5277..a42895ee7c72aa 100644 --- a/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm @@ -21,7 +21,7 @@ using namespace facebook::react; -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] static UIInterfaceOrientationMask supportedOrientationsMask(ModalHostViewSupportedOrientationsMask mask) { UIInterfaceOrientationMask supportedOrientations = 0; @@ -94,7 +94,7 @@ static UIModalPresentationStyle presentationConfiguration(ModalHostViewProps con : ModalHostViewEventEmitter::OnOrientationChangeOrientation::Landscape; return {orientation}; } -#endif // ]TODO(macOS GH#774) +#endif // [macOS] @interface RCTModalHostViewComponentView () @@ -106,10 +106,10 @@ @implementation RCTModalHostViewComponentView { BOOL _shouldAnimatePresentation; BOOL _shouldPresent; BOOL _isPresented; - RCTUIView *_modalContentsSnapshot; // TODO(macOS GH#774) + RCTUIView *_modalContentsSnapshot; // [macOS] } -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (instancetype)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { @@ -168,7 +168,7 @@ - (void)ensurePresentedOnlyIfNeeded _isPresented = NO; // To animate dismissal of view controller, snapshot of // view hierarchy needs to be added to the UIViewController. - RCTUIView *snapshot = _modalContentsSnapshot; // TODO(macOS GH#774) + RCTUIView *snapshot = _modalContentsSnapshot; // [macOS] [self.viewController.view addSubview:snapshot]; [self dismissViewController:self.viewController @@ -272,16 +272,16 @@ - (void)updateState:(facebook::react::State::Shared const &)state _state = std::static_pointer_cast(state); } -- (void)mountChildComponentView:(RCTUIView *)childComponentView index:(NSInteger)index // TODO(macOS GH#774) +- (void)mountChildComponentView:(RCTUIView *)childComponentView index:(NSInteger)index // [macOS] { [self.viewController.view insertSubview:childComponentView atIndex:index]; } -- (void)unmountChildComponentView:(RCTUIView *)childComponentView index:(NSInteger)index // TODO(macOS GH#774) +- (void)unmountChildComponentView:(RCTUIView *)childComponentView index:(NSInteger)index // [macOS] { [childComponentView removeFromSuperview]; } -#endif // ]TODO(macOS GH#774) +#endif // [macOS] @end diff --git a/React/Fabric/Mounting/ComponentViews/Root/RCTRootComponentView.h b/React/Fabric/Mounting/ComponentViews/Root/RCTRootComponentView.h index e028aed693b1ad..1bf3b1f3cd5da8 100644 --- a/React/Fabric/Mounting/ComponentViews/Root/RCTRootComponentView.h +++ b/React/Fabric/Mounting/ComponentViews/Root/RCTRootComponentView.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import diff --git a/React/Fabric/Mounting/ComponentViews/SafeAreaView/RCTSafeAreaViewComponentView.h b/React/Fabric/Mounting/ComponentViews/SafeAreaView/RCTSafeAreaViewComponentView.h index 84e11aacbfcb08..260d6e74fd77e2 100644 --- a/React/Fabric/Mounting/ComponentViews/SafeAreaView/RCTSafeAreaViewComponentView.h +++ b/React/Fabric/Mounting/ComponentViews/SafeAreaView/RCTSafeAreaViewComponentView.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import diff --git a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.h b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.h index 94e652b30ca0cf..97db725137c0a8 100644 --- a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.h +++ b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import @@ -19,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN */ @protocol RCTEnhancedScrollViewOverridingDelegate -- (BOOL)touchesShouldCancelInContentView:(RCTUIView *)view; // TODO(macOS GH#774) +- (BOOL)touchesShouldCancelInContentView:(RCTUIView *)view; // [macOS] @end @@ -27,7 +27,7 @@ NS_ASSUME_NONNULL_BEGIN * `UIScrollView` subclass which has some improvements and tweaks * which are not directly related to React Native. */ -@interface RCTEnhancedScrollView : RCTUIScrollView // TODO(macOS GH#774) +@interface RCTEnhancedScrollView : RCTUIScrollView // [macOS] /* * Returns a delegate splitter that can be used to create as many `UIScrollView` delegates as needed. diff --git a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm index 61616d97e38c88..765f9871a0826b 100644 --- a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm +++ b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm @@ -11,20 +11,20 @@ #import @interface RCTEnhancedScrollView () < -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UIScrollViewDelegate -#else // [TODO(macOS GH#774) +#else // [macOS RCTScrollableProtocol, RCTAutoInsetsProtocol -#endif // ]TODO(macOS GH#774) +#endif // macOS] > @end @implementation RCTEnhancedScrollView { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] __weak id _publicDelegate; -#else // [TODO(macOS GH#774) +#else// [macOS __weak id _publicDelegate; -#endif // ]TODO(macOS GH#774) +#endif // macOS] BOOL _isSetContentOffsetDisabled; } @@ -42,7 +42,7 @@ + (BOOL)automaticallyNotifiesObserversForKey:(NSString *)key - (instancetype)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] // We set the default behavior to "never" so that iOS // doesn't do weird things to UIScrollView insets automatically // and keeps it as an opt-in behavior. @@ -58,7 +58,7 @@ - (instancetype)initWithFrame:(CGRect)frame [weakSelf setPrivateDelegate:delegate]; }]; [_delegateSplitter addDelegate:self]; -#endif // TODO(macOS GH#774) +#endif // [macOS] } return self; @@ -102,8 +102,8 @@ - (void)setContentOffset:(CGPoint)contentOffset RCTSanitizeNaNValue(contentOffset.y, @"scrollView.contentOffset.y")); } -#if !TARGET_OS_OSX // TODO(macOS GH#774) -- (BOOL)touchesShouldCancelInContentView:(RCTUIView *)view // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] +- (BOOL)touchesShouldCancelInContentView:(RCTUIView *)view // [macOS] { if ([_overridingDelegate respondsToSelector:@selector(touchesShouldCancelInContentView:)]) { return [_overridingDelegate touchesShouldCancelInContentView:view]; @@ -143,13 +143,13 @@ - (void)setDelegate:(id)delegate } } -#endif // TODO(macOS GH#774) +#endif // [macOS] #pragma mark - UIScrollViewDelegate - (void)scrollViewWillEndDragging:(RCTUIScrollView *)scrollView withVelocity:(CGPoint)velocity - targetContentOffset:(inout CGPoint *)targetContentOffset // TODO(macOS GH#774) + targetContentOffset:(inout CGPoint *)targetContentOffset // [macOS] { if (self.snapToOffsets && self.snapToOffsets.count > 0) { // An alternative to enablePaging and snapToInterval which allows setting custom @@ -276,7 +276,7 @@ - (void)scrollViewWillEndDragging:(RCTUIScrollView *)scrollView #pragma mark - -- (BOOL)isHorizontal:(RCTUIScrollView *)scrollView // TODO(macOS GH#774) +- (BOOL)isHorizontal:(RCTUIScrollView *)scrollView // [macOS] { return scrollView.contentSize.width > self.frame.size.width; } diff --git a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.h b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.h index 264d306b49b51c..acaeb4be6734c0 100644 --- a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.h +++ b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import diff --git a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.h b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.h index cbacc6a0caa974..bf8c731a26b8c8 100644 --- a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.h +++ b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import @@ -28,19 +28,19 @@ NS_ASSUME_NONNULL_BEGIN /* * Finds and returns the closet RCTScrollViewComponentView component to the given view */ -+ (nullable RCTScrollViewComponentView *)findScrollViewComponentViewForView:(RCTUIView *)view; // TODO(macOS GH#774) ++ (nullable RCTScrollViewComponentView *)findScrollViewComponentViewForView:(RCTUIView *)view; // [macOS] /* * Returns an actual UIScrollView that this component uses under the hood. */ -@property (nonatomic, strong, readonly) RCTUIScrollView *scrollView; // TODO(macOS GH#774) +@property (nonatomic, strong, readonly) RCTUIScrollView *scrollView; // [macOS] /* * Returns the subview of the scroll view that the component uses to mount all subcomponents into. That's useful to * separate component views from auxiliary views to be able to reliably implement pull-to-refresh- and RTL-related * functionality. */ -@property (nonatomic, strong, readonly) RCTUIView *containerView; // TODO(macOS GH#774) +@property (nonatomic, strong, readonly) RCTUIView *containerView; // [macOS] /* * Returns a delegate splitter that can be used to subscribe for UIScrollView delegate. diff --git a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm index e99f5b7c2b95d0..9accee33bef755 100644 --- a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm @@ -28,7 +28,7 @@ static CGFloat const kClippingLeeway = 44.0; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] static UIScrollViewKeyboardDismissMode RCTUIKeyboardDismissModeFromProps(ScrollViewProps const &props) { switch (props.keyboardDismissMode) { @@ -57,7 +57,7 @@ static UIScrollViewIndicatorStyle RCTUIScrollViewIndicatorStyleFromProps(ScrollV // This is just a workaround to allow animations based on onScroll event. // This is only used to animate sticky headers in ScrollViews, and only the contentOffset and tag is used. // TODO: T116850910 [Fabric][iOS] Make Fabric not use legacy RCTEventDispatcher for native-driven AnimatedEvents -static void RCTSendScrollEventForNativeAnimations_DEPRECATED(RCTUIScrollView *scrollView, NSInteger tag) // TODO(macOS GH#774) +static void RCTSendScrollEventForNativeAnimations_DEPRECATED(RCTUIScrollView *scrollView, NSInteger tag) // [macOS] { static uint16_t coalescingKey = 0; RCTScrollEvent *scrollEvent = [[RCTScrollEvent alloc] initWithEventName:@"onScroll" @@ -79,12 +79,12 @@ static void RCTSendScrollEventForNativeAnimations_DEPRECATED(RCTUIScrollView *sc userInfo:userInfo]; } } -#endif // TODO(macOS GH#774) +#endif // [macOS] @interface RCTScrollViewComponentView () < -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UIScrollViewDelegate, -#endif // TODO(macOS GH#774) +#endif // [macOS] RCTScrollViewProtocol, RCTScrollableProtocol, RCTEnhancedScrollViewOverridingDelegate> @@ -106,10 +106,10 @@ @implementation RCTScrollViewComponentView { CGPoint _contentOffsetWhenClipped; } -+ (RCTScrollViewComponentView *_Nullable)findScrollViewComponentViewForView:(RCTUIView *)view // TODO(macOS GH#774) ++ (RCTScrollViewComponentView *_Nullable)findScrollViewComponentViewForView:(RCTUIView *)view // [macOS] { do { - view = (RCTUIView *)view.superview; // TODO(macOS GH#774) + view = (RCTUIView *)view.superview; // [macOS] } while (view != nil && ![view isKindOfClass:[RCTScrollViewComponentView class]]); return (RCTScrollViewComponentView *)view; } @@ -122,19 +122,19 @@ - (instancetype)initWithFrame:(CGRect)frame _scrollView = [[RCTEnhancedScrollView alloc] initWithFrame:self.bounds]; _scrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] _scrollView.delaysContentTouches = NO; -#endif // TODO(macOS GH#774) +#endif // [macOS] ((RCTEnhancedScrollView *)_scrollView).overridingDelegate = self; _isUserTriggeredScrolling = NO; _shouldUpdateContentInsetAdjustmentBehavior = YES; [self addSubview:_scrollView]; - _containerView = [[RCTUIView alloc] initWithFrame:CGRectZero]; // TODO(macOS GH#774) + _containerView = [[RCTUIView alloc] initWithFrame:CGRectZero]; // [macOS] [_scrollView addSubview:_containerView]; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [self.scrollViewDelegateSplitter addDelegate:self]; -#endif // TODO(macOS GH#774) +#endif // [macOS] _scrollEventThrottle = INFINITY; } @@ -146,17 +146,17 @@ - (void)dealloc { // Removing all delegates from the splitter nils the actual delegate which prevents a crash on UIScrollView // deallocation. -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [self.scrollViewDelegateSplitter removeAllDelegates]; -#endif // TODO(macOS GH#774) +#endif // [macOS] } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (RCTGenericDelegateSplitter> *)scrollViewDelegateSplitter { return ((RCTEnhancedScrollView *)_scrollView).delegateSplitter; } -#endif // TODO(macOS GH#774) +#endif // [macOS] #pragma mark - RCTMountingTransactionObserving @@ -183,9 +183,9 @@ - (void)updateLayoutMetrics:(const LayoutMetrics &)layoutMetrics : CGAffineTransformMakeScale(-1, 1); _containerView.transform = transform; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] _scrollView.transform = transform; -#endif // TODO(macOS GH#774) +#endif // [macOS] } } @@ -208,25 +208,25 @@ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const & // FIXME: Commented props are not supported yet. MAP_SCROLL_VIEW_PROP(alwaysBounceHorizontal); MAP_SCROLL_VIEW_PROP(alwaysBounceVertical); -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] MAP_SCROLL_VIEW_PROP(bounces); MAP_SCROLL_VIEW_PROP(bouncesZoom); MAP_SCROLL_VIEW_PROP(canCancelContentTouches); -#endif // TODO(macOS GH#774) +#endif // [macOS] MAP_SCROLL_VIEW_PROP(centerContent); // MAP_SCROLL_VIEW_PROP(automaticallyAdjustContentInsets); -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] MAP_SCROLL_VIEW_PROP(decelerationRate); MAP_SCROLL_VIEW_PROP(directionalLockEnabled); MAP_SCROLL_VIEW_PROP(maximumZoomScale); MAP_SCROLL_VIEW_PROP(minimumZoomScale); -#endif // TODO(macOS GH#774) +#endif // [macOS] MAP_SCROLL_VIEW_PROP(scrollEnabled); -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] MAP_SCROLL_VIEW_PROP(pagingEnabled); MAP_SCROLL_VIEW_PROP(pinchGestureEnabled); MAP_SCROLL_VIEW_PROP(scrollsToTop); -#endif // TODO(macOS GH#774) +#endif // [macOS] MAP_SCROLL_VIEW_PROP(showsHorizontalScrollIndicator); MAP_SCROLL_VIEW_PROP(showsVerticalScrollIndicator); @@ -235,9 +235,9 @@ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const & } if (oldScrollViewProps.indicatorStyle != newScrollViewProps.indicatorStyle) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] _scrollView.indicatorStyle = RCTUIScrollViewIndicatorStyleFromProps(newScrollViewProps); -#endif // TODO(macOS GH#774) +#endif // [macOS] } if (oldScrollViewProps.scrollEventThrottle != newScrollViewProps.scrollEventThrottle) { @@ -281,7 +281,7 @@ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const & scrollView.snapToOffsets = snapToOffsets; } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] if (@available(iOS 13.0, *)) { if (oldScrollViewProps.automaticallyAdjustsScrollIndicatorInsets != newScrollViewProps.automaticallyAdjustsScrollIndicatorInsets) { @@ -304,15 +304,15 @@ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const & } _shouldUpdateContentInsetAdjustmentBehavior = NO; } -#endif // TODO(macOS GH#774) +#endif // [macOS] MAP_SCROLL_VIEW_PROP(disableIntervalMomentum); MAP_SCROLL_VIEW_PROP(snapToInterval); if (oldScrollViewProps.keyboardDismissMode != newScrollViewProps.keyboardDismissMode) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] scrollView.keyboardDismissMode = RCTUIKeyboardDismissModeFromProps(newScrollViewProps); -#endif // TODO(macOS GH#774) +#endif // [macOS] } [super updateProps:props oldProps:oldProps]; @@ -359,12 +359,12 @@ - (void)_preserveContentOffsetIfNeededWithBlock:(void (^)())block [((RCTEnhancedScrollView *)_scrollView) preserveContentOffsetWithBlock:block]; } -- (void)mountChildComponentView:(RCTUIView *)childComponentView index:(NSInteger)index // TODO(macOS GH#774) +- (void)mountChildComponentView:(RCTUIView *)childComponentView index:(NSInteger)index // [macOS] { [_containerView insertSubview:childComponentView atIndex:index]; } -- (void)unmountChildComponentView:(RCTUIView *)childComponentView index:(NSInteger)index // TODO(macOS GH#774) +- (void)unmountChildComponentView:(RCTUIView *)childComponentView index:(NSInteger)index // [macOS] { [childComponentView removeFromSuperview]; } @@ -375,17 +375,17 @@ - (void)unmountChildComponentView:(RCTUIView *)childCo */ - (BOOL)_shouldDisableScrollInteraction { - RCTUIView *ancestorView = (RCTUIView *)self.superview; // TODO(macOS GH#774) + RCTUIView *ancestorView = (RCTUIView *)self.superview; // [macOS] while (ancestorView) { if ([ancestorView respondsToSelector:@selector(isJSResponder)]) { - BOOL isJSResponder = ((RCTUIView *)ancestorView).isJSResponder; // TODO(macOS GH#774) + BOOL isJSResponder = ((RCTUIView *)ancestorView).isJSResponder; // [macOS] if (isJSResponder) { return YES; } } - ancestorView = (RCTUIView *)ancestorView.superview; + ancestorView = (RCTUIView *)ancestorView.superview; // [macOS] } return NO; @@ -422,9 +422,9 @@ - (void)prepareForRecycle // We set the default behavior to "never" so that iOS // doesn't do weird things to UIScrollView insets automatically // and keeps it as an opt-in behavior. -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] _scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; -#endif // TODO(macOS GH#774) +#endif // [macOS] _shouldUpdateContentInsetAdjustmentBehavior = YES; _state.reset(); _isUserTriggeredScrolling = NO; @@ -436,14 +436,14 @@ - (void)prepareForRecycle #pragma mark - UIScrollViewDelegate -- (BOOL)touchesShouldCancelInContentView:(__unused RCTUIView *)view // TODO(macOS GH#774) +- (BOOL)touchesShouldCancelInContentView:(__unused RCTUIView *)view // [macOS] { // Historically, `UIScrollView`s in React Native do not cancel touches // started on `UIControl`-based views (as normal iOS `UIScrollView`s do). return ![self _shouldDisableScrollInteraction]; } -- (void)scrollViewDidScroll:(RCTUIScrollView *)scrollView // TODO(macOS GH#774) +- (void)scrollViewDidScroll:(RCTUIScrollView *)scrollView // [macOS] { if (!_isUserTriggeredScrolling) { [self _updateStateWithContentOffset]; @@ -455,32 +455,32 @@ - (void)scrollViewDidScroll:(RCTUIScrollView *)scrollView // TODO(macOS GH#774) if (_eventEmitter) { std::static_pointer_cast(_eventEmitter)->onScroll([self _scrollViewMetrics]); } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCTSendScrollEventForNativeAnimations_DEPRECATED(scrollView, self.tag); -#endif // TODO(macOS GH#774) +#endif // [macOS] } [self _remountChildrenIfNeeded]; } -- (void)scrollViewDidZoom:(RCTUIScrollView *)scrollView // TODO(macOS GH#774) +- (void)scrollViewDidZoom:(RCTUIScrollView *)scrollView // [macOS] { [self scrollViewDidScroll:scrollView]; } -- (BOOL)scrollViewShouldScrollToTop:(RCTUIScrollView *)scrollView // TODO(macOS GH#774) +- (BOOL)scrollViewShouldScrollToTop:(RCTUIScrollView *)scrollView // [macOS] { _isUserTriggeredScrolling = YES; return YES; } -- (void)scrollViewDidScrollToTop:(RCTUIScrollView *)scrollView // TODO(macOS GH#774) +- (void)scrollViewDidScrollToTop:(RCTUIScrollView *)scrollView // [macOS] { _isUserTriggeredScrolling = NO; [self _updateStateWithContentOffset]; } -- (void)scrollViewWillBeginDragging:(RCTUIScrollView *)scrollView // TODO(macOS GH#774) +- (void)scrollViewWillBeginDragging:(RCTUIScrollView *)scrollView // [macOS] { [self _forceDispatchNextScrollEvent]; @@ -492,7 +492,7 @@ - (void)scrollViewWillBeginDragging:(RCTUIScrollView *)scrollView // TODO(macOS _isUserTriggeredScrolling = YES; } -- (void)scrollViewDidEndDragging:(RCTUIScrollView *)scrollView willDecelerate:(BOOL)decelerate // TODO(macOS GH#774) +- (void)scrollViewDidEndDragging:(RCTUIScrollView *)scrollView willDecelerate:(BOOL)decelerate // [macOS] { [self _forceDispatchNextScrollEvent]; @@ -504,7 +504,7 @@ - (void)scrollViewDidEndDragging:(RCTUIScrollView *)scrollView willDecelerate:(B [self _updateStateWithContentOffset]; } -- (void)scrollViewWillBeginDecelerating:(RCTUIScrollView *)scrollView // TODO(macOS GH#774) +- (void)scrollViewWillBeginDecelerating:(RCTUIScrollView *)scrollView // [macOS] { [self _forceDispatchNextScrollEvent]; @@ -516,7 +516,7 @@ - (void)scrollViewWillBeginDecelerating:(RCTUIScrollView *)scrollView // TODO(ma ->onMomentumScrollBegin([self _scrollViewMetrics]); } -- (void)scrollViewDidEndDecelerating:(RCTUIScrollView *)scrollView // TODO(macOS GH#774) +- (void)scrollViewDidEndDecelerating:(RCTUIScrollView *)scrollView // [macOS] { [self _forceDispatchNextScrollEvent]; @@ -529,12 +529,12 @@ - (void)scrollViewDidEndDecelerating:(RCTUIScrollView *)scrollView // TODO(macOS _isUserTriggeredScrolling = NO; } -- (void)scrollViewDidEndScrollingAnimation:(RCTUIScrollView *)scrollView // TODO(macOS GH#774) +- (void)scrollViewDidEndScrollingAnimation:(RCTUIScrollView *)scrollView // [macOS] { [self _handleFinishedScrolling:scrollView]; } -- (void)_handleFinishedScrolling:(RCTUIScrollView *)scrollView // TODO(macOS GH#774) +- (void)_handleFinishedScrolling:(RCTUIScrollView *)scrollView // [macOS] { [self _forceDispatchNextScrollEvent]; [self scrollViewDidScroll:scrollView]; @@ -547,7 +547,7 @@ - (void)_handleFinishedScrolling:(RCTUIScrollView *)scrollView // TODO(macOS GH# [self _updateStateWithContentOffset]; } -- (void)scrollViewWillBeginZooming:(RCTUIScrollView *)scrollView withView:(nullable RCTUIView *)view // TODO(macOS GH#774) +- (void)scrollViewWillBeginZooming:(RCTUIScrollView *)scrollView withView:(nullable RCTUIView *)view // [macOS] { [self _forceDispatchNextScrollEvent]; @@ -558,7 +558,7 @@ - (void)scrollViewWillBeginZooming:(RCTUIScrollView *)scrollView withView:(nulla std::static_pointer_cast(_eventEmitter)->onScrollBeginDrag([self _scrollViewMetrics]); } -- (void)scrollViewDidEndZooming:(RCTUIScrollView *)scrollView withView:(nullable RCTUIView *)view atScale:(CGFloat)scale // TODO(macOS GH#774) +- (void)scrollViewDidEndZooming:(RCTUIScrollView *)scrollView withView:(nullable RCTUIView *)view atScale:(CGFloat)scale // [macOS] { [self _forceDispatchNextScrollEvent]; @@ -570,7 +570,7 @@ - (void)scrollViewDidEndZooming:(RCTUIScrollView *)scrollView withView:(nullable [self _updateStateWithContentOffset]; } -- (RCTUIView *)viewForZoomingInScrollView:(__unused RCTUIScrollView *)scrollView // TODO(macOS GH#774) +- (RCTUIView *)viewForZoomingInScrollView:(__unused RCTUIScrollView *)scrollView // [macOS] { return _containerView; } @@ -591,9 +591,9 @@ - (void)handleCommand:(const NSString *)commandName args:(const NSArray *)args - (void)flashScrollIndicators { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [_scrollView flashScrollIndicators]; -#endif // TODO(macOS GH#774) +#endif // [macOS] } - (void)scrollTo:(double)x y:(double)y animated:(BOOL)animated @@ -640,7 +640,7 @@ - (void)scrollToEnd:(BOOL)animated #pragma mark - Child views mounting -- (void)updateClippedSubviewsWithClipRect:(CGRect)clipRect relativeToView:(RCTUIView *)clipView // TODO(macOS GH#774) +- (void)updateClippedSubviewsWithClipRect:(CGRect)clipRect relativeToView:(RCTUIView *)clipView // [macOS] { // Do nothing. ScrollView manages its subview clipping individually in `_remountChildren`. } @@ -661,10 +661,10 @@ - (void)_remountChildrenIfNeeded - (void)_remountChildren { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [_scrollView updateClippedSubviewsWithClipRect:CGRectInset(_scrollView.bounds, -kClippingLeeway, -kClippingLeeway) relativeToView:_scrollView]; -#endif // TODO(macOS GH#774) +#endif // [macOS] } #pragma mark - RCTScrollableProtocol @@ -692,9 +692,9 @@ - (void)scrollToOffset:(CGPoint)offset animated:(BOOL)animated offset.x = self.contentSize.width - _scrollView.frame.size.width - offset.x; } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [_scrollView setContentOffset:offset animated:animated]; -#endif // TODO(macOS GH#774) +#endif // [macOS] if (!animated) { // When not animated, the expected workflow in ``scrollViewDidEndScrollingAnimation`` after scrolling is not going @@ -705,12 +705,12 @@ - (void)scrollToOffset:(CGPoint)offset animated:(BOOL)animated - (void)zoomToRect:(CGRect)rect animated:(BOOL)animated { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [_scrollView zoomToRect:rect animated:animated]; -#endif // TODO(macOS GH#774) +#endif // [macOS] } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)addScrollListener:(NSObject *)scrollListener { [self.scrollViewDelegateSplitter addDelegate:scrollListener]; @@ -720,7 +720,7 @@ - (void)removeScrollListener:(NSObject *)scrollListener { [self.scrollViewDelegateSplitter removeDelegate:scrollListener]; } -#endif // TODO(macOS GH#774) +#endif // [macOS] @end diff --git a/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.h b/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.h index a436db3af4bf1f..297b4be240d684 100644 --- a/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.h +++ b/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import diff --git a/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.mm b/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.mm index 6214374edf91df..1ea87f8bfc2d83 100644 --- a/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.mm @@ -23,7 +23,7 @@ @interface RCTSliderComponentView () @end @implementation RCTSliderComponentView { - RCTUISlider *_sliderView; // TODO(macOS GH#774) + RCTUISlider *_sliderView; // [macOS] float _previousValue; UIImage *_trackImage; @@ -48,7 +48,7 @@ - (instancetype)initWithFrame:(CGRect)frame static const auto defaultProps = std::make_shared(); _props = defaultProps; - _sliderView = [[RCTUISlider alloc] initWithFrame:self.bounds]; // TODO(macOS GH#774) + _sliderView = [[RCTUISlider alloc] initWithFrame:self.bounds]; // [macOS] #if !TARGET_OS_OSX // TODO(macOS GH#774) [_sliderView addTarget:self action:@selector(onChange:) forControlEvents:UIControlEventValueChanged]; @@ -298,17 +298,17 @@ - (void)setThumbImage:(UIImage *)thumbImage #endif // TODO(macOS GH#774) } -- (void)onChange:(RCTUISlider *)sender // TODO(macOS GH#774) +- (void)onChange:(RCTUISlider *)sender // [macOS] { [self onChange:sender withContinuous:YES]; } -- (void)sliderTouchEnd:(RCTUISlider *)sender // TODO(macOS GH#774) +- (void)sliderTouchEnd:(RCTUISlider *)sender // [macOS] { [self onChange:sender withContinuous:NO]; } -- (void)onChange:(RCTUISlider *)sender withContinuous:(BOOL)continuous // TODO(macOS GH#774) +- (void)onChange:(RCTUISlider *)sender withContinuous:(BOOL)continuous // [macOS] { float value = sender.value; diff --git a/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.h b/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.h index 77b88e8c316a85..4317aa4e7b1310 100644 --- a/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.h +++ b/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import diff --git a/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.mm b/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.mm index 97c222a82ac6e0..59eaeb218c77ff 100644 --- a/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.mm @@ -22,7 +22,7 @@ @interface RCTSwitchComponentView () @end @implementation RCTSwitchComponentView { - RCTUISwitch *_switchView; // TODO(macOS GH#774) + RCTUISwitch *_switchView; // [macOS] BOOL _isInitialValueSet; } @@ -32,7 +32,7 @@ - (instancetype)initWithFrame:(CGRect)frame static const auto defaultProps = std::make_shared(); _props = defaultProps; - _switchView = [[RCTUISwitch alloc] initWithFrame:self.bounds]; // TODO(macOS GH#774) + _switchView = [[RCTUISwitch alloc] initWithFrame:self.bounds]; // [macOS] [_switchView addTarget:self action:@selector(onChange:) forControlEvents:UIControlEventValueChanged]; @@ -90,7 +90,7 @@ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const & [super updateProps:props oldProps:oldProps]; } -- (void)onChange:(RCTUISwitch *)sender // TODO(macOS GH#774) +- (void)onChange:(RCTUISwitch *)sender // [macOS] { const auto &props = *std::static_pointer_cast(_props); if (props.value == sender.on) { diff --git a/React/Fabric/Mounting/ComponentViews/Text/RCTAccessibilityElement.h b/React/Fabric/Mounting/ComponentViews/Text/RCTAccessibilityElement.h index 44226a9fcba1ef..7ade131768319f 100644 --- a/React/Fabric/Mounting/ComponentViews/Text/RCTAccessibilityElement.h +++ b/React/Fabric/Mounting/ComponentViews/Text/RCTAccessibilityElement.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] NS_ASSUME_NONNULL_BEGIN diff --git a/React/Fabric/Mounting/ComponentViews/Text/RCTAccessibilityElement.mm b/React/Fabric/Mounting/ComponentViews/Text/RCTAccessibilityElement.mm index 8d8c67002733ff..30735e00422e70 100644 --- a/React/Fabric/Mounting/ComponentViews/Text/RCTAccessibilityElement.mm +++ b/React/Fabric/Mounting/ComponentViews/Text/RCTAccessibilityElement.mm @@ -12,7 +12,7 @@ @implementation RCTAccessibilityElement #if !TARGET_OS_OSX // TODO(macOS GH#774) - (CGRect)accessibilityFrame { - RCTUIView *container = (RCTUIView *)self.accessibilityContainer; // TODO(macOS GH#774) + RCTUIView *container = (RCTUIView *)self.accessibilityContainer; // [macOS] if (CGRectEqualToRect(_frame, CGRectZero)) { return UIAccessibilityConvertFrameToScreenCoordinates(container.bounds, container); } else { diff --git a/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentAccessibilityProvider.h b/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentAccessibilityProvider.h index 92bc380798a0bf..4d346468d5434b 100644 --- a/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentAccessibilityProvider.h +++ b/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentAccessibilityProvider.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import @@ -19,7 +19,7 @@ layoutManager:(RCTTextLayoutManager *)layoutManager paragraphAttributes:(facebook::react::ParagraphAttributes)paragraphAttributes frame:(CGRect)frame - view:(RCTUIView *)view; // TODO(macOS GH#774) + view:(RCTUIView *)view; // [macOS] #if !TARGET_OS_OSX // TODO(macOS GH#774) /* diff --git a/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentAccessibilityProvider.mm b/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentAccessibilityProvider.mm index a5ff6fe261a0bd..55d5f9893b155b 100644 --- a/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentAccessibilityProvider.mm +++ b/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentAccessibilityProvider.mm @@ -28,14 +28,14 @@ @implementation RCTParagraphComponentAccessibilityProvider { RCTTextLayoutManager *_layoutManager; ParagraphAttributes _paragraphAttributes; CGRect _frame; - __weak RCTUIView *_view; // TODO(macOS GH#774) + __weak RCTUIView *_view; // [macOS] } - (instancetype)initWithString:(facebook::react::AttributedString)attributedString layoutManager:(RCTTextLayoutManager *)layoutManager paragraphAttributes:(ParagraphAttributes)paragraphAttributes frame:(CGRect)frame - view:(RCTUIView *)view // TODO(macOS GH#774) + view:(RCTUIView *)view // [macOS] { if (self = [super init]) { _attributedString = attributedString; diff --git a/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.h b/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.h index 050fb5a1ebceba..b02c6893772b9b 100644 --- a/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.h +++ b/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import diff --git a/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm b/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm index 35b0a85f6d7dfb..8cc5a40fd41fb0 100644 --- a/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm @@ -8,9 +8,9 @@ #import "RCTParagraphComponentView.h" #import "RCTParagraphComponentAccessibilityProvider.h" -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] #import -#endif // TODO(macOS GH#774) +#endif // [macOS] #import #import @@ -32,9 +32,9 @@ @implementation RCTParagraphComponentView { ParagraphShadowNode::ConcreteState::Shared _state; ParagraphAttributes _paragraphAttributes; RCTParagraphComponentAccessibilityProvider *_accessibilityProvider; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UILongPressGestureRecognizer *_longPressGestureRecognizer; -#endif // TODO(macOS GH#774) +#endif // [macOS] } - (instancetype)initWithFrame:(CGRect)frame @@ -43,10 +43,10 @@ - (instancetype)initWithFrame:(CGRect)frame static const auto defaultProps = std::make_shared(); _props = defaultProps; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] self.contentMode = UIViewContentModeRedraw; self.opaque = NO; -#endif // TODO(macOS GH#774) +#endif // [macOS] } return self; @@ -95,13 +95,13 @@ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const & _paragraphAttributes = newParagraphProps.paragraphAttributes; if (newParagraphProps.isSelectable != oldParagraphProps.isSelectable) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] if (newParagraphProps.isSelectable) { [self enableContextMenu]; } else { [self disableContextMenu]; } -#endif // TODO(macOS GH#774) +#endif // [macOS] } [super updateProps:props oldProps:oldProps]; @@ -157,7 +157,7 @@ - (BOOL)isAccessibilityElement return NO; } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (NSArray *)accessibilityElements { auto const ¶graphProps = *std::static_pointer_cast(_props); @@ -193,7 +193,7 @@ - (UIAccessibilityTraits)accessibilityTraits { return [super accessibilityTraits] | UIAccessibilityTraitStaticText; } -#endif // TODO(macOS GH#774) +#endif // [macOS] #pragma mark - RCTTouchableComponentViewProtocol @@ -228,7 +228,7 @@ - (SharedTouchEventEmitter)touchEventEmitterAtPoint:(CGPoint)point #pragma mark - Context Menu -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)enableContextMenu { _longPressGestureRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self @@ -260,7 +260,7 @@ - (void)handleLongPress:(UILongPressGestureRecognizer *)gesture [menuController setMenuVisible:YES animated:YES]; #endif } -#endif // TODO(macOS GH#774) +#endif // [macOS] - (BOOL)canBecomeFirstResponder { @@ -268,7 +268,7 @@ - (BOOL)canBecomeFirstResponder return paragraphProps.isSelectable; } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (BOOL)canPerformAction:(SEL)action withSender:(id)sender { auto const ¶graphProps = *std::static_pointer_cast(_props); @@ -279,7 +279,7 @@ - (BOOL)canPerformAction:(SEL)action withSender:(id)sender return [self.nextResponder canPerformAction:action withSender:sender]; } -#endif // TODO(macOS GH#774) +#endif // [macOS] - (void)copy:(id)sender { @@ -297,14 +297,14 @@ - (void)copy:(id)sender [item setObject:attributedText.string forKey:(id)kUTTypeUTF8PlainText]; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; pasteboard.items = @[ item ]; -#else // [TODO(macOS GH#774) +#else // [macOS NSPasteboard *pasteboard = [NSPasteboard generalPasteboard]; [pasteboard clearContents]; [pasteboard setData:rtf forType:NSPasteboardTypeRTFD]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } @end diff --git a/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.h b/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.h index d36a4f11ffbaf8..36495da8236a79 100644 --- a/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.h +++ b/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import diff --git a/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm b/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm index 30ca8ccbb93c9c..65d5fb8801fed0 100644 --- a/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm @@ -30,7 +30,7 @@ @interface RCTTextInputComponentView () *_backedTextInputView; // TODO(macOS GH#774) + RCTUIView *_backedTextInputView; // [macOS] NSUInteger _mostRecentEventCount; NSAttributedString *_lastStringStateWasUpdatedWith; @@ -117,7 +117,7 @@ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const & } -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] if (newTextInputProps.traits.autocapitalizationType != oldTextInputProps.traits.autocapitalizationType) { _backedTextInputView.autocapitalizationType = RCTUITextAutocapitalizationTypeFromAutocapitalizationType(newTextInputProps.traits.autocapitalizationType); @@ -127,7 +127,7 @@ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const & _backedTextInputView.autocorrectionType = RCTUITextAutocorrectionTypeFromOptionalBool(newTextInputProps.traits.autoCorrect); } -#endif // ]TODO(macOS GH#774) +#endif // [macOS] if (newTextInputProps.traits.contextMenuHidden != oldTextInputProps.traits.contextMenuHidden) { _backedTextInputView.contextMenuHidden = newTextInputProps.traits.contextMenuHidden; @@ -142,7 +142,7 @@ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const & _backedTextInputView.enablesReturnKeyAutomatically = newTextInputProps.traits.enablesReturnKeyAutomatically; } -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] if (newTextInputProps.traits.keyboardAppearance != oldTextInputProps.traits.keyboardAppearance) { _backedTextInputView.keyboardAppearance = RCTUIKeyboardAppearanceFromKeyboardAppearance(newTextInputProps.traits.keyboardAppearance); @@ -152,24 +152,24 @@ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const & _backedTextInputView.spellCheckingType = RCTUITextSpellCheckingTypeFromOptionalBool(newTextInputProps.traits.spellCheck); } -#endif // ]TODO(macOS GH#774) +#endif // [macOS] if (newTextInputProps.traits.caretHidden != oldTextInputProps.traits.caretHidden) { _backedTextInputView.caretHidden = newTextInputProps.traits.caretHidden; } -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] if (newTextInputProps.traits.clearButtonMode != oldTextInputProps.traits.clearButtonMode) { _backedTextInputView.clearButtonMode = RCTUITextFieldViewModeFromTextInputAccessoryVisibilityMode(newTextInputProps.traits.clearButtonMode); } -#endif // ]TODO(macOS GH#774) +#endif // [macOS] if (newTextInputProps.traits.scrollEnabled != oldTextInputProps.traits.scrollEnabled) { _backedTextInputView.scrollEnabled = newTextInputProps.traits.scrollEnabled; } -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] if (newTextInputProps.traits.secureTextEntry != oldTextInputProps.traits.secureTextEntry) { _backedTextInputView.secureTextEntry = newTextInputProps.traits.secureTextEntry; } @@ -192,7 +192,7 @@ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const & RCTUITextInputPasswordRulesFromString(newTextInputProps.traits.passwordRules); } } -#endif // ]TODO(macOS GH#774) +#endif // [macOS] // Traits `blurOnSubmit`, `clearTextOnFocus`, and `selectTextOnFocus` were omitted intentially here // because they are being checked on-demand. @@ -211,11 +211,11 @@ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const & RCTNSTextAttributesFromTextAttributes(newTextInputProps.getEffectiveTextAttributes(RCTFontSizeMultiplier())); } -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] if (newTextInputProps.selectionColor != oldTextInputProps.selectionColor) { _backedTextInputView.tintColor = RCTUIColorFromSharedColor(newTextInputProps.selectionColor); } -#endif // ]TODO(macOS GH#774) +#endif // [macOS] if (newTextInputProps.inputAccessoryViewID != oldTextInputProps.inputAccessoryViewID) { _backedTextInputView.inputAccessoryViewID = RCTNSStringFromString(newTextInputProps.inputAccessoryViewID); @@ -420,7 +420,7 @@ - (void)textInputDidChangeSelection #pragma mark - RCTBackedTextInputDelegate (UIScrollViewDelegate) -- (void)scrollViewDidScroll:(RCTUIScrollView *)scrollView // TODO(macOS GH#774) +- (void)scrollViewDidScroll:(RCTUIScrollView *)scrollView // [macOS] { if (_eventEmitter) { std::static_pointer_cast(_eventEmitter)->onScroll([self _textInputMetrics]); @@ -460,7 +460,7 @@ - (void)setTextAndSelection:(NSInteger)eventCount [self _updateState]; } -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UITextPosition *startPosition = [_backedTextInputView positionFromPosition:_backedTextInputView.beginningOfDocument offset:start]; UITextPosition *endPosition = [_backedTextInputView positionFromPosition:_backedTextInputView.beginningOfDocument @@ -470,7 +470,7 @@ - (void)setTextAndSelection:(NSInteger)eventCount UITextRange *range = [_backedTextInputView textRangeFromPosition:startPosition toPosition:endPosition]; [_backedTextInputView setSelectedTextRange:range notifyDelegate:NO]; } -#endif // ]TODO(macOS GH#774) +#endif // [macOS] _comingFromJS = NO; } @@ -481,14 +481,14 @@ - (void)setDefaultInputAccessoryView // InputAccessoryView component sets the inputAccessoryView when inputAccessoryViewID exists if (_backedTextInputView.inputAccessoryViewID) { if (_backedTextInputView.isFirstResponder) { -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [_backedTextInputView reloadInputViews]; -#endif +#endif // [macOS] } return; } -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UIKeyboardType keyboardType = _backedTextInputView.keyboardType; // These keyboard types (all are number pads) don't have a "Done" button by default, @@ -516,21 +516,21 @@ - (void)setDefaultInputAccessoryView } else { _backedTextInputView.inputAccessoryView = nil; } -#endif // ]TODO(macOS GH#774) +#endif // [macOS] if (_backedTextInputView.isFirstResponder) { -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [_backedTextInputView reloadInputViews]; -#endif // ]TODO(macOS GH#774) +#endif // [macOS] } } - (void)handleInputAccessoryDoneButton { if ([self textInputShouldReturn]) { -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [_backedTextInputView endEditing:YES]; -#endif // ]TODO(macOS GH#774) +#endif // [macOS] } } @@ -577,17 +577,17 @@ - (void)_updateState - (AttributedString::Range)_selectionRange { -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UITextRange *selectedTextRange = _backedTextInputView.selectedTextRange; NSInteger start = [_backedTextInputView offsetFromPosition:_backedTextInputView.beginningOfDocument toPosition:selectedTextRange.start]; NSInteger end = [_backedTextInputView offsetFromPosition:_backedTextInputView.beginningOfDocument toPosition:selectedTextRange.end]; return AttributedString::Range{(int)start, (int)(end - start)}; -#else +#else // [macOS // [Fabric] Placeholder till we implement selection in Fabric return AttributedString::Range({0, 1}); -#endif // ]TODO(macOS GH#774) +#endif // macOS] } - (void)_restoreTextSelection @@ -596,13 +596,13 @@ - (void)_restoreTextSelection if (!selection.has_value()) { return; } -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] auto start = [_backedTextInputView positionFromPosition:_backedTextInputView.beginningOfDocument offset:selection->start]; auto end = [_backedTextInputView positionFromPosition:_backedTextInputView.beginningOfDocument offset:selection->end]; auto range = [_backedTextInputView textRangeFromPosition:start toPosition:end]; [_backedTextInputView setSelectedTextRange:range notifyDelegate:YES]; -#endif // ]TODO(macOS GH#774) +#endif // [macOS] } - (void)_setAttributedString:(NSAttributedString *)attributedString @@ -610,7 +610,7 @@ - (void)_setAttributedString:(NSAttributedString *)attributedString if ([self _textOf:attributedString equals:_backedTextInputView.attributedText]) { return; } -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UITextRange *selectedRange = _backedTextInputView.selectedTextRange; NSInteger oldTextLength = _backedTextInputView.attributedText.string.length; _backedTextInputView.attributedText = attributedString; @@ -627,13 +627,13 @@ - (void)_setAttributedString:(NSAttributedString *)attributedString } [self _restoreTextSelection]; _lastStringStateWasUpdatedWith = attributedString; -#endif // ]TODO(macOS GH#774) +#endif // [macOS] } - (void)_setMultiline:(BOOL)multiline { [_backedTextInputView removeFromSuperview]; - RCTUIView *backedTextInputView = multiline ? [RCTUITextView new] : [RCTUITextField new]; // TODO(macOS GH#774) + RCTUIView *backedTextInputView = multiline ? [RCTUITextView new] : [RCTUITextField new]; // [macOS] backedTextInputView.frame = _backedTextInputView.frame; RCTCopyBackedTextInput(_backedTextInputView, backedTextInputView); _backedTextInputView = backedTextInputView; @@ -661,7 +661,7 @@ - (BOOL)_textOf:(NSAttributedString *)newText equals:(NSAttributedString *)oldTe } }]; -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] BOOL shouldFallbackToBareTextComparison = [_backedTextInputView.textInputMode.primaryLanguage isEqualToString:@"dictation"] || _backedTextInputView.markedTextRange || _backedTextInputView.isSecureTextEntry || fontHasBeenUpdatedBySystem; @@ -669,11 +669,11 @@ - (BOOL)_textOf:(NSAttributedString *)newText equals:(NSAttributedString *)oldTe if (shouldFallbackToBareTextComparison) { return ([newText.string isEqualToString:oldText.string]); } else { -#endif // ]TODO(macOS GH#774) +#endif // [macOS] return ([newText isEqualToAttributedString:oldText]); -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] } -#endif // ]TODO(macOS GH#774) +#endif // [macOS] } @end diff --git a/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.h b/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.h index 0faef32b659f73..da452fcf21086b 100644 --- a/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.h +++ b/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import @@ -15,10 +15,10 @@ NS_ASSUME_NONNULL_BEGIN void RCTCopyBackedTextInput( - RCTUIView *fromTextInput, - RCTUIView *toTextInput); // TODO(macOS GH#774) + RCTUIView *fromTextInput, // [macOS] + RCTUIView *toTextInput); // [macOS] -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UITextAutocorrectionType RCTUITextAutocorrectionTypeFromOptionalBool(std::optional autoCorrect); UITextAutocapitalizationType RCTUITextAutocapitalizationTypeFromAutocapitalizationType( @@ -41,6 +41,6 @@ UITextContentType RCTUITextContentTypeFromString(std::string const &contentType) API_AVAILABLE(ios(12.0)) UITextInputPasswordRules *RCTUITextInputPasswordRulesFromString(std::string const &passwordRules); -#endif // ]TODO(macOS GH#774) +#endif // [macOS] NS_ASSUME_NONNULL_END diff --git a/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm b/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm index 51fadace188af2..2a3936934a5403 100644 --- a/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm +++ b/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm @@ -20,35 +20,35 @@ void RCTCopyBackedTextInput( RCTUIView *fromTextInput, - RCTUIView *toTextInput) // TODO(macOS GH#774) + RCTUIView *toTextInput) // [macOS] { toTextInput.attributedText = RCTSanitizeAttributedString(fromTextInput.attributedText); toTextInput.placeholder = fromTextInput.placeholder; toTextInput.placeholderColor = fromTextInput.placeholderColor; toTextInput.textContainerInset = fromTextInput.textContainerInset; -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] toTextInput.inputAccessoryView = fromTextInput.inputAccessoryView; -#endif // ]TODO(macOS GH#774) +#endif // [macOS] toTextInput.textInputDelegate = fromTextInput.textInputDelegate; toTextInput.placeholderColor = fromTextInput.placeholderColor; toTextInput.defaultTextAttributes = fromTextInput.defaultTextAttributes; -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] toTextInput.autocapitalizationType = fromTextInput.autocapitalizationType; toTextInput.autocorrectionType = fromTextInput.autocorrectionType; -#endif // ]TODO(macOS GH#774) +#endif // [macOS] toTextInput.contextMenuHidden = fromTextInput.contextMenuHidden; toTextInput.editable = fromTextInput.editable; toTextInput.enablesReturnKeyAutomatically = fromTextInput.enablesReturnKeyAutomatically; -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] toTextInput.keyboardAppearance = fromTextInput.keyboardAppearance; toTextInput.spellCheckingType = fromTextInput.spellCheckingType; -#endif // ]TODO(macOS GH#774) +#endif // [macOS] toTextInput.caretHidden = fromTextInput.caretHidden; -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] toTextInput.clearButtonMode = fromTextInput.clearButtonMode; -#endif // ]TODO(macOS GH#774) +#endif // [macOS] toTextInput.scrollEnabled = fromTextInput.scrollEnabled; -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] toTextInput.secureTextEntry = fromTextInput.secureTextEntry; toTextInput.keyboardType = fromTextInput.keyboardType; toTextInput.textContentType = fromTextInput.textContentType; @@ -58,10 +58,10 @@ void RCTCopyBackedTextInput( } [toTextInput setSelectedTextRange:fromTextInput.selectedTextRange notifyDelegate:NO]; -#endif // ]TODO(macOS GH#774) +#endif // [macOS] } -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UITextAutocorrectionType RCTUITextAutocorrectionTypeFromOptionalBool(std::optional autoCorrect) { return autoCorrect.has_value() ? (*autoCorrect ? UITextAutocorrectionTypeYes : UITextAutocorrectionTypeNo) @@ -243,4 +243,4 @@ UITextContentType RCTUITextContentTypeFromString(std::string const &contentType) { return [UITextInputPasswordRules passwordRulesWithDescriptor:RCTNSStringFromStringNilIfEmpty(passwordRules)]; } -#endif // ]TODO(macOS GH#774) +#endif // [macOS] diff --git a/React/Fabric/Mounting/ComponentViews/UnimplementedComponent/RCTUnimplementedNativeComponentView.h b/React/Fabric/Mounting/ComponentViews/UnimplementedComponent/RCTUnimplementedNativeComponentView.h index 7c35ec552bbe6d..be5a2c0c908e9a 100644 --- a/React/Fabric/Mounting/ComponentViews/UnimplementedComponent/RCTUnimplementedNativeComponentView.h +++ b/React/Fabric/Mounting/ComponentViews/UnimplementedComponent/RCTUnimplementedNativeComponentView.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import "React/RCTUITextView.h" #import diff --git a/React/Fabric/Mounting/ComponentViews/UnimplementedComponent/RCTUnimplementedNativeComponentView.mm b/React/Fabric/Mounting/ComponentViews/UnimplementedComponent/RCTUnimplementedNativeComponentView.mm index 4f44b11b36b822..a8729c2e2ca91e 100644 --- a/React/Fabric/Mounting/ComponentViews/UnimplementedComponent/RCTUnimplementedNativeComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/UnimplementedComponent/RCTUnimplementedNativeComponentView.mm @@ -14,7 +14,7 @@ using namespace facebook::react; @implementation RCTUnimplementedNativeComponentView { - RCTUILabel *_label; // TODO(macOS GH#774) + RCTUILabel *_label; // [macOS] } - (instancetype)initWithFrame:(CGRect)frame @@ -24,15 +24,15 @@ - (instancetype)initWithFrame:(CGRect)frame _props = defaultProps; CGRect bounds = self.bounds; - _label = [[RCTUILabel alloc] initWithFrame:bounds]; // TODO(macOS GH#774) + _label = [[RCTUILabel alloc] initWithFrame:bounds]; // [macOS] _label.backgroundColor = [RCTUIColor colorWithRed:1.0 green:0.0 blue:0.0 alpha:0.3]; -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] _label.layoutMargins = UIEdgeInsetsMake(12, 12, 12, 12); -#endif // ]TODO(macOS GH#774) +#endif // [macOS] _label.lineBreakMode = NSLineBreakByWordWrapping; _label.numberOfLines = 0; _label.textAlignment = NSTextAlignmentCenter; - _label.textColor = [RCTUIColor whiteColor]; // TODO(macOS GH#774) + _label.textColor = [RCTUIColor whiteColor]; // [macOS] self.contentView = _label; } diff --git a/React/Fabric/Mounting/ComponentViews/UnimplementedView/RCTUnimplementedViewComponentView.h b/React/Fabric/Mounting/ComponentViews/UnimplementedView/RCTUnimplementedViewComponentView.h index 5354d3611035ab..8c7bc564ab69cb 100644 --- a/React/Fabric/Mounting/ComponentViews/UnimplementedView/RCTUnimplementedViewComponentView.h +++ b/React/Fabric/Mounting/ComponentViews/UnimplementedView/RCTUnimplementedViewComponentView.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import diff --git a/React/Fabric/Mounting/ComponentViews/UnimplementedView/RCTUnimplementedViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/UnimplementedView/RCTUnimplementedViewComponentView.mm index fa88a630265508..cb67b03893780b 100644 --- a/React/Fabric/Mounting/ComponentViews/UnimplementedView/RCTUnimplementedViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/UnimplementedView/RCTUnimplementedViewComponentView.mm @@ -21,7 +21,7 @@ using namespace facebook::react; @implementation RCTUnimplementedViewComponentView { - RCTUILabel *_label; // TODO(macOS GH#774) + RCTUILabel *_label; // [macOS] } - (instancetype)initWithFrame:(CGRect)frame @@ -30,26 +30,26 @@ - (instancetype)initWithFrame:(CGRect)frame static auto const defaultProps = std::make_shared(); _props = defaultProps; - _label = [[RCTUILabel alloc] initWithFrame:self.bounds]; // TODO(macOS GH#774) - _label.backgroundColor = [RCTUIColor colorWithRed:1.0 green:0.0 blue:0.0 alpha:0.3]; // TODO(macOS GH#774) + _label = [[RCTUILabel alloc] initWithFrame:self.bounds]; // [macOS] + _label.backgroundColor = [RCTUIColor colorWithRed:1.0 green:0.0 blue:0.0 alpha:0.3]; // [macOS] _label.lineBreakMode = NSLineBreakByCharWrapping; -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] _label.numberOfLines = 0; _label.textAlignment = NSTextAlignmentCenter; -#else +#else // [macOS _label.alignment = NSTextAlignmentCenter; -#endif // ]TODO(macOS GH#774) - _label.textColor = [RCTUIColor whiteColor]; // TODO(macOS GH#774) +#endif // macOS] + _label.textColor = [RCTUIColor whiteColor]; // [macOS] _label.allowsDefaultTighteningForTruncation = YES; -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] _label.adjustsFontSizeToFitWidth = YES; -#endif // ]TODO(macOS GH#774) +#endif // [macOS] -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] self.contentView = _label; -#else +#else // [macOS [self.contentView addSubview:_label]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } return self; diff --git a/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h b/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h index bd14b1b4048428..70d11b9aba1950 100644 --- a/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h +++ b/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import @@ -27,7 +27,7 @@ NS_ASSUME_NONNULL_BEGIN facebook::react::LayoutMetrics _layoutMetrics; facebook::react::SharedViewProps _props; facebook::react::SharedViewEventEmitter _eventEmitter; -} // TODO(macOS GH#774) +} // [macOS] /** * Represents the `UIView` instance that is being automatically attached to @@ -37,7 +37,7 @@ NS_ASSUME_NONNULL_BEGIN * to embed/bridge pure native views as component views. * Defaults to `nil`. Assign `nil` to remove view as subview. */ -@property (nonatomic, strong, nullable) RCTUIView *contentView; // TODO(macOS GH#774) +@property (nonatomic, strong, nullable) RCTUIView *contentView; // [macOS] /** * Provides access to `nativeId` prop of the component. @@ -52,7 +52,7 @@ NS_ASSUME_NONNULL_BEGIN * Provides access to `foregroundColor` prop of the component. * Must be used by subclasses only. */ -@property (nonatomic, strong, nullable) RCTUIColor *foregroundColor; // TODO(macOS GH#774) +@property (nonatomic, strong, nullable) RCTUIColor *foregroundColor; // [macOS] /** * Returns the object - usually (sub)view - which represents this diff --git a/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm index 79614282218afe..8d9b4fe9637c4d 100644 --- a/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm @@ -21,12 +21,12 @@ using namespace facebook::react; @implementation RCTViewComponentView { - RCTUIColor *_backgroundColor; // TODO(macOS GH#774) + RCTUIColor *_backgroundColor; // [macOS] CALayer *_borderLayer; BOOL _needsInvalidateLayer; BOOL _isJSResponder; BOOL _removeClippedSubviews; - NSMutableArray *_reactSubviews; // TODO(macOS GH#774) + NSMutableArray *_reactSubviews; // [macOS] NSSet *_Nullable _propKeysManagedByAnimated_DO_NOT_USE_THIS_IS_BROKEN; } @@ -50,7 +50,7 @@ - (instancetype)initWithFrame:(CGRect)frame return _props; } -- (void)setContentView:(RCTUIView *)contentView // TODO(macOS GH#774) +- (void)setContentView:(RCTUIView *)contentView // [macOS] { if (_contentView) { [_contentView removeFromSuperview]; @@ -73,12 +73,12 @@ - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event return CGRectContainsPoint(hitFrame, point); } -- (RCTUIColor *)backgroundColor // TODO(macOS GH#774) +- (RCTUIColor *)backgroundColor // [macOS] { return _backgroundColor; } -- (void)setBackgroundColor:(RCTUIColor *)backgroundColor // TODO(macOS GH#774) +- (void)setBackgroundColor:(RCTUIColor *)backgroundColor // [macOS] { _backgroundColor = backgroundColor; } @@ -94,7 +94,7 @@ + (ComponentDescriptorProvider)componentDescriptorProvider return concreteComponentDescriptorProvider(); } -- (void)mountChildComponentView:(RCTUIView *)childComponentView index:(NSInteger)index // TODO(macOS GH#774) +- (void)mountChildComponentView:(RCTUIView *)childComponentView index:(NSInteger)index // [macOS] { RCTAssert( childComponentView.superview == nil, @@ -111,7 +111,7 @@ - (void)mountChildComponentView:(RCTUIView *)childComp } } -- (void)unmountChildComponentView:(RCTUIView *)childComponentView index:(NSInteger)index // TODO(macOS GH#774) +- (void)unmountChildComponentView:(RCTUIView *)childComponentView index:(NSInteger)index // [macOS] { if (_removeClippedSubviews) { [_reactSubviews removeObjectAtIndex:index]; @@ -135,7 +135,7 @@ - (void)unmountChildComponentView:(RCTUIView *)childCo [childComponentView removeFromSuperview]; } -- (void)updateClippedSubviewsWithClipRect:(CGRect)clipRect relativeToView:(RCTUIView *)clipView // TODO(macOS GH#774) +- (void)updateClippedSubviewsWithClipRect:(CGRect)clipRect relativeToView:(RCTUIView *)clipView // [macOS] { if (!_removeClippedSubviews) { // Use default behavior if unmounting is disabled @@ -156,7 +156,7 @@ - (void)updateClippedSubviewsWithClipRect:(CGRect)clipRect relativeToView:(RCTUI clipRect = [clipView convertRect:clipRect toView:self]; // Mount / unmount views - for (RCTUIView *view in _reactSubviews) { // TODO(macOS GH#774) + for (RCTUIView *view in _reactSubviews) { // [macOS] if (CGRectIntersectsRect(clipRect, view.frame)) { // View is at least partially visible, so remount it if unmounted [self addSubview:view]; @@ -205,13 +205,13 @@ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const & // `backgroundColor` if (oldViewProps.backgroundColor != newViewProps.backgroundColor) { - self.backgroundColor = RCTUIColorFromSharedColor(newViewProps.backgroundColor); // TODO(macOS GH#774) + self.backgroundColor = RCTUIColorFromSharedColor(newViewProps.backgroundColor); // [macOS] needsInvalidateLayer = YES; } // `foregroundColor` if (oldViewProps.foregroundColor != newViewProps.foregroundColor) { - self.foregroundColor = RCTUIColorFromSharedColor(newViewProps.foregroundColor); // TODO(macOS GH#774) + self.foregroundColor = RCTUIColorFromSharedColor(newViewProps.foregroundColor); // [macOS] } // `shadowColor` @@ -446,7 +446,7 @@ - (void)setPropKeysManagedByAnimated_DO_NOT_USE_THIS_IS_BROKEN:(NSSetpointerEvents) { case PointerEventsMode::Auto: @@ -488,7 +488,7 @@ - (RCTUIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event // TODO(macOS G case PointerEventsMode::BoxOnly: return [self pointInside:point withEvent:event] ? self : nil; case PointerEventsMode::BoxNone: - RCTUIView *view = [self betterHitTest:point withEvent:event]; // TODO(macOS GH#774) + RCTUIView *view = [self betterHitTest:point withEvent:event]; // [macOS] return view != self ? view : nil; } } @@ -600,12 +600,12 @@ - (void)invalidateLayer RCTBorderColors borderColors = RCTCreateRCTBorderColorsFromBorderColors(borderMetrics.borderColors); -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS CGFloat scaleFactor = self.window.backingScaleFactor; #else // On iOS setting the scaleFactor to 0.0 will default to the device's native scale factor. CGFloat scaleFactor = 0.0; -#endif // ]TODO(macOS GH#774) +#endif // macOS] UIImage *image = RCTGetBorderImage( RCTBorderStyleFromBorderStyle(borderMetrics.borderStyles.left), layer.bounds.size, @@ -614,7 +614,7 @@ - (void)invalidateLayer borderColors, _backgroundColor.CGColor, self.clipsToBounds, - scaleFactor); // TODO(macOS GH#774) + scaleFactor); // [macOS] RCTReleaseRCTBorderColors(borderColors); @@ -670,10 +670,10 @@ - (NSObject *)accessibilityElement return self; } -static NSString *RCTRecursiveAccessibilityLabel(RCTUIView *view) // TODO(macOS GH#774) +static NSString *RCTRecursiveAccessibilityLabel(RCTUIView *view) // [macOS] { NSMutableString *result = [NSMutableString stringWithString:@""]; - for (RCTUIView *subview in view.subviews) { // TODO(macOS GH#774) + for (RCTUIView *subview in view.subviews) { // [macOS] NSString *label = subview.accessibilityLabel; if (!label) { label = RCTRecursiveAccessibilityLabel(subview); diff --git a/React/Fabric/Mounting/RCTComponentViewClassDescriptor.h b/React/Fabric/Mounting/RCTComponentViewClassDescriptor.h index f4826fc4ae9f60..4797e137aec88b 100644 --- a/React/Fabric/Mounting/RCTComponentViewClassDescriptor.h +++ b/React/Fabric/Mounting/RCTComponentViewClassDescriptor.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import diff --git a/React/Fabric/Mounting/RCTComponentViewDescriptor.h b/React/Fabric/Mounting/RCTComponentViewDescriptor.h index 703b3b34a9d931..b59fb32748d283 100644 --- a/React/Fabric/Mounting/RCTComponentViewDescriptor.h +++ b/React/Fabric/Mounting/RCTComponentViewDescriptor.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import @@ -21,7 +21,7 @@ class RCTComponentViewDescriptor final { /* * Associated (and owned) native view instance. */ - __strong RCTUIView *view = nil; // TODO(macOS GH#774) + __strong RCTUIView *view = nil; // [macOS] /* * Indicates a requirement to call on the view methods from diff --git a/React/Fabric/Mounting/RCTComponentViewFactory.h b/React/Fabric/Mounting/RCTComponentViewFactory.h index 960daa9dc7f137..01f2dc7b334159 100644 --- a/React/Fabric/Mounting/RCTComponentViewFactory.h +++ b/React/Fabric/Mounting/RCTComponentViewFactory.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import diff --git a/React/Fabric/Mounting/RCTComponentViewProtocol.h b/React/Fabric/Mounting/RCTComponentViewProtocol.h index 7ef2e065642e50..c19b8592212141 100644 --- a/React/Fabric/Mounting/RCTComponentViewProtocol.h +++ b/React/Fabric/Mounting/RCTComponentViewProtocol.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import @@ -54,14 +54,14 @@ typedef NS_OPTIONS(NSInteger, RNComponentViewUpdateMask) { * component view. * Receiver must add `childComponentView` as a subview. */ -- (void)mountChildComponentView:(RCTUIView *)childComponentView index:(NSInteger)index; // TODO(macOS GH#774) +- (void)mountChildComponentView:(RCTUIView *)childComponentView index:(NSInteger)index; // [macOS] /* * Called for unmounting (detaching) a child component view from `self` * component view. * Receiver must remove `childComponentView` as a subview. */ -- (void)unmountChildComponentView:(RCTUIView *)childComponentView index:(NSInteger)index; // TODO(macOS GH#774) +- (void)unmountChildComponentView:(RCTUIView *)childComponentView index:(NSInteger)index; // [macOS] /* * Called for updating component's props. diff --git a/React/Fabric/Mounting/RCTComponentViewRegistry.h b/React/Fabric/Mounting/RCTComponentViewRegistry.h index 8cde9198889a05..8e3c0d7543a175 100644 --- a/React/Fabric/Mounting/RCTComponentViewRegistry.h +++ b/React/Fabric/Mounting/RCTComponentViewRegistry.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import @@ -48,7 +48,7 @@ NS_ASSUME_NONNULL_BEGIN * Finds a native component view by given `tag`. * Returns `nil` if there is no registered component with the `tag`. */ -- (nullable RCTUIView *)findComponentViewWithTag:(facebook::react::Tag)tag; // TODO(macOS GH#774) +- (nullable RCTUIView *)findComponentViewWithTag:(facebook::react::Tag)tag; // [macOS] /** * Creates a component view with a given type and puts it to the recycle pool. diff --git a/React/Fabric/Mounting/RCTComponentViewRegistry.mm b/React/Fabric/Mounting/RCTComponentViewRegistry.mm index 99332578ea24d6..e08a3c199dcb69 100644 --- a/React/Fabric/Mounting/RCTComponentViewRegistry.mm +++ b/React/Fabric/Mounting/RCTComponentViewRegistry.mm @@ -31,12 +31,12 @@ - (instancetype)init if (self = [super init]) { _componentViewFactory = [RCTComponentViewFactory currentComponentViewFactory]; -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleApplicationDidReceiveMemoryWarningNotification) name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; -#endif // ]TODO(macOS GH#774) +#endif // [macOS] dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ // Calling this a bit later, when the main thread is probably idle while JavaScript thread is busy. @@ -118,7 +118,7 @@ - (void)optimisticallyCreateComponentViewWithComponentHandle:(ComponentHandle)co return iterator->second; } -- (nullable RCTUIView *)findComponentViewWithTag:(Tag)tag // TODO(macOS GH#774) +- (nullable RCTUIView *)findComponentViewWithTag:(Tag)tag // [macOS] { RCTAssertMainQueue(); auto iterator = _registry.find(tag); diff --git a/React/Fabric/Mounting/RCTMountingManager.h b/React/Fabric/Mounting/RCTMountingManager.h index 7f2fd10d3e06c0..811c207253893d 100644 --- a/React/Fabric/Mounting/RCTMountingManager.h +++ b/React/Fabric/Mounting/RCTMountingManager.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import @@ -36,12 +36,12 @@ NS_ASSUME_NONNULL_BEGIN * influence the intrinsic size of the view and cannot be measured using UIView/UIKit layout API. * Must be called on the main thead. */ -- (void)attachSurfaceToView:(RCTUIView *)view surfaceId:(facebook::react::SurfaceId)surfaceId; // TODO(macOS GH#774) +- (void)attachSurfaceToView:(RCTUIView *)view surfaceId:(facebook::react::SurfaceId)surfaceId; // [macOS] /** * Stops designating the view as a rendering viewport of a React Native surface. */ -- (void)detachSurfaceFromView:(RCTUIView *)view surfaceId:(facebook::react::SurfaceId)surfaceId; // TODO(macOS GH#774) +- (void)detachSurfaceFromView:(RCTUIView *)view surfaceId:(facebook::react::SurfaceId)surfaceId; // [macOS] /** * Schedule a mounting transaction to be performed on the main thread. diff --git a/React/Fabric/Mounting/RCTMountingManager.mm b/React/Fabric/Mounting/RCTMountingManager.mm index 95e223d4c3783c..06585ef689c750 100644 --- a/React/Fabric/Mounting/RCTMountingManager.mm +++ b/React/Fabric/Mounting/RCTMountingManager.mm @@ -29,7 +29,7 @@ using namespace facebook::react; -static SurfaceId RCTSurfaceIdForView(RCTUIView *view) // TODO(macOS GH#774) +static SurfaceId RCTSurfaceIdForView(RCTUIView *view) // [macOS] { do { if (RCTIsReactRootView(@(view.tag))) { @@ -81,7 +81,7 @@ static void RCTPerformMountInstructions( auto &newChildViewDescriptor = [registry componentViewDescriptorWithTag:newChildShadowView.tag]; auto &parentViewDescriptor = [registry componentViewDescriptorWithTag:parentShadowView.tag]; - RCTUIView *newChildComponentView = newChildViewDescriptor.view; // TODO(macOS GH#774) + RCTUIView *newChildComponentView = newChildViewDescriptor.view; // [macOS] RCTAssert(newChildShadowView.props, @"`newChildShadowView.props` must not be null."); @@ -109,7 +109,7 @@ static void RCTPerformMountInstructions( auto &oldChildShadowView = mutation.oldChildShadowView; auto &newChildShadowView = mutation.newChildShadowView; auto &newChildViewDescriptor = [registry componentViewDescriptorWithTag:newChildShadowView.tag]; - RCTUIView *newChildComponentView = newChildViewDescriptor.view; // TODO(macOS GH#774) + RCTUIView *newChildComponentView = newChildViewDescriptor.view; // [macOS] auto mask = RNComponentViewUpdateMask{}; @@ -168,7 +168,7 @@ - (void)setContextContainer:(ContextContainer::Shared)contextContainer _contextContainer = contextContainer; } -- (void)attachSurfaceToView:(RCTUIView *)view surfaceId:(SurfaceId)surfaceId // TODO(macOS GH#774) +- (void)attachSurfaceToView:(RCTUIView *)view surfaceId:(SurfaceId)surfaceId // [macOS] { RCTAssertMainQueue(); @@ -179,7 +179,7 @@ - (void)attachSurfaceToView:(RCTUIView *)view surfaceId:(SurfaceId)surfaceId // [view addSubview:rootViewDescriptor.view]; } -- (void)detachSurfaceFromView:(RCTUIView *)view surfaceId:(SurfaceId)surfaceId // TODO(macOS GH#774) +- (void)detachSurfaceFromView:(RCTUIView *)view surfaceId:(SurfaceId)surfaceId // [macOS] { RCTAssertMainQueue(); RCTComponentViewDescriptor rootViewDescriptor = [_componentViewRegistry componentViewDescriptorWithTag:surfaceId]; @@ -288,7 +288,7 @@ - (void)setIsJSResponder:(BOOL)isJSResponder ReactTag reactTag = shadowView.tag; RCTExecuteOnMainQueue(^{ RCTUIView *componentView = - [self->_componentViewRegistry findComponentViewWithTag:reactTag]; // TODO(macOS GH#774) + [self->_componentViewRegistry findComponentViewWithTag:reactTag]; // [macOS] [componentView setIsJSResponder:isJSResponder]; }); } @@ -298,7 +298,7 @@ - (void)synchronouslyUpdateViewOnUIThread:(ReactTag)reactTag componentDescriptor:(const ComponentDescriptor &)componentDescriptor { RCTAssertMainQueue(); - RCTUIView *componentView = [_componentViewRegistry findComponentViewWithTag:reactTag]; // TODO(macOS GH#774) + RCTUIView *componentView = [_componentViewRegistry findComponentViewWithTag:reactTag]; // [macOS] SurfaceId surfaceId = RCTSurfaceIdForView(componentView); Props::Shared oldProps = [componentView props]; Props::Shared newProps = componentDescriptor.cloneProps( @@ -332,17 +332,17 @@ - (void)synchronouslyDispatchCommandOnUIThread:(ReactTag)reactTag args:(NSArray *)args { RCTAssertMainQueue(); - RCTUIView *componentView = [_componentViewRegistry findComponentViewWithTag:reactTag]; // TODO(macOS GH#774) + RCTUIView *componentView = [_componentViewRegistry findComponentViewWithTag:reactTag]; // [macOS] [componentView handleCommand:commandName args:args]; } - (void)synchronouslyDispatchAccessbilityEventOnUIThread:(ReactTag)reactTag eventType:(NSString *)eventType { if ([@"focus" isEqualToString:eventType]) { - RCTUIView *componentView = [_componentViewRegistry findComponentViewWithTag:reactTag]; // TODO(macOS GH#774) -#if !TARGET_OS_OSX // TODO(macOS GH#774) + RCTUIView *componentView = [_componentViewRegistry findComponentViewWithTag:reactTag]; // [macOS] +#if !TARGET_OS_OSX // [macOS] UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, componentView); -#endif // TODO(macOS GH#774) +#endif // [macOS] } } diff --git a/React/Fabric/Mounting/RCTMountingManagerDelegate.h b/React/Fabric/Mounting/RCTMountingManagerDelegate.h index 7c4b3e0a126ef7..3d9bc3d8837d94 100644 --- a/React/Fabric/Mounting/RCTMountingManagerDelegate.h +++ b/React/Fabric/Mounting/RCTMountingManagerDelegate.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import diff --git a/React/Fabric/Mounting/RCTMountingTransactionObserving.h b/React/Fabric/Mounting/RCTMountingTransactionObserving.h index a09905ea7b30ec..789445c1fd5389 100644 --- a/React/Fabric/Mounting/RCTMountingTransactionObserving.h +++ b/React/Fabric/Mounting/RCTMountingTransactionObserving.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #include diff --git a/React/Fabric/Mounting/UIView+ComponentViewProtocol.h b/React/Fabric/Mounting/UIView+ComponentViewProtocol.h index bb8a122c4dbae9..a02c67ed30d2c0 100644 --- a/React/Fabric/Mounting/UIView+ComponentViewProtocol.h +++ b/React/Fabric/Mounting/UIView+ComponentViewProtocol.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import @@ -14,13 +14,13 @@ NS_ASSUME_NONNULL_BEGIN /** * Default implementation of RCTComponentViewProtocol. */ -@interface RCTUIView (ComponentViewProtocol) // TODO(macOS GH#774) +@interface RCTUIView (ComponentViewProtocol) // [macOS] + (std::vector)supplementalComponentDescriptorProviders; -- (void)mountChildComponentView:(RCTUIView *)childComponentView index:(NSInteger)index; // TODO(macOS GH#774) +- (void)mountChildComponentView:(RCTUIView *)childComponentView index:(NSInteger)index; // [macOS] -- (void)unmountChildComponentView:(RCTUIView *)childComponentView index:(NSInteger)index; // TODO(macOS GH#774) +- (void)unmountChildComponentView:(RCTUIView *)childComponentView index:(NSInteger)index; // [macOS] - (void)updateProps:(facebook::react::Props::Shared const &)props oldProps:(facebook::react::Props::Shared const &)oldProps; @@ -44,7 +44,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)setPropKeysManagedByAnimated_DO_NOT_USE_THIS_IS_BROKEN:(nullable NSSet *)props; - (nullable NSSet *)propKeysManagedByAnimated_DO_NOT_USE_THIS_IS_BROKEN; -- (void)updateClippedSubviewsWithClipRect:(CGRect)clipRect relativeToView:(RCTUIView *)clipView; // TODO(macOS GH#774) +- (void)updateClippedSubviewsWithClipRect:(CGRect)clipRect relativeToView:(RCTUIView *)clipView; // [macOS] @end diff --git a/React/Fabric/Mounting/UIView+ComponentViewProtocol.mm b/React/Fabric/Mounting/UIView+ComponentViewProtocol.mm index 9068d9ec494f8e..9d7b3717683e70 100644 --- a/React/Fabric/Mounting/UIView+ComponentViewProtocol.mm +++ b/React/Fabric/Mounting/UIView+ComponentViewProtocol.mm @@ -15,7 +15,7 @@ using namespace facebook::react; -@implementation RCTUIView (ComponentViewProtocol) // TODO(macOS GH#774) +@implementation RCTUIView (ComponentViewProtocol) // [macOS] + (ComponentDescriptorProvider)componentDescriptorProvider { @@ -28,7 +28,7 @@ + (ComponentDescriptorProvider)componentDescriptorProvider return {}; } -- (void)mountChildComponentView:(RCTUIView *)childComponentView index:(NSInteger)index // TODO(macOS GH#774) +- (void)mountChildComponentView:(RCTUIView *)childComponentView index:(NSInteger)index // [macOS] { RCTAssert( childComponentView.superview == nil, @@ -40,7 +40,7 @@ - (void)mountChildComponentView:(RCTUIView *)childComp [self insertSubview:childComponentView atIndex:index]; } -- (void)unmountChildComponentView:(RCTUIView *)childComponentView index:(NSInteger)index // TODO(macOS GH#774) +- (void)unmountChildComponentView:(RCTUIView *)childComponentView index:(NSInteger)index // [macOS] { RCTAssert( childComponentView.superview == self, @@ -156,14 +156,14 @@ - (void)setPropKeysManagedByAnimated_DO_NOT_USE_THIS_IS_BROKEN:(nullable NSSet // TODO(macOS GH#774) +#import // [macOS] #import #import @@ -35,26 +35,26 @@ inline std::string RCTStringFromNSString(NSString *string) return std::string{string.UTF8String ?: ""}; } -inline RCTUIColor *_Nullable RCTUIColorFromSharedColor(facebook::react::SharedColor const &sharedColor) // TODO(macOS GH#774) +inline RCTUIColor *_Nullable RCTUIColorFromSharedColor(facebook::react::SharedColor const &sharedColor) // [macOS] { if (!sharedColor) { return nil; } if (*facebook::react::clearColor() == *sharedColor) { - return [RCTUIColor clearColor]; // TODO(macOS GH#774) + return [RCTUIColor clearColor]; // [macOS] } if (*facebook::react::blackColor() == *sharedColor) { - return [RCTUIColor blackColor]; // TODO(macOS GH#774) + return [RCTUIColor blackColor]; // [macOS] } if (*facebook::react::whiteColor() == *sharedColor) { - return [RCTUIColor whiteColor]; // TODO(macOS GH#774) + return [RCTUIColor whiteColor]; // [macOS] } auto components = facebook::react::colorComponentsFromColor(sharedColor); - return [RCTUIColor colorWithRed:components.red green:components.green blue:components.blue alpha:components.alpha]; // TODO(macOS GH#774) + return [RCTUIColor colorWithRed:components.red green:components.green blue:components.blue alpha:components.alpha]; // [macOS] } inline CF_RETURNS_RETAINED CGColorRef diff --git a/React/Fabric/RCTImageResponseDelegate.h b/React/Fabric/RCTImageResponseDelegate.h index 3744c1d2bc69ae..b9f6170b25e782 100644 --- a/React/Fabric/RCTImageResponseDelegate.h +++ b/React/Fabric/RCTImageResponseDelegate.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] NS_ASSUME_NONNULL_BEGIN diff --git a/React/Fabric/RCTLocalizationProvider.h b/React/Fabric/RCTLocalizationProvider.h index 3fec8fca1a4342..503ea2e33b0318 100644 --- a/React/Fabric/RCTLocalizationProvider.h +++ b/React/Fabric/RCTLocalizationProvider.h @@ -6,7 +6,7 @@ */ #import -#import // TODO(macOS GH#774) +#import // [macOS] @protocol RCTLocalizationProtocol diff --git a/React/Fabric/RCTScheduler.h b/React/Fabric/RCTScheduler.h index 7edf36aad5c8ef..c0bf0fd158df9d 100644 --- a/React/Fabric/RCTScheduler.h +++ b/React/Fabric/RCTScheduler.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import diff --git a/React/Fabric/RCTSurfacePresenter.h b/React/Fabric/RCTSurfacePresenter.h index cc22dc07605f9a..30428f67fd6abc 100644 --- a/React/Fabric/RCTSurfacePresenter.h +++ b/React/Fabric/RCTSurfacePresenter.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import @@ -78,7 +78,7 @@ NS_ASSUME_NONNULL_BEGIN /* * Please do not use this, this will be deleted soon. */ -- (nullable RCTUIView *)findComponentViewWithTag_DO_NOT_USE_DEPRECATED:(NSInteger)tag; // TODO(macOS GH#774) +- (nullable RCTUIView *)findComponentViewWithTag_DO_NOT_USE_DEPRECATED:(NSInteger)tag; // [macOS] @end diff --git a/React/Fabric/RCTSurfacePresenter.mm b/React/Fabric/RCTSurfacePresenter.mm index 4ba0cf63f0d999..f17bc2ab8f88a8 100644 --- a/React/Fabric/RCTSurfacePresenter.mm +++ b/React/Fabric/RCTSurfacePresenter.mm @@ -171,10 +171,10 @@ - (RCTFabricSurface *)surfaceForRootTag:(ReactTag)rootTag initialProperties:initialProperties]; } -- (RCTUIView *)findComponentViewWithTag_DO_NOT_USE_DEPRECATED:(NSInteger)tag // TODO(macOS GH#774) +- (RCTUIView *)findComponentViewWithTag_DO_NOT_USE_DEPRECATED:(NSInteger)tag // [macOS] { RCTUIView *componentView = - [_mountingManager.componentViewRegistry findComponentViewWithTag:tag]; // TODO(macOS GH#774) + [_mountingManager.componentViewRegistry findComponentViewWithTag:tag]; // [macOS] return componentView; } @@ -187,7 +187,7 @@ - (BOOL)synchronouslyUpdateViewOnUIThread:(NSNumber *)reactTag props:(NSDictiona ReactTag tag = [reactTag integerValue]; RCTUIView *componentView = - [_mountingManager.componentViewRegistry findComponentViewWithTag:tag]; // TODO(macOS GH#774) + [_mountingManager.componentViewRegistry findComponentViewWithTag:tag]; // [macOS] if (componentView == nil) { return NO; // This view probably isn't managed by Fabric } diff --git a/React/Fabric/RCTSurfacePresenterBridgeAdapter.h b/React/Fabric/RCTSurfacePresenterBridgeAdapter.h index 43a0b3ab45c229..1a701779c4ec4e 100644 --- a/React/Fabric/RCTSurfacePresenterBridgeAdapter.h +++ b/React/Fabric/RCTSurfacePresenterBridgeAdapter.h @@ -7,7 +7,7 @@ #import #import -#import // TODO(macOS GH#774) +#import // [macOS] #import NS_ASSUME_NONNULL_BEGIN diff --git a/React/Fabric/RCTSurfaceRegistry.h b/React/Fabric/RCTSurfaceRegistry.h index c01231c8a426b9..79ee5a7e10537a 100644 --- a/React/Fabric/RCTSurfaceRegistry.h +++ b/React/Fabric/RCTSurfaceRegistry.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import diff --git a/React/Fabric/RCTSurfaceTouchHandler.h b/React/Fabric/RCTSurfaceTouchHandler.h index 8f8768357a8c63..f3f802d256592d 100644 --- a/React/Fabric/RCTSurfaceTouchHandler.h +++ b/React/Fabric/RCTSurfaceTouchHandler.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] NS_ASSUME_NONNULL_BEGIN @@ -15,8 +15,8 @@ NS_ASSUME_NONNULL_BEGIN * Attaches (and detaches) a view to the touch handler. * The receiver does not retain the provided view. */ -- (void)attachToView:(RCTUIView *)view; // TODO(macOS GH#774) -- (void)detachFromView:(RCTUIView *)view; // TODO(macOS GH#774) +- (void)attachToView:(RCTUIView *)view; // [macOS] +- (void)detachFromView:(RCTUIView *)view; // [macOS] /* * Offset of the attached view relative to the root component in points. diff --git a/React/Fabric/RCTSurfaceTouchHandler.mm b/React/Fabric/RCTSurfaceTouchHandler.mm index e16cfe0949acd1..b6c033f6cc0a34 100644 --- a/React/Fabric/RCTSurfaceTouchHandler.mm +++ b/React/Fabric/RCTSurfaceTouchHandler.mm @@ -60,7 +60,7 @@ typedef NS_ENUM(NSInteger, RCTTouchEventType) { /* * A component view on which the touch was begun. */ - __strong RCTUIView *componentView = nil; // TODO(macOS GH#774) + __strong RCTUIView *componentView = nil; // [macOS] struct Hasher { size_t operator()(const ActiveTouch &activeTouch) const @@ -81,7 +81,7 @@ static void UpdateActiveTouchWithUITouch( ActiveTouch &activeTouch, UITouch *uiTouch, RCTUIView *rootComponentView, - CGPoint rootViewOriginOffset) // TODO(macOS GH#774) + CGPoint rootViewOriginOffset) // [macOS] { CGPoint offsetPoint = [uiTouch locationInView:activeTouch.componentView]; CGPoint screenPoint = [uiTouch locationInView:uiTouch.window]; @@ -99,12 +99,12 @@ static void UpdateActiveTouchWithUITouch( } } -static ActiveTouch CreateTouchWithUITouch(UITouch *uiTouch, RCTUIView *rootComponentView, CGPoint rootViewOriginOffset) // TODO(macOS GH#774) +static ActiveTouch CreateTouchWithUITouch(UITouch *uiTouch, RCTUIView *rootComponentView, CGPoint rootViewOriginOffset) // [macOS] { ActiveTouch activeTouch = {}; // Find closest Fabric-managed touchable view - RCTUIView *componentView = uiTouch.view; // TODO(macOS GH#774) + RCTUIView *componentView = uiTouch.view; // [macOS] while (componentView) { if ([componentView respondsToSelector:@selector(touchEventEmitterAtPoint:)]) { activeTouch.eventEmitter = [(id)componentView @@ -164,7 +164,7 @@ @implementation RCTSurfaceTouchHandler { /* * We hold the view weakly to prevent a retain cycle. */ - __weak RCTUIView *_rootComponentView; // TODO(macOS GH#774) + __weak RCTUIView *_rootComponentView; // [macOS] IdentifierPool<11> _identifierPool; } @@ -187,7 +187,7 @@ - (instancetype)init RCT_NOT_IMPLEMENTED(-(instancetype)initWithTarget : (id)target action : (SEL)action) -- (void)attachToView:(RCTUIView *)view // TODO(macOS GH#774) +- (void)attachToView:(RCTUIView *)view // [macOS] { RCTAssert(self.view == nil, @"RCTTouchHandler already has attached view."); @@ -195,7 +195,7 @@ - (void)attachToView:(RCTUIView *)view // TODO(macOS GH#774) _rootComponentView = view; } -- (void)detachFromView:(RCTUIView *)view // TODO(macOS GH#774) +- (void)detachFromView:(RCTUIView *)view // [macOS] { RCTAssertParam(view); RCTAssert(self.view == view, @"RCTTouchHandler attached to another view."); diff --git a/React/Fabric/RCTTouchableComponentViewProtocol.h b/React/Fabric/RCTTouchableComponentViewProtocol.h index 2fe963bad510f3..b209453956e077 100644 --- a/React/Fabric/RCTTouchableComponentViewProtocol.h +++ b/React/Fabric/RCTTouchableComponentViewProtocol.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import @protocol RCTTouchableComponentViewProtocol diff --git a/React/Fabric/Utils/RCTGenericDelegateSplitter.h b/React/Fabric/Utils/RCTGenericDelegateSplitter.h index e7d5a5e0688627..fdd6d5643ee656 100644 --- a/React/Fabric/Utils/RCTGenericDelegateSplitter.h +++ b/React/Fabric/Utils/RCTGenericDelegateSplitter.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] NS_ASSUME_NONNULL_BEGIN diff --git a/React/Modules/RCTEventEmitter.h b/React/Modules/RCTEventEmitter.h index 80669e4245e693..f7dc623f0b0141 100644 --- a/React/Modules/RCTEventEmitter.h +++ b/React/Modules/RCTEventEmitter.h @@ -13,24 +13,24 @@ */ @interface RCTEventEmitter : NSObject -@property (nonatomic, weak) RCTBridge * _Nullable bridge; // TODO(macOS GH#774) -@property (nonatomic, weak) RCTModuleRegistry * _Nullable moduleRegistry; // TODO(macOS GH#774) -@property (nonatomic, weak) RCTViewRegistry * _Nullable viewRegistry_DEPRECATED; // TODO(macOS GH#774) +@property (nonatomic, weak) RCTBridge * _Nullable bridge; // [macOS] +@property (nonatomic, weak) RCTModuleRegistry * _Nullable moduleRegistry; // [macOS] +@property (nonatomic, weak) RCTViewRegistry * _Nullable viewRegistry_DEPRECATED; // [macOS] -- (instancetype _Nullable)initWithDisabledObservation; // TODO(macOS GH#774) +- (instancetype _Nullable)initWithDisabledObservation; // [macOS] /** * Override this method to return an array of supported event names. Attempting * to observe or send an event that isn't included in this list will result in * an error. */ -- (NSArray *_Nullable)supportedEvents; // TODO(macOS GH#774) +- (NSArray *_Nullable)supportedEvents; // [macOS] /** * Send an event that does not relate to a specific view, e.g. a navigation * or data update notification. */ -- (void)sendEventWithName:(NSString *_Nullable)name body:(id _Nullable )body; // TODO(macOS GH#774) +- (void)sendEventWithName:(NSString *_Nullable)name body:(id _Nullable )body; // [macOS] /** * These methods will be called when the first observer is added and when the @@ -42,7 +42,7 @@ - (void)invalidate NS_REQUIRES_SUPER; -- (void)addListener:(NSString *_Nullable)eventName; // TODO(macOS GH#774) +- (void)addListener:(NSString *_Nullable)eventName; // [macOS] - (void)removeListeners:(double)count; @end diff --git a/React/Modules/RCTI18nUtil.m b/React/Modules/RCTI18nUtil.m index 0e3be4677a6dcf..575c9e16069b6a 100644 --- a/React/Modules/RCTI18nUtil.m +++ b/React/Modules/RCTI18nUtil.m @@ -7,7 +7,7 @@ #import "RCTI18nUtil.h" -#import // TODO(macOS GH#774) +#import // [macOS] @implementation RCTI18nUtil diff --git a/React/Modules/RCTLayoutAnimation.h b/React/Modules/RCTLayoutAnimation.h index 7ee1e014d55508..f95d6a8cd675dc 100644 --- a/React/Modules/RCTLayoutAnimation.h +++ b/React/Modules/RCTLayoutAnimation.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import diff --git a/React/Modules/RCTLayoutAnimation.m b/React/Modules/RCTLayoutAnimation.m index 5e37b382bd3c89..a15d806dab419a 100644 --- a/React/Modules/RCTLayoutAnimation.m +++ b/React/Modules/RCTLayoutAnimation.m @@ -11,11 +11,11 @@ @implementation RCTLayoutAnimation -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] static UIViewAnimationCurve _currentKeyboardAnimationCurve; -#endif // TODO(macOS GH#774) +#endif // [macOS] -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] static UIViewAnimationOptions UIViewAnimationOptionsFromRCTAnimationType(RCTAnimationType type) { switch (type) { @@ -35,7 +35,7 @@ static UIViewAnimationOptions UIViewAnimationOptionsFromRCTAnimationType(RCTAnim return UIViewAnimationOptionCurveEaseInOut; } } -#elif TARGET_OS_OSX // [TODO(macOS GH#774) +#else // [macOS static NSString *CAMediaTimingFunctionNameFromRCTAnimationType(RCTAnimationType type) { switch (type) { @@ -52,9 +52,9 @@ static UIViewAnimationOptions UIViewAnimationOptionsFromRCTAnimationType(RCTAnim return kCAMediaTimingFunctionDefault; } } -#endif // ]TODO(macOS GH#774) +#endif // macOS] -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] // Use a custom initialization function rather than implementing `+initialize` so that we can control // when the initialization code runs. `+initialize` runs immediately before the first message is sent // to the class which may be too late for us. By this time, we may have missed some @@ -75,7 +75,7 @@ + (void)keyboardWillChangeFrame:(NSNotification *)notification NSDictionary *userInfo = notification.userInfo; _currentKeyboardAnimationCurve = [userInfo[UIKeyboardAnimationCurveUserInfoKey] integerValue]; } -#endif // TODO(macOS GH#774) +#endif // [macOS] - (instancetype)initWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay @@ -118,12 +118,12 @@ - (instancetype)initWithDuration:(NSTimeInterval)duration config:(NSDictionary * } _animationType = [RCTConvert RCTAnimationType:config[@"type"]]; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] if (_animationType == RCTAnimationTypeSpring) { _springDamping = [RCTConvert CGFloat:config[@"springDamping"]]; _initialVelocity = [RCTConvert CGFloat:config[@"initialVelocity"]]; } -#endif // TODO(macOS GH#774) +#endif // [macOS] } return self; @@ -131,7 +131,7 @@ - (instancetype)initWithDuration:(NSTimeInterval)duration config:(NSDictionary * - (void)performAnimations:(void (^)(void))animations withCompletionBlock:(void (^)(BOOL completed))completionBlock { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] if (_animationType == RCTAnimationTypeSpring) { [UIView animateWithDuration:_duration delay:_delay @@ -150,7 +150,7 @@ - (void)performAnimations:(void (^)(void))animations withCompletionBlock:(void ( animations:animations completion:completionBlock]; } -#elif TARGET_OS_OSX // [TODO(macOS GH#774) +#else // [macOS NSString *timingFunctionName = CAMediaTimingFunctionNameFromRCTAnimationType(_animationType); CAMediaTimingFunction *timingFunction = [CAMediaTimingFunction functionWithName:timingFunctionName]; @@ -179,7 +179,7 @@ - (void)performAnimations:(void (^)(void))animations withCompletionBlock:(void ( dispatch_time_t time = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(_delay * NSEC_PER_SEC)); dispatch_after(time, dispatch_get_main_queue(), runAnimationGroup); } -#endif // ]TODO(macOS GH#774) +#endif // macOS] } - (BOOL)isEqual:(RCTLayoutAnimation *)animation @@ -190,7 +190,7 @@ - (BOOL)isEqual:(RCTLayoutAnimation *)animation _animationType == animation.animationType; } -#if DEBUG // TODO(macOS GH#774) description is a debug-only feature +#if DEBUG // [macOS description is a debug-only feature - (NSString *)description { return [NSString @@ -205,6 +205,6 @@ - (NSString *)description _initialVelocity, (long)_animationType]; } -#endif // TODO(macOS GH#774) +#endif // macOS] @end diff --git a/React/Modules/RCTLayoutAnimationGroup.h b/React/Modules/RCTLayoutAnimationGroup.h index db42eb349a4ec9..02b01c325181cc 100644 --- a/React/Modules/RCTLayoutAnimationGroup.h +++ b/React/Modules/RCTLayoutAnimationGroup.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import diff --git a/React/Modules/RCTLayoutAnimationGroup.m b/React/Modules/RCTLayoutAnimationGroup.m index 06af65ebfd6f0f..27275d0ec88667 100644 --- a/React/Modules/RCTLayoutAnimationGroup.m +++ b/React/Modules/RCTLayoutAnimationGroup.m @@ -64,7 +64,7 @@ - (BOOL)isEqual:(RCTLayoutAnimationGroup *)layoutAnimation [_deletingLayoutAnimation isEqual:deletingLayoutAnimation]); } -#if DEBUG // TODO(macOS GH#774) description is a debug-only feature +#if DEBUG // [macOS description is a debug-only feature - (NSString *)description { return @@ -76,6 +76,6 @@ - (NSString *)description [_updatingLayoutAnimation description], [_deletingLayoutAnimation description]]; } -#endif // TODO(macOS GH#774) +#endif // macOS] @end diff --git a/React/Modules/RCTSurfacePresenterStub.h b/React/Modules/RCTSurfacePresenterStub.h index ba0a148a4dd02e..c0654234ee6224 100644 --- a/React/Modules/RCTSurfacePresenterStub.h +++ b/React/Modules/RCTSurfacePresenterStub.h @@ -8,7 +8,7 @@ #import #import -#import // TODO(macOS GH#774) +#import // [macOS] @protocol RCTSurfaceProtocol; @@ -31,7 +31,7 @@ NS_ASSUME_NONNULL_BEGIN - (id)createFabricSurfaceForModuleName:(NSString *)moduleName initialProperties:(NSDictionary *)initialProperties; -- (nullable RCTPlatformView *)findComponentViewWithTag_DO_NOT_USE_DEPRECATED:(NSInteger)tag; // TODO(macOS GH#774) +- (nullable RCTPlatformView *)findComponentViewWithTag_DO_NOT_USE_DEPRECATED:(NSInteger)tag; // [macOS] - (BOOL)synchronouslyUpdateViewOnUIThread:(NSNumber *)reactTag props:(NSDictionary *)props; - (void)addObserver:(id)observer; - (void)removeObserver:(id)observer; diff --git a/React/Modules/RCTUIManager.h b/React/Modules/RCTUIManager.h index e228957479706c..ed5623a80c1341 100644 --- a/React/Modules/RCTUIManager.h +++ b/React/Modules/RCTUIManager.h @@ -9,7 +9,7 @@ #import #import #import -#import // TODO(macOS GH#774) +#import // [macOS] #import /** @@ -18,7 +18,7 @@ */ RCT_EXTERN NSString *const RCTUIManagerWillUpdateViewsDueToContentSizeMultiplierChangeNotification; -void RCTTraverseViewNodes(id view, void (^block)(id)); // TODO(macOS GH#774) +void RCTTraverseViewNodes(id view, void (^block)(id)); // [macOS] @class RCTLayoutAnimationGroup; @class RCTUIManagerObserverCoordinator; @@ -37,7 +37,7 @@ void RCTTraverseViewNodes(id view, void (^block)(id) /** * Register a root view with the RCTUIManager. */ -- (void)registerRootView:(RCTUIView *)rootView; // TODO(macOS ISS#3536887) +- (void)registerRootView:(RCTUIView *)rootView; // [macOS] /** * Gets the view name associated with a reactTag. @@ -47,7 +47,7 @@ void RCTTraverseViewNodes(id view, void (^block)(id) /** * Gets the view associated with a reactTag. */ -- (RCTPlatformView *)viewForReactTag:(NSNumber *)reactTag; // TODO(macOS GH#774) +- (RCTPlatformView *)viewForReactTag:(NSNumber *)reactTag; // [macOS] /** * Gets the shadow view associated with a reactTag. @@ -61,7 +61,7 @@ void RCTTraverseViewNodes(id view, void (^block)(id) * this value does not affect root node size style properties. * Can be considered as something similar to `setSize:forView:` but applicable only for root view. */ -- (void)setAvailableSize:(CGSize)availableSize forRootView:(RCTUIView *)rootView; // TODO(macOS ISS#3536887) +- (void)setAvailableSize:(CGSize)availableSize forRootView:(RCTUIView *)rootView; // [macOS] /** * Sets local data for a shadow view corresponded with given view. @@ -72,20 +72,20 @@ void RCTTraverseViewNodes(id view, void (^block)(id) * the shadow view. * Please respect one-directional data flow of React. */ -- (void)setLocalData:(NSObject *)localData forView:(RCTUIView *)view; // TODO(macOS ISS#3536887) +- (void)setLocalData:(NSObject *)localData forView:(RCTUIView *)view; // [macOS] /** * Set the size of a view. This might be in response to a screen rotation * or some other layout event outside of the React-managed view hierarchy. */ -- (void)setSize:(CGSize)size forView:(RCTPlatformView *)view; // TODO(macOS GH#774) +- (void)setSize:(CGSize)size forView:(RCTPlatformView *)view; // [macOS] /** * Set the natural size of a view, which is used when no explicit size is set. * Use `UIViewNoIntrinsicMetric` to ignore a dimension. * The `size` must NOT include padding and border. */ -- (void)setIntrinsicContentSize:(CGSize)intrinsicContentSize forView:(RCTPlatformView *)view; // TODO(macOS GH#774) +- (void)setIntrinsicContentSize:(CGSize)intrinsicContentSize forView:(RCTPlatformView *)view; // [macOS] /** * Sets up layout animation which will perform on next layout pass. @@ -124,7 +124,7 @@ void RCTTraverseViewNodes(id view, void (^block)(id) * @param completion the completion block that will hand over the rootView, if any. * */ -- (void)rootViewForReactTag:(NSNumber *)reactTag withCompletion:(void (^)(RCTPlatformView *view))completion; // TODO(macOS GH#774) +- (void)rootViewForReactTag:(NSNumber *)reactTag withCompletion:(void (^)(RCTPlatformView *view))completion; // [macOS] /** * Finds a view that is tagged with nativeID as its nativeID prop @@ -134,7 +134,7 @@ void RCTTraverseViewNodes(id view, void (^block)(id) * @param nativeID the id reference to native component relative to root view. * @param rootTag the react tag of root view hierarchy from which to find the view. */ -- (RCTPlatformView *)viewForNativeID:(NSString *)nativeID withRootTag:(NSNumber *)rootTag; // TODO(macOS ISS#3536887) +- (RCTPlatformView *)viewForNativeID:(NSString *)nativeID withRootTag:(NSNumber *)rootTag; // [macOS] /** * Register a view that is tagged with nativeID as its nativeID prop @@ -142,12 +142,12 @@ void RCTTraverseViewNodes(id view, void (^block)(id) * @param nativeID the id reference to native component relative to root view. * @param view the view that is tagged with nativeID as its nativeID prop. */ -- (void)setNativeID:(NSString *)nativeID forView:(RCTUIView *)view; // TODO(macOS GH#774) +- (void)setNativeID:(NSString *)nativeID forView:(RCTUIView *)view; // [macOS] /** * The view that is currently first responder, according to the JS context. */ -+ (RCTPlatformView *)JSResponder; // TODO(macOS GH#774) ++ (RCTPlatformView *)JSResponder; // [macOS] /** * In some cases we might want to trigger layout from native side. diff --git a/React/Modules/RCTUIManager.m b/React/Modules/RCTUIManager.m index 2acd5bd99c35b9..a9f0eb52958f11 100644 --- a/React/Modules/RCTUIManager.m +++ b/React/Modules/RCTUIManager.m @@ -10,7 +10,7 @@ #import #import -#import // TODO(macOS GH#774) +#import // [macOS] #import "RCTAssert.h" #import "RCTBridge+Private.h" @@ -19,7 +19,7 @@ #import "RCTComponentData.h" #import "RCTConvert.h" #import "RCTDefines.h" -#import "RCTDevSettings.h" // TODO(macOS GH#774) +#import "RCTDevSettings.h" // [macOS] #import "RCTEventDispatcherProtocol.h" #import "RCTLayoutAnimation.h" #import "RCTLayoutAnimationGroup.h" @@ -30,9 +30,9 @@ #import "RCTRootContentView.h" #import "RCTRootShadowView.h" #import "RCTRootViewInternal.h" -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] #import "RCTScrollableProtocol.h" -#endif // TODO(macOS GH#774) +#endif // [macOS] #import "RCTShadowView+Internal.h" #import "RCTShadowView.h" #import "RCTSurfaceRootShadowView.h" @@ -43,12 +43,12 @@ #import "RCTView.h" #import "RCTViewManager.h" #import "UIView+React.h" -#import "RCTUIKit.h" // TODO(macOS GH#768) -#import "RCTDeviceInfo.h" // TODO(macOS GH#774) +#import "RCTUIKit.h" // [macOS] +#import "RCTDeviceInfo.h" // [macOS] #import -void RCTTraverseViewNodes(id view, void (^block)(id)) // TODO(OSS Candidate ISS#2710739) +void RCTTraverseViewNodes(id view, void (^block)(id)) // [macOS] { if (view.reactTag) { block(view); @@ -79,8 +79,8 @@ @implementation RCTUIManager { RCTLayoutAnimationGroup *_layoutAnimationGroup; // Main thread only NSMutableDictionary *_shadowViewRegistry; // RCT thread only - NSMutableDictionary *_viewRegistry; // Main thread only // TODO(macOS GH#774) - NSMapTable *_nativeIDRegistry; // TODO(macOS GH#774) + NSMutableDictionary *_viewRegistry; // Main thread only // [macOS] + NSMapTable *_nativeIDRegistry; // [macOS] NSMapTable *> *_shadowViewsWithUpdatedProps; // UIManager queue only. NSHashTable *_shadowViewsWithUpdatedChildren; // UIManager queue only. @@ -111,7 +111,7 @@ - (void)invalidate RCTExecuteOnMainQueue(^{ RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"UIManager invalidate", nil); for (NSNumber *rootViewTag in self->_rootViewTags) { - RCTPlatformView *rootView = self->_viewRegistry[rootViewTag]; // TODO(macOS ISS#3536887) + RCTPlatformView *rootView = self->_viewRegistry[rootViewTag]; // [macOS] if ([rootView conformsToProtocol:@protocol(RCTInvalidating)]) { [(id)rootView invalidate]; } @@ -137,7 +137,7 @@ - (void)invalidate return _shadowViewRegistry; } -- (NSMutableDictionary *)viewRegistry // TODO(macOS GH#774) +- (NSMutableDictionary *)viewRegistry // [macOS] { // NOTE: this method only exists so that it can be accessed by unit tests if (!_viewRegistry) { @@ -186,7 +186,7 @@ - (void)setBridge:(RCTBridge *)bridge } } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] // This dispatch_async avoids a deadlock while configuring native modules dispatch_async(dispatch_get_main_queue(), ^{ [[NSNotificationCenter defaultCenter] addObserver:self @@ -200,12 +200,12 @@ - (void)setBridge:(RCTBridge *)bridge name:UIDeviceOrientationDidChangeNotification object:nil]; [RCTLayoutAnimation initializeStatics]; -#endif // TODO(macOS GH#774) +#endif // [macOS] } #pragma mark - Event emitting -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)didReceiveNewContentSizeMultiplier { // Report the event across the bridge. @@ -226,9 +226,9 @@ - (void)didReceiveNewContentSizeMultiplier [self setNeedsLayout]; }); } -#endif // TODO(macOS GH#774) +#endif // [macOS] -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] // Names and coordinate system from html5 spec: // https://developer.mozilla.org/en-US/docs/Web/API/Screen.orientation // https://developer.mozilla.org/en-US/docs/Web/API/Screen.lockOrientation @@ -281,7 +281,7 @@ - (void)namedOrientationDidChange body:orientationEvent]; #pragma clang diagnostic pop } -#endif // TODO(macOS GH#774) +#endif // macOS] - (dispatch_queue_t)methodQueue { @@ -321,7 +321,7 @@ - (void)registerRootView:(RCTRootContentView *)rootView NSNumber *reactTag = rootView.reactTag; RCTAssert(RCTIsReactRootView(reactTag), @"View %@ with tag #%@ is not a root view", rootView, reactTag); - RCTPlatformView *existingView = _viewRegistry[reactTag]; // TODO(macOS GH#774) + RCTPlatformView *existingView = _viewRegistry[reactTag]; // [macOS] RCTAssert( existingView == nil || existingView == rootView, @"Expect all root views to have unique tag. Added %@ twice", @@ -333,7 +333,7 @@ - (void)registerRootView:(RCTRootContentView *)rootView _viewRegistry[reactTag] = rootView; // Register shadow view - RCTRootShadowView *shadowView = [RCTRootShadowView new]; // TODO(macOS GH#774) - do this early to prevent RCTI18nUtil deadlock + RCTRootShadowView *shadowView = [RCTRootShadowView new]; // [macOS] do this early to prevent RCTI18nUtil deadlock RCTExecuteOnUIManagerQueue(^{ if (!self->_viewRegistry) { @@ -357,8 +357,8 @@ - (NSString *)viewNameForReactTag:(NSNumber *)reactTag } // Re-enable componentViewName_DO_NOT_USE_THIS_IS_BROKEN once macOS uses Fabric -#if !TARGET_OS_OSX // [TODO(macOS GH#774) - __block RCTPlatformView *view; // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] + __block RCTPlatformView *view; // [macOS] RCTUnsafeExecuteOnMainQueueSync(^{ view = self->_viewRegistry[reactTag]; }); @@ -371,14 +371,14 @@ - (NSString *)viewNameForReactTag:(NSNumber *)reactTag } #pragma clang diagnostic pop -#endif // ]TODO(macOS GH#774) +#endif // [macOS] return nil; } -- (RCTPlatformView *)viewForReactTag:(NSNumber *)reactTag // TODO(macOS GH#774) +- (RCTPlatformView *)viewForReactTag:(NSNumber *)reactTag // [macOS] { RCTAssertMainQueue(); - RCTPlatformView *view = [_bridge.surfacePresenter findComponentViewWithTag_DO_NOT_USE_DEPRECATED:reactTag.integerValue]; // TODO(macOS GH#774) + RCTPlatformView *view = [_bridge.surfacePresenter findComponentViewWithTag_DO_NOT_USE_DEPRECATED:reactTag.integerValue]; // [macOS] if (!view) { view = _viewRegistry[reactTag]; } @@ -387,9 +387,9 @@ - (RCTPlatformView *)viewForReactTag:(NSNumber *)reactTag // TODO(macOS GH#774) - (RCTShadowView *)shadowViewForReactTag:(NSNumber *)reactTag { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCTAssertUIManagerQueue(); -#endif // TODO(macOS GH#774) +#endif // [macOS] return _shadowViewRegistry[reactTag]; } @@ -411,7 +411,7 @@ - (void)_executeBlockWithShadowView:(void (^)(RCTShadowView *shadowView))block f }); } -- (void)setAvailableSize:(CGSize)availableSize forRootView:(RCTUIView *)rootView // TODO(macOS ISS#3536887) +- (void)setAvailableSize:(CGSize)availableSize forRootView:(RCTUIView *)rootView // [macOS] { RCTAssertMainQueue(); @@ -429,7 +429,7 @@ - (void)setAvailableSize:(CGSize)availableSize forRootView:(RCTUIView *)rootView [self setNeedsLayout]; }; -#if TARGET_OS_OSX // [TODO(macOS GH#744) +#if TARGET_OS_OSX // [macOS if (rootView.inLiveResize) { NSNumber* tag = rootView.reactTag; // Synchronously relayout to prevent "tearing" when resizing windows. @@ -439,12 +439,12 @@ - (void)setAvailableSize:(CGSize)availableSize forRootView:(RCTUIView *)rootView block(shadowView); }); } -#endif // ]TODO(macOS GH#744) +#endif // macOS] [self _executeBlockWithShadowView:block forTag:rootView.reactTag]; } -- (void)setLocalData:(NSObject *)localData forView:(RCTUIView *)view // TODO(macOS ISS#3536887) +- (void)setLocalData:(NSObject *)localData forView:(RCTUIView *)view // [macOS] { RCTAssertMainQueue(); [self @@ -460,14 +460,14 @@ - (RCTPlatformView *)viewForNativeID:(NSString *)nativeID withRootTag:(NSNumber if (!nativeID || !rootTag) { return nil; } - RCTPlatformView *view; // TODO(macOS ISS#3536887) + RCTPlatformView *view; // [macOS] @synchronized(self) { view = [_nativeIDRegistry objectForKey:RCTNativeIDRegistryKey(nativeID, rootTag)]; } return view; } -- (void)setNativeID:(NSString *)nativeID forView:(RCTUIView *)view // TODO(macOS ISS#3536887) +- (void)setNativeID:(NSString *)nativeID forView:(RCTUIView *)view // [macOS] { if (!nativeID || !view) { return; @@ -481,7 +481,7 @@ - (void)setNativeID:(NSString *)nativeID forView:(RCTUIView *)view // TODO(macOS }); } -- (void)setSize:(CGSize)size forView:(RCTUIView *)view // TODO(macOS ISS#3536887) +- (void)setSize:(CGSize)size forView:(RCTUIView *)view // [macOS] { RCTAssertMainQueue(); [self @@ -496,7 +496,7 @@ - (void)setSize:(CGSize)size forView:(RCTUIView *)view // TODO(macOS ISS#3536887 forTag:view.reactTag]; } -- (void)setIntrinsicContentSize:(CGSize)intrinsicContentSize forView:(RCTUIView *)view // TODO(macOS ISS#3536887) +- (void)setIntrinsicContentSize:(CGSize)intrinsicContentSize forView:(RCTUIView *)view // [macOS] { RCTAssertMainQueue(); [self @@ -625,7 +625,7 @@ - (RCTViewManagerUIBlock)uiBlockWithLayoutUpdateForRootView:(RCTRootShadowView * CGSize contentSize = shadowView.layoutMetrics.frame.size; RCTExecuteOnMainQueue(^{ - RCTPlatformView *view = self->_viewRegistry[reactTag]; // TODO(macOS GH#774) + RCTPlatformView *view = self->_viewRegistry[reactTag]; // [macOS] RCTAssert(view != nil, @"view (for ID %@) not found", reactTag); RCTRootView *rootView = (RCTRootView *)[view superview]; @@ -637,7 +637,7 @@ - (RCTViewManagerUIBlock)uiBlockWithLayoutUpdateForRootView:(RCTRootShadowView * } // Perform layout (possibly animated) - return ^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { // TODO(macOS GH#774) + return ^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { // [macOS] const RCTFrameData *frameDataArray = (const RCTFrameData *)framesData.bytes; RCTLayoutAnimationGroup *layoutAnimationGroup = uiManager->_layoutAnimationGroup; @@ -647,7 +647,7 @@ - (RCTViewManagerUIBlock)uiBlockWithLayoutUpdateForRootView:(RCTRootShadowView * for (NSNumber *reactTag in reactTags) { RCTFrameData frameData = frameDataArray[index++]; - RCTPlatformView *view = viewRegistry[reactTag]; // TODO(macOS GH#774) + RCTPlatformView *view = viewRegistry[reactTag]; // [macOS] CGRect frame = frameData.frame; UIUserInterfaceLayoutDirection layoutDirection = frameData.layoutDirection; @@ -795,15 +795,15 @@ - (void)_removeChildren:(NSArray> *)children fromContainer:(id< /** * Remove subviews from their parent with an animation. */ -- (void)_removeChildren:(NSArray *)children // TODO(macOS GH#774) - fromContainer:(RCTPlatformView *)container // TODO(macOS GH#774) +- (void)_removeChildren:(NSArray *)children // [macOS] + fromContainer:(RCTPlatformView *)container // [macOS] withAnimation:(RCTLayoutAnimationGroup *)animation { RCTAssertMainQueue(); RCTLayoutAnimation *deletingLayoutAnimation = animation.deletingLayoutAnimation; __block NSUInteger completionsCalled = 0; - for (RCTPlatformView *removedChild in children) { // TODO(macOS GH#774) + for (RCTPlatformView *removedChild in children) { // [macOS] void (^completion)(BOOL) = ^(BOOL finished) { completionsCalled++; @@ -825,25 +825,25 @@ - (void)_removeChildren:(NSArray *)children // TODO(macOS GH# // Here the problem: the default implementation of `-[UIView removeReactSubview:]` also removes the view from // UIKit's hierarchy. So, let's temporary restore the view back after removing. To do so, we have to memorize // original `superview` (which can differ from `container`) and an index of removed view. - RCTPlatformView *originalSuperview = removedChild.superview; // TODO(macOS GH#774) + RCTPlatformView *originalSuperview = removedChild.superview; // [macOS] NSUInteger originalIndex = [originalSuperview.subviews indexOfObjectIdenticalTo:removedChild]; -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS NSView *nextLowerView = nil; if (originalIndex > 0) { nextLowerView = [originalSuperview.subviews objectAtIndex:originalIndex - 1]; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] [container removeReactSubview:removedChild]; // Disable user interaction while the view is animating // since the view is (conceptually) deleted and not supposed to be interactive. - if ([removedChild respondsToSelector:@selector(setUserInteractionEnabled:)]) { // [TODO(macOS GH#774) - ((RCTUIView *)removedChild).userInteractionEnabled = NO; // TODO(macOS ISS#3536887) + if ([removedChild respondsToSelector:@selector(setUserInteractionEnabled:)]) { // [macOS + ((RCTUIView *)removedChild).userInteractionEnabled = NO; // [macOS] } -#if !TARGET_OS_OSX // ]TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [originalSuperview insertSubview:removedChild atIndex:originalIndex]; -#else // [TODO(macOS GH#774) +#else // [macOS [originalSuperview addSubview:removedChild positioned:nextLowerView == nil ? NSWindowBelow : NSWindowAbove relativeTo:nextLowerView]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] NSString *property = deletingLayoutAnimation.property; [deletingLayoutAnimation @@ -873,9 +873,9 @@ - (void)_removeChildren:(NSArray *)children // TODO(macOS GH# [_shadowViewRegistry removeObjectForKey:rootReactTag]; [_rootViewTags removeObject:rootReactTag]; - [self addUIBlock:^(RCTUIManager *uiManager, NSDictionary *viewRegistry) { // TODO(macOS GH#774) + [self addUIBlock:^(RCTUIManager *uiManager, NSDictionary *viewRegistry) { // [macOS] RCTAssertMainQueue(); - RCTPlatformView *rootView = viewRegistry[rootReactTag]; // TODO(macOS GH#774) + RCTPlatformView *rootView = viewRegistry[rootReactTag]; // [macOS] [uiManager _purgeChildren:(NSArray> *)rootView.reactSubviews fromRegistry:(NSMutableDictionary> *)viewRegistry]; [(NSMutableDictionary *)viewRegistry removeObjectForKey:rootReactTag]; @@ -911,7 +911,7 @@ - (void)_removeChildren:(NSArray *)children // TODO(macOS GH# { RCTSetChildren(containerTag, reactTags, (NSDictionary> *)_shadowViewRegistry); - [self addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { // TODO(macOS GH#774) + [self addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { // [macOS] RCTSetChildren(containerTag, reactTags, (NSDictionary> *)viewRegistry); }]; @@ -949,7 +949,7 @@ static void RCTSetChildren( removeAtIndices:removeAtIndices registry:(NSMutableDictionary> *)_shadowViewRegistry]; - [self addUIBlock:^(RCTUIManager *uiManager, NSDictionary *viewRegistry) { // TODO(macOS GH#774) + [self addUIBlock:^(RCTUIManager *uiManager, NSDictionary *viewRegistry) { // [macOS] [uiManager _manageChildren:containerTag moveFromIndices:moveFromIndices moveToIndices:moveToIndices @@ -986,8 +986,8 @@ - (void)_manageChildren:(NSNumber *)containerTag BOOL isUIViewRegistry = ((id)registry == (id)_viewRegistry); if (isUIViewRegistry && _layoutAnimationGroup.deletingLayoutAnimation) { - [self _removeChildren:(NSArray *)permanentlyRemovedChildren // TODO(macOS GH#774) - fromContainer:(RCTPlatformView *)container // TODO(macOS GH#774) + [self _removeChildren:(NSArray *)permanentlyRemovedChildren // [macOS] + fromContainer:(RCTPlatformView *)container // [macOS] withAnimation:_layoutAnimationGroup]; } else { [self _removeChildren:permanentlyRemovedChildren fromContainer:container]; @@ -1044,7 +1044,7 @@ - (void)_manageChildren:(NSNumber *)containerTag // Dispatch view creation directly to the main thread instead of adding to // UIBlocks array. This way, it doesn't get deferred until after layout. - __block RCTPlatformView *preliminaryCreatedView = nil; // TODO(macOS GH#774) + __block RCTPlatformView *preliminaryCreatedView = nil; // [macOS] void (^createViewBlock)(void) = ^{ // Do nothing on the second run. @@ -1068,7 +1068,7 @@ - (void)_manageChildren:(NSNumber *)containerTag RCTExecuteOnMainQueue(createViewBlock); - [self addUIBlock:^(__unused RCTUIManager *uiManager, __unused NSDictionary *viewRegistry) { // TODO(macOS GH#774) + [self addUIBlock:^(__unused RCTUIManager *uiManager, __unused NSDictionary *viewRegistry) { // [macOS] createViewBlock(); if (preliminaryCreatedView) { @@ -1089,8 +1089,8 @@ - (void)_manageChildren:(NSNumber *)containerTag RCTComponentData *componentData = _componentDataByName[shadowView.viewName ?: viewName]; [componentData setProps:props forShadowView:shadowView]; - [self addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { // TODO(macOS GH#774) - RCTPlatformView *view = viewRegistry[reactTag]; // TODO(macOS GH#774) + [self addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { // [macOS] + RCTPlatformView *view = viewRegistry[reactTag]; // [macOS] [componentData setProps:props forView:view]; }]; @@ -1101,22 +1101,22 @@ - (void)synchronouslyUpdateViewOnUIThread:(NSNumber *)reactTag viewName:(NSStrin { RCTAssertMainQueue(); RCTComponentData *componentData = _componentDataByName[viewName]; - RCTPlatformView *view = _viewRegistry[reactTag]; // TODO(macOS ISS#3536887) + RCTPlatformView *view = _viewRegistry[reactTag]; // [macOS] [componentData setProps:props forView:view]; } RCT_EXPORT_METHOD(focus : (nonnull NSNumber *)reactTag) { - [self addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { // TODO(macOS ISS#3536887) - RCTUIView *newResponder = viewRegistry[reactTag]; // TODO(macOS ISS#3536887) + [self addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { // [macOS] + RCTUIView *newResponder = viewRegistry[reactTag]; // [macOS] [newResponder reactFocus]; }]; } RCT_EXPORT_METHOD(blur : (nonnull NSNumber *)reactTag) { - [self addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { // TODO(macOS ISS#3536887) - RCTUIView *currentResponder = viewRegistry[reactTag]; // TODO(macOS ISS#3536887) + [self addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { // [macOS] + RCTUIView *currentResponder = viewRegistry[reactTag]; // [macOS] [currentResponder reactBlur]; }]; } @@ -1126,9 +1126,9 @@ - (void)synchronouslyUpdateViewOnUIThread:(NSNumber *)reactTag viewName:(NSStrin : (CGPoint)point callback : (RCTResponseSenderBlock)callback) { - [self addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { // TODO(macOS GH#774) - RCTPlatformView *view = viewRegistry[reactTag]; // TODO(macOS GH#774) - RCTPlatformView *target = RCTUIViewHitTestWithEvent(view, point, nil); // TODO(macOS GH#774) and TODO(macOS ISS#3536887) + [self addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { // [macOS] + RCTPlatformView *view = viewRegistry[reactTag]; // [macOS] + RCTPlatformView *target = RCTUIViewHitTestWithEvent(view, point, nil); // [macOS] CGRect frame = [target convertRect:target.bounds toView:view]; while (target.reactTag == nil && target.superview != nil) { @@ -1154,7 +1154,7 @@ - (void)synchronouslyUpdateViewOnUIThread:(NSNumber *)reactTag viewName:(NSStrin RCTComponentData *componentData = _componentDataByName[shadowView.viewName]; // Re-enable componentViewName_DO_NOT_USE_THIS_IS_BROKEN once macOS uses Fabric -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] // Achtung! Achtung! // This is a remarkably hacky and ugly workaround. // We need this only temporary for some testing. We need this hack until Fabric fully implements command-execution @@ -1162,7 +1162,7 @@ - (void)synchronouslyUpdateViewOnUIThread:(NSNumber *)reactTag viewName:(NSStrin #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wundeclared-selector" if (!componentData) { - __block RCTPlatformView *view; // TODO(macOS GH#774) + __block RCTPlatformView *view; // [macOS] RCTUnsafeExecuteOnMainQueueSync(^{ view = self->_viewRegistry[reactTag]; }); @@ -1172,7 +1172,7 @@ - (void)synchronouslyUpdateViewOnUIThread:(NSNumber *)reactTag viewName:(NSStrin } } #pragma clang diagnostic pop -#endif // ]TODO(macOS GH#774) +#endif // [macOS] Class managerClass = componentData.managerClass; RCTModuleData *moduleData = [_bridge moduleDataForName:RCTBridgeModuleNameForClass(managerClass)]; @@ -1320,9 +1320,9 @@ - (void)_dispatchChildrenDidChangeEvents [tags addObject:shadowView.reactTag]; } - [self addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { // TODO(macOS ISS#3536887) + [self addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { // [macOS] for (NSNumber *tag in tags) { - RCTUIView *view = viewRegistry[tag]; // TODO(macOS ISS#3536887) + RCTUIView *view = viewRegistry[tag]; // [macOS] [view didUpdateReactSubviews]; } }]; @@ -1345,9 +1345,9 @@ - (void)_dispatchPropsDidChangeEvents [tags setObject:props forKey:shadowView.reactTag]; } - [self addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { // TODO(macOS ISS#3536887) + [self addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { // [macOS] for (NSNumber *tag in tags) { - RCTUIView *view = viewRegistry[tag]; // TODO(macOS ISS#3536887) + RCTUIView *view = viewRegistry[tag]; // [macOS] [view didSetProps:[tags objectForKey:tag]]; } }]; @@ -1355,8 +1355,8 @@ - (void)_dispatchPropsDidChangeEvents RCT_EXPORT_METHOD(measure : (nonnull NSNumber *)reactTag callback : (RCTResponseSenderBlock)callback) { - [self addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { // TODO(macOS GH#774) - RCTPlatformView *view = viewRegistry[reactTag]; // TODO(macOS GH#774) + [self addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { // [macOS] + RCTPlatformView *view = viewRegistry[reactTag]; // [macOS] if (!view) { // this view was probably collapsed out RCTLogWarn(@"measure cannot find view with tag #%@", reactTag); @@ -1365,7 +1365,7 @@ - (void)_dispatchPropsDidChangeEvents } // If in a , rootView will be the root of the modal container. - RCTPlatformView *rootView = view; // TODO(macOS GH#774) + RCTPlatformView *rootView = view; // [macOS] while (rootView.superview && ![rootView isReactRootView]) { rootView = rootView.superview; } @@ -1388,8 +1388,8 @@ - (void)_dispatchPropsDidChangeEvents RCT_EXPORT_METHOD(measureInWindow : (nonnull NSNumber *)reactTag callback : (RCTResponseSenderBlock)callback) { - [self addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { // TODO(macOS GH#774) - RCTPlatformView *view = viewRegistry[reactTag]; // TODO(macOS GH#774) + [self addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { // [macOS] + RCTPlatformView *view = viewRegistry[reactTag]; // [macOS] if (!view) { // this view was probably collapsed out RCTLogWarn(@"measure cannot find view with tag #%@", reactTag); @@ -1399,10 +1399,10 @@ - (void)_dispatchPropsDidChangeEvents // Return frame coordinates in window CGRect windowFrame = [view convertRect:view.bounds toView:nil]; -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS //The macOS default coordinate system has its origin at the lower left of the drawing area, so we need to flip the y-axis coordinate. windowFrame.origin.y = view.window.contentView.frame.size.height - windowFrame.origin.y - windowFrame.size.height; -#endif // ]TODO(macOS GH#774) +#endif // macOS] callback(@[ @(windowFrame.origin.x), @@ -1503,7 +1503,7 @@ static void RCTMeasureLayout(RCTShadowView *view, RCTShadowView *ancestor, RCTRe : (nonnull NSNumber *)reactTag blockNativeResponder : (__unused BOOL)blockNativeResponder) { - [self addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { // TODO(macOS GH#774) + [self addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { // [macOS] _jsResponder = viewRegistry[reactTag]; // Fabric view's are not stored in viewRegistry. We avoid logging a warning in that case. if (!_jsResponder && !RCTUIManagerTypeForTagIsFabric(reactTag)) { @@ -1514,7 +1514,7 @@ static void RCTMeasureLayout(RCTShadowView *view, RCTShadowView *ancestor, RCTRe RCT_EXPORT_METHOD(clearJSResponder) { - [self addUIBlock:^(__unused RCTUIManager *uiManager, __unused NSDictionary *viewRegistry) { // TODO(macOS GH#774) + [self addUIBlock:^(__unused RCTUIManager *uiManager, __unused NSDictionary *viewRegistry) { // [macOS] _jsResponder = nil; }]; } @@ -1522,7 +1522,7 @@ static void RCTMeasureLayout(RCTShadowView *view, RCTShadowView *ancestor, RCTRe static NSMutableDictionary *moduleConstantsForComponent( NSMutableDictionary *directEvents, NSMutableDictionary *bubblingEvents, - NSMutableDictionary *registrationCache, // TODO(macOS GH#774) + NSMutableDictionary *registrationCache, // [macOS] RCTComponentData *componentData) { NSMutableDictionary *moduleConstants = [NSMutableDictionary new]; @@ -1542,7 +1542,7 @@ static void RCTMeasureLayout(RCTShadowView *view, RCTShadowView *ancestor, RCTRe moduleConstants[@"bubblingEventTypes"] = bubblingEventTypes; moduleConstants[@"directEventTypes"] = directEventTypes; - NSString *componentName = [componentData name]; // TODO(macOS GH#774) + NSString *componentName = [componentData name]; // [macOS] // Add direct events for (NSString *eventName in viewConfig[@"directEvents"]) { @@ -1558,9 +1558,9 @@ static void RCTMeasureLayout(RCTShadowView *view, RCTShadowView *ancestor, RCTRe "direct event", componentName, eventName, - registrationCache[eventName] ?: @""); // TODO(macOS GH#774) + registrationCache[eventName] ?: @""); // [macOS] } - registrationCache[eventName] = componentName; // TODO(macOS GH#774) + registrationCache[eventName] = componentName; // [macOS] } // Add bubbling events @@ -1581,9 +1581,9 @@ static void RCTMeasureLayout(RCTShadowView *view, RCTShadowView *ancestor, RCTRe "bubbling event", componentName, eventName, - registrationCache[eventName] ?: @""); // TODO(macOS GH#774) + registrationCache[eventName] ?: @""); // [macOS] } - registrationCache[eventName] = componentName; // TODO(macOS GH#774) + registrationCache[eventName] = componentName; // [macOS] } return moduleConstants; @@ -1599,13 +1599,13 @@ static void RCTMeasureLayout(RCTShadowView *view, RCTShadowView *ancestor, RCTRe NSMutableDictionary *constants = [NSMutableDictionary new]; NSMutableDictionary *directEvents = [NSMutableDictionary new]; NSMutableDictionary *bubblingEvents = [NSMutableDictionary new]; - NSMutableDictionary *registrationCache = [NSMutableDictionary new]; // TODO(macOS GH#774) + NSMutableDictionary *registrationCache = [NSMutableDictionary new]; // [macOS] [_componentDataByName enumerateKeysAndObjectsUsingBlock:^(NSString *name, RCTComponentData *componentData, __unused BOOL *stop) { RCTAssert(!constants[name], @"UIManager already has constants for %@", componentData.name); NSMutableDictionary *moduleConstants = - moduleConstantsForComponent(directEvents, bubblingEvents, registrationCache, componentData); // TODO(macOS GH#774) + moduleConstantsForComponent(directEvents, bubblingEvents, registrationCache, componentData); // [macOS] constants[name] = moduleConstants; }]; @@ -1652,9 +1652,9 @@ static void RCTMeasureLayout(RCTShadowView *view, RCTShadowView *ancestor, RCTRe _componentDataByName[componentData.name] = componentData; NSMutableDictionary *directEvents = [NSMutableDictionary new]; NSMutableDictionary *bubblingEvents = [NSMutableDictionary new]; - NSMutableDictionary *registrationCache = [NSMutableDictionary new]; // TODO(macOS GH#774) + NSMutableDictionary *registrationCache = [NSMutableDictionary new]; // [macOS] NSMutableDictionary *moduleConstants = - moduleConstantsForComponent(directEvents, bubblingEvents, registrationCache, componentData); // TODO(macOS GH#774) + moduleConstantsForComponent(directEvents, bubblingEvents, registrationCache, componentData); // [macOS] return @{ @"viewConfig" : moduleConstants, }; @@ -1668,12 +1668,12 @@ static void RCTMeasureLayout(RCTShadowView *view, RCTShadowView *ancestor, RCTRe RCTLayoutAnimationGroup *layoutAnimationGroup = [[RCTLayoutAnimationGroup alloc] initWithConfig:config callback:callback]; - [self addUIBlock:^(RCTUIManager *uiManager, __unused NSDictionary *viewRegistry) { // TODO(macOS GH#774) + [self addUIBlock:^(RCTUIManager *uiManager, __unused NSDictionary *viewRegistry) { // [macOS] [uiManager setNextLayoutAnimationGroup:layoutAnimationGroup]; }]; } -- (void)rootViewForReactTag:(NSNumber *)reactTag withCompletion:(void (^)(RCTPlatformView *view))completion // TODO(macOS GH#774) +- (void)rootViewForReactTag:(NSNumber *)reactTag withCompletion:(void (^)(RCTPlatformView *view))completion // [macOS] { RCTAssertMainQueue(); RCTAssert(completion != nil, @"Attempted to resolve rootView for tag %@ without a completion block", reactTag); @@ -1686,7 +1686,7 @@ - (void)rootViewForReactTag:(NSNumber *)reactTag withCompletion:(void (^)(RCTPla RCTExecuteOnUIManagerQueue(^{ NSNumber *rootTag = [self shadowViewForReactTag:reactTag].rootView.reactTag; RCTExecuteOnMainQueue(^{ - RCTPlatformView *rootView = nil; // TODO(macOS GH#774) + RCTPlatformView *rootView = nil; // [macOS] if (rootTag != nil) { rootView = [self viewForReactTag:rootTag]; } @@ -1696,9 +1696,9 @@ - (void)rootViewForReactTag:(NSNumber *)reactTag withCompletion:(void (^)(RCTPla } -static RCTPlatformView *_jsResponder; // TODO(macOS GH#774) +static RCTPlatformView *_jsResponder; // [macOS] -+ (RCTPlatformView *)JSResponder // TODO(macOS GH#774) ++ (RCTPlatformView *)JSResponder // [macOS] { return _jsResponder; } diff --git a/React/Modules/RCTUIManagerObserverCoordinator.h b/React/Modules/RCTUIManagerObserverCoordinator.h index 4303ba9be26056..a2447f8025d4ea 100644 --- a/React/Modules/RCTUIManagerObserverCoordinator.h +++ b/React/Modules/RCTUIManagerObserverCoordinator.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import diff --git a/React/Modules/RCTUIManagerUtils.h b/React/Modules/RCTUIManagerUtils.h index ab1d42308e3406..e5dc9b8d1b120c 100644 --- a/React/Modules/RCTUIManagerUtils.h +++ b/React/Modules/RCTUIManagerUtils.h @@ -6,7 +6,7 @@ */ #import -#import // TODO(macOS GH#774) +#import // [macOS] #import #import diff --git a/React/Profiler/RCTProfile.m b/React/Profiler/RCTProfile.m index 85327a39dc83cd..eefe0b01fe1cfa 100644 --- a/React/Profiler/RCTProfile.m +++ b/React/Profiler/RCTProfile.m @@ -13,7 +13,7 @@ #import #import -#import // TODO(macOS GH#774) +#import // [macOS] #import "RCTAssert.h" #import "RCTBridge+Private.h" @@ -49,10 +49,10 @@ static NSTimeInterval RCTProfileStartTime; static NSUInteger RCTProfileEventID = 0; static __weak RCTBridge *_RCTProfilingBridge; -#if !TARGET_OS_OSX // TODO(macOS GH#774) -static CADisplayLink *RCTProfileDisplayLink; // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] +static CADisplayLink *RCTProfileDisplayLink; // [macOS] static UIWindow *RCTProfileControlsWindow; -#endif // TODO(macOS GH#774) +#endif // [macOS] #pragma mark - Macros @@ -204,10 +204,10 @@ void RCTProfileTrampolineEnd(void) RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @"objc_call,modules,auto"); } -static RCTUIView *(*originalCreateView)(RCTComponentData *, SEL, NSNumber *, NSNumber *); // TODO(macOS GH#774) -static RCTUIView *RCTProfileCreateView(RCTComponentData *self, SEL _cmd, NSNumber *tag, NSNumber *rootTag) // TODO(macOS GH#774) +static RCTUIView *(*originalCreateView)(RCTComponentData *, SEL, NSNumber *, NSNumber *); // [macOS] +static RCTUIView *RCTProfileCreateView(RCTComponentData *self, SEL _cmd, NSNumber *tag, NSNumber *rootTag) // [macOS] { - RCTUIView *view = originalCreateView(self, _cmd, tag, rootTag); // TODO(macOS GH#774) + RCTUIView *view = originalCreateView(self, _cmd, tag, rootTag); // [macOS] RCTProfileHookInstance(view); return view; } @@ -369,7 +369,7 @@ void RCTProfileUnhookModules(RCTBridge *bridge) #pragma mark - Private ObjC class only used for the vSYNC CADisplayLink target -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] @interface RCTProfile : NSObject @end @@ -427,7 +427,7 @@ + (void)drag:(UIPanGestureRecognizer *)gestureRecognizer } @end -#endif // TODO(macOS GH#774) +#endif // [macOS] #pragma mark - Public Functions @@ -487,10 +487,10 @@ void RCTProfileInit(RCTBridge *bridge) RCTProfileHookModules(bridge); -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCTProfileDisplayLink = [CADisplayLink displayLinkWithTarget:[RCTProfile class] selector:@selector(vsync:)]; [RCTProfileDisplayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes]; -#endif // TODO(macOS GH#774) +#endif // [macOS] [[NSNotificationCenter defaultCenter] postNotificationName:RCTProfileDidStartProfiling object:bridge]; } @@ -505,10 +505,10 @@ void RCTProfileEnd(RCTBridge *bridge, void (^callback)(NSString *)) [[NSNotificationCenter defaultCenter] postNotificationName:RCTProfileDidEndProfiling object:bridge]; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [RCTProfileDisplayLink invalidate]; RCTProfileDisplayLink = nil; -#endif // TODO(macOS GH#774) +#endif // [macOS] RCTProfileUnhookModules(bridge); @@ -754,13 +754,7 @@ void RCTProfileSendResult(RCTBridge *bridge, NSString *route, NSData *data) NSString *message = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]; if (message.length) { -#if TARGET_OS_OSX // [TODO(macOS GH#774) - NSAlert *alert = [NSAlert new]; - alert.messageText = @"Profile"; - alert.informativeText = message; - [alert addButtonWithTitle:@"OK"]; - [alert runModal]; -#else // ]TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] dispatch_async(dispatch_get_main_queue(), ^{ UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Profile" @@ -771,7 +765,13 @@ void RCTProfileSendResult(RCTBridge *bridge, NSString *route, NSData *data) handler:nil]]; [RCTPresentedViewController() presentViewController:alertController animated:YES completion:nil]; }); -#endif // TODO(macOS GH#774) +#else // [macOS + NSAlert *alert = [NSAlert new]; + alert.messageText = @"Profile"; + alert.informativeText = message; + [alert addButtonWithTitle:@"OK"]; + [alert runModal]; +#endif // macOS] } } }]; @@ -779,7 +779,7 @@ void RCTProfileSendResult(RCTBridge *bridge, NSString *route, NSData *data) [task resume]; } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] void RCTProfileShowControls(void) { static const CGFloat height = 30; @@ -818,6 +818,6 @@ void RCTProfileHideControls(void) RCTProfileControlsWindow.hidden = YES; RCTProfileControlsWindow = nil; } -#endif // TODO(macOS GH#774) +#endif // [macOS] #endif diff --git a/React/React-RCTFabric.podspec b/React/React-RCTFabric.podspec index d900aa31ace24c..cda312df82c224 100644 --- a/React/React-RCTFabric.podspec +++ b/React/React-RCTFabric.podspec @@ -28,7 +28,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "11.0", :osx => "10.15" } # TODO(macOS GH#774) + s.platforms = { :ios => "11.0", :osx => "10.15" } # [macOS] s.source = source s.source_files = "Fabric/**/*.{c,h,m,mm,S,cpp}" s.exclude_files = "**/tests/*", diff --git a/React/UIUtils/RCTUIUtils.h b/React/UIUtils/RCTUIUtils.h index eae01325311016..bdd75663c5a655 100644 --- a/React/UIUtils/RCTUIUtils.h +++ b/React/UIUtils/RCTUIUtils.h @@ -7,7 +7,7 @@ #import #import -#import // TODO(macOS GH#774) +#import // [macOS] NS_ASSUME_NONNULL_BEGIN @@ -22,17 +22,17 @@ typedef struct { } window, screen; } RCTDimensions; extern __attribute__((visibility("default"))) -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCTDimensions RCTGetDimensions(CGFloat fontScale); -#else // [TODO(macOS GH#774) +#else // [macOS RCTDimensions RCTGetDimensions(RCTPlatformView *rootView); -#endif // ]TODO(macOS GH#774) +#endif // macOS] -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] // Get font size multiplier for font base size (Large) by content size category extern __attribute__((visibility("default"))) CGFloat RCTGetMultiplierForContentSizeCategory( UIContentSizeCategory category); -#endif // TODO(macOS GH#774) +#endif // [macOS] #ifdef __cplusplus } diff --git a/React/UIUtils/RCTUIUtils.m b/React/UIUtils/RCTUIUtils.m index bc37616313ac8f..fdac0db4c06432 100644 --- a/React/UIUtils/RCTUIUtils.m +++ b/React/UIUtils/RCTUIUtils.m @@ -9,7 +9,7 @@ #import "RCTUtils.h" -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCTDimensions RCTGetDimensions(CGFloat fontScale) { UIScreen *mainScreen = UIScreen.mainScreen; @@ -56,7 +56,7 @@ CGFloat RCTGetMultiplierForContentSizeCategory(UIContentSizeCategory category) return value > 0.0 ? value : 1.0; } -#else // [TODO(macOS GH#774) +#else // [macOS RCTDimensions RCTGetDimensions(RCTPlatformView *rootView) { RCTDimensions dimensions = { @@ -97,4 +97,4 @@ RCTDimensions RCTGetDimensions(RCTPlatformView *rootView) { return dimensions; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] diff --git a/React/Views/RCTActivityIndicatorView.h b/React/Views/RCTActivityIndicatorView.h index 6101846d78d834..81a3c5e02c200b 100644 --- a/React/Views/RCTActivityIndicatorView.h +++ b/React/Views/RCTActivityIndicatorView.h @@ -5,17 +5,17 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] @interface RCTActivityIndicatorView : UIActivityIndicatorView -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS @property (nonatomic, assign) UIActivityIndicatorViewStyle activityIndicatorViewStyle; @property (nonatomic, assign) BOOL hidesWhenStopped; -@property (nullable, readwrite, nonatomic, strong) RCTUIColor *color; // TODO(OSS Candidate ISS#2710739) +@property (nullable, readwrite, nonatomic, strong) RCTUIColor *color; // [macOS] @property (nonatomic, readonly, getter=isAnimating) BOOL animating; - (void)startAnimating; - (void)stopAnimating; -#endif // ]TODO(macOS GH#774) +#endif // macOS] @end diff --git a/React/Views/RCTActivityIndicatorView.m b/React/Views/RCTActivityIndicatorView.m index 3a7124465d91f4..38beea6b7ffed8 100644 --- a/React/Views/RCTActivityIndicatorView.m +++ b/React/Views/RCTActivityIndicatorView.m @@ -7,19 +7,19 @@ #import "RCTActivityIndicatorView.h" -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS #import #import @interface RCTActivityIndicatorView () @property (nonatomic, readwrite, getter=isAnimating) BOOL animating; @end -#endif // ]TODO(macOS GH#774) +#endif // macOS] @implementation RCTActivityIndicatorView { } -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS - (instancetype)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) { @@ -111,7 +111,7 @@ - (BOOL)hidesWhenStopped return !self.displayedWhenStopped; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] - (void)setHidden:(BOOL)hidden { diff --git a/React/Views/RCTActivityIndicatorViewManager.m b/React/Views/RCTActivityIndicatorViewManager.m index 07b68c42aada86..501adb0be1500b 100644 --- a/React/Views/RCTActivityIndicatorViewManager.m +++ b/React/Views/RCTActivityIndicatorViewManager.m @@ -30,26 +30,26 @@ @implementation RCTActivityIndicatorViewManager RCT_EXPORT_MODULE() -- (RCTPlatformView *)view // TODO(macOS GH#774) +- (RCTPlatformView *)view // [macOS] { return [RCTActivityIndicatorView new]; } RCT_EXPORT_VIEW_PROPERTY(color, UIColor) RCT_EXPORT_VIEW_PROPERTY(hidesWhenStopped, BOOL) -RCT_CUSTOM_VIEW_PROPERTY(size, UIActivityIndicatorViewStyle, RCTActivityIndicatorView) // TODO(macOS GH#774) +RCT_CUSTOM_VIEW_PROPERTY(size, UIActivityIndicatorViewStyle, RCTActivityIndicatorView) // [macOS] { /* Setting activityIndicatorViewStyle overrides the color, so restore the original color after setting the indicator style. */ - RCTUIColor *oldColor = view.color; // TODO(macOS GH#774) + RCTUIColor *oldColor = view.color; // [macOS] view.activityIndicatorViewStyle = json ? [RCTConvert UIActivityIndicatorViewStyle:json] : defaultView.activityIndicatorViewStyle; view.color = oldColor; } -RCT_CUSTOM_VIEW_PROPERTY(animating, BOOL, RCTActivityIndicatorView) // TODO(macOS GH#774) +RCT_CUSTOM_VIEW_PROPERTY(animating, BOOL, RCTActivityIndicatorView) // [macOS] { BOOL animating = json ? [RCTConvert BOOL:json] : [defaultView isAnimating]; if (animating != [view isAnimating]) { diff --git a/React/Views/RCTAnimationType.h b/React/Views/RCTAnimationType.h index 3471fd1ee0ef99..2f74280ccd2e96 100644 --- a/React/Views/RCTAnimationType.h +++ b/React/Views/RCTAnimationType.h @@ -8,14 +8,14 @@ #import typedef NS_ENUM(NSInteger, RCTAnimationType) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCTAnimationTypeSpring = 0, -#endif // TODO(macOS GH#774) +#endif // [macOS] RCTAnimationTypeLinear, RCTAnimationTypeEaseIn, RCTAnimationTypeEaseOut, RCTAnimationTypeEaseInEaseOut, -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCTAnimationTypeKeyboard, -#endif // TODO(macOS GH#774) +#endif // [macOS] }; diff --git a/React/Views/RCTAutoInsetsProtocol.h b/React/Views/RCTAutoInsetsProtocol.h index 3e629d8a14a603..df9ab00d13300e 100644 --- a/React/Views/RCTAutoInsetsProtocol.h +++ b/React/Views/RCTAutoInsetsProtocol.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] /** * Defines a View that wants to support auto insets adjustment diff --git a/React/Views/RCTBorderDrawing.h b/React/Views/RCTBorderDrawing.h index 38316d4340fe2a..dec9bdc0e70f8c 100644 --- a/React/Views/RCTBorderDrawing.h +++ b/React/Views/RCTBorderDrawing.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import @@ -66,4 +66,4 @@ RCT_EXTERN UIImage *RCTGetBorderImage( RCTBorderColors borderColors, CGColorRef backgroundColor, BOOL drawToEdge, - CGFloat scaleFactor); // TODO(macOS GH#774) + CGFloat scaleFactor); // [macOS] diff --git a/React/Views/RCTBorderDrawing.m b/React/Views/RCTBorderDrawing.m index be57a8022d03f0..43071e09c6e9dc 100644 --- a/React/Views/RCTBorderDrawing.m +++ b/React/Views/RCTBorderDrawing.m @@ -54,19 +54,19 @@ RCTCornerInsets RCTGetCornerInsets(RCTCornerRadii cornerRadii, UIEdgeInsets edge static UIEdgeInsets RCTRoundInsetsToPixel( UIEdgeInsets edgeInsets, - CGFloat scaleFactor // TODO(macOS GH#774) + CGFloat scaleFactor // [macOS] ) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] edgeInsets.top = RCTRoundPixelValue(edgeInsets.top); edgeInsets.bottom = RCTRoundPixelValue(edgeInsets.bottom); edgeInsets.left = RCTRoundPixelValue(edgeInsets.left); edgeInsets.right = RCTRoundPixelValue(edgeInsets.right); -#else // [TODO(macOS GH#774) +#else // [macOS edgeInsets.top = RCTRoundPixelValue(edgeInsets.top, scaleFactor); edgeInsets.bottom = RCTRoundPixelValue(edgeInsets.bottom, scaleFactor); edgeInsets.left = RCTRoundPixelValue(edgeInsets.left, scaleFactor); edgeInsets.right = RCTRoundPixelValue(edgeInsets.right, scaleFactor); -#endif // ]TODO(macOS GH#774) +#endif // macOS] return edgeInsets; } @@ -186,11 +186,11 @@ static CGPathRef RCTPathCreateOuterOutline(BOOL drawToEdge, CGRect rect, RCTCorn CGColorRef backgroundColor, BOOL hasCornerRadii, BOOL drawToEdge, - CGFloat scaleFactor // TODO(macOS GH#774) + CGFloat scaleFactor // [macOS] ) { const CGFloat alpha = CGColorGetAlpha(backgroundColor); const BOOL opaque = (drawToEdge || !hasCornerRadii) && alpha == 1.0; - UIGraphicsBeginImageContextWithOptions(size, opaque, scaleFactor); // TODO(macOS GH#774) + UIGraphicsBeginImageContextWithOptions(size, opaque, scaleFactor); // [macOS] return UIGraphicsGetCurrentContext(); } @@ -201,7 +201,7 @@ static CGPathRef RCTPathCreateOuterOutline(BOOL drawToEdge, CGRect rect, RCTCorn RCTBorderColors borderColors, CGColorRef backgroundColor, BOOL drawToEdge, - CGFloat scaleFactor // TODO(macOS GH#774) + CGFloat scaleFactor // [macOS] ) { const BOOL hasCornerRadii = RCTCornerRadiiAreAboveThreshold(cornerRadii); const RCTCornerInsets cornerInsets = RCTGetCornerInsets(cornerRadii, borderInsets); @@ -209,7 +209,7 @@ static CGPathRef RCTPathCreateOuterOutline(BOOL drawToEdge, CGRect rect, RCTCorn // Incorrect render for borders that are not proportional to device pixel: borders get stretched and become // significantly bigger than expected. // Rdar: http://www.openradar.me/15959788 - borderInsets = RCTRoundInsetsToPixel(borderInsets, scaleFactor); // TODO(macOS GH#774) + borderInsets = RCTRoundInsetsToPixel(borderInsets, scaleFactor); // [macOS] const BOOL makeStretchable = (borderInsets.left + cornerInsets.topLeft.width + borderInsets.right + cornerInsets.bottomRight.width <= @@ -243,12 +243,12 @@ static CGPathRef RCTPathCreateOuterOutline(BOOL drawToEdge, CGRect rect, RCTCorn edgeInsets.top + 1 + edgeInsets.bottom } : viewSize; - // [TODO(OSS Candidate ISS#2710739): size must nonzero + // [macOS size must nonzero if (size.width <= 0 || size.height <= 0) { return nil; - } // ]TODO(OSS Candidate ISS#2710739) + } // macOS] - CGContextRef ctx = RCTUIGraphicsBeginImageContext(size, backgroundColor, hasCornerRadii, drawToEdge, scaleFactor); // TODO(macOS GH#774) + CGContextRef ctx = RCTUIGraphicsBeginImageContext(size, backgroundColor, hasCornerRadii, drawToEdge, scaleFactor); // [macOS] const CGRect rect = {.size = size}; CGPathRef path = RCTPathCreateOuterOutline(drawToEdge, rect, cornerRadii); @@ -408,11 +408,11 @@ static CGPathRef RCTPathCreateOuterOutline(BOOL drawToEdge, CGRect rect, RCTCorn UIGraphicsEndImageContext(); if (makeStretchable) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] image = [image resizableImageWithCapInsets:edgeInsets]; -#else // [TODO(macOS GH#774) +#else // [macOS image.capInsets = edgeInsets; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } return image; @@ -486,7 +486,7 @@ static CGPathRef RCTPathCreateOuterOutline(BOOL drawToEdge, CGRect rect, RCTCorn RCTBorderColors borderColors, CGColorRef backgroundColor, BOOL drawToEdge, - CGFloat scaleFactor // TODO(macOS GH#774) + CGFloat scaleFactor // [macOS] ) { NSCParameterAssert(borderStyle == RCTBorderStyleDashed || borderStyle == RCTBorderStyleDotted); @@ -500,13 +500,13 @@ static CGPathRef RCTPathCreateOuterOutline(BOOL drawToEdge, CGRect rect, RCTCorn return nil; } - // [TODO(OSS Candidate ISS#2710739): viewSize must nonzero + // [macOS viewSize must nonzero if (viewSize.width <= 0 || viewSize.height <= 0) { return nil; - } // ]TODO(OSS Candidate ISS#2710739) + } // macOS] const BOOL hasCornerRadii = RCTCornerRadiiAreAboveThreshold(cornerRadii); - CGContextRef ctx = RCTUIGraphicsBeginImageContext(viewSize, backgroundColor, hasCornerRadii, drawToEdge, scaleFactor); // TODO(macOS GH#774) + CGContextRef ctx = RCTUIGraphicsBeginImageContext(viewSize, backgroundColor, hasCornerRadii, drawToEdge, scaleFactor); // [macOS] const CGRect rect = {.size = viewSize}; if (backgroundColor) { @@ -530,7 +530,7 @@ static CGPathRef RCTPathCreateOuterOutline(BOOL drawToEdge, CGRect rect, RCTCorn CGContextSetLineWidth(ctx, lineWidth); CGContextSetLineDash(ctx, 0, dashLengths, sizeof(dashLengths) / sizeof(*dashLengths)); - CGContextSetStrokeColorWithColor(ctx, [RCTUIColor yellowColor].CGColor); // TODO(OSS Candidate ISS#2710739) + CGContextSetStrokeColorWithColor(ctx, [RCTUIColor yellowColor].CGColor); // [macOS] CGContextAddPath(ctx, path); CGContextSetStrokeColorWithColor(ctx, borderColors.top); @@ -552,15 +552,15 @@ static CGPathRef RCTPathCreateOuterOutline(BOOL drawToEdge, CGRect rect, RCTCorn RCTBorderColors borderColors, CGColorRef backgroundColor, BOOL drawToEdge, - CGFloat scaleFactor // TODO(macOS GH#774) + CGFloat scaleFactor // [macOS] ) { switch (borderStyle) { case RCTBorderStyleSolid: - return RCTGetSolidBorderImage(cornerRadii, viewSize, borderInsets, borderColors, backgroundColor, drawToEdge, scaleFactor); // TODO(macOS GH#774) + return RCTGetSolidBorderImage(cornerRadii, viewSize, borderInsets, borderColors, backgroundColor, drawToEdge, scaleFactor); // [macOS] case RCTBorderStyleDashed: case RCTBorderStyleDotted: return RCTGetDashedOrDottedBorderImage( - borderStyle, cornerRadii, viewSize, borderInsets, borderColors, backgroundColor, drawToEdge, scaleFactor); // TODO(macOS GH#774) + borderStyle, cornerRadii, viewSize, borderInsets, borderColors, backgroundColor, drawToEdge, scaleFactor); // [macOS] case RCTBorderStyleUnset: break; } diff --git a/React/Views/RCTComponentData.h b/React/Views/RCTComponentData.h index b007b3888a7e2d..e3e203f64a9568 100644 --- a/React/Views/RCTComponentData.h +++ b/React/Views/RCTComponentData.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import @@ -13,7 +13,7 @@ @class RCTBridge; @class RCTShadowView; -@class RCTUIView; // TODO(macOS GH#774) +@class RCTUIView; // [macOS] @class RCTEventDispatcherProtocol; NS_ASSUME_NONNULL_BEGIN @@ -34,7 +34,7 @@ NS_ASSUME_NONNULL_BEGIN bridge:(RCTBridge *)bridge eventDispatcher:(id)eventDispatcher NS_DESIGNATED_INITIALIZER; -- (RCTPlatformView *)createViewWithTag:(nullable NSNumber *)tag rootTag:(nullable NSNumber *)rootTag; // TODO(macOS GH#774) +- (RCTPlatformView *)createViewWithTag:(nullable NSNumber *)tag rootTag:(nullable NSNumber *)rootTag; // [macOS] - (RCTShadowView *)createShadowViewWithTag:(NSNumber *)tag; - (void)setProps:(NSDictionary *)props forView:(id)view; - (void)setProps:(NSDictionary *)props forShadowView:(RCTShadowView *)shadowView; diff --git a/React/Views/RCTComponentData.m b/React/Views/RCTComponentData.m index 43e05a4cb2e5e7..9b593fb68191f8 100644 --- a/React/Views/RCTComponentData.m +++ b/React/Views/RCTComponentData.m @@ -74,18 +74,18 @@ - (RCTViewManager *)manager RCT_NOT_IMPLEMENTED(-(instancetype)init) -- (RCTPlatformView *)createViewWithTag:(nullable NSNumber *)tag rootTag:(nullable NSNumber *)rootTag // TODO(macOS GH#774) +- (RCTPlatformView *)createViewWithTag:(nullable NSNumber *)tag rootTag:(nullable NSNumber *)rootTag // [macOS] { RCTAssertMainQueue(); - RCTPlatformView *view = [self.manager view]; // TODO(macOS GH#774) + RCTPlatformView *view = [self.manager view]; // [macOS] view.reactTag = tag; view.rootTag = rootTag; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] view.multipleTouchEnabled = YES; view.userInteractionEnabled = YES; // required for touch handling view.layer.allowsGroupOpacity = YES; // required for touch handling -#endif // TODO(macOS GH#774) +#endif // [macOS] return view; } diff --git a/React/Views/RCTCursor.h b/React/Views/RCTCursor.h index 889b523eefc44e..a893cd40b66fa5 100644 --- a/React/Views/RCTCursor.h +++ b/React/Views/RCTCursor.h @@ -32,8 +32,8 @@ typedef NS_ENUM(NSInteger, RCTCursor) { @interface RCTConvert (RCTCursor) + (RCTCursor)RCTCursor:(id)json; -#if TARGET_OS_OSX // TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS + (NSCursor *)NSCursor:(RCTCursor)rctCursor; -#endif // ]TODO(macOS GH#774) +#endif // macOS] @end diff --git a/React/Views/RCTCursor.m b/React/Views/RCTCursor.m index 5350523c309610..a0f3b21146d907 100644 --- a/React/Views/RCTCursor.m +++ b/React/Views/RCTCursor.m @@ -36,7 +36,7 @@ @implementation RCTConvert (RCTCursor) RCTCursorAuto, integerValue) -#if TARGET_OS_OSX // TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS + (NSCursor *)NSCursor:(RCTCursor)rctCursor { NSCursor *cursor; @@ -100,6 +100,6 @@ + (NSCursor *)NSCursor:(RCTCursor)rctCursor return cursor; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] @end diff --git a/React/Views/RCTDatePicker.h b/React/Views/RCTDatePicker.h index 38888f70758e65..9778aaa75baf2d 100644 --- a/React/Views/RCTDatePicker.h +++ b/React/Views/RCTDatePicker.h @@ -5,12 +5,12 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] @interface RCTDatePicker : UIDatePicker -#else // [TODO(macOS GH#774) +#else // [macOS @interface RCTDatePicker : NSDatePicker -#endif // ]TODO(macOS GH#774) +#endif // macOS] @end diff --git a/React/Views/RCTDatePicker.m b/React/Views/RCTDatePicker.m index 80a3f9f61b275c..9d82f9df7d9605 100644 --- a/React/Views/RCTDatePicker.m +++ b/React/Views/RCTDatePicker.m @@ -33,21 +33,21 @@ @implementation RCTDatePicker - (instancetype)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [self addTarget:self action:@selector(didChange) forControlEvents:UIControlEventValueChanged]; -#else // [TODO(macOS GH#774) +#else // [macOS self.target = self; self.action = @selector(didChange); -#endif // ]TODO(macOS GH#774) +#endif // macOS] _reactMinuteInterval = 1; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] #if RCT_IOS_14_0_SDK_OR_LATER if (@available(iOS 14, *)) { self.preferredDatePickerStyle = UIDatePickerStyleWheels; } #endif // RCT_IOS_14_0_SDK_OR_LATER -#endif // ]TODO(macOS GH#774) +#endif // [macOS] } return self; } @@ -58,31 +58,31 @@ - (void)didChange { if (_onChange) { _onChange(@{ @"timestamp": -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] @(self.date.timeIntervalSince1970 * 1000.0) -#else // [TODO(macOS GH#774) +#else // [macOS @(self.dateValue.timeIntervalSince1970 * 1000.0) -#endif // ]TODO(macOS GH#774) +#endif // macOS] }); } } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)setDatePickerMode:(UIDatePickerMode)datePickerMode { [super setDatePickerMode:datePickerMode]; // We need to set minuteInterval after setting datePickerMode, otherwise minuteInterval is invalid in time mode. self.minuteInterval = _reactMinuteInterval; } -#endif // TODO(macOS GH#774) +#endif // [macOS] -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)setMinuteInterval:(NSInteger)minuteInterval { [super setMinuteInterval:minuteInterval]; _reactMinuteInterval = minuteInterval; } -#endif // TODO(macOS GH#774) +#endif // [macOS] @end diff --git a/React/Views/RCTDatePickerManager.h b/React/Views/RCTDatePickerManager.h index 55a8dd4d464bce..e4c152f4dbfe11 100644 --- a/React/Views/RCTDatePickerManager.h +++ b/React/Views/RCTDatePickerManager.h @@ -8,15 +8,15 @@ #import #import -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] @interface RCTConvert (UIDatePicker) + (UIDatePickerMode)UIDatePickerMode:(id)json; -#else // [TODO(macOS GH#774) +#else // [macOS @interface RCTConvert (NSDatePicker) + (NSDatePickerMode)NSDatePickerMode:(id)json; + (NSDatePickerStyle)NSDatePickerStyle:(id)json; -#endif // ]TODO(macOS GH#774) +#endif // macOS] @end diff --git a/React/Views/RCTDatePickerManager.m b/React/Views/RCTDatePickerManager.m index a9043e87645d9b..0d2b783c8ec65d 100644 --- a/React/Views/RCTDatePickerManager.m +++ b/React/Views/RCTDatePickerManager.m @@ -12,7 +12,7 @@ #import "RCTDatePicker.h" #import "UIView+React.h" -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] @implementation RCTConvert (UIDatePicker) RCT_ENUM_CONVERTER( @@ -25,7 +25,7 @@ @implementation RCTConvert (UIDatePicker) }), UIDatePickerModeTime, integerValue) -#else // [TODO(macOS GH#774) +#else // [macOS @implementation RCTConvert (NSDatePicker) RCT_ENUM_CONVERTER(NSDatePickerMode, (@{ @"single": @(NSSingleDateMode), @@ -36,7 +36,7 @@ @implementation RCTConvert (NSDatePicker) @"clock-calendar": @(NSClockAndCalendarDatePickerStyle), @"textfield": @(NSTextFieldDatePickerStyle) }), NSTextFieldAndStepperDatePickerStyle, unsignedIntegerValue) -#endif // ]TODO(macOS GH#774) +#endif // macOS] #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wunguarded-availability-new" @@ -59,12 +59,12 @@ @implementation RCTDatePickerManager RCT_EXPORT_MODULE() -- (RCTPlatformView *)view // TODO(macOS GH#774) +- (RCTPlatformView *)view // [macOS] { return [RCTDatePicker new]; } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCT_EXPORT_VIEW_PROPERTY(date, NSDate) RCT_EXPORT_VIEW_PROPERTY(locale, NSLocale) RCT_EXPORT_VIEW_PROPERTY(minimumDate, NSDate) @@ -73,7 +73,7 @@ - (RCTPlatformView *)view // TODO(macOS GH#774) RCT_EXPORT_VIEW_PROPERTY(onChange, RCTBubblingEventBlock) RCT_REMAP_VIEW_PROPERTY(mode, datePickerMode, UIDatePickerMode) RCT_REMAP_VIEW_PROPERTY(timeZoneOffsetInMinutes, timeZone, NSTimeZone) -#else // [TODO(macOS GH#774) +#else // [macOS RCT_REMAP_VIEW_PROPERTY(date, dateValue, NSDate) RCT_REMAP_VIEW_PROPERTY(minimumDate, minDate, NSDate) RCT_REMAP_VIEW_PROPERTY(maximumDate, maxDate, NSDate) @@ -81,30 +81,30 @@ - (RCTPlatformView *)view // TODO(macOS GH#774) RCT_REMAP_VIEW_PROPERTY(mode, datePickerMode, NSDatePickerMode) RCT_REMAP_VIEW_PROPERTY(timeZoneOffsetInMinutes, timeZone, NSTimeZone) RCT_REMAP_VIEW_PROPERTY(pickerStyle, datePickerStyle, NSDatePickerStyle) -#endif // ]TODO(macOS GH#774) +#endif // macOS] RCT_EXPORT_METHOD(setNativeDate : (nonnull NSNumber *)viewTag toDate : (NSDate *)date) { - [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary *viewRegistry) { // TODO(macOS GH#774) - RCTPlatformView *view = viewRegistry[viewTag]; // TODO(macOS GH#774) + [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary *viewRegistry) { // [macOS] + RCTPlatformView *view = viewRegistry[viewTag]; // [macOS] if ([view isKindOfClass:[RCTDatePicker class]]) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [(RCTDatePicker *)view setDate:date]; -#else // [TODO(macOS GH#774) +#else // [macOS [(RCTDatePicker *)view setDateValue:date]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } else { // This component is used in Fabric through LegacyInteropLayer. // `RCTDatePicker` view is subview of `RCTLegacyViewManagerInteropComponentView`. // `viewTag` passed as parameter to this method is tag of the `RCTLegacyViewManagerInteropComponentView`. - RCTPlatformView *subview = [uiManager viewForReactTag:viewTag].subviews.firstObject; // TODO(macOS GH#774) + RCTPlatformView *subview = [uiManager viewForReactTag:viewTag].subviews.firstObject; // [macOS] if ([subview isKindOfClass:[RCTDatePicker class]]) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [(RCTDatePicker *)subview setDate:date]; -#else // [TODO(macOS GH#774) +#else // [macOS [(RCTDatePicker *)subview setDateValue:date]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } else { RCTLogError(@"view type must be RCTDatePicker"); } diff --git a/React/Views/RCTFont.h b/React/Views/RCTFont.h index 899d7158aaaa78..5c2189ac26fd13 100644 --- a/React/Views/RCTFont.h +++ b/React/Views/RCTFont.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import diff --git a/React/Views/RCTFont.mm b/React/Views/RCTFont.mm index a2aca13656ecb0..b0c2826add0cf1 100644 --- a/React/Views/RCTFont.mm +++ b/React/Views/RCTFont.mm @@ -144,12 +144,12 @@ struct __attribute__((__packed__)) CacheKey { if (defaultFontHandler) { NSString *fontWeightDescription = FontWeightDescriptionFromUIFontWeight(weight); font = defaultFontHandler(size, fontWeightDescription); -#pragma clang diagnostic push // TODO(OSS Candidate ISS#2710739) -#pragma clang diagnostic ignored "-Wunguarded-availability" // TODO(OSS Candidate ISS#2710739) +#pragma clang diagnostic push // [macOS] +#pragma clang diagnostic ignored "-Wunguarded-availability" // [macOS] } else if ([UIFont respondsToSelector:@selector(systemFontOfSize:weight:)]) { // Only supported on iOS8.2/macOS10.11 and above font = [UIFont systemFontOfSize:size weight:weight]; -#pragma clang diagnostic pop // TODO(OSS Candidate ISS#2710739) +#pragma clang diagnostic pop // [macOS] } else { font = [UIFont systemFontOfSize:size weight:weight]; } @@ -178,15 +178,15 @@ struct __attribute__((__packed__)) CacheKey { auto names = [cache objectForKey:familyName]; if (!names) { -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] names = [UIFont fontNamesForFamilyName:familyName] ?: [NSArray new]; -#else +#else // [macOS NSMutableArray *fontNames = [NSMutableArray array]; for (NSArray *fontSettings in [[NSFontManager sharedFontManager] availableMembersOfFontFamily:familyName]) { [fontNames addObject:fontSettings[0]]; } names = fontNames; -#endif // ]TODO(macOS GH#774) +#endif // macOS] [cache setObject:names forKey:familyName]; } return names; @@ -359,11 +359,11 @@ + (UIFont *)updateFont:(UIFont *)font } else { // Not a valid font or family RCTLogError(@"Unrecognized font family '%@'", familyName); -#pragma clang diagnostic push // TODO(OSS Candidate ISS#2710739) -#pragma clang diagnostic ignored "-Wunguarded-availability" // TODO(OSS Candidate ISS#2710739) +#pragma clang diagnostic push // [macOS] +#pragma clang diagnostic ignored "-Wunguarded-availability" // [macOS] if ([UIFont respondsToSelector:@selector(systemFontOfSize:weight:)]) { font = [UIFont systemFontOfSize:fontSize weight:fontWeight]; -#pragma clang diagnostic pop // TODO(OSS Candidate ISS#2710739) +#pragma clang diagnostic pop // [macOS] } else if (fontWeight > UIFontWeightRegular) { font = [UIFont boldSystemFontOfSize:fontSize]; } else { diff --git a/React/Views/RCTFontSmoothing.h b/React/Views/RCTFontSmoothing.h index a520f04eecd0ae..306236a95ad90b 100644 --- a/React/Views/RCTFontSmoothing.h +++ b/React/Views/RCTFontSmoothing.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -// TODO(OSS Candidate ISS#2710739) +// [macOS] #import diff --git a/React/Views/RCTLayout.h b/React/Views/RCTLayout.h index 47f895bde044c7..5403e9c0da35ee 100644 --- a/React/Views/RCTLayout.h +++ b/React/Views/RCTLayout.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import diff --git a/React/Views/RCTMaskedView.h b/React/Views/RCTMaskedView.h index 6f913c057af4fe..a87a5847f30784 100644 --- a/React/Views/RCTMaskedView.h +++ b/React/Views/RCTMaskedView.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import diff --git a/React/Views/RCTModalHostView.h b/React/Views/RCTModalHostView.h index db78f2f1382d47..9be08f0cbe464c 100644 --- a/React/Views/RCTModalHostView.h +++ b/React/Views/RCTModalHostView.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import @@ -16,7 +16,7 @@ @protocol RCTModalHostViewInteractor; -@interface RCTModalHostView : RCTUIView // TODO(macOS GH#774) +@interface RCTModalHostView : RCTUIView // [macOS] @property (nonatomic, copy) NSString *animationType; @property (nonatomic, assign) UIModalPresentationStyle presentationStyle; diff --git a/React/Views/RCTModalHostViewController.h b/React/Views/RCTModalHostViewController.h index 66a1659886db30..99d52261241fe3 100644 --- a/React/Views/RCTModalHostViewController.h +++ b/React/Views/RCTModalHostViewController.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] @interface RCTModalHostViewController : UIViewController diff --git a/React/Views/RCTModalManager.h b/React/Views/RCTModalManager.h index 6cecbd16b69095..cdc254518ac65b 100644 --- a/React/Views/RCTModalManager.h +++ b/React/Views/RCTModalManager.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import diff --git a/React/Views/RCTProgressView.h b/React/Views/RCTProgressView.h index a76fe15dc41b6b..e75b78180b49eb 100644 --- a/React/Views/RCTProgressView.h +++ b/React/Views/RCTProgressView.h @@ -5,22 +5,22 @@ * LICENSE file in the root directory of this source tree. */ -// TODO(macOS GH#774) +// [macOS] #import #import -#if !TARGET_OS_OSX +#if !TARGET_OS_OSX // [macOS] @interface RCTProgressView : UIProgressView -#else +#else // [macOS @interface RCTProgressView : NSProgressIndicator -#endif +#endif // macOS] -#if TARGET_OS_OSX +#if TARGET_OS_OSX // [macOS @property (nonatomic, strong, nullable) RCTUIColor *progressTintColor; @property (nonatomic, strong, nullable) RCTUIColor *trackTintColor; @property(nonatomic, strong, nullable) UIImage *progressImage; @property(nonatomic, strong, nullable) UIImage *trackImage; -#endif +#endif // macOS] @end diff --git a/React/Views/RCTProgressView.m b/React/Views/RCTProgressView.m index da6bc86b72e3bb..c9ca0db8c3da59 100644 --- a/React/Views/RCTProgressView.m +++ b/React/Views/RCTProgressView.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -// TODO(macOS GH#774) +// [macOS] #import "RCTProgressView.h" diff --git a/React/Views/RCTProgressViewManager.m b/React/Views/RCTProgressViewManager.m index 87a524af011e98..3b071ffac4c2c6 100644 --- a/React/Views/RCTProgressViewManager.m +++ b/React/Views/RCTProgressViewManager.m @@ -8,16 +8,11 @@ #import "RCTProgressViewManager.h" #import "RCTConvert.h" -#import "RCTProgressView.h" // TODO(macOS GH#774) +#import "RCTProgressView.h" // [macOS] @implementation RCTConvert (RCTProgressViewManager) -#if TARGET_OS_OSX // [TODO(macOS GH#774) -RCT_ENUM_CONVERTER(NSProgressIndicatorStyle, (@{ - @"default": @(NSProgressIndicatorStyleBar), - @"bar": @(NSProgressIndicatorStyleBar), -}), NSProgressIndicatorStyleBar, integerValue) -#else // ]TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCT_ENUM_CONVERTER( UIProgressViewStyle, (@{ @@ -26,7 +21,12 @@ @implementation RCTConvert (RCTProgressViewManager) }), UIProgressViewStyleDefault, integerValue) -#endif // TODO(macOS GH#774) +#else // [macOS +RCT_ENUM_CONVERTER(NSProgressIndicatorStyle, (@{ + @"default": @(NSProgressIndicatorStyleBar), + @"bar": @(NSProgressIndicatorStyleBar), +}), NSProgressIndicatorStyleBar, integerValue) +#endif // macOS] @end @@ -34,18 +34,18 @@ @implementation RCTProgressViewManager RCT_EXPORT_MODULE() -- (RCTPlatformView *)view // TODO(macOS GH#774) +- (RCTPlatformView *)view // [macOS] { - return [RCTProgressView new]; // TODO(macOS GH#774) + return [RCTProgressView new]; // [macOS] } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCT_EXPORT_VIEW_PROPERTY(progressViewStyle, UIProgressViewStyle) RCT_EXPORT_VIEW_PROPERTY(progress, float) -#else // [TODO(macOS GH#774) +#else // [macOS RCT_EXPORT_VIEW_PROPERTY(style, NSProgressIndicatorStyle) RCT_REMAP_VIEW_PROPERTY(progress, doubleValue, double) -#endif // ]TODO(macOS GH#774) +#endif // macOS] RCT_EXPORT_VIEW_PROPERTY(progressTintColor, UIColor) RCT_EXPORT_VIEW_PROPERTY(trackTintColor, UIColor) RCT_EXPORT_VIEW_PROPERTY(progressImage, UIImage) diff --git a/React/Views/RCTSegmentedControl.h b/React/Views/RCTSegmentedControl.h index a553851b842440..b6727da119612a 100644 --- a/React/Views/RCTSegmentedControl.h +++ b/React/Views/RCTSegmentedControl.h @@ -5,19 +5,19 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] @interface RCTSegmentedControl : UISegmentedControl -#else // [TODO(macOS GH#774) +#else // [macOS @interface RCTSegmentedControl : NSSegmentedControl -#endif // ]TODO(macOS GH#774) +#endif // macOS] -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS] @property (nonatomic, assign, getter = isMomentary) BOOL momentary; -#endif // ]TODO(macOS GH#774) +#endif // [macOS] @property (nonatomic, copy) NSArray *values; @property (nonatomic, assign) NSInteger selectedIndex; diff --git a/React/Views/RCTSegmentedControl.m b/React/Views/RCTSegmentedControl.m index 3f557ea306fb19..53df405592740c 100644 --- a/React/Views/RCTSegmentedControl.m +++ b/React/Views/RCTSegmentedControl.m @@ -9,7 +9,7 @@ #import "RCTConvert.h" #import "UIView+React.h" -#import "RCTUIKit.h" // TODO(macOS GH#774) +#import "RCTUIKit.h" // [macOS] @implementation RCTSegmentedControl @@ -17,13 +17,13 @@ - (instancetype)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) { _selectedIndex = self.selectedSegmentIndex; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [self addTarget:self action:@selector(didChange) forControlEvents:UIControlEventValueChanged]; -#else // [TODO(macOS GH#774) +#else // [macOS self.segmentStyle = NSSegmentStyleRounded; self.target = self; self.action = @selector(didChange); -#endif // ]TODO(macOS GH#774) +#endif // macOS] } return self; } @@ -31,27 +31,27 @@ - (instancetype)initWithFrame:(CGRect)frame - (void)setValues:(NSArray *)values { _values = [values copy]; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [self removeAllSegments]; for (NSString *value in values) { [self insertSegmentWithTitle:value atIndex:self.numberOfSegments animated:NO]; } -#else // [TODO(macOS GH#774) +#else // [macOS self.segmentCount = values.count; for (NSUInteger i = 0; i < values.count; i++) { [self setLabel:values[i] forSegment:i]; } -#endif // ]TODO(macOS GH#774) - self.selectedSegmentIndex = _selectedIndex; // TODO(macOS GH#774) +#endif // macOS] + self.selectedSegmentIndex = _selectedIndex; // [macOS] } - (void)setSelectedIndex:(NSInteger)selectedIndex { _selectedIndex = selectedIndex; - self.selectedSegmentIndex = selectedIndex; // TODO(macOS GH#774) + self.selectedSegmentIndex = selectedIndex; // [macOS] } -- (void)setBackgroundColor:(RCTUIColor *)backgroundColor // TODO(macOS GH#774) +- (void)setBackgroundColor:(RCTUIColor *)backgroundColor // [macOS] { #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \ __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0 @@ -61,7 +61,7 @@ - (void)setBackgroundColor:(RCTUIColor *)backgroundColor // TODO(macOS GH#774) #endif } -- (void)setTextColor:(RCTUIColor *)textColor // TODO(macOS GH#774) +- (void)setTextColor:(RCTUIColor *)textColor // [macOS] { #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \ __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0 @@ -71,8 +71,8 @@ - (void)setTextColor:(RCTUIColor *)textColor // TODO(macOS GH#774) #endif } -#if !TARGET_OS_OSX // TODO(macOS GH#774) - no concept of tintColor on macOS -- (void)setTintColor:(UIColor *)tintColor // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] no concept of tintColor on macOS +- (void)setTintColor:(UIColor *)tintColor // [macOS] { [super setTintColor:tintColor]; #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \ @@ -85,7 +85,7 @@ - (void)setTintColor:(UIColor *)tintColor // TODO(macOS GH#774) } #endif } -#endif // TODO(macOS GH#774) +#endif // [macOS] - (void)didChange { @@ -95,7 +95,7 @@ - (void)didChange } } -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS - (BOOL)isFlipped { @@ -137,6 +137,6 @@ - (NSInteger)numberOfSegments return self.segmentCount; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] @end diff --git a/React/Views/RCTSegmentedControlManager.m b/React/Views/RCTSegmentedControlManager.m index dc90558cc7f8d4..3d38ee398f077a 100644 --- a/React/Views/RCTSegmentedControlManager.m +++ b/React/Views/RCTSegmentedControlManager.m @@ -15,16 +15,16 @@ @implementation RCTSegmentedControlManager RCT_EXPORT_MODULE() -- (RCTPlatformView *)view // TODO(macOS GH#774) +- (RCTPlatformView *)view // [macOS] { return [RCTSegmentedControl new]; } RCT_EXPORT_VIEW_PROPERTY(values, NSArray) RCT_EXPORT_VIEW_PROPERTY(selectedIndex, NSInteger) -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCT_EXPORT_VIEW_PROPERTY(tintColor, UIColor) -#endif // TODO(macOS GH#774) +#endif // [macOS] RCT_EXPORT_VIEW_PROPERTY(backgroundColor, UIColor) RCT_EXPORT_VIEW_PROPERTY(textColor, UIColor) RCT_EXPORT_VIEW_PROPERTY(momentary, BOOL) diff --git a/React/Views/RCTShadowView+Internal.h b/React/Views/RCTShadowView+Internal.h index e1d08328243ac5..bf0a277fc29054 100644 --- a/React/Views/RCTShadowView+Internal.h +++ b/React/Views/RCTShadowView+Internal.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import diff --git a/React/Views/RCTShadowView+Layout.h b/React/Views/RCTShadowView+Layout.h index 978044c761c86c..e56829cf058475 100644 --- a/React/Views/RCTShadowView+Layout.h +++ b/React/Views/RCTShadowView+Layout.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import diff --git a/React/Views/RCTShadowView.h b/React/Views/RCTShadowView.h index 539e891f336ed5..5b4535233dba5e 100644 --- a/React/Views/RCTShadowView.h +++ b/React/Views/RCTShadowView.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import @@ -15,7 +15,7 @@ @class RCTRootShadowView; @class RCTSparseArray; -typedef void (^RCTApplierBlock)(NSDictionary *viewRegistry); // TODO(macOS GH#774) +typedef void (^RCTApplierBlock)(NSDictionary *viewRegistry); // [macOS] /** * ShadowView tree mirrors RCT view tree. Every node is highly stateful. @@ -49,9 +49,9 @@ typedef void (^RCTApplierBlock)(NSDictionary *vie @property (nonatomic, assign, readonly) YGNodeRef yogaNode; @property (nonatomic, copy) NSString *viewName; @property (nonatomic, copy) RCTDirectEventBlock onLayout; -#if TARGET_OS_OSX // [TODO(OSS Candidate ISS#2710739) +#if TARGET_OS_OSX // [macOS @property (nonatomic) CGFloat scale; -#endif // ]TODO(OSS Candidate ISS#2710739) +#endif // macOS] /** * Computed layout of the view. diff --git a/React/Views/RCTShadowView.m b/React/Views/RCTShadowView.m index 2630637da6e7fa..ccabdb024b4d77 100644 --- a/React/Views/RCTShadowView.m +++ b/React/Views/RCTShadowView.m @@ -49,11 +49,11 @@ + (YGConfigRef)yogaConfig static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ yogaConfig = YGConfigNew(); -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] float pixelsInPoint = RCTScreenScale(); -#else - float pixelsInPoint = 1; // TODO(ISS#1656079): Use 1x alignment for macOS until we can use backing resolution -#endif // ]TODO(macOS GH#774) +#else // [macOS + float pixelsInPoint = 1; // Use 1x alignment for macOS until we can use backing resolution +#endif // macOS] YGConfigSetPointScaleFactor(yogaConfig, pixelsInPoint); YGConfigSetUseLegacyStretchBehaviour(yogaConfig, true); }); @@ -210,10 +210,10 @@ - (instancetype)init YGNodeSetContext(_yogaNode, (__bridge void *)self); YGNodeSetPrintFunc(_yogaNode, RCTPrint); -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS // RCTUIManager will fix the scale if we're on a Retina display _scale = 1.0; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } return self; } @@ -393,7 +393,7 @@ - (NSNumber *)reactTagAtPoint:(CGPoint)point return self.reactTag; } -#if DEBUG // TODO(macOS GH#774) description is a debug-only feature +#if DEBUG // [macOS description is a debug-only feature - (NSString *)description { NSString *description = super.description; @@ -404,7 +404,7 @@ - (NSString *)description NSStringFromCGRect(self.layoutMetrics.frame)]; return description; } -#endif // TODO(macOS GH#774) +#endif // macOS] - (void)addRecursiveDescriptionToString:(NSMutableString *)string atLevel:(NSUInteger)level { diff --git a/React/Views/RCTSlider.h b/React/Views/RCTSlider.h index ff082c02d48467..1a26d0534cc1fe 100644 --- a/React/Views/RCTSlider.h +++ b/React/Views/RCTSlider.h @@ -5,23 +5,23 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import NS_ASSUME_NONNULL_BEGIN -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS @protocol RCTSliderDelegate; -#endif +#endif // macOS] -#if !TARGET_OS_OSX // ]TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] @interface RCTSlider : UISlider -#else // [TODO(macOS GH#774) +#else // [macOS @interface RCTSlider : NSSlider -#endif +#endif // macOS] -#if TARGET_OS_OSX +#if TARGET_OS_OSX // [macOS @property (nonatomic, weak) id delegate; @property (nonatomic, readonly) BOOL pressed; @property (nonatomic, assign) float value; @@ -30,7 +30,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, strong) NSColor *minimumTrackTintColor; @property (nonatomic, strong) NSColor *maximumTrackTintColor; - (void)setValue:(float)value animated:(BOOL)animated; -#endif // ]TODO(macOS GH#774) +#endif // macOS] @property (nonatomic, copy) RCTBubblingEventBlock onValueChange; @property (nonatomic, copy) RCTDirectEventBlock onSlidingComplete; @@ -46,11 +46,11 @@ NS_ASSUME_NONNULL_BEGIN @end -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS @protocol RCTSliderDelegate @optional - (void)slider:(RCTSlider *)slider didPress:(BOOL)press; @end -#endif // ]TODO(macOS GH#774) +#endif // macOS] NS_ASSUME_NONNULL_END diff --git a/React/Views/RCTSlider.m b/React/Views/RCTSlider.m index 2f5aa47806eb39..5cf2d8ffcf7601 100644 --- a/React/Views/RCTSlider.m +++ b/React/Views/RCTSlider.m @@ -7,7 +7,7 @@ #import "RCTSlider.h" -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS #import @protocol RCTSliderCellDelegate @@ -109,19 +109,19 @@ - (BOOL)usesCustomTrackImage @end -#endif +#endif // macOS] -#if TARGET_OS_OSX +#if TARGET_OS_OSX // [macOS @interface RCTSlider () @end -#endif // ]TODO(macOS GH#774) +#endif // macOS] @implementation RCTSlider { float _unclippedValue; } -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS - (instancetype)initWithFrame:(NSRect)frameRect { @@ -201,40 +201,40 @@ + (id)defaultAnimationForKey:(NSString *)key } } -#endif // ]TODO(macOS GH#774) +#endif // macOS] - (void)setValue:(float)value { _unclippedValue = value; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] super.value = value; -#else // [TODO(macOS GH#774) +#else // [macOS self.floatValue = value; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } - (void)setMinimumValue:(float)minimumValue { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] super.minimumValue = minimumValue; super.value = _unclippedValue; -#else // [TODO(macOS GH#774) +#else // [macOS _minimumValue = minimumValue; self.minValue = minimumValue; self.floatValue = _unclippedValue; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } - (void)setMaximumValue:(float)maximumValue { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] super.maximumValue = maximumValue; super.value = _unclippedValue; -#else // [TODO(macOS GH#774) +#else // [macOS _maximumValue = maximumValue; self.maxValue = maximumValue; self.floatValue = _unclippedValue; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } - (void)setTrackImage:(UIImage *)trackImage @@ -242,89 +242,89 @@ - (void)setTrackImage:(UIImage *)trackImage if (trackImage != _trackImage) { _trackImage = trackImage; CGFloat width = trackImage.size.width / 2; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UIImage *minimumTrackImage = [trackImage resizableImageWithCapInsets:(UIEdgeInsets){0, width, 0, width} resizingMode:UIImageResizingModeStretch]; UIImage *maximumTrackImage = [trackImage resizableImageWithCapInsets:(UIEdgeInsets){0, width, 0, width} resizingMode:UIImageResizingModeStretch]; [self setMinimumTrackImage:minimumTrackImage forState:UIControlStateNormal]; [self setMaximumTrackImage:maximumTrackImage forState:UIControlStateNormal]; -#else // [TODO(macOS GH#774) +#else // [macOS trackImage.capInsets = NSEdgeInsetsMake(0, width-0.5, 0, width-0.5); trackImage.resizingMode = NSImageResizingModeStretch; ((RCTSliderCell*)self.cell).minimumValueImage = trackImage; ((RCTSliderCell*)self.cell).maximumValueImage = trackImage; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } } - (void)setMinimumTrackImage:(UIImage *)minimumTrackImage { _trackImage = nil; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] minimumTrackImage = [minimumTrackImage resizableImageWithCapInsets:(UIEdgeInsets){0, minimumTrackImage.size.width, 0, 0} resizingMode:UIImageResizingModeStretch]; [self setMinimumTrackImage:minimumTrackImage forState:UIControlStateNormal]; -#else // [TODO(macOS GH#774) +#else // [macOS minimumTrackImage.capInsets = NSEdgeInsetsMake(0, minimumTrackImage.size.width-0.5, 0, 0); minimumTrackImage.resizingMode = NSImageResizingModeStretch; ((RCTSliderCell*)self.cell).minimumValueImage = minimumTrackImage; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } - (UIImage *)minimumTrackImage { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] return [self thumbImageForState:UIControlStateNormal]; -#else // [TODO(macOS GH#774) +#else // [macOS return ((RCTSliderCell*)self.cell).minimumValueImage; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } - (void)setMaximumTrackImage:(UIImage *)maximumTrackImage { _trackImage = nil; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] maximumTrackImage = [maximumTrackImage resizableImageWithCapInsets:(UIEdgeInsets){0, 0, 0, maximumTrackImage.size.width} resizingMode:UIImageResizingModeStretch]; [self setMaximumTrackImage:maximumTrackImage forState:UIControlStateNormal]; -#else // [TODO(macOS GH#774) +#else // [macOS maximumTrackImage.capInsets = NSEdgeInsetsMake(0, 0, 0, maximumTrackImage.size.width-0.5); maximumTrackImage.resizingMode = NSImageResizingModeStretch; ((RCTSliderCell*)self.cell).maximumValueImage = maximumTrackImage; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } - (UIImage *)maximumTrackImage { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] return [self thumbImageForState:UIControlStateNormal]; -#else // [TODO(macOS GH#774) +#else // [macOS return ((RCTSliderCell*)self.cell).maximumValueImage; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } - (void)setThumbImage:(UIImage *)thumbImage { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [self setThumbImage:thumbImage forState:UIControlStateNormal]; -#else // [TODO(macOS GH#774) +#else // [macOS ((RCTSliderCell*)self.cell).knobImage = thumbImage; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } - (UIImage *)thumbImage { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] return [self thumbImageForState:UIControlStateNormal]; -#else // [TODO(macOS GH#774) +#else // [macOS return ((RCTSliderCell*)self.cell).knobImage; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } -#if !TARGET_OS_OSX // TODO(macOS GH#774) - accessibility on macOS is on the NSCell rather than the NSControl +#if !TARGET_OS_OSX // [macOS] accessibility on macOS is on the NSCell rather than the NSControl - (void)accessibilityIncrement { [super accessibilityIncrement]; @@ -344,6 +344,6 @@ - (void)accessibilityDecrement }); } } -#endif // TODO(macOS GH#774) +#endif // [macOS] @end diff --git a/React/Views/RCTSliderManager.m b/React/Views/RCTSliderManager.m index b4d1674bedb291..34ca6f83f7bc5d 100644 --- a/React/Views/RCTSliderManager.m +++ b/React/Views/RCTSliderManager.m @@ -11,28 +11,28 @@ #import "RCTSlider.h" #import "UIView+React.h" -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS @interface RCTSliderManager () @end -#endif // ]TODO(macOS GH#774) +#endif // macOS] @implementation RCTSliderManager RCT_EXPORT_MODULE() -- (RCTPlatformView *)view // TODO(macOS GH#774) +- (RCTPlatformView *)view // [macOS] { RCTSlider *slider = [RCTSlider new]; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [slider addTarget:self action:@selector(sliderValueChanged:) forControlEvents:UIControlEventValueChanged]; [slider addTarget:self action:@selector(sliderTouchEnd:) forControlEvents:(UIControlEventTouchUpInside | UIControlEventTouchUpOutside | UIControlEventTouchCancel)]; -#else // [TODO(macOS GH#774) +#else // [macOS slider.delegate = self; slider.target = self; slider.action = @selector(sliderValueChanged:); -#endif // ]TODO(macOS GH#774) +#endif // macOS] return slider; } @@ -77,14 +77,14 @@ - (void)sliderTouchEnd:(RCTSlider *)sender RCTSendSliderEvent(sender, NO); } -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS - (void)slider:(id)slider didPress:(BOOL)press { if (!press) { RCTSendSliderEvent(slider, NO); } } -#endif // ]TODO(macOS GH#774) +#endif // macOS] RCT_EXPORT_VIEW_PROPERTY(value, float); RCT_EXPORT_VIEW_PROPERTY(step, float); @@ -97,7 +97,7 @@ - (void)slider:(id)slider didPress:(BOOL)press RCT_EXPORT_VIEW_PROPERTY(maximumTrackTintColor, UIColor); RCT_EXPORT_VIEW_PROPERTY(onValueChange, RCTBubblingEventBlock); RCT_EXPORT_VIEW_PROPERTY(onSlidingComplete, RCTDirectEventBlock); -RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(thumbTintColor, UIColor); // TODO(macOS GH#774) +RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(thumbTintColor, UIColor); // [macOS] RCT_EXPORT_VIEW_PROPERTY(thumbImage, UIImage); RCT_CUSTOM_VIEW_PROPERTY(disabled, BOOL, RCTSlider) { diff --git a/React/Views/RCTSwitch.h b/React/Views/RCTSwitch.h index c17d0e3c3952f8..5f4775a8ab874f 100644 --- a/React/Views/RCTSwitch.h +++ b/React/Views/RCTSwitch.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import diff --git a/React/Views/RCTSwitchManager.m b/React/Views/RCTSwitchManager.m index 3d5d5d84721761..df1d1dba5a062e 100644 --- a/React/Views/RCTSwitchManager.m +++ b/React/Views/RCTSwitchManager.m @@ -16,15 +16,15 @@ @implementation RCTSwitchManager RCT_EXPORT_MODULE() -- (RCTPlatformView *)view // TODO(macOS GH#774) +- (RCTPlatformView *)view // [macOS] { RCTSwitch *switcher = [RCTSwitch new]; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [switcher addTarget:self action:@selector(onChange:) forControlEvents:UIControlEventValueChanged]; -#else // [TODO(macOS GH#774) +#else // [macOS [switcher setTarget:self]; [switcher setAction:@selector(onChange:)]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] return switcher; } @@ -40,8 +40,8 @@ - (void)onChange:(RCTSwitch *)sender RCT_EXPORT_METHOD(setValue : (nonnull NSNumber *)viewTag toValue : (BOOL)value) { - [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary *viewRegistry) { // TODO(macOS ISS#3536887) - RCTUIView *view = viewRegistry[viewTag]; // TODO(macOS ISS#3536887) + [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary *viewRegistry) { // [macOS] + RCTUIView *view = viewRegistry[viewTag]; // [macOS] if ([view isKindOfClass:[RCTSwitch class]]) { [(RCTSwitch *)view setOn:value animated:NO]; @@ -51,11 +51,11 @@ - (void)onChange:(RCTSwitch *)sender }]; } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCT_EXPORT_VIEW_PROPERTY(onTintColor, UIColor); RCT_EXPORT_VIEW_PROPERTY(tintColor, UIColor); RCT_EXPORT_VIEW_PROPERTY(thumbTintColor, UIColor); -#endif // TODO(macOS GH#774) +#endif // [macOS] RCT_REMAP_VIEW_PROPERTY(value, on, BOOL); RCT_EXPORT_VIEW_PROPERTY(onChange, RCTBubblingEventBlock); RCT_CUSTOM_VIEW_PROPERTY(disabled, BOOL, RCTSwitch) diff --git a/React/Views/RCTView.h b/React/Views/RCTView.h index 83e9edc5d02b3c..eb05aac5d5651e 100644 --- a/React/Views/RCTView.h +++ b/React/Views/RCTView.h @@ -5,26 +5,26 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import -#import // TODO(OSS Candidate ISS#2710739) +#import // [macOS] #import -#if TARGET_OS_OSX // TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS #import -#endif // TODO(macOS GH#774) +#endif // macOS] -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] extern const UIAccessibilityTraits SwitchAccessibilityTrait; -#endif // TODO(macOS GH#774) +#endif // [macOS] @protocol RCTAutoInsetsProtocol; -@interface RCTView : RCTUIView // TODO(macOS ISS#3536887) +@interface RCTView : RCTUIView // [macOS] -// [TODO(OSS Candidate ISS#2710739) +// [macOS - (instancetype)initWithEventDispatcher:(id)eventDispatcher; - (BOOL)becomeFirstResponder; @@ -34,16 +34,16 @@ extern const UIAccessibilityTraits SwitchAccessibilityTrait; - (NSDictionary*)dataTransferInfoFromPasteboard:(NSPasteboard*)pasteboard; - (BOOL)handleKeyboardEvent:(NSEvent *)event; #endif -// ]TODO(OSS Candidate ISS#2710739) +// macOS] /** * Accessibility event handlers */ @property (nonatomic, copy) RCTDirectEventBlock onAccessibilityAction; @property (nonatomic, copy) RCTDirectEventBlock onAccessibilityTap; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] @property (nonatomic, copy) RCTDirectEventBlock onMagicTap; -#endif // TODO(macOS GH#774) +#endif // [macOS] @property (nonatomic, copy) RCTDirectEventBlock onAccessibilityEscape; /** @@ -51,8 +51,8 @@ extern const UIAccessibilityTraits SwitchAccessibilityTrait; */ @property (nonatomic, assign) RCTPointerEvents pointerEvents; -+ (void)autoAdjustInsetsForView:(RCTUIView *)parentView // TODO(macOS ISS#3536887) - withScrollView:(RCTUIScrollView *)scrollView // TODO(macOS ISS#3536887) and TODO(macOS ISS#3536887) ++ (void)autoAdjustInsetsForView:(RCTUIView *)parentView // [macOS] + withScrollView:(RCTUIScrollView *)scrollView // [macOS] updateOffset:(BOOL)updateOffset; /** @@ -124,7 +124,7 @@ extern const UIAccessibilityTraits SwitchAccessibilityTrait; */ @property (nonatomic, assign) UIEdgeInsets hitTestEdgeInsets; -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS /** * macOS Properties */ @@ -151,7 +151,7 @@ extern const UIAccessibilityTraits SwitchAccessibilityTrait; @property (nonatomic, assign) CGFloat shadowOpacity; @property (nonatomic, assign) CGFloat shadowRadius; @property (nonatomic, assign) CGSize shadowOffset; -#endif // ]TODO(macOS GH#774) +#endif // macOS] /** * Common Focus Properties diff --git a/React/Views/RCTView.m b/React/Views/RCTView.m index 850d3186dbd021..23d469a097ea47 100644 --- a/React/Views/RCTView.m +++ b/React/Views/RCTView.m @@ -11,22 +11,22 @@ #import "RCTAutoInsetsProtocol.h" #import "RCTBorderDrawing.h" -#import "RCTFocusChangeEvent.h" // TODO(OSS Candidate ISS#2710739) +#import "RCTFocusChangeEvent.h" // [macOS] #import "RCTI18nUtil.h" #import "RCTLog.h" -#import "RCTRootContentView.h" // TODO(macOS GH#774) +#import "RCTRootContentView.h" // [macOS] #import "RCTViewUtils.h" #import "UIView+React.h" #import "RCTViewKeyboardEvent.h" -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS #import "RCTTextView.h" -#endif // ]TODO(macOS GH#774) +#endif // macOS] -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UIAccessibilityTraits const SwitchAccessibilityTrait = 0x20000000000001; -#endif // TODO(macOS GH#774) +#endif // [macOS] -@implementation RCTPlatformView (RCTViewUnmounting) // TODO(macOS GH#774) +@implementation RCTPlatformView (RCTViewUnmounting) // [macOS] - (void)react_remountAllSubviews { @@ -34,18 +34,18 @@ - (void)react_remountAllSubviews // this does is forward message to our subviews, // in case any of those do support it - for (RCTUIView *subview in self.subviews) { // TODO(macOS ISS#3536887) + for (RCTUIView *subview in self.subviews) { // [macOS] [subview react_remountAllSubviews]; } } -- (void)react_updateClippedSubviewsWithClipRect:(CGRect)clipRect relativeToView:(RCTPlatformView *)clipView // TODO(macOS GH#774) +- (void)react_updateClippedSubviewsWithClipRect:(CGRect)clipRect relativeToView:(RCTPlatformView *)clipView // [macOS] { // Even though we don't support subview unmounting // we do support clipsToBounds, so if that's enabled // we'll update the clipping - if (RCTUIViewSetClipsToBounds(self) && self.subviews.count > 0) { // TODO(macOS GH#774) and TODO(macOS ISS#3536887) + if (RCTUIViewSetClipsToBounds(self) && self.subviews.count > 0) { // [macOS] clipRect = [clipView convertRect:clipRect toView:self]; clipRect = CGRectIntersection(clipRect, self.bounds); clipView = self; @@ -55,19 +55,19 @@ - (void)react_updateClippedSubviewsWithClipRect:(CGRect)clipRect relativeToView: // this does is forward message to our subviews, // in case any of those do support it - for (RCTUIView *subview in self.subviews) { // TODO(macOS ISS#3536887) + for (RCTUIView *subview in self.subviews) { // [macOS] [subview react_updateClippedSubviewsWithClipRect:clipRect relativeToView:clipView]; } } -- (RCTPlatformView *)react_findClipView // TODO(macOS GH#774) +- (RCTPlatformView *)react_findClipView // [macOS] { - RCTPlatformView *testView = self; // TODO(macOS GH#774) - RCTPlatformView *clipView = nil; // TODO(macOS GH#774) + RCTPlatformView *testView = self; // [macOS] + RCTPlatformView *clipView = nil; // [macOS] CGRect clipRect = self.bounds; // We will only look for a clipping view up the view hierarchy until we hit the root view. while (testView) { - if (RCTUIViewSetClipsToBounds(testView)) { // TODO(macOS GH#774) and TODO(macOS ISS#3536887) + if (RCTUIViewSetClipsToBounds(testView)) { // [macOS] if (clipView) { CGRect testRect = [clipView convertRect:clipRect toView:testView]; if (!CGRectContainsRect(testView.bounds, testRect)) { @@ -84,22 +84,22 @@ - (RCTPlatformView *)react_findClipView // TODO(macOS GH#774) } testView = testView.superview; } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] return clipView ?: self.window; -#else // [TODO(macOS GH#774) +#else // [macOS return clipView ?: self.window.contentView; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } @end -static NSString *RCTRecursiveAccessibilityLabel(RCTUIView *view) // TODO(macOS ISS#3536887) +static NSString *RCTRecursiveAccessibilityLabel(RCTUIView *view) // [macOS] { NSMutableString *str = [NSMutableString stringWithString:@""]; - for (RCTUIView *subview in view.subviews) { // TODO(macOS ISS#3536887) -#if !TARGET_OS_OSX // TODO(macOS GH#774) + for (RCTUIView *subview in view.subviews) { // [macOS] +#if !TARGET_OS_OSX // [macOS] NSString *label = subview.accessibilityLabel; -#else // [TODO(macOS GH#774) +#else // [macOS NSString *label; if ([subview isKindOfClass:[RCTTextView class]]) { // on macOS VoiceOver a text element will always have its accessibilityValue read, but will only read it's accessibilityLabel if it's value is set. @@ -108,7 +108,7 @@ - (RCTPlatformView *)react_findClipView // TODO(macOS GH#774) } else { label = subview.accessibilityLabel; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] if (!label) { label = RCTRecursiveAccessibilityLabel(subview); } @@ -123,17 +123,17 @@ - (RCTPlatformView *)react_findClipView // TODO(macOS GH#774) } @implementation RCTView { - RCTUIColor *_backgroundColor; // TODO(OSS Candidate ISS#2710739) - id _eventDispatcher; // TODO(OSS Candidate ISS#2710739) -#if TARGET_OS_OSX // [TODO(macOS GH#774) + RCTUIColor *_backgroundColor; // [macOS] + id _eventDispatcher; // [macOS] +#if TARGET_OS_OSX // [macOS NSTrackingArea *_trackingArea; BOOL _hasMouseOver; -#endif // ]TODO(macOS GH#774) +#endif // macOS] NSMutableDictionary *accessibilityActionsNameMap; NSMutableDictionary *accessibilityActionsLabelMap; } -// [TODO(OSS Candidate ISS#2710739) +// [macOS - (instancetype)initWithEventDispatcher:(id)eventDispatcher { if ((self = [self initWithFrame:CGRectZero])) { @@ -141,7 +141,7 @@ - (instancetype)initWithEventDispatcher:(id)eventDis } return self; } -// ]TODO(OSS Candidate ISS#2710739) +// macOS] - (instancetype)initWithFrame:(CGRect)frame { @@ -163,10 +163,10 @@ - (instancetype)initWithFrame:(CGRect)frame _borderBottomEndRadius = -1; _borderStyle = RCTBorderStyleSolid; _hitTestEdgeInsets = UIEdgeInsetsZero; -#if TARGET_OS_OSX // TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS _transform3D = CATransform3DIdentity; _shadowColor = nil; -#endif // TODO(macOS GH#774) +#endif // macOS] _backgroundColor = super.backgroundColor; } @@ -183,21 +183,21 @@ - (void)setReactLayoutDirection:(UIUserInterfaceLayoutDirection)layoutDirection [self.layer setNeedsDisplay]; } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] if ([self respondsToSelector:@selector(setSemanticContentAttribute:)]) { -#pragma clang diagnostic push // TODO(OSS Candidate ISS#2710739) -#pragma clang diagnostic ignored "-Wunguarded-availability" // TODO(OSS Candidate ISS#2710739) +#pragma clang diagnostic push // [macOS] +#pragma clang diagnostic ignored "-Wunguarded-availability" // [macOS] self.semanticContentAttribute = layoutDirection == UIUserInterfaceLayoutDirectionLeftToRight ? UISemanticContentAttributeForceLeftToRight : UISemanticContentAttributeForceRightToLeft; -#pragma clang diagnostic pop // TODO(OSS Candidate ISS#2710739) +#pragma clang diagnostic pop // [macOS] } -#else // [TODO(macOS GH#774) +#else // [macOS self.userInterfaceLayoutDirection = layoutDirection == UIUserInterfaceLayoutDirectionLeftToRight ? NSUserInterfaceLayoutDirectionLeftToRight : NSUserInterfaceLayoutDirectionRightToLeft; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } #pragma mark - Hit Testing @@ -206,14 +206,14 @@ - (void)setPointerEvents:(RCTPointerEvents)pointerEvents { _pointerEvents = pointerEvents; self.userInteractionEnabled = (pointerEvents != RCTPointerEventsNone); -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] if (pointerEvents == RCTPointerEventsBoxNone) { self.accessibilityViewIsModal = NO; } -#endif // TODO(macOS GH#774) +#endif // [macOS] } -- (RCTPlatformView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event // TODO(macOS GH#774) +- (RCTPlatformView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event // [macOS] { BOOL canReceiveTouchEvents = ([self isUserInteractionEnabled] && ![self isHidden]); if (!canReceiveTouchEvents) { @@ -222,12 +222,12 @@ - (RCTPlatformView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event // TODO(m // `hitSubview` is the topmost subview which was hit. The hit point can // be outside the bounds of `view` (e.g., if -clipsToBounds is NO). - RCTPlatformView *hitSubview = nil; // TODO(macOS GH#774) + RCTPlatformView *hitSubview = nil; // [macOS] BOOL isPointInside = [self pointInside:point withEvent:event]; BOOL needsHitSubview = !(_pointerEvents == RCTPointerEventsNone || _pointerEvents == RCTPointerEventsBoxOnly); if (needsHitSubview && (![self clipsToBounds] || isPointInside)) { // Take z-index into account when calculating the touch target. - NSArray *sortedSubviews = [self reactZIndexSortedSubviews]; // TODO(macOS ISS#3536887) + NSArray *sortedSubviews = [self reactZIndexSortedSubviews]; // [macOS] // The default behaviour of UIKit is that if a view does not contain a point, // then no subviews will be returned from hit testing, even if they contain @@ -235,25 +235,25 @@ - (RCTPlatformView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event // TODO(m // the strict containment policy (i.e., UIKit guarantees that every ancestor // of the hit view will return YES from -pointInside:withEvent:). See: // - https://developer.apple.com/library/ios/qa/qa2013/qa1812.html - for (RCTUIView *subview in [sortedSubviews reverseObjectEnumerator]) { // TODO(macOS ISS#3536887) - CGPoint pointForHitTest = CGPointZero; // [TODO(macOS GH#774) -#if TARGET_OS_OSX + for (RCTUIView *subview in [sortedSubviews reverseObjectEnumerator]) { // [macOS] + CGPoint pointForHitTest = CGPointZero; // [macOS +#if !TARGET_OS_OSX // [macOS] + pointForHitTest = [subview convertPoint:point fromView:self]; +#else // [macOS if ([subview isKindOfClass:[RCTView class]]) { pointForHitTest = [subview convertPoint:point fromView:self]; } else { pointForHitTest = point; } -#else - pointForHitTest = [subview convertPoint:point fromView:self]; -#endif - hitSubview = RCTUIViewHitTestWithEvent(subview, pointForHitTest, event); // ]TODO(macOS GH#774) and TODO(macOS ISS#3536887) +#endif // macOS] + hitSubview = RCTUIViewHitTestWithEvent(subview, pointForHitTest, event); // macOS] if (hitSubview != nil) { break; } } } - RCTPlatformView *hitView = (isPointInside ? self : nil); // TODO(macOS GH#774) + RCTPlatformView *hitView = (isPointInside ? self : nil); // [macOS] switch (_pointerEvents) { case RCTPointerEventsNone: @@ -287,11 +287,11 @@ - (NSString *)accessibilityLabel if (label) { return label; } -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS // calling super.accessibilityLabel above on macOS causes the return value of this accessor to be ignored by VoiceOver. // Calling the super's setAccessibilityLabel with nil ensures that the return value of this accessor is used by VoiceOver. [super setAccessibilityLabel:nil]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] return RCTRecursiveAccessibilityLabel(self); } @@ -334,7 +334,7 @@ - (BOOL)didActivateAccessibilityCustomAction:(UIAccessibilityCustomAction *)acti return YES; } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (NSString *)accessibilityValue { static dispatch_once_t onceToken; @@ -391,7 +391,7 @@ - (NSString *)accessibilityValue } } NSMutableArray *valueComponents = [NSMutableArray new]; - NSString *roleDescription = self.accessibilityRoleInternal ? rolesAndStatesDescription[self.accessibilityRoleInternal] : nil; // TODO(OSS Candidate ISS#2710739): renamed prop so it doesn't conflict with -[NSAccessibility accessibilityRole]. + NSString *roleDescription = self.accessibilityRoleInternal ? rolesAndStatesDescription[self.accessibilityRoleInternal] : nil; // [macOS] renamed prop so it doesn't conflict with -[NSAccessibility accessibilityRole]. if (roleDescription) { [valueComponents addObject:roleDescription]; } @@ -438,7 +438,7 @@ - (NSString *)accessibilityValue } return nil; } -#else // [TODO(macOS GH#774) +#else // [macOS - (id)accessibilityValue { id accessibilityValue = nil; NSAccessibilityRole role = [self accessibilityRole]; @@ -517,12 +517,10 @@ - (BOOL)isAccessibilitySelectorAllowed:(SEL)selector { if (_onAccessibilityAction != nil && accessibilityActionsNameMap[@"decrement"]) { isAllowed = YES; } -#if TARGET_OS_OSX // [TODO(macOS GH#774) } else if (selector == @selector(accessibilityPerformShowMenu)) { if (_onAccessibilityAction != nil && accessibilityActionsNameMap[@"showMenu"]) { isAllowed = YES; } -#endif // ]TODO(macOS GH#774) } else { isAllowed = YES; } @@ -599,9 +597,9 @@ - (id)accessibilityMaxValue { return accessibilityMaxValue; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] -- (RCTPlatformView *)reactAccessibilityElement // TODO(macOS GH#774) +- (RCTPlatformView *)reactAccessibilityElement // [macOS] { return self; } @@ -624,34 +622,34 @@ - (BOOL)performAccessibilityAction:(NSString *)name return NO; } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (BOOL)accessibilityActivate -#else // [TODO(macOS GH#774) +#else // [macOS - (BOOL)accessibilityPerformPress -#endif // ]TODO(macOS GH#774) +#endif // macOS] { -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS if ([self isAccessibilityEnabled] == NO) { return NO; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] if ([self performAccessibilityAction:@"activate"]) { return YES; } else if (_onAccessibilityTap) { _onAccessibilityTap(nil); return YES; -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS } else if (_onClick != nil) { // macOS is not simulating a click if there is no onAccessibilityAction like it does on iOS, so we simulate it here. _onClick(nil); return YES; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } else { return NO; } } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (BOOL)accessibilityPerformMagicTap { if ([self performAccessibilityAction:@"magicTap"]) { @@ -663,7 +661,7 @@ - (BOOL)accessibilityPerformMagicTap return NO; } } -#endif // TODO(macOS GH#774) +#endif // [macOS] - (BOOL)accessibilityPerformEscape { @@ -677,46 +675,46 @@ - (BOOL)accessibilityPerformEscape } } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)accessibilityIncrement { [self performAccessibilityAction:@"increment"]; } -#else // [TODO(macOS GH#774) +#else // [macOS - (BOOL)accessibilityPerformIncrement { return [self performAccessibilityAction:@"increment"]; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)accessibilityDecrement { [self performAccessibilityAction:@"decrement"]; } -#else // [TODO(macOS GH#774) +#else // [macOS - (BOOL)accessibilityPerformDecrement { return [self performAccessibilityAction:@"decrement"]; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] -#if TARGET_OS_OSX // TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS - (BOOL)accessibilityPerformShowMenu { return [self performAccessibilityAction:@"showMenu"]; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] -#if DEBUG // TODO(macOS GH#774) description is a debug-only feature +#if DEBUG // [macOS description is a debug-only feature - (NSString *)description { - // TODO(macOS GH#774): we shouldn't make assumptions on what super's description is. Just append additional content. + // [macOS] we shouldn't make assumptions on what super's description is. Just append additional content. return [[super description] stringByAppendingFormat:@" reactTag: %@; frame = %@; layer = %@", self.reactTag, NSStringFromCGRect(self.frame), self.layer]; } -#endif // TODO(macOS GH#774) +#endif // macOS] -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS - (void)setShadowColor:(NSColor *)shadowColor { if (_shadowColor != shadowColor) @@ -780,7 +778,7 @@ - (void)viewDidMoveToWindow object:[[self enclosingScrollView] contentView]]; } - [self reactViewDidMoveToWindow]; // TODO(macOS GH#1412) + [self reactViewDidMoveToWindow]; // [macOS] Github#1412 [super viewDidMoveToWindow]; } @@ -823,19 +821,19 @@ - (void)viewBoundsChanged:(NSNotification*)__unused inNotif } } } -#endif // ]TODO(macOS GH#774) +#endif // macOS] #pragma mark - Statics for dealing with layoutGuides -+ (void)autoAdjustInsetsForView:(RCTUIView *)parentView // TODO(macOS ISS#3536887) - withScrollView:(RCTUIScrollView *)scrollView // TODO(macOS ISS#3536887) ++ (void)autoAdjustInsetsForView:(RCTUIView *)parentView // [macOS] + withScrollView:(RCTUIScrollView *)scrollView // [macOS] updateOffset:(BOOL)updateOffset { UIEdgeInsets baseInset = parentView.contentInset; CGFloat previousInsetTop = scrollView.contentInset.top; CGPoint contentOffset = scrollView.contentOffset; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] if (parentView.automaticallyAdjustContentInsets) { UIEdgeInsets autoInset = RCTContentInsets(parentView); baseInset.top += autoInset.top; @@ -843,7 +841,7 @@ + (void)autoAdjustInsetsForView:(RCTUIView *)parentView / baseInset.left += autoInset.left; baseInset.right += autoInset.right; } -#endif // TODO(macOS GH#774) +#endif // [macOS] scrollView.contentInset = baseInset; scrollView.scrollIndicatorInsets = baseInset; @@ -865,7 +863,7 @@ + (void)autoAdjustInsetsForView:(RCTUIView *)parentView / - (void)react_remountAllSubviews { if (_removeClippedSubviews) { - for (RCTUIView *view in self.reactSubviews) { // TODO(macOS ISS#3536887) + for (RCTUIView *view in self.reactSubviews) { // [macOS] if (view.superview != self) { [self addSubview:view]; [view react_remountAllSubviews]; @@ -877,7 +875,7 @@ - (void)react_remountAllSubviews } } -- (void)react_updateClippedSubviewsWithClipRect:(CGRect)clipRect relativeToView:(RCTPlatformView *)clipView // TODO(macOS GH#774) +- (void)react_updateClippedSubviewsWithClipRect:(CGRect)clipRect relativeToView:(RCTPlatformView *)clipView // [macOS] { // TODO (#5906496): for scrollviews (the primary use-case) we could // optimize this by only doing a range check along the scroll axis, @@ -904,7 +902,7 @@ - (void)react_updateClippedSubviewsWithClipRect:(CGRect)clipRect relativeToView: clipView = self; // Mount / unmount views - for (RCTUIView *view in self.reactSubviews) { // TODO(macOS ISS#3536887) + for (RCTUIView *view in self.reactSubviews) { // [macOS] if (!CGSizeEqualToSize(CGRectIntersection(clipRect, view.frame).size, CGSizeZero)) { // View is at least partially visible, so remount it if unmounted [self addSubview:view]; @@ -945,7 +943,7 @@ - (void)didUpdateReactSubviews - (void)updateClippedSubviews { // Find a suitable view to use for clipping - RCTPlatformView *clipView = [self react_findClipView]; // TODO(macOS GH#774) + RCTPlatformView *clipView = [self react_findClipView]; // [macOS] if (clipView) { [self react_updateClippedSubviewsWithClipRect:clipView.bounds relativeToView:clipView]; } @@ -965,7 +963,7 @@ - (void)layoutSubviews } } -// [TODO(OSS Candidate ISS#2710739) +// [macOS - (BOOL)becomeFirstResponder { if (![super becomeFirstResponder]) { @@ -990,7 +988,7 @@ - (BOOL)resignFirstResponder return YES; } -#if !TARGET_OS_OSX +#if !TARGET_OS_OSX // [macOS] - (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection { [super traitCollectionDidChange:previousTraitCollection]; @@ -1002,18 +1000,16 @@ - (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection } #endif } -#endif // !TARGET_OS_OSX - -// ]TODO(OSS Candidate ISS#2710739) +#endif // [macOS] #pragma mark - Borders -- (RCTUIColor *)backgroundColor // TODO(OSS Candidate ISS#2710739) RCTUIColor +- (RCTUIColor *)backgroundColor // macOS RCTUIColor { return _backgroundColor; } -- (void)setBackgroundColor:(RCTUIColor *)backgroundColor // TODO(OSS Candidate ISS#2710739) RCTUIColor +- (void)setBackgroundColor:(RCTUIColor *)backgroundColor // macOS RCTUIColor { if ([_backgroundColor isEqual:backgroundColor]) { return; @@ -1121,11 +1117,11 @@ - (RCTBorderColors)borderColors const BOOL isRTL = _reactLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft; if ([[RCTI18nUtil sharedInstance] doLeftAndRightSwapInRTL]) { - RCTUIColor *borderStartColor = _borderStartColor ?: _borderLeftColor; // TODO(OSS Candidate ISS#2710739) RCTUIColor - RCTUIColor *borderEndColor = _borderEndColor ?: _borderRightColor; // TODO(OSS Candidate ISS#2710739) RCTUIColor + RCTUIColor *borderStartColor = _borderStartColor ?: _borderLeftColor; // macOS RCTUIColor + RCTUIColor *borderEndColor = _borderEndColor ?: _borderRightColor; // macOS RCTUIColor - RCTUIColor *directionAwareBorderLeftColor = isRTL ? borderEndColor : borderStartColor; // TODO(OSS Candidate ISS#2710739) RCTUIColor - RCTUIColor *directionAwareBorderRightColor = isRTL ? borderStartColor : borderEndColor; // TODO(OSS Candidate ISS#2710739) RCTUIColor + RCTUIColor *directionAwareBorderLeftColor = isRTL ? borderEndColor : borderStartColor; // macOS RCTUIColor + RCTUIColor *directionAwareBorderRightColor = isRTL ? borderStartColor : borderEndColor; // macOS RCTUIColor return (RCTBorderColors){ (_borderTopColor ?: _borderColor).CGColor, @@ -1135,8 +1131,8 @@ - (RCTBorderColors)borderColors }; } - RCTUIColor *directionAwareBorderLeftColor = isRTL ? _borderEndColor : _borderStartColor; // TODO(OSS Candidate ISS#2710739) RCTUIColor - RCTUIColor *directionAwareBorderRightColor = isRTL ? _borderStartColor : _borderEndColor; // TODO(OSS Candidate ISS#2710739) RCTUIColor + RCTUIColor *directionAwareBorderLeftColor = isRTL ? _borderEndColor : _borderStartColor; // macOS RCTUIColor + RCTUIColor *directionAwareBorderRightColor = isRTL ? _borderStartColor : _borderEndColor; // macOS RCTUIColor return (RCTBorderColors){ (_borderTopColor ?: _borderColor).CGColor, @@ -1166,10 +1162,10 @@ - (void)displayLayer:(CALayer *)layer RCTUpdateShadowPathForView(self); -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS // clipsToBounds is stubbed out on macOS because it's not part of NSView layer.masksToBounds = self.clipsToBounds; -#endif // ]TODO(macOS GH#774) +#endif // macOS] const RCTCornerRadii cornerRadii = [self cornerRadii]; const UIEdgeInsets borderInsets = [self bordersAsInsets]; @@ -1199,7 +1195,7 @@ - (void)displayLayer:(CALayer *)layer backgroundColor = _backgroundColor.CGColor; #endif -#if TARGET_OS_OSX // [TODO(macOS GH#1035) +#if TARGET_OS_OSX // [macOS CATransform3D transform = [self transform3D]; CGPoint anchorPoint = [layer anchorPoint]; if (CGPointEqualToPoint(anchorPoint, CGPointZero) && !CATransform3DEqualToTransform(transform, CATransform3DIdentity)) { @@ -1211,7 +1207,7 @@ - (void)displayLayer:(CALayer *)layer [layer setAllowsEdgeAntialiasing:!(transform.m34 == 0.0f)]; } [layer setTransform:transform]; -#endif // ]TODO(macOS GH#1035) +#endif // macOS] if (useIOSBorderRendering) { layer.cornerRadius = cornerRadii.topLeft; layer.borderColor = borderColors.left; @@ -1223,7 +1219,7 @@ - (void)displayLayer:(CALayer *)layer return; } -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS CGFloat scaleFactor = self.window.backingScaleFactor; if (scaleFactor == 0.0 && RCTRunningInTestEnvironment()) { // When running in the test environment the view is not on screen. @@ -1234,10 +1230,10 @@ - (void)displayLayer:(CALayer *)layer #else // On iOS setting the scaleFactor to 0.0 will default to the device's native scale factor. CGFloat scaleFactor = 0.0; -#endif // ]TODO(macOS GH#774) +#endif // macOS] UIImage *image = RCTGetBorderImage( - _borderStyle, layer.bounds.size, cornerRadii, borderInsets, borderColors, backgroundColor, self.clipsToBounds, scaleFactor); // TODO(OSS Candidate ISS#2710739) + _borderStyle, layer.bounds.size, cornerRadii, borderInsets, borderColors, backgroundColor, self.clipsToBounds, scaleFactor); // [macOS] layer.backgroundColor = NULL; @@ -1254,13 +1250,13 @@ - (void)displayLayer:(CALayer *)layer insets.left / size.width, insets.top / size.height, (CGFloat)1.0 / size.width, (CGFloat)1.0 / size.height); }); -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] layer.contents = (id)image.CGImage; layer.contentsScale = image.scale; -#else // [TODO(macOS GH#774) +#else // [macOS layer.contents = [image layerContentsForContentsScale:scaleFactor]; layer.contentsScale = scaleFactor; -#endif // ]TODO(macOS GH#774) +#endif // macOS] layer.needsDisplayOnBoundsChange = YES; layer.magnificationFilter = kCAFilterNearest; @@ -1330,7 +1326,7 @@ - (void)updateClippingForLayer:(CALayer *)layer #pragma mark Border Color -// TODO(OSS Candidate ISS#2710739) RCTUIColor +// macOS RCTUIColor #define setBorderColor(side) \ -(void)setBorder##side##Color : (RCTUIColor *)color \ { \ @@ -1389,9 +1385,10 @@ -(void)setBorder##side##Style : (RCTBorderStyle)style \ setBorderStyle() -#pragma mark Focus ring // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS + +#pragma mark Focus ring -#if TARGET_OS_OSX - (CGRect)focusRingMaskBounds { return self.bounds; @@ -1409,11 +1406,9 @@ - (void)drawFocusRingMask CGPathRelease(path); } } -#endif #pragma mark - macOS Event Handler -#if TARGET_OS_OSX - (void)resetCursorRects { [self discardCursorRects]; @@ -1657,11 +1652,9 @@ - (BOOL)performDragOperation:(id )sender additionalData:[self dataTransferInfoFromPasteboard:sender.draggingPasteboard]]; return YES; } -#endif // ]TODO(macOS GH#774) #pragma mark - Keyboard Events -#if TARGET_OS_OSX - (RCTViewKeyboardEvent*)keyboardEvent:(NSEvent*)event { BOOL keyDown = event.type == NSEventTypeKeyDown; NSArray *validKeys = keyDown ? self.validKeysDown : self.validKeysUp; @@ -1697,6 +1690,6 @@ - (void)keyUp:(NSEvent *)event { [super keyUp:event]; } } -#endif // TARGET_OS_OSX +#endif // macOS] @end diff --git a/React/Views/RCTViewKeyboardEvent.h b/React/Views/RCTViewKeyboardEvent.h index 25d35441dcf32b..e4b60b62b2479e 100644 --- a/React/Views/RCTViewKeyboardEvent.h +++ b/React/Views/RCTViewKeyboardEvent.h @@ -8,10 +8,10 @@ @interface RCTViewKeyboardEvent : RCTComponentEvent -#if TARGET_OS_OSX // TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS + (NSDictionary *)bodyFromEvent:(NSEvent *)event; + (NSString *)keyFromEvent:(NSEvent *)event; + (instancetype)keyEventFromEvent:(NSEvent *)event reactTag:(NSNumber *)reactTag; -#endif // TODO(macOS GH#774) +#endif // macOS] @end diff --git a/React/Views/RCTViewKeyboardEvent.m b/React/Views/RCTViewKeyboardEvent.m index 3ec04a2e350eb3..cca78099bd0a8c 100644 --- a/React/Views/RCTViewKeyboardEvent.m +++ b/React/Views/RCTViewKeyboardEvent.m @@ -5,12 +5,14 @@ * LICENSE file in the root directory of this source tree. */ + // [macOS] + #import "RCTViewKeyboardEvent.h" #import @implementation RCTViewKeyboardEvent -#if TARGET_OS_OSX // TODO(macOS GH#774) +#if TARGET_OS_OSX + (NSDictionary *)bodyFromEvent:(NSEvent *)event { NSString *key = [self keyFromEvent:event]; @@ -77,6 +79,6 @@ + (instancetype)keyEventFromEvent:(NSEvent *)event reactTag:(NSNumber *)reactTag viewTag:reactTag body:[self bodyFromEvent:event]]; } -#endif // TODO(macOS GH#774) +#endif @end diff --git a/React/Views/RCTViewManager.h b/React/Views/RCTViewManager.h index 2b0d2c7e489fad..be6c6baf53cdf8 100644 --- a/React/Views/RCTViewManager.h +++ b/React/Views/RCTViewManager.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import @@ -19,7 +19,7 @@ @class RCTSparseArray; @class RCTUIManager; -typedef void (^RCTViewManagerUIBlock)(RCTUIManager *uiManager, NSDictionary *viewRegistry); // TODO(macOS GH#774) +typedef void (^RCTViewManagerUIBlock)(RCTUIManager *uiManager, NSDictionary *viewRegistry); // [macOS] @interface RCTViewManager : NSObject @@ -37,7 +37,7 @@ typedef void (^RCTViewManagerUIBlock)(RCTUIManager *uiManager, NSDictionary *viewRegistry) { @@ -147,37 +147,37 @@ - (RCTShadowView *)shadowView [view reactBlur]; }]; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] #pragma mark - View properties // Accessibility related properties -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCT_REMAP_VIEW_PROPERTY(accessible, reactAccessibilityElement.isAccessibilityElement, BOOL) -#else // [TODO(macOS GH#774) +#else // [macOS RCT_REMAP_VIEW_PROPERTY(accessible, reactAccessibilityElement.accessibilityElement, BOOL) -#endif // ]TODO(macOS GH#774) +#endif // macOS] RCT_REMAP_VIEW_PROPERTY(accessibilityActions, reactAccessibilityElement.accessibilityActions, NSDictionaryArray) RCT_REMAP_VIEW_PROPERTY(accessibilityLabel, reactAccessibilityElement.accessibilityLabel, NSString) -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCT_REMAP_VIEW_PROPERTY(accessibilityHint, reactAccessibilityElement.accessibilityHint, NSString) -#else // [TODO(macOS GH#774) +#else // [macOS RCT_REMAP_VIEW_PROPERTY(accessibilityHint, reactAccessibilityElement.accessibilityHelp, NSString) -#endif // TODO(macOS GH#774) +#endif // macOS] RCT_REMAP_VIEW_PROPERTY(accessibilityValue, reactAccessibilityElement.accessibilityValueInternal, NSDictionary) -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCT_REMAP_VIEW_PROPERTY(accessibilityViewIsModal, reactAccessibilityElement.accessibilityViewIsModal, BOOL) RCT_REMAP_VIEW_PROPERTY(accessibilityElementsHidden, reactAccessibilityElement.accessibilityElementsHidden, BOOL) RCT_REMAP_VIEW_PROPERTY( accessibilityIgnoresInvertColors, reactAccessibilityElement.shouldAccessibilityIgnoresInvertColors, BOOL) -#endif // ]TODO(macOS GH#774) +#endif // [macOS] RCT_REMAP_VIEW_PROPERTY(onAccessibilityAction, reactAccessibilityElement.onAccessibilityAction, RCTDirectEventBlock) RCT_REMAP_VIEW_PROPERTY(onAccessibilityTap, reactAccessibilityElement.onAccessibilityTap, RCTDirectEventBlock) -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCT_REMAP_VIEW_PROPERTY(onMagicTap, reactAccessibilityElement.onMagicTap, RCTDirectEventBlock) -#else // [TODO(macOS GH#774): accessibilityTraits is gone in react-native and deprecated in react-native-macos, use accessibilityRole instead +#else // [macOS accessibilityTraits is gone in react-native and deprecated in react-native-macos, use accessibilityRole instead RCT_CUSTOM_VIEW_PROPERTY(accessibilityTraits, NSString, RCTView) { if (json) { @@ -186,29 +186,29 @@ - (RCTShadowView *)shadowView view.accessibilityRole = defaultView.accessibilityRole; } } -#endif // ]TODO(macOS GH#774) +#endif // macOS] RCT_REMAP_VIEW_PROPERTY(onAccessibilityEscape, reactAccessibilityElement.onAccessibilityEscape, RCTDirectEventBlock) RCT_REMAP_VIEW_PROPERTY(testID, reactAccessibilityElement.accessibilityIdentifier, NSString) RCT_EXPORT_VIEW_PROPERTY(backgroundColor, UIColor) RCT_REMAP_VIEW_PROPERTY(backfaceVisibility, layer.doubleSided, css_backface_visibility_t) -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCT_REMAP_VIEW_PROPERTY(opacity, alpha, CGFloat) -#else // [TODO(macOS GH#774) +#else // [macOS RCT_REMAP_VIEW_PROPERTY(opacity, alphaValue, CGFloat) -#endif // ]TODO(macOS GH#774) +#endif // macOS] -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCT_REMAP_VIEW_PROPERTY(shadowColor, layer.shadowColor, CGColor) RCT_REMAP_VIEW_PROPERTY(shadowOffset, layer.shadowOffset, CGSize) RCT_REMAP_VIEW_PROPERTY(shadowOpacity, layer.shadowOpacity, float) RCT_REMAP_VIEW_PROPERTY(shadowRadius, layer.shadowRadius, CGFloat) -#else // [TODO(macOS GH#774) +#else // [macOS RCT_EXPORT_VIEW_PROPERTY(shadowColor, NSColor) RCT_EXPORT_VIEW_PROPERTY(shadowOffset, CGSize) RCT_EXPORT_VIEW_PROPERTY(shadowOpacity, CGFloat) RCT_EXPORT_VIEW_PROPERTY(shadowRadius, CGFloat) -#endif // ]TODO(macOS GH#774) +#endif // macOS] RCT_REMAP_VIEW_PROPERTY(needsOffscreenAlphaCompositing, layer.allowsGroupOpacity, BOOL) RCT_CUSTOM_VIEW_PROPERTY(overflow, YGOverflow, RCTView) @@ -219,32 +219,32 @@ - (RCTShadowView *)shadowView view.clipsToBounds = defaultView.clipsToBounds; } } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCT_CUSTOM_VIEW_PROPERTY(shouldRasterizeIOS, BOOL, RCTView) { view.layer.shouldRasterize = json ? [RCTConvert BOOL:json] : defaultView.layer.shouldRasterize; view.layer.rasterizationScale = view.layer.shouldRasterize ? [UIScreen mainScreen].scale : defaultView.layer.rasterizationScale; } -#endif // TODO(macOS GH#774) +#endif // [macOS] RCT_CUSTOM_VIEW_PROPERTY(transform, CATransform3D, RCTView) { -#if TARGET_OS_OSX // [TODO(macOS GH#460) - CATransform3D transform = json ? [RCTConvert CATransform3D:json] : defaultView.layer.transform; - [view setTransform3D:transform]; - [view setNeedsDisplay]; -#else // ]TODO(macOS GH#460)] +#if !TARGET_OS_OSX // [macOS] view.layer.transform = json ? [RCTConvert CATransform3D:json] : defaultView.layer.transform; // Enable edge antialiasing in rotation, skew, or perspective transforms view.layer.allowsEdgeAntialiasing = view.layer.transform.m12 != 0.0f || view.layer.transform.m21 != 0.0f || view.layer.transform.m34 != 0.0f; -#endif // [TODO(macOS GH#460)] +#else // [macOS + CATransform3D transform = json ? [RCTConvert CATransform3D:json] : defaultView.layer.transform; + [view setTransform3D:transform]; + [view setNeedsDisplay]; +#endif // macOS] } RCT_CUSTOM_VIEW_PROPERTY(accessibilityRole, UIAccessibilityTraits, RCTView) { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] const UIAccessibilityTraits AccessibilityRolesMask = UIAccessibilityTraitNone | UIAccessibilityTraitButton | UIAccessibilityTraitLink | UIAccessibilityTraitSearchField | UIAccessibilityTraitImage | UIAccessibilityTraitKeyboardKey | UIAccessibilityTraitStaticText | UIAccessibilityTraitAdjustable | @@ -258,15 +258,15 @@ - (RCTShadowView *)shadowView view.reactAccessibilityElement.accessibilityTraits |= maskedTraits; } else { NSString *role = json ? [RCTConvert NSString:json] : @""; - view.reactAccessibilityElement.accessibilityRoleInternal = role; // TODO(OSS Candidate ISS#2710739): renamed prop so it doesn't conflict with -[NSAccessibility accessibilityRole]. + view.reactAccessibilityElement.accessibilityRoleInternal = role; // [macOS] renamed prop so it doesn't conflict with -[NSAccessibility accessibilityRole]. } -#else // [TODO(macOS GH#774) +#else // [macOS if (json) { view.reactAccessibilityElement.accessibilityRole = [RCTConvert accessibilityRoleFromTraits:json]; } else { view.reactAccessibilityElement.accessibilityRole = defaultView.accessibilityRole; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] } RCT_CUSTOM_VIEW_PROPERTY(accessibilityState, NSDictionary, RCTView) @@ -278,7 +278,7 @@ - (RCTShadowView *)shadowView return; } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] const UIAccessibilityTraits AccessibilityStatesMask = UIAccessibilityTraitNotEnabled | UIAccessibilityTraitSelected; view.reactAccessibilityElement.accessibilityTraits = view.reactAccessibilityElement.accessibilityTraits & ~AccessibilityStatesMask; @@ -296,7 +296,7 @@ - (RCTShadowView *)shadowView newState[s] = val; } } -#else // [TODO(macOS GH#774) +#else // [macOS for (NSString *s in state) { id val = [state objectForKey:s]; if (val == nil) { @@ -304,7 +304,7 @@ - (RCTShadowView *)shadowView } newState[s] = val; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] if (newState.count > 0) { view.reactAccessibilityElement.accessibilityState = newState; } else { @@ -394,7 +394,7 @@ - (RCTShadowView *)shadowView } } -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS // macOS properties RCT_CUSTOM_VIEW_PROPERTY(acceptsFirstMouse, BOOL, RCTView) { @@ -427,7 +427,7 @@ - (RCTShadowView *)shadowView [view registerForDraggedTypes:types]; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] RCT_CUSTOM_VIEW_PROPERTY(collapsable, BOOL, RCTView) { @@ -477,13 +477,13 @@ - (RCTShadowView *)shadowView RCT_REMAP_VIEW_PROPERTY(display, reactDisplay, YGDisplay) RCT_REMAP_VIEW_PROPERTY(zIndex, reactZIndex, NSInteger) -// [TODO(OSS Candidate ISS#2710739) +// [macOS RCT_EXPORT_VIEW_PROPERTY(onFocus, RCTBubblingEventBlock) RCT_EXPORT_VIEW_PROPERTY(onBlur, RCTBubblingEventBlock) -// ]TODO(OSS Candidate ISS#2710739) +// macOS] -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS #pragma mark - macOS properties RCT_EXPORT_VIEW_PROPERTY(cursor, RCTCursor) @@ -498,8 +498,6 @@ - (RCTShadowView *)shadowView RCT_EXPORT_VIEW_PROPERTY(onKeyUp, RCTDirectEventBlock) // macOS keyboard events RCT_EXPORT_VIEW_PROPERTY(validKeysDown, NSArray) RCT_EXPORT_VIEW_PROPERTY(validKeysUp, NSArray) -#endif // ]TODO(macOS GH#774) -#if TARGET_OS_OSX // [TODO(macOS GH#768) RCT_CUSTOM_VIEW_PROPERTY(nextKeyViewTag, NSNumber, RCTView) { NSNumber *nextKeyViewTag = [RCTConvert NSNumber:json]; @@ -530,7 +528,7 @@ - (RCTShadowView *)shadowView [[view window] recalculateKeyViewLoop]; }]; } -#endif // ]TODO(macOS GH#768) +#endif // macOS] #pragma mark - ShadowView properties diff --git a/React/Views/RCTViewUtils.h b/React/Views/RCTViewUtils.h index 957de875362aaa..d274bb53386cf7 100644 --- a/React/Views/RCTViewUtils.h +++ b/React/Views/RCTViewUtils.h @@ -7,13 +7,13 @@ #import -#import // TODO(macOS GH#774) +#import // [macOS] NS_ASSUME_NONNULL_BEGIN RCT_EXTERN_C_BEGIN -UIEdgeInsets RCTContentInsets(RCTPlatformView *view); // TODO(macOS GH#774) +UIEdgeInsets RCTContentInsets(RCTPlatformView *view); // [macOS] RCT_EXTERN_C_END diff --git a/React/Views/RCTViewUtils.m b/React/Views/RCTViewUtils.m index 769f58b16342c6..4872e00fa5c73f 100644 --- a/React/Views/RCTViewUtils.m +++ b/React/Views/RCTViewUtils.m @@ -9,9 +9,9 @@ #import "UIView+React.h" -UIEdgeInsets RCTContentInsets(RCTPlatformView *view) // TODO(macOS GH#774) +UIEdgeInsets RCTContentInsets(RCTPlatformView *view) // [macOS] { -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] while (view) { UIViewController *controller = view.reactViewController; if (controller) { @@ -19,6 +19,6 @@ UIEdgeInsets RCTContentInsets(RCTPlatformView *view) // TODO(macOS GH#774) } view = view.superview; } -#endif // ]TODO(macOS GH#774) +#endif // [macOS] return UIEdgeInsetsZero; } diff --git a/React/Views/RCTWeakViewHolder.h b/React/Views/RCTWeakViewHolder.h index db0b489a1545c5..0f37b1bbcb8d45 100644 --- a/React/Views/RCTWeakViewHolder.h +++ b/React/Views/RCTWeakViewHolder.h @@ -14,6 +14,6 @@ */ @protocol RCTWeakViewHolder -@property (nonatomic, strong) NSMapTable *weakViews; // TODO(macOS GH#774) +@property (nonatomic, strong) NSMapTable *weakViews; // [macOS] @end diff --git a/React/Views/RCTWrapperViewController.h b/React/Views/RCTWrapperViewController.h index 5f8357eaa4934d..a0c075613c413e 100644 --- a/React/Views/RCTWrapperViewController.h +++ b/React/Views/RCTWrapperViewController.h @@ -5,12 +5,12 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] @class RCTWrapperViewController; @interface RCTWrapperViewController : UIViewController -- (instancetype)initWithContentView:(RCTUIView *)contentView NS_DESIGNATED_INITIALIZER; // TODO(macOS GH#774) +- (instancetype)initWithContentView:(RCTUIView *)contentView NS_DESIGNATED_INITIALIZER; // [macOS] @end diff --git a/React/Views/RefreshControl/RCTRefreshControl.h b/React/Views/RefreshControl/RCTRefreshControl.h index f3d6b2cdc6e150..31943c474883c9 100644 --- a/React/Views/RefreshControl/RCTRefreshControl.h +++ b/React/Views/RefreshControl/RCTRefreshControl.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import @@ -14,6 +14,6 @@ @property (nonatomic, copy) NSString *title; @property (nonatomic, copy) RCTDirectEventBlock onRefresh; -@property (nonatomic, weak) RCTUIScrollView *scrollView; // TODO(macOS GH#774) +@property (nonatomic, weak) RCTUIScrollView *scrollView; // [macOS] @end diff --git a/React/Views/RefreshControl/RCTRefreshableProtocol.h b/React/Views/RefreshControl/RCTRefreshableProtocol.h index ccfb6426cbeff0..122767b8617702 100644 --- a/React/Views/RefreshControl/RCTRefreshableProtocol.h +++ b/React/Views/RefreshControl/RCTRefreshableProtocol.h @@ -6,7 +6,7 @@ */ #import -#import // TODO(macOS GH#774) +#import // [macOS] /** * Protocol used to dispatch commands in `RCTRefreshControlManager.h`. diff --git a/React/Views/SafeAreaView/RCTSafeAreaView.h b/React/Views/SafeAreaView/RCTSafeAreaView.h index 34e875558ecc77..12d1876907bd24 100644 --- a/React/Views/SafeAreaView/RCTSafeAreaView.h +++ b/React/Views/SafeAreaView/RCTSafeAreaView.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import diff --git a/React/Views/SafeAreaView/RCTSafeAreaView.m b/React/Views/SafeAreaView/RCTSafeAreaView.m index 46097f57a5889f..6fe788c91f6d17 100644 --- a/React/Views/SafeAreaView/RCTSafeAreaView.m +++ b/React/Views/SafeAreaView/RCTSafeAreaView.m @@ -30,7 +30,7 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)decoder) RCT_NOT_IMPLEMENTED(-(instancetype)initWithFrame : (CGRect)frame) -#if DEBUG // TODO(macOS GH#774) description is a debug-only feature +#if DEBUG // [macOS] description is a debug-only feature - (NSString *)description { NSString *superDescription = [super description]; @@ -45,7 +45,7 @@ - (NSString *)description NSStringFromUIEdgeInsets([self safeAreaInsetsIfSupportedAndEnabled]), NSStringFromUIEdgeInsets(_currentSafeAreaInsets)]; } -#endif // TODO(macOS GH#774) +#endif // [macOS] - (BOOL)isSupportedByOS { diff --git a/React/Views/SafeAreaView/RCTSafeAreaViewLocalData.h b/React/Views/SafeAreaView/RCTSafeAreaViewLocalData.h index f3a4b2bab0acd1..a9482d01e687ec 100644 --- a/React/Views/SafeAreaView/RCTSafeAreaViewLocalData.h +++ b/React/Views/SafeAreaView/RCTSafeAreaViewLocalData.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] NS_ASSUME_NONNULL_BEGIN diff --git a/React/Views/ScrollView/RCTScrollContentShadowView.h b/React/Views/ScrollView/RCTScrollContentShadowView.h index 9bb825d7b1c4ae..d7c570055f275d 100644 --- a/React/Views/ScrollView/RCTScrollContentShadowView.h +++ b/React/Views/ScrollView/RCTScrollContentShadowView.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import diff --git a/React/Views/ScrollView/RCTScrollContentShadowView.m b/React/Views/ScrollView/RCTScrollContentShadowView.m index 986685c2d7f8df..e62bd7287ab5f3 100644 --- a/React/Views/ScrollView/RCTScrollContentShadowView.m +++ b/React/Views/ScrollView/RCTScrollContentShadowView.m @@ -9,15 +9,15 @@ #import -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS #import "RCTScrollContentLocalData.h" -#endif // ]TODO(macOS GH#774) +#endif // macOS] #import "RCTUtils.h" @implementation RCTScrollContentShadowView -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS - (void)setLocalData:(RCTScrollContentLocalData *)localData { RCTAssert( @@ -29,7 +29,7 @@ - (void)setLocalData:(RCTScrollContentLocalData *)localData [self didSetProps:@[@"marginEnd", @"marginBottom"]]; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] - (void)layoutWithMetrics:(RCTLayoutMetrics)layoutMetrics layoutContext:(RCTLayoutContext)layoutContext { diff --git a/React/Views/ScrollView/RCTScrollContentView.h b/React/Views/ScrollView/RCTScrollContentView.h index 3fb89ede4b0f14..012a2c2456dd12 100644 --- a/React/Views/ScrollView/RCTScrollContentView.h +++ b/React/Views/ScrollView/RCTScrollContentView.h @@ -5,14 +5,14 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import @interface RCTScrollContentView : RCTView -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS @property (nonatomic, assign, getter=isInverted) BOOL inverted; -#endif // ]TODO(macOS GH#774) +#endif // macOS] @end diff --git a/React/Views/ScrollView/RCTScrollContentView.m b/React/Views/ScrollView/RCTScrollContentView.m index b54a393a08f0cb..1e2d25658fab09 100644 --- a/React/Views/ScrollView/RCTScrollContentView.m +++ b/React/Views/ScrollView/RCTScrollContentView.m @@ -10,31 +10,31 @@ #import #import -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS #import #import "RCTScrollContentLocalData.h" -#endif // ]TODO(macOS GH#774) +#endif // macOS] #import "RCTScrollView.h" @implementation RCTScrollContentView -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS - (BOOL)isFlipped { return !self.inverted; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] - (void)reactSetFrame:(CGRect)frame { [super reactSetFrame:frame]; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCTScrollView *scrollView = (RCTScrollView *)self.superview.superview; -#else // [TODO(macOS GH#774) +#else // [macOS // macOS also has a NSClipView in its hierarchy RCTScrollView *scrollView = (RCTScrollView *)self.superview.superview.superview; -#endif // ]TODO(macOS GH#774) +#endif // macOS] if (!scrollView) { return; @@ -43,7 +43,7 @@ - (void)reactSetFrame:(CGRect)frame RCTAssert([scrollView isKindOfClass:[RCTScrollView class]], @"Unexpected view hierarchy of RCTScrollView component."); [scrollView updateContentSizeIfNeeded]; -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS // On macOS scroll indicators may float over the content view like they do in iOS // or depending on system preferences they may be outside of the content view // which means the clip view will be smaller than the scroll view itself. @@ -72,7 +72,7 @@ - (void)reactSetFrame:(CGRect)frame [platformScrollView setAccessibilityRows:subViews]; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] } @end diff --git a/React/Views/ScrollView/RCTScrollContentViewManager.m b/React/Views/ScrollView/RCTScrollContentViewManager.m index 02ddc6520edde5..677003968dabb9 100644 --- a/React/Views/ScrollView/RCTScrollContentViewManager.m +++ b/React/Views/ScrollView/RCTScrollContentViewManager.m @@ -14,7 +14,7 @@ @implementation RCTScrollContentViewManager RCT_EXPORT_MODULE() -RCT_EXPORT_OSX_VIEW_PROPERTY(inverted, BOOL) // TODO(macOS GH#774) +RCT_EXPORT_OSX_VIEW_PROPERTY(inverted, BOOL) // [macOS] - (RCTScrollContentView *)view { diff --git a/React/Views/ScrollView/RCTScrollEvent.m b/React/Views/ScrollView/RCTScrollEvent.m index f4b05ccd408861..b5139e0f930b3e 100644 --- a/React/Views/ScrollView/RCTScrollEvent.m +++ b/React/Views/ScrollView/RCTScrollEvent.m @@ -16,7 +16,7 @@ @implementation RCTScrollEvent { CGFloat _scrollViewZoomScale; NSDictionary *_userData; uint16_t _coalescingKey; - NSDictionary *_body; // TODO(OSS Candidate ISS#2710739) + NSDictionary *_body; // [macOS] } @synthesize viewTag = _viewTag; @@ -44,7 +44,7 @@ - (instancetype)initWithEventName:(NSString *)eventName _scrollViewZoomScale = scrollViewZoomScale; _userData = userData; _coalescingKey = coalescingKey; - _body = [self body]; // TODO(OSS Candidate ISS#2710739) + _body = [self body]; // [macOS] } return self; } @@ -109,7 +109,7 @@ - (NSArray *)arguments // Previously this called [self body], which in turn calls view-related methods. // Because the arguments method is called from a background thread, we now return // the cached metrics from _body to avoid calling main-thread-specific methods. - return @[ self.viewTag, RCTNormalizeInputEventName(self.eventName), _body ]; // TODO(OSS Candidate ISS#2710739) + return @[ self.viewTag, RCTNormalizeInputEventName(self.eventName), _body ]; // [macOS] } @end diff --git a/React/Views/ScrollView/RCTScrollView.h b/React/Views/ScrollView/RCTScrollView.h index 5c9c8dea95cc63..b624a56908a043 100644 --- a/React/Views/ScrollView/RCTScrollView.h +++ b/React/Views/ScrollView/RCTScrollView.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import @@ -16,11 +16,11 @@ @protocol UIScrollViewDelegate; @interface RCTScrollView : RCTView < -#if TARGET_OS_IPHONE // [TODO(macOS GH#774) +#if TARGET_OS_IPHONE // [macOS UIScrollViewDelegate, #endif RCTScrollableProtocol, RCTAutoInsetsProtocol -> // ]TODO(macOS GH#774) +> // macOS] - (instancetype)initWithEventDispatcher:(id)eventDispatcher NS_DESIGNATED_INITIALIZER; @@ -33,12 +33,12 @@ * efficiently since it will have already been computed by the off-main-thread * layout system. */ -@property (nonatomic, readonly) RCTUIView *contentView; // TODO(macOS ISS#3536887) +@property (nonatomic, readonly) RCTUIView *contentView; // [macOS] /** * The underlying scrollView (TODO: can we remove this?) */ -@property (nonatomic, readonly) RCTUIScrollView *scrollView; // TODO(macOS ISS#3536887) +@property (nonatomic, readonly) RCTUIScrollView *scrollView; // [macOS] @property (nonatomic, assign) UIEdgeInsets contentInset; @property (nonatomic, assign) BOOL automaticallyAdjustContentInsets; @@ -65,11 +65,11 @@ @property (nonatomic, copy) RCTDirectEventBlock onScrollEndDrag; @property (nonatomic, copy) RCTDirectEventBlock onMomentumScrollBegin; @property (nonatomic, copy) RCTDirectEventBlock onMomentumScrollEnd; -@property (nonatomic, copy) RCTDirectEventBlock onPreferredScrollerStyleDidChange; // TODO(macOS GH#774) +@property (nonatomic, copy) RCTDirectEventBlock onPreferredScrollerStyleDidChange; // [macOS] -@property (nonatomic, copy) RCTDirectEventBlock onInvertedDidChange; // TODO(macOS GH#774) +@property (nonatomic, copy) RCTDirectEventBlock onInvertedDidChange; // [macOS] -- (void)flashScrollIndicators; // TODO(macOS GH#774) +- (void)flashScrollIndicators; // [macOS] @end diff --git a/React/Views/ScrollView/RCTScrollView.m b/React/Views/ScrollView/RCTScrollView.m index 6fad425d036d03..683c168adec155 100644 --- a/React/Views/ScrollView/RCTScrollView.m +++ b/React/Views/ScrollView/RCTScrollView.m @@ -7,7 +7,7 @@ #import "RCTScrollView.h" -#import // TODO(macOS GH#774) +#import // [macOS] #import "RCTConvert.h" #import "RCTLog.h" @@ -21,11 +21,11 @@ #import "UIView+React.h" -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] #import "RCTRefreshControl.h" -#else +#else // [macOS #import "RCTViewKeyboardEvent.h" -#endif // TODO(macOS GH#774) +#endif // macOS] /** * Include a custom scroll view subclass because we want to limit certain @@ -33,22 +33,22 @@ * scroll views that contain them. */ @interface RCTCustomScrollView : -#if TARGET_OS_OSX // [TODO(macOS GH#774) - RCTUIScrollView // TODO(macOS ISS#3536887) -#else +#if !TARGET_OS_OSX // [macOS] UIScrollView -#endif // ]TODO(macOS GH#774) +#else // [macOS + RCTUIScrollView +#endif // macOS] @property (nonatomic, assign) BOOL centerContent; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] @property (nonatomic, strong) UIView *customRefreshControl; @property (nonatomic, assign) BOOL pinchGestureEnabled; -#else // [TODO(macOS GH#774) +#else // [macOS + (BOOL)isCompatibleWithResponsiveScrolling; @property (nonatomic, assign, getter=isInverted) BOOL inverted; @property (nonatomic, assign, getter=isScrollEnabled) BOOL scrollEnabled; @property (nonatomic, strong) NSPanGestureRecognizer *panGestureRecognizer; -#endif // ]TODO(macOS GH#774) +#endif // macOS] @end @implementation RCTCustomScrollView @@ -56,13 +56,7 @@ @implementation RCTCustomScrollView - (instancetype)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) { -#if TARGET_OS_OSX // [TODO(macOS GH#774) - self.scrollEnabled = YES; - self.hasHorizontalScroller = YES; - self.hasVerticalScroller = YES; - self.autohidesScrollers = YES; - self.panGestureRecognizer = [[NSPanGestureRecognizer alloc] initWithTarget:self action:@selector(handleCustomPan:)]; -#else // ]TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [self.panGestureRecognizer addTarget:self action:@selector(handleCustomPan:)]; if ([self respondsToSelector:@selector(setSemanticContentAttribute:)]) { @@ -71,21 +65,27 @@ - (instancetype)initWithFrame:(CGRect)frame // scrollbar flip because we also flip it with whole `UIScrollView` flip. self.semanticContentAttribute = UISemanticContentAttributeForceLeftToRight; } -#endif +#else // [macOS + self.scrollEnabled = YES; + self.hasHorizontalScroller = YES; + self.hasVerticalScroller = YES; + self.autohidesScrollers = YES; + self.panGestureRecognizer = [[NSPanGestureRecognizer alloc] initWithTarget:self action:@selector(handleCustomPan:)]; +#endif // macOS] -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] _pinchGestureEnabled = YES; -#endif // TODO(macOS GH#774) +#endif // [macOS] } return self; } -#if !TARGET_OS_OSX // TODO(macOS GH#774) NSScrollView's contentView is an NSClipView. Use documentView to access NSScrollView's content. +#if !TARGET_OS_OSX // [macOS] NSScrollView's contentView is an NSClipView. Use documentView to access NSScrollView's content. - (UIView *)contentView { return ((RCTScrollView *)self.superview).contentView; } -#endif // TODO(macOS GH#774) +#endif // [macOS] /** * @return Whether or not the scroll view interaction should be blocked because @@ -95,15 +95,15 @@ - (BOOL)_shouldDisableScrollInteraction { // Since this may be called on every pan, we need to make sure to only climb // the hierarchy on rare occasions. - RCTPlatformView *JSResponder = [RCTUIManager JSResponder]; // TODO(macOS GH#774) + RCTPlatformView *JSResponder = [RCTUIManager JSResponder]; // [macOS] if (JSResponder && JSResponder != self.superview) { - BOOL superviewHasResponder = RCTUIViewIsDescendantOfView(self, JSResponder); // TODO(macOS GH#774) and TODO(macOS ISS#3536887) + BOOL superviewHasResponder = RCTUIViewIsDescendantOfView(self, JSResponder); // [macOS] return superviewHasResponder; } return NO; } -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS + (BOOL)isCompatibleWithResponsiveScrolling { return YES; @@ -122,9 +122,9 @@ - (void)scrollWheel:(NSEvent *)theEvent } [super scrollWheel:theEvent]; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] -- (void)handleCustomPan:(__unused UIGestureRecognizer *)sender // TODO(macOS GH#774) +- (void)handleCustomPan:(__unused UIGestureRecognizer *)sender // [macOS] { if ([self _shouldDisableScrollInteraction] && ![[RCTUIManager JSResponder] isKindOfClass:[RCTScrollView class]]) { self.panGestureRecognizer.enabled = NO; @@ -152,11 +152,11 @@ - (void)scrollRectToVisible:(CGRect)rect animated:(BOOL)animated if (CGRectIsNull(rect)) { return; } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [super scrollRectToVisible:rect animated:animated]; -#else // [TODO(macOS GH#774) +#else // [macOS [super scrollRectToVisible:rect]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } /** @@ -201,15 +201,15 @@ - (void)scrollRectToVisible:(CGRect)rect animated:(BOOL)animated * In order to have this called, you must have delaysContentTouches set to NO * (which is the not the `UIKit` default). */ -- (BOOL)touchesShouldCancelInContentView:(__unused RCTUIView *)view // TODO(macOS ISS#3536887) +- (BOOL)touchesShouldCancelInContentView:(__unused RCTUIView *)view // [macOS] { BOOL shouldDisableScrollInteraction = [self _shouldDisableScrollInteraction]; -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] if (shouldDisableScrollInteraction == NO) { [super touchesShouldCancelInContentView:view]; } -#endif // [TODO(macOS GH#774) +#endif // [macOS] return !shouldDisableScrollInteraction; } @@ -222,19 +222,19 @@ - (BOOL)touchesShouldCancelInContentView:(__unused RCTUIView *)view // TODO(macO */ - (void)setContentOffset:(CGPoint)contentOffset { - RCTUIView *contentView = nil; // TODO(macOS ISS#3536887) -#if TARGET_OS_OSX // [TODO(macOS GH#774) - contentView = (RCTUIView *) self.documentView; // NSScrollView's documentView must be of type UIView/RCTView and TODO(macOS ISS#3536887) -#else + RCTUIView *contentView = nil; // [macOS] +#if !TARGET_OS_OSX // [macOS] contentView = [self contentView]; -#endif // ]TODO(macOS GH#774) +#else // [macOS + contentView = (RCTUIView *) self.documentView; // [macOS] NSScrollView's documentView must be of type UIView/RCTView +#endif // macOS] if (contentView && _centerContent && !CGSizeEqualToSize(contentView.frame.size, CGSizeZero)) { CGSize subviewSize = contentView.frame.size; -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS CGSize scrollViewSize = self.contentView.bounds.size; -#else // ]TODO(macOS GH#774) +#else // [macOS CGSize scrollViewSize = self.bounds.size; -#endif // TODO(macOS GH#774) +#endif // macOS] if (subviewSize.width <= scrollViewSize.width) { contentOffset.x = -(scrollViewSize.width - subviewSize.width) / 2.0; } @@ -242,20 +242,20 @@ - (void)setContentOffset:(CGPoint)contentOffset contentOffset.y = -(scrollViewSize.height - subviewSize.height) / 2.0; } } -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] + super.contentOffset = CGPointMake( + RCTSanitizeNaNValue(contentOffset.x, @"scrollView.contentOffset.x"), + RCTSanitizeNaNValue(contentOffset.y, @"scrollView.contentOffset.y")); +#else // [macOS if (!NSEqualPoints(contentOffset, self.documentVisibleRect.origin)) { [self.contentView scrollToPoint:contentOffset]; [self reflectScrolledClipView:self.contentView]; } -#else // ]TODO(macOS GH#774) - super.contentOffset = CGPointMake( - RCTSanitizeNaNValue(contentOffset.x, @"scrollView.contentOffset.x"), - RCTSanitizeNaNValue(contentOffset.y, @"scrollView.contentOffset.y")); -#endif // TODO(macOS GH#774) +#endif // macOS] } -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS - (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated { @@ -268,7 +268,7 @@ - (void)setContentOffset:(CGPoint)contentOffset self.contentOffset = contentOffset; } } -#endif // TODO(macOS GH#774) +#endif // macOS] - (void)setFrame:(CGRect)frame { @@ -284,11 +284,11 @@ - (void)setFrame:(CGRect)frame if (CGSizeEqualToSize(contentSize, CGSizeZero)) { self.contentOffset = originalOffset; } else { -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] if (!UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsetsZero, self.adjustedContentInset)) { contentInset = self.adjustedContentInset; } -#endif // [TODO(macOS GH#774) +#endif // [macOS] CGSize boundsSize = self.bounds.size; CGFloat xMaxOffset = contentSize.width - boundsSize.width + contentInset.right; CGFloat yMaxOffset = contentSize.height - boundsSize.height + contentInset.bottom; @@ -303,7 +303,7 @@ - (void)setFrame:(CGRect)frame } } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)setCustomRefreshControl:(UIView *)refreshControl { if (_customRefreshControl) { @@ -336,9 +336,9 @@ - (void)didMoveToWindow // in the setter gets overridden when the view loads. self.pinchGestureRecognizer.enabled = _pinchGestureEnabled; } -#endif // TODO(macOS GH#774) +#endif // [macOS] -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS - (void)setAccessibilityLabel:(NSString *)accessibilityLabel { [super setAccessibilityLabel:accessibilityLabel]; @@ -349,7 +349,7 @@ - (void)setDocumentView:(__kindof NSView *)documentView [super setDocumentView:documentView]; [documentView setAccessibilityLabel:[self accessibilityLabel]]; } -#endif // ]TODO(macOS GH#774) +#endif // macOS] - (BOOL)shouldGroupAccessibilityChildren { @@ -365,24 +365,24 @@ @interface RCTScrollView () @implementation RCTScrollView { id _eventDispatcher; CGRect _prevFirstVisibleFrame; - __weak RCTUIView *_firstVisibleView; // TODO(macOS ISS#3536887) + __weak RCTUIView *_firstVisibleView; // [macOS] RCTCustomScrollView *_scrollView; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UIView *_contentView; -#endif // TODO(macOS GH#774) +#endif // [macOS] NSTimeInterval _lastScrollDispatchTime; NSMutableArray *_cachedChildFrames; BOOL _allowNextScrollNoMatterWhat; -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS BOOL _notifyDidScroll; -#endif // ]TODO(macOS GH#774) +#endif // macOS] CGRect _lastClippedToRect; uint16_t _coalescingKey; NSString *_lastEmittedEventName; NSHashTable *_scrollListeners; } -#if !TARGET_OS_OSX // [TODO(macOS GH#774) - UIKeyboard notifications not needed on macOS +#if !TARGET_OS_OSX // [macOS] UIKeyboard notifications not needed on macOS - (void)_registerKeyboardListener { [[NSNotificationCenter defaultCenter] addObserver:self @@ -450,34 +450,34 @@ - (void)_keyboardWillChangeFrame:(NSNotification *)notification } completion:nil]; } -#endif // ]TODO(macOS GH#774) +#endif // [macOS] - (instancetype)initWithEventDispatcher:(id)eventDispatcher { RCTAssertParam(eventDispatcher); if ((self = [super initWithFrame:CGRectZero])) { -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [self _registerKeyboardListener]; -#endif // ]TODO(macOS GH#774) +#endif // [macOS] _eventDispatcher = eventDispatcher; _scrollView = [[RCTCustomScrollView alloc] initWithFrame:CGRectZero]; _scrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; -#if TARGET_OS_OSX // [TODO(macOS GH#774) - _scrollView.drawsBackground = NO; - _scrollView.postsBoundsChangedNotifications = YES; -#else // ]TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] _scrollView.delegate = self; _scrollView.delaysContentTouches = NO; -#endif // TODO(macOS GH#774) +#else // [macOS + _scrollView.drawsBackground = NO; + _scrollView.postsBoundsChangedNotifications = YES; +#endif // macOS] -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] // We set the default behavior to "never" so that iOS // doesn't do weird things to UIScrollView insets automatically // and keeps it as an opt-in behavior. _scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; -#endif // ]TODO(macOS GH#774) +#endif // [macOS] _automaticallyAdjustContentInsets = YES; _contentInset = UIEdgeInsetsZero; @@ -494,7 +494,7 @@ - (instancetype)initWithEventDispatcher:(id)eventDis return self; } -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS - (BOOL)canBecomeKeyView { return [self focusable]; @@ -518,7 +518,7 @@ - (RCTBridge *)bridge return [_eventDispatcher bridge]; } -- (RCTUIView *)contentView // TODO(macOS ISS#3536887) +- (RCTUIView *)contentView // [macOS] { return _scrollView.documentView; } @@ -541,19 +541,19 @@ - (void)setInverted:(BOOL)inverted _onInvertedDidChange(@{}); } } -#endif // ]TODO(macOS GH#774) +#endif // macOS] RCT_NOT_IMPLEMENTED(-(instancetype)initWithFrame : (CGRect)frame) RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)aDecoder) static inline void RCTApplyTransformationAccordingLayoutDirection( - RCTPlatformView *view, // TODO(macOS GH#774) + RCTPlatformView *view, // [macOS] UIUserInterfaceLayoutDirection layoutDirection) { -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] view.transform = layoutDirection == UIUserInterfaceLayoutDirectionLeftToRight ? CGAffineTransformIdentity : CGAffineTransformMakeScale(-1, 1); -#endif // ]TODO(macOS GH#774) +#endif // [macOS] } - (void)setReactLayoutDirection:(UIUserInterfaceLayoutDirection)layoutDirection @@ -561,7 +561,7 @@ - (void)setReactLayoutDirection:(UIUserInterfaceLayoutDirection)layoutDirection [super setReactLayoutDirection:layoutDirection]; RCTApplyTransformationAccordingLayoutDirection(_scrollView, layoutDirection); - RCTApplyTransformationAccordingLayoutDirection(self.contentView, layoutDirection); // TODO(OSS Candidate ISS#2710739) use property instead of ivar for mac + RCTApplyTransformationAccordingLayoutDirection(self.contentView, layoutDirection); // macOS use property instead of ivar for mac } - (void)setRemoveClippedSubviews:(__unused BOOL)removeClippedSubviews @@ -569,14 +569,10 @@ - (void)setRemoveClippedSubviews:(__unused BOOL)removeClippedSubviews // Does nothing } -- (void)insertReactSubview:(RCTUIView *)view atIndex:(NSInteger)atIndex // TODO(macOS ISS#3536887) +- (void)insertReactSubview:(RCTUIView *)view atIndex:(NSInteger)atIndex // [macOS] { [super insertReactSubview:view atIndex:atIndex]; -#if TARGET_OS_OSX // [TODO(macOS GH#774) - RCTAssert(self.contentView == nil, @"RCTScrollView may only contain a single subview"); - - _scrollView.documentView = view; -#else // ]TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] if ([view conformsToProtocol:@protocol(RCTCustomRefreshContolProtocol)]) { [_scrollView setCustomRefreshControl:(UIView *)view]; if (![view isKindOfClass:[UIRefreshControl class]] && [view conformsToProtocol:@protocol(UIScrollViewDelegate)]) { @@ -591,15 +587,19 @@ - (void)insertReactSubview:(RCTUIView *)view atIndex:(NSInteger)atIndex // TODO( RCTApplyTransformationAccordingLayoutDirection(_contentView, self.reactLayoutDirection); [_scrollView addSubview:view]; } -#endif // TODO(macOS GH#774) +#else // [macOS + RCTAssert(self.contentView == nil, @"RCTScrollView may only contain a single subview"); + + _scrollView.documentView = view; +#endif // macOS] } -- (void)removeReactSubview:(RCTUIView *)subview // TODO(macOS ISS#3536887) +- (void)removeReactSubview:(RCTUIView *)subview // [macOS] { [super removeReactSubview:subview]; -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS _scrollView.documentView = nil; -#else // ]TODO(macOS GH#774) +#else // [macOS if ([subview conformsToProtocol:@protocol(RCTCustomRefreshContolProtocol)]) { [_scrollView setCustomRefreshControl:nil]; if (![subview isKindOfClass:[UIRefreshControl class]] && @@ -610,7 +610,7 @@ - (void)removeReactSubview:(RCTUIView *)subview // TODO(macOS ISS#3536887) RCTAssert(_contentView == subview, @"Attempted to remove non-existent subview"); _contentView = nil; } -#endif // TODO(macOS GH#774) +#endif // macOS] } - (void)didUpdateReactSubviews @@ -638,20 +638,20 @@ - (void)setCenterContent:(BOOL)centerContent - (void)setClipsToBounds:(BOOL)clipsToBounds { super.clipsToBounds = clipsToBounds; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] _scrollView.clipsToBounds = clipsToBounds; -#endif // TODO(macOS GH#774) +#endif // [macOS] } - (void)dealloc { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] _scrollView.delegate = nil; -#endif // TODO(macOS GH#774) +#endif // [macOS] [_eventDispatcher.bridge.uiManager.observerCoordinator removeObserver:self]; -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [self _unregisterKeyboardListener]; -#endif // ]TODO(macOS GH#774) +#endif // [macOS] } - (void)layoutSubviews @@ -660,7 +660,7 @@ - (void)layoutSubviews RCTAssert(self.subviews.count == 1, @"we should only have exactly one subview"); RCTAssert([self.subviews lastObject] == _scrollView, @"our only subview should be a scrollview"); -#if !TARGET_OS_TV && !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_TV && !TARGET_OS_OSX // [macOS] // Adjust the refresh control frame if the scrollview layout changes. UIView *refreshControl = _scrollView.customRefreshControl; if (refreshControl && refreshControl.isRefreshing && ![refreshControl isKindOfClass:UIRefreshControl.class]) { @@ -675,7 +675,7 @@ - (void)layoutSubviews - (void)updateClippedSubviews { // Find a suitable view to use for clipping - RCTPlatformView *clipView = [self react_findClipView]; // TODO(macOS GH#774) + RCTPlatformView *clipView = [self react_findClipView]; // [macOS] if (!clipView) { return; } @@ -683,11 +683,11 @@ - (void)updateClippedSubviews static const CGFloat leeway = 1.0; const CGSize contentSize = _scrollView.contentSize; -#if TARGET_OS_OSX // [TODO(macOS GH#774) - const CGRect bounds = _scrollView.contentView.bounds; -#else +#if !TARGET_OS_OSX // [macOS] const CGRect bounds = _scrollView.bounds; -#endif // ]TODO(macOS GH#774) +#else // [macOS + const CGRect bounds = _scrollView.contentView.bounds; +#endif // macOS] const BOOL scrollsHorizontally = contentSize.width > bounds.size.width; const BOOL scrollsVertically = contentSize.height > bounds.size.height; @@ -704,7 +704,7 @@ - (void)updateClippedSubviews } } -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS - (void)viewDidMoveToWindow { [super viewDidMoveToWindow]; @@ -732,7 +732,7 @@ - (void)viewDidMoveToWindow _notifyDidScroll = ([self window] != nil); } -#endif // ]TODO(macOS GH#774) +#endif // macOS] - (void)setContentInset:(UIEdgeInsets)contentInset { @@ -748,21 +748,21 @@ - (void)setContentInset:(UIEdgeInsets)contentInset _scrollView.contentOffset = contentOffset; } -#if TARGET_OS_OSX // [TODO(macOS GH#774) -- (BOOL)isHorizontal:(RCTCustomScrollView *)scrollView -#else // ]TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (BOOL)isHorizontal:(UIScrollView *)scrollView -#endif // TODO(macOS GH#774) +#else // [macOS +- (BOOL)isHorizontal:(RCTCustomScrollView *)scrollView +#endif // macOS] { return scrollView.contentSize.width > self.frame.size.width; } -#if TARGET_OS_OSX // [TODO(macOS Candidate ISS#2710739) +#if TARGET_OS_OSX // [macOS - (BOOL)isVertical:(RCTCustomScrollView *)scrollView { return scrollView.contentSize.height > self.frame.size.height; } -#endif // ]TODO(macOS Candidate ISS#2710739) +#endif // macOS] - (void)scrollToOffset:(CGPoint)offset { @@ -805,17 +805,17 @@ - (void)scrollToOffset:(CGPoint)offset animated:(BOOL)animated - (void)scrollToEnd:(BOOL)animated { BOOL isHorizontal = [self isHorizontal:_scrollView]; -#if TARGET_OS_OSX // [TODO(macOS GH#774) - CGSize boundsSize = _scrollView.contentView.bounds.size; -#else +#if !TARGET_OS_OSX // [macOS CGSize boundsSize = _scrollView.bounds.size; -#endif // ]TODO(macOS GH#774) +#else + CGSize boundsSize = _scrollView.contentView.bounds.size; +#endif // macOS] CGPoint offset; if (isHorizontal) { - CGFloat offsetX = _scrollView.contentSize.width - boundsSize.width + _scrollView.contentInset.right; // TODO(macOS GH#774) + CGFloat offsetX = _scrollView.contentSize.width - boundsSize.width + _scrollView.contentInset.right; // [macOS] offset = CGPointMake(fmax(offsetX, 0), 0); } else { - CGFloat offsetY = _scrollView.contentSize.height - boundsSize.height + _scrollView.contentInset.bottom; // TODO(macOS GH#774) + CGFloat offsetY = _scrollView.contentSize.height - boundsSize.height + _scrollView.contentInset.bottom; // [macOS] offset = CGPointMake(0, fmax(offsetY, 0)); } if (!CGPointEqualToPoint(_scrollView.contentOffset, offset)) { @@ -827,12 +827,12 @@ - (void)scrollToEnd:(BOOL)animated - (void)zoomToRect:(CGRect)rect animated:(BOOL)animated { -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS (void) animated; [_scrollView magnifyToFitRect:rect]; -#else // ]TODO(macOS GH#774) +#else // [macOS [_scrollView zoomToRect:rect animated:animated]; -#endif // TODO(macOS GH#774) +#endif // macOS] } - (void)refreshContentInset @@ -840,20 +840,20 @@ - (void)refreshContentInset [RCTView autoAdjustInsetsForView:self withScrollView:_scrollView updateOffset:YES]; } -// [TODO(macOS GH#774) +// [macOS - (void)flashScrollIndicators { -#if TARGET_OS_OSX - [_scrollView flashScrollers]; -#else +#if !TARGET_OS_OSX [_scrollView flashScrollIndicators]; +#else + [_scrollView flashScrollers]; #endif } -// ]TODO(macOS GH#774) +// macOS] #pragma mark - ScrollView delegate -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if TARGET_OS_OSX // [macOS - (void)scrollViewDocumentViewBoundsDidChange:(__unused NSNotification *)notification { if (_scrollView.centerContent) { @@ -865,7 +865,7 @@ - (void)scrollViewDocumentViewBoundsDidChange:(__unused NSNotification *)notific [self scrollViewDidScroll:_scrollView]; } } -#endif // ]TODO(macOS GH#774) +#endif // macOS] #define RCT_SEND_SCROLL_EVENT(_eventName, _userData) \ { \ @@ -887,7 +887,7 @@ -(void)delegateMethod : (UIScrollView *)scrollView \ RCT_FORWARD_SCROLL_EVENT(delegateMethod : scrollView); \ } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCT_SCROLL_EVENT_HANDLER(scrollViewWillBeginDecelerating, onMomentumScrollBegin) RCT_SCROLL_EVENT_HANDLER(scrollViewDidZoom, onScroll) @@ -903,9 +903,9 @@ - (void)removeScrollListener:(NSObject *)scrollListener [_scrollListeners removeObject:scrollListener]; } -#endif // TODO(macOS GH#774) +#endif // [macOS] -- (void)scrollViewDidScroll:(RCTCustomScrollView *)scrollView // TODO(macOS GH#774) +- (void)scrollViewDidScroll:(RCTCustomScrollView *)scrollView // [macOS] { NSTimeInterval now = CACurrentMediaTime(); [self updateClippedSubviews]; @@ -925,14 +925,14 @@ - (void)scrollViewDidScroll:(RCTCustomScrollView *)scrollView // TODO(macOS GH#7 _lastScrollDispatchTime = now; _allowNextScrollNoMatterWhat = NO; } -#if TARGET_OS_OSX // [TODO(macOS GH#774) - (void) scrollView; -#else // ]TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCT_FORWARD_SCROLL_EVENT(scrollViewDidScroll : scrollView); -#endif // TODO(macOS GH#774) +#else // [macOS + (void) scrollView; +#endif // macOS] } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView { @@ -1138,7 +1138,7 @@ - (UIView *)viewForZoomingInScrollView:(__unused UIScrollView *)scrollView return _contentView; } -#endif // TODO(macOS GH#774) +#endif // [macOS] - (CGSize)_calculateViewportSize { @@ -1154,7 +1154,7 @@ - (CGSize)_calculateViewportSize - (CGSize)contentSize { - return self.contentView.frame.size; // TODO(OSS Candidate ISS#2710739) use property instead of ivar for mac + return self.contentView.frame.size; // macOS use property instead of ivar for mac } - (void)updateContentSizeIfNeeded @@ -1183,13 +1183,13 @@ - (void)uiManagerWillPerformMounting:(RCTUIManager *)manager { RCTAssertUIManagerQueue(); [manager - prependUIBlock:^(__unused RCTUIManager *uiManager, __unused NSDictionary *viewRegistry) { // TODO(macOS ISS#3536887) + prependUIBlock:^(__unused RCTUIManager *uiManager, __unused NSDictionary *viewRegistry) { // [macOS] BOOL horz = [self isHorizontal:self->_scrollView]; NSUInteger minIdx = [self->_maintainVisibleContentPosition[@"minIndexForVisible"] integerValue]; - for (NSUInteger ii = minIdx; ii < self.contentView.subviews.count; ++ii) { // TODO(OSS Candidate ISS#2710739) use property instead of ivar for mac + for (NSUInteger ii = minIdx; ii < self.contentView.subviews.count; ++ii) { // macOS use property instead of ivar for mac // Find the first entirely visible view. This must be done after we update the content offset // or it will tend to grab rows that were made visible by the shift in position - RCTUIView *subview = self.contentView.subviews[ii]; // TODO(OSS Candidate ISS#2710739) use property instead of ivar for mac and TODO(macOS ISS#3536887) + RCTUIView *subview = self.contentView.subviews[ii]; // [macOS] use property instead of ivar for mac BOOL hasNewView = NO; if (horz) { CGFloat leftInset = self.inverted ? self->_scrollView.contentInset.right : self->_scrollView.contentInset.left; @@ -1201,14 +1201,14 @@ - (void)uiManagerWillPerformMounting:(RCTUIManager *)manager CGFloat y = self->_scrollView.contentOffset.y + bottomInset; hasNewView = subview.frame.origin.y > y; } - if (hasNewView || ii == self.contentView.subviews.count - 1) { // TODO(OSS Candidate ISS#2710739) use property instead of ivar for mac + if (hasNewView || ii == self.contentView.subviews.count - 1) { // macOS use property instead of ivar for mac self->_prevFirstVisibleFrame = subview.frame; self->_firstVisibleView = subview; break; } } }]; - [manager addUIBlock:^(__unused RCTUIManager *uiManager, __unused NSDictionary *viewRegistry) { // TODO(macOS ISS#3536887) + [manager addUIBlock:^(__unused RCTUIManager *uiManager, __unused NSDictionary *viewRegistry) { // [macOS] if (self->_maintainVisibleContentPosition == nil) { return; // The prop might have changed in the previous UIBlocks, so need to abort here. } @@ -1248,7 +1248,7 @@ - (void)uiManagerWillPerformMounting:(RCTUIManager *)manager }]; } -// [TODO(macOS GH#774) +// [macOS #pragma mark - Keyboard Events #if TARGET_OS_OSX @@ -1314,8 +1314,7 @@ - (void)keyUp:(NSEvent *)event { - (void)preferredScrollerStyleDidChange:(__unused NSNotification *)notification { RCT_SEND_SCROLL_EVENT(onPreferredScrollerStyleDidChange, (@{ @"preferredScrollerStyle": RCTStringForScrollerStyle([NSScroller preferredScrollerStyle])})); } -#endif -// ]TODO(macOS GH#774) +#endif // macOS] // Note: setting several properties of UIScrollView has the effect of // resetting its contentOffset to {0, 0}. To prevent this, we generate @@ -1336,7 +1335,7 @@ -(type)getter \ RCT_SET_AND_PRESERVE_OFFSET(setAlwaysBounceHorizontal, alwaysBounceHorizontal, BOOL) RCT_SET_AND_PRESERVE_OFFSET(setAlwaysBounceVertical, alwaysBounceVertical, BOOL) -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCT_SET_AND_PRESERVE_OFFSET(setBounces, bounces, BOOL) RCT_SET_AND_PRESERVE_OFFSET(setBouncesZoom, bouncesZoom, BOOL) RCT_SET_AND_PRESERVE_OFFSET(setCanCancelContentTouches, canCancelContentTouches, BOOL) @@ -1346,19 +1345,19 @@ -(type)getter \ RCT_SET_AND_PRESERVE_OFFSET(setKeyboardDismissMode, keyboardDismissMode, UIScrollViewKeyboardDismissMode) RCT_SET_AND_PRESERVE_OFFSET(setMaximumZoomScale, maximumZoomScale, CGFloat) RCT_SET_AND_PRESERVE_OFFSET(setMinimumZoomScale, minimumZoomScale, CGFloat) -#endif // TODO(macOS GH#774) +#endif // [macOS] RCT_SET_AND_PRESERVE_OFFSET(setScrollEnabled, isScrollEnabled, BOOL) -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCT_SET_AND_PRESERVE_OFFSET(setPagingEnabled, isPagingEnabled, BOOL) RCT_SET_AND_PRESERVE_OFFSET(setScrollsToTop, scrollsToTop, BOOL) -#endif // TODO(macOS GH#774) +#endif // [macOS] RCT_SET_AND_PRESERVE_OFFSET(setShowsHorizontalScrollIndicator, showsHorizontalScrollIndicator, BOOL) RCT_SET_AND_PRESERVE_OFFSET(setShowsVerticalScrollIndicator, showsVerticalScrollIndicator, BOOL) RCT_SET_AND_PRESERVE_OFFSET(setZoomScale, zoomScale, CGFloat); RCT_SET_AND_PRESERVE_OFFSET(setScrollIndicatorInsets, scrollIndicatorInsets, UIEdgeInsets); -#pragma clang diagnostic push // TODO(OSS Candidate ISS#2710739) -#pragma clang diagnostic ignored "-Wunguarded-availability" // TODO(OSS Candidate ISS#2710739) +#pragma clang diagnostic push // [macOS] +#pragma clang diagnostic ignored "-Wunguarded-availability" // [macOS] #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* __IPHONE_13_0 */ - (void)setAutomaticallyAdjustsScrollIndicatorInsets:(BOOL)automaticallyAdjusts API_AVAILABLE(ios(13.0)) @@ -1372,18 +1371,18 @@ - (void)setAutomaticallyAdjustsScrollIndicatorInsets:(BOOL)automaticallyAdjusts } #endif -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)setContentInsetAdjustmentBehavior:(UIScrollViewContentInsetAdjustmentBehavior)behavior { CGPoint contentOffset = _scrollView.contentOffset; _scrollView.contentInsetAdjustmentBehavior = behavior; _scrollView.contentOffset = contentOffset; } -#endif // ]TODO(macOS GH#774) -#pragma clang diagnostic pop // TODO(OSS Candidate ISS#2710739) +#endif // [macOS] +#pragma clang diagnostic pop // [macOS] - (void)sendScrollEventWithName:(NSString *)eventName - scrollView:(RCTCustomScrollView *)scrollView // TODO(macOS GH#774) + scrollView:(RCTCustomScrollView *)scrollView // [macOS] userData:(NSDictionary *)userData { if (![_lastEmittedEventName isEqualToString:eventName]) { diff --git a/React/Views/ScrollView/RCTScrollViewManager.h b/React/Views/ScrollView/RCTScrollViewManager.h index e9acf0b537c34e..f5a0060df8123a 100644 --- a/React/Views/ScrollView/RCTScrollViewManager.h +++ b/React/Views/ScrollView/RCTScrollViewManager.h @@ -8,13 +8,13 @@ #import #import -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] @interface RCTConvert (UIScrollView) + (UIScrollViewKeyboardDismissMode)UIScrollViewKeyboardDismissMode:(id)json; @end -#endif // TODO(macOS GH#774) +#endif // [macOS] @interface RCTScrollViewManager : RCTViewManager diff --git a/React/Views/ScrollView/RCTScrollViewManager.m b/React/Views/ScrollView/RCTScrollViewManager.m index 06adede10eab4d..7720c1681b3a24 100644 --- a/React/Views/ScrollView/RCTScrollViewManager.m +++ b/React/Views/ScrollView/RCTScrollViewManager.m @@ -12,7 +12,7 @@ #import "RCTShadowView.h" #import "RCTUIManager.h" -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] @implementation RCTConvert (UIScrollView) RCT_ENUM_CONVERTER( @@ -49,36 +49,36 @@ @implementation RCTConvert (UIScrollView) integerValue) @end -#endif // TODO(OSS Candidate ISS#2710739) +#endif // [macOS] @implementation RCTScrollViewManager RCT_EXPORT_MODULE() -- (RCTPlatformView *)view // TODO(macOS GH#774) +- (RCTPlatformView *)view // [macOS] { return [[RCTScrollView alloc] initWithEventDispatcher:self.bridge.eventDispatcher]; } RCT_EXPORT_VIEW_PROPERTY(alwaysBounceHorizontal, BOOL) RCT_EXPORT_VIEW_PROPERTY(alwaysBounceVertical, BOOL) -RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(bounces, BOOL) // TODO(macOS GH#774) -RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(bouncesZoom, BOOL) // TODO(macOS GH#774) -RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(canCancelContentTouches, BOOL) // TODO(macOS GH#774) +RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(bounces, BOOL) // [macOS] +RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(bouncesZoom, BOOL) // [macOS] +RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(canCancelContentTouches, BOOL) // [macOS] RCT_EXPORT_VIEW_PROPERTY(centerContent, BOOL) RCT_EXPORT_VIEW_PROPERTY(maintainVisibleContentPosition, NSDictionary) RCT_EXPORT_VIEW_PROPERTY(automaticallyAdjustContentInsets, BOOL) -RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(automaticallyAdjustKeyboardInsets, BOOL) // TODO(macOS GH#774) -RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(decelerationRate, CGFloat) // TODO(macOS GH#774) -RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(directionalLockEnabled, BOOL) // TODO(macOS GH#774) -RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(indicatorStyle, UIScrollViewIndicatorStyle) // TODO(macOS GH#774) -RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(keyboardDismissMode, UIScrollViewKeyboardDismissMode) // TODO(macOS GH#774) -RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(maximumZoomScale, CGFloat) // TODO(macOS GH#774) -RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(minimumZoomScale, CGFloat) // TODO(macOS GH#774) +RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(automaticallyAdjustKeyboardInsets, BOOL) // [macOS] +RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(decelerationRate, CGFloat) // [macOS] +RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(directionalLockEnabled, BOOL) // [macOS] +RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(indicatorStyle, UIScrollViewIndicatorStyle) // [macOS] +RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(keyboardDismissMode, UIScrollViewKeyboardDismissMode) // [macOS] +RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(maximumZoomScale, CGFloat) // [macOS] +RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(minimumZoomScale, CGFloat) // [macOS] RCT_EXPORT_VIEW_PROPERTY(scrollEnabled, BOOL) -RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(pagingEnabled, BOOL) // TODO(macOS GH#774) -RCT_REMAP_NOT_OSX_VIEW_PROPERTY(pinchGestureEnabled, scrollView.pinchGestureEnabled, BOOL) // TODO(macOS GH#774) -RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(scrollsToTop, BOOL) // TODO(macOS GH#774) +RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(pagingEnabled, BOOL) // [macOS] +RCT_REMAP_NOT_OSX_VIEW_PROPERTY(pinchGestureEnabled, scrollView.pinchGestureEnabled, BOOL) // [macOS] +RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(scrollsToTop, BOOL) // [macOS] RCT_EXPORT_VIEW_PROPERTY(showsHorizontalScrollIndicator, BOOL) RCT_EXPORT_VIEW_PROPERTY(showsVerticalScrollIndicator, BOOL) RCT_EXPORT_VIEW_PROPERTY(scrollEventThrottle, NSTimeInterval) @@ -99,15 +99,15 @@ - (RCTPlatformView *)view // TODO(macOS GH#774) RCT_EXPORT_VIEW_PROPERTY(onScrollEndDrag, RCTDirectEventBlock) RCT_EXPORT_VIEW_PROPERTY(onMomentumScrollBegin, RCTDirectEventBlock) RCT_EXPORT_VIEW_PROPERTY(onMomentumScrollEnd, RCTDirectEventBlock) -RCT_EXPORT_OSX_VIEW_PROPERTY(onInvertedDidChange, RCTDirectEventBlock) // TODO(macOS GH#774) -RCT_EXPORT_OSX_VIEW_PROPERTY(onPreferredScrollerStyleDidChange, RCTDirectEventBlock) // TODO(macOS GH#774) +RCT_EXPORT_OSX_VIEW_PROPERTY(onInvertedDidChange, RCTDirectEventBlock) // [macOS] +RCT_EXPORT_OSX_VIEW_PROPERTY(onPreferredScrollerStyleDidChange, RCTDirectEventBlock) // [macOS] RCT_EXPORT_VIEW_PROPERTY(inverted, BOOL) #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* __IPHONE_13_0 */ RCT_EXPORT_VIEW_PROPERTY(automaticallyAdjustsScrollIndicatorInsets, BOOL) #endif -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] RCT_EXPORT_VIEW_PROPERTY(contentInsetAdjustmentBehavior, UIScrollViewContentInsetAdjustmentBehavior) -#endif // ]TODO(macOS GH#774) +#endif // [macOS] // overflow is used both in css-layout as well as by react-native. In css-layout // we always want to treat overflow as scroll but depending on what the overflow @@ -142,8 +142,8 @@ - (RCTPlatformView *)view // TODO(macOS GH#774) : (BOOL)animated) { [self.bridge.uiManager - addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { // TODO(macOS ISS#3536887) - RCTUIView *view = viewRegistry[reactTag]; // TODO(macOS ISS#3536887) + addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { // [macOS] + RCTUIView *view = viewRegistry[reactTag]; // [macOS] if ([view conformsToProtocol:@protocol(RCTScrollableProtocol)]) { [(id)view scrollToOffset:(CGPoint){x, y} animated:animated]; } else { @@ -159,8 +159,8 @@ - (RCTPlatformView *)view // TODO(macOS GH#774) RCT_EXPORT_METHOD(scrollToEnd : (nonnull NSNumber *)reactTag animated : (BOOL)animated) { [self.bridge.uiManager - addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { // TODO(macOS ISS#3536887) - RCTUIView *view = viewRegistry[reactTag]; // TODO(macOS ISS#3536887) + addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { // [macOS] + RCTUIView *view = viewRegistry[reactTag]; // [macOS] if ([view conformsToProtocol:@protocol(RCTScrollableProtocol)]) { [(id)view scrollToEnd:animated]; } else { @@ -176,8 +176,8 @@ - (RCTPlatformView *)view // TODO(macOS GH#774) RCT_EXPORT_METHOD(zoomToRect : (nonnull NSNumber *)reactTag withRect : (CGRect)rect animated : (BOOL)animated) { [self.bridge.uiManager - addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { // TODO(macOS ISS#3536887) - RCTUIView *view = viewRegistry[reactTag]; // TODO(macOS ISS#3536887) + addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary *viewRegistry) { // [macOS] + RCTUIView *view = viewRegistry[reactTag]; // [macOS] if ([view conformsToProtocol:@protocol(RCTScrollableProtocol)]) { [(id)view zoomToRect:rect animated:animated]; } else { @@ -200,7 +200,7 @@ - (RCTPlatformView *)view // TODO(macOS GH#774) return; } - [view flashScrollIndicators]; // TODO(macOS GH#774) + [view flashScrollIndicators]; // [macOS] }]; } diff --git a/React/Views/ScrollView/RCTScrollableProtocol.h b/React/Views/ScrollView/RCTScrollableProtocol.h index d1ff41cea33402..fb5c2a4bf4601c 100644 --- a/React/Views/ScrollView/RCTScrollableProtocol.h +++ b/React/Views/ScrollView/RCTScrollableProtocol.h @@ -6,7 +6,7 @@ */ #import -#import // TODO(macOS GH#774) +#import // [macOS] /** * Contains any methods related to scrolling. Any `RCTView` that has scrolling @@ -25,10 +25,10 @@ - (void)scrollToEnd:(BOOL)animated; - (void)zoomToRect:(CGRect)rect animated:(BOOL)animated; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)addScrollListener:(NSObject *)scrollListener; - (void)removeScrollListener:(NSObject *)scrollListener; -#endif // TODO(macOS GH#774) +#endif // [macOS] @end @@ -40,9 +40,9 @@ @property (nonatomic, copy) RCTDirectEventBlock onRefresh; @property (nonatomic, readonly, getter=isRefreshing) BOOL refreshing; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] @optional @property (nonatomic, weak) RCTUIScrollView *scrollView; -#endif // TODO(macOS GH#774) +#endif // [macOS] @end diff --git a/React/Views/UIView+Private.h b/React/Views/UIView+Private.h index 9858938f95a4d4..e08a8d357969ba 100644 --- a/React/Views/UIView+Private.h +++ b/React/Views/UIView+Private.h @@ -5,13 +5,13 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] -@interface RCTPlatformView (Private) // TODO(macOS GH#774) +@interface RCTPlatformView (Private) // [macOS] // remove clipped subviews implementation - (void)react_remountAllSubviews; -- (void)react_updateClippedSubviewsWithClipRect:(CGRect)clipRect relativeToView:(RCTPlatformView *)clipView; // TODO(macOS GH#774) -- (RCTPlatformView *)react_findClipView; // TODO(macOS GH#774) +- (void)react_updateClippedSubviewsWithClipRect:(CGRect)clipRect relativeToView:(RCTPlatformView *)clipView; // [macOS] +- (RCTPlatformView *)react_findClipView; // [macOS] @end diff --git a/React/Views/UIView+React.h b/React/Views/UIView+React.h index 94f1991a3b2df8..41b048a5d27637 100644 --- a/React/Views/UIView+React.h +++ b/React/Views/UIView+React.h @@ -5,22 +5,22 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import @class RCTShadowView; -@interface RCTPlatformView (React) // TODO(macOS GH#774) +@interface RCTPlatformView (React) // [macOS] /** * RCTComponent interface. */ -- (NSArray *)reactSubviews NS_REQUIRES_SUPER; // TODO(macOS GH#774) -- (RCTPlatformView *)reactSuperview NS_REQUIRES_SUPER; // TODO(macOS GH#774) -- (void)insertReactSubview:(RCTPlatformView *)subview atIndex:(NSInteger)atIndex NS_REQUIRES_SUPER; // TODO(macOS GH#774) -- (void)removeReactSubview:(RCTPlatformView *)subview NS_REQUIRES_SUPER; // TODO(macOS GH#774) +- (NSArray *)reactSubviews NS_REQUIRES_SUPER; // [macOS] +- (RCTPlatformView *)reactSuperview NS_REQUIRES_SUPER; // [macOS] +- (void)insertReactSubview:(RCTPlatformView *)subview atIndex:(NSInteger)atIndex NS_REQUIRES_SUPER; // [macOS] +- (void)removeReactSubview:(RCTPlatformView *)subview NS_REQUIRES_SUPER; // [macOS] /** * The native id of the view, used to locate view from native codes @@ -56,7 +56,7 @@ * Subviews sorted by z-index. Note that this method doesn't do any caching (yet) * and sorts all the views each call. */ -- (NSArray *)reactZIndexSortedSubviews; // TODO(macOS GH#774) +- (NSArray *)reactZIndexSortedSubviews; // [macOS] /** * Updates the subviews array based on the reactSubviews. Default behavior is @@ -81,7 +81,7 @@ */ - (UIViewController *)reactViewController; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] /** * This method attaches the specified controller as a child of the * the owning view controller of this view. Returns NO if no view @@ -89,9 +89,9 @@ * attached to the view hierarchy). */ - (void)reactAddControllerToClosestParent:(UIViewController *)controller; -#endif // TODO(macOS GH#774) +#endif // [macOS] -- (void)reactViewDidMoveToWindow; // TODO(macOS GH#1412) +- (void)reactViewDidMoveToWindow; // [macOS] Github #1412 /** * Focus manipulation. @@ -115,12 +115,12 @@ * transparent in favour of some subview. * Defaults to `self`. */ -@property (nonatomic, readonly) RCTPlatformView *reactAccessibilityElement; // TODO(macOS GH#774) +@property (nonatomic, readonly) RCTPlatformView *reactAccessibilityElement; // [macOS] /** * Accessibility properties */ -@property (nonatomic, copy) NSString *accessibilityRoleInternal; // TODO(OSS Candidate ISS#2710739): renamed so it doesn't conflict with -[NSAccessibility accessibilityRole]. +@property (nonatomic, copy) NSString *accessibilityRoleInternal; // [macOS] renamed so it doesn't conflict with -[NSAccessibility accessibilityRole]. @property (nonatomic, copy) NSDictionary *accessibilityState; @property (nonatomic, copy) NSArray *accessibilityActions; @property (nonatomic, copy) NSDictionary *accessibilityValueInternal; diff --git a/React/Views/UIView+React.m b/React/Views/UIView+React.m index 9c49613884ce96..f1c5f52c1d7386 100644 --- a/React/Views/UIView+React.m +++ b/React/Views/UIView+React.m @@ -13,7 +13,7 @@ #import "RCTLog.h" #import "RCTShadowView.h" -@implementation RCTPlatformView (React) // TODO(macOS GH#774) +@implementation RCTPlatformView (React) // [macOS] - (NSNumber *)reactTag { @@ -47,18 +47,18 @@ - (void)setNativeID:(NSString *)nativeID - (BOOL)shouldAccessibilityIgnoresInvertColors { -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] return self.accessibilityIgnoresInvertColors; -#else // TODO(macOS GH#774) +#else // [macOS return NO; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } - (void)setShouldAccessibilityIgnoresInvertColors:(BOOL)shouldAccessibilityIgnoresInvertColors { -#if !TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] self.accessibilityIgnoresInvertColors = shouldAccessibilityIgnoresInvertColors; -#endif // ]TODO(macOS GH#774) +#endif // [macOS] } - (BOOL)isReactRootView @@ -68,24 +68,24 @@ - (BOOL)isReactRootView - (NSNumber *)reactTagAtPoint:(CGPoint)point { - RCTPlatformView *view = RCTUIViewHitTestWithEvent(self, point, nil); // TODO(macOS GH#774) and TODO(macOS ISS#3536887) + RCTPlatformView *view = RCTUIViewHitTestWithEvent(self, point, nil); // [macOS] while (view && !view.reactTag) { view = view.superview; } return view.reactTag; } -- (NSArray *)reactSubviews // TODO(macOS GH#774) +- (NSArray *)reactSubviews // [macOS] { return objc_getAssociatedObject(self, _cmd); } -- (RCTPlatformView *)reactSuperview // TODO(macOS GH#774) +- (RCTPlatformView *)reactSuperview // [macOS] { return self.superview; } -- (void)insertReactSubview:(RCTPlatformView *)subview atIndex:(NSInteger)atIndex // TODO(macOS GH#774) +- (void)insertReactSubview:(RCTPlatformView *)subview atIndex:(NSInteger)atIndex // [macOS] { // We access the associated object directly here in case someone overrides // the `reactSubviews` getter method and returns an immutable array. @@ -97,7 +97,7 @@ - (void)insertReactSubview:(RCTPlatformView *)subview atIndex:(NSInteger)atIndex [subviews insertObject:subview atIndex:atIndex]; } -- (void)removeReactSubview:(RCTPlatformView *)subview // TODO(macOS GH#774) +- (void)removeReactSubview:(RCTPlatformView *)subview // [macOS] { // We access the associated object directly here in case someone overrides // the `reactSubviews` getter method and returns an immutable array. @@ -122,37 +122,37 @@ - (void)setReactDisplay:(YGDisplay)display - (UIUserInterfaceLayoutDirection)reactLayoutDirection { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] if ([self respondsToSelector:@selector(semanticContentAttribute)]) { -#pragma clang diagnostic push // TODO(OSS Candidate ISS#2710739) -#pragma clang diagnostic ignored "-Wunguarded-availability" // TODO(OSS Candidate ISS#2710739) +#pragma clang diagnostic push // [macOS] +#pragma clang diagnostic ignored "-Wunguarded-availability" // [macOS] return [UIView userInterfaceLayoutDirectionForSemanticContentAttribute:self.semanticContentAttribute]; -#pragma clang diagnostic pop // TODO(OSS Candidate ISS#2710739) +#pragma clang diagnostic pop // [macOS] } else { return [objc_getAssociatedObject(self, @selector(reactLayoutDirection)) integerValue]; } -#else // [TODO(macOS GH#774) +#else // [macOS return self.userInterfaceLayoutDirection; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } - (void)setReactLayoutDirection:(UIUserInterfaceLayoutDirection)layoutDirection { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] if ([self respondsToSelector:@selector(setSemanticContentAttribute:)]) { -#pragma clang diagnostic push // TODO(OSS Candidate ISS#2710739) -#pragma clang diagnostic ignored "-Wunguarded-availability" // TODO(OSS Candidate ISS#2710739) +#pragma clang diagnostic push // [macOS] +#pragma clang diagnostic ignored "-Wunguarded-availability" // [macOS] self.semanticContentAttribute = layoutDirection == UIUserInterfaceLayoutDirectionLeftToRight ? UISemanticContentAttributeForceLeftToRight : UISemanticContentAttributeForceRightToLeft; -#pragma clang diagnostic pop // TODO(OSS Candidate ISS#2710739) +#pragma clang diagnostic pop // [macOS] } else { objc_setAssociatedObject( self, @selector(reactLayoutDirection), @(layoutDirection), OBJC_ASSOCIATION_RETAIN_NONATOMIC); } -#else // [TODO(macOS GH#774) +#else // [macOS self.userInterfaceLayoutDirection = layoutDirection; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } #pragma mark - zIndex @@ -167,17 +167,17 @@ - (void)setReactZIndex:(NSInteger)reactZIndex self.layer.zPosition = reactZIndex; } -- (NSArray *)reactZIndexSortedSubviews // TODO(macOS GH#774) +- (NSArray *)reactZIndexSortedSubviews // [macOS] { // Check if sorting is required - in most cases it won't be. BOOL sortingRequired = NO; - for (RCTUIView *subview in self.subviews) { // TODO(macOS ISS#3536887) + for (RCTUIView *subview in self.subviews) { // [macOS] if (subview.reactZIndex != 0) { sortingRequired = YES; break; } } - return sortingRequired ? [self.reactSubviews sortedArrayUsingComparator:^NSComparisonResult(RCTUIView *a, RCTUIView *b) { // TODO(macOS ISS#3536887) + return sortingRequired ? [self.reactSubviews sortedArrayUsingComparator:^NSComparisonResult(RCTUIView *a, RCTUIView *b) { // [macOS] if (a.reactZIndex > b.reactZIndex) { return NSOrderedDescending; } else { @@ -191,7 +191,7 @@ - (void)setReactZIndex:(NSInteger)reactZIndex - (void)didUpdateReactSubviews { - for (RCTPlatformView *subview in self.reactSubviews) { // TODO(macOS GH#774) + for (RCTPlatformView *subview in self.reactSubviews) { // [macOS] [self addSubview:subview]; } } @@ -203,7 +203,7 @@ - (void)didSetProps:(__unused NSArray *)changedProps - (void)reactSetFrame:(CGRect)frame { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] // These frames are in terms of anchorPoint = topLeft, but internally the // views are anchorPoint = center for easier scale and rotation animations. // Convert the frame so it works with anchorPoint = center. @@ -224,7 +224,7 @@ - (void)reactSetFrame:(CGRect)frame self.center = position; self.bounds = bounds; -#else // [TODO(macOS GH#774) +#else // [macOS // Avoid crashes due to nan coords if (isnan(frame.origin.x) || isnan(frame.origin.y) || isnan(frame.size.width) || isnan(frame.size.height)) { @@ -234,7 +234,7 @@ - (void)reactSetFrame:(CGRect)frame } self.frame = frame; -#endif // ]TODO(macOS GH#774) +#endif // macOS] } - (UIViewController *)reactViewController @@ -249,7 +249,7 @@ - (UIViewController *)reactViewController return nil; } -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] - (void)reactAddControllerToClosestParent:(UIViewController *)controller { if (!controller.parentViewController) { @@ -265,63 +265,63 @@ - (void)reactAddControllerToClosestParent:(UIViewController *)controller return; } } -#endif // TODO(macOS GH#774) +#endif // [macOS] -// [TODO(macOS GH#1412) +// [macOS Github#1412 - (void)reactViewDidMoveToWindow { [self reactFocusIfNeeded]; } -// TODO(macOS GH#1412)] +// macOS] /** * Focus manipulation. */ -static __weak RCTPlatformView *_pendingFocusView; // TODO(macOS GH#1412) +static __weak RCTPlatformView *_pendingFocusView; // [macOS] - (void)reactFocus { -#if TARGET_OS_OSX // [TODO(macOS GH#774) - if (![[self window] makeFirstResponder:self]) { -#else +#if !TARGET_OS_OSX // [macOS] if (![self becomeFirstResponder]) { -#endif // TODO(macOS GH#774)] -// [TODO(macOS GH#1412) +#else // [macOS + if (![[self window] makeFirstResponder:self]) { +#endif // macOS] +// [macOS Github#1412 _pendingFocusView = self; } else { _pendingFocusView = nil; } -// TODO(macOS GH#1412)] +// macOS] } - (void)reactFocusIfNeeded { - if ([self isEqual:_pendingFocusView]) { // TODO(macOS GH#1412) -#if TARGET_OS_OSX // [TODO(macOS GH#774) + if ([self isEqual:_pendingFocusView]) { // [macOS] +#if TARGET_OS_OSX // [macOS if ([[self window] makeFirstResponder:self]) { #else if ([self becomeFirstResponder]) { -#endif // TODO(macOS GH#774)] - _pendingFocusView = nil; // TODO(macOS GH#1412) +#endif // macOS] + _pendingFocusView = nil; // [macOS] Github#1412 } } } - (void)reactBlur { -#if TARGET_OS_OSX // [TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] + [self resignFirstResponder]; +#else // [macOS if (self == [[self window] firstResponder]) { [[self window] makeFirstResponder:[[self window] nextResponder]]; } -#else - [self resignFirstResponder]; -#endif // TODO(macOS GH#774)] +#endif // macOS] -// [TODO(macOS GH#1412) +// [macOS Github#1412 if ([self isEqual:_pendingFocusView]) { _pendingFocusView = nil; } -// TODO(macOS GH#1412)] +// macOS] } #pragma mark - Layout @@ -356,7 +356,7 @@ - (CGRect)reactContentFrame #pragma mark - Accessibility -- (RCTPlatformView *)reactAccessibilityElement // TODO(macOS GH#774) +- (RCTPlatformView *)reactAccessibilityElement // [macOS] { return self; } @@ -372,12 +372,12 @@ - (void)setAccessibilityActions:(NSArray *)accessibilityActions self, @selector(accessibilityActions), accessibilityActions, OBJC_ASSOCIATION_RETAIN_NONATOMIC); } -- (NSString *)accessibilityRoleInternal // TODO(OSS Candidate ISS#2710739): renamed so it doesn't conflict with -[NSAccessibility accessibilityRole]. +- (NSString *)accessibilityRoleInternal // [macOS] renamed so it doesn't conflict with -[NSAccessibility accessibilityRole]. { return objc_getAssociatedObject(self, _cmd); } -- (void)setAccessibilityRoleInternal:(NSString *)accessibilityRole // TODO(OSS Candidate ISS#2710739): renamed so it doesn't conflict with -[NSAccessibility setAccessibilityRole]. +- (void)setAccessibilityRoleInternal:(NSString *)accessibilityRole // [macOS] renamed so it doesn't conflict with -[NSAccessibility setAccessibilityRole]. { objc_setAssociatedObject(self, @selector(accessibilityRoleInternal), accessibilityRole, OBJC_ASSOCIATION_RETAIN_NONATOMIC); } @@ -412,7 +412,7 @@ - (void)react_addRecursiveDescriptionToString:(NSMutableString *)string atLevel: [string appendString:self.description]; [string appendString:@"\n"]; - for (RCTPlatformView *subview in self.subviews) { // TODO(macOS GH#774) + for (RCTPlatformView *subview in self.subviews) { // [macOS] [subview react_addRecursiveDescriptionToString:string atLevel:level + 1]; } } diff --git a/ReactAndroid/.npmignore b/ReactAndroid/.npmignore index 18bc708a9e6aaf..94cd8271da55f5 100644 --- a/ReactAndroid/.npmignore +++ b/ReactAndroid/.npmignore @@ -1,5 +1,5 @@ # Make sure we never publish ReactAndroid/build (Gradle output) to npm. # The folder is huge (> 100MB)! build/ -# TODO(macOS GH#774): No need to publish our imported nugets +# [macOS] No need to publish our imported nugets packages \ No newline at end of file diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/BundleLoadCallback.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/BundleLoadCallback.java index 5afe2ca4fa0412..6e8bece90984d6 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/BundleLoadCallback.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/BundleLoadCallback.java @@ -5,8 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -// TODO(macOS GH#774) - package com.facebook.react.devsupport.interfaces; public interface BundleLoadCallback { diff --git a/ReactCommon/React-Fabric.podspec b/ReactCommon/React-Fabric.podspec index acae9e934a3194..8ea0cb1f768542 100644 --- a/ReactCommon/React-Fabric.podspec +++ b/ReactCommon/React-Fabric.podspec @@ -29,7 +29,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "11.0", :osx => "10.15" } # TODO(macOS GH#774) + s.platforms = { :ios => "11.0", :osx => "10.15" } # [macOS] s.source = source s.source_files = "dummyFile.cpp" s.pod_target_xcconfig = { "USE_HEADERMAP" => "YES", diff --git a/ReactCommon/React-rncore.podspec b/ReactCommon/React-rncore.podspec index 13b612264757a7..52434ba58b4160 100644 --- a/ReactCommon/React-rncore.podspec +++ b/ReactCommon/React-rncore.podspec @@ -25,7 +25,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "11.0", :osx => "10.15" } # TODO(macOS GH#774) + s.platforms = { :ios => "11.0", :osx => "10.15" } # [macOS] s.source = source s.source_files = "dummyFile.cpp" s.pod_target_xcconfig = { "USE_HEADERMAP" => "YES", diff --git a/ReactCommon/ReactCommon.podspec b/ReactCommon/ReactCommon.podspec index 2ba196f30a8b55..4ba8bbd1f6bf5e 100644 --- a/ReactCommon/ReactCommon.podspec +++ b/ReactCommon/ReactCommon.podspec @@ -28,7 +28,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "11.0", :osx => "10.15" } # TODO(macOS GH#214) + s.platforms = { :ios => "11.0", :osx => "10.15" } # [macOS] s.source = source s.header_dir = "ReactCommon" # Use global header_dir for all subspecs for use_frameworks! compatibility s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags diff --git a/ReactCommon/callinvoker/React-callinvoker.podspec b/ReactCommon/callinvoker/React-callinvoker.podspec index b7ab336c29b1bb..035dd83f427dec 100644 --- a/ReactCommon/callinvoker/React-callinvoker.podspec +++ b/ReactCommon/callinvoker/React-callinvoker.podspec @@ -27,7 +27,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "11.0", :osx => "10.15" } # TODO(macOS GH#214) + s.platforms = { :ios => "11.0", :osx => "10.15" } # [macOS] s.source = source s.source_files = "**/*.{cpp,h}" s.header_dir = "ReactCommon" diff --git a/ReactCommon/cxxreact/React-cxxreact.podspec b/ReactCommon/cxxreact/React-cxxreact.podspec index 6e9cd403444d16..d23cfb734dc8c3 100644 --- a/ReactCommon/cxxreact/React-cxxreact.podspec +++ b/ReactCommon/cxxreact/React-cxxreact.podspec @@ -28,7 +28,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "11.0", :osx => "10.15" } # TODO(macOS GH#214) + s.platforms = { :ios => "11.0", :osx => "10.15" } # [macOS] s.source = source s.source_files = "*.{cpp,h}" s.exclude_files = "SampleCxxModule.*" diff --git a/ReactCommon/jsi/React-jsi.podspec b/ReactCommon/jsi/React-jsi.podspec index ad655e35984d92..f280eab4ca4b76 100644 --- a/ReactCommon/jsi/React-jsi.podspec +++ b/ReactCommon/jsi/React-jsi.podspec @@ -27,7 +27,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "11.0", :osx => "10.15" } # TODO(macOS GH#214) + s.platforms = { :ios => "11.0", :osx => "10.15" } # [macOS] s.source = source s.source_files = "**/*.{cpp,h}" s.exclude_files = "**/test/*" diff --git a/ReactCommon/jsi/jsi/jsi.h b/ReactCommon/jsi/jsi/jsi.h index ec6cf34c007066..1e8040d05bcf8e 100644 --- a/ReactCommon/jsi/jsi/jsi.h +++ b/ReactCommon/jsi/jsi/jsi.h @@ -966,7 +966,7 @@ class JSI_EXPORT Value { std::is_base_of::value || std::is_base_of::value, "Value cannot be implicitly move-constructed from this type"); -#ifndef __clang_analyzer__ // TODO(macOS GH#774) Disable [bugprone-move-forwarding-reference] when running clang static analysis +#ifndef __clang_analyzer__ // [macOS] Disable [bugprone-move-forwarding-reference] when running clang static analysis new (&data_.pointer) T(std::move(other)); #endif // __clang_analyzer__ } diff --git a/ReactCommon/jsiexecutor/React-jsiexecutor.podspec b/ReactCommon/jsiexecutor/React-jsiexecutor.podspec index ca4f484147cf70..f7f7ea2ceed189 100644 --- a/ReactCommon/jsiexecutor/React-jsiexecutor.podspec +++ b/ReactCommon/jsiexecutor/React-jsiexecutor.podspec @@ -27,7 +27,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "11.0", :osx => "10.15" } # TODO(macOS GH#214) + s.platforms = { :ios => "11.0", :osx => "10.15" } # [macOS] s.source = source s.source_files = "jsireact/*.{cpp,h}" s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags diff --git a/ReactCommon/jsinspector/React-jsinspector.podspec b/ReactCommon/jsinspector/React-jsinspector.podspec index 2ca461792f4efb..96125c80264318 100644 --- a/ReactCommon/jsinspector/React-jsinspector.podspec +++ b/ReactCommon/jsinspector/React-jsinspector.podspec @@ -23,7 +23,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "11.0", :osx => "10.15" } # TODO(macOS GH#214) + s.platforms = { :ios => "11.0", :osx => "10.15" } # [macOS] s.source = source s.source_files = "*.{cpp,h}" s.header_dir = 'jsinspector' diff --git a/ReactCommon/logger/React-logger.podspec b/ReactCommon/logger/React-logger.podspec index c3048e286b9197..367c375d075d06 100644 --- a/ReactCommon/logger/React-logger.podspec +++ b/ReactCommon/logger/React-logger.podspec @@ -28,7 +28,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "11.0", :tvos => "11.0", :osx => "10.15" } # TODO(macOS GH#214) + s.platforms = { :ios => "11.0", :tvos => "11.0", :osx => "10.15" } # [macOS] s.source = source s.source_files = "*.{cpp,h}" s.exclude_files = "SampleCxxModule.*" diff --git a/ReactCommon/react/nativemodule/samples/platform/ios/RCTSampleTurboModule.mm b/ReactCommon/react/nativemodule/samples/platform/ios/RCTSampleTurboModule.mm index 1f5c14f9308069..05f8c45b513aae 100644 --- a/ReactCommon/react/nativemodule/samples/platform/ios/RCTSampleTurboModule.mm +++ b/ReactCommon/react/nativemodule/samples/platform/ios/RCTSampleTurboModule.mm @@ -7,7 +7,7 @@ #import "RCTSampleTurboModule.h" -#import // TODO(macOS GH#774) +#import // [macOS] #import using namespace facebook::react; @@ -45,13 +45,13 @@ - (NSDictionary *)getConstants { __block NSDictionary *constants; RCTUnsafeExecuteOnMainQueueSync(^{ -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UIScreen *mainScreen = UIScreen.mainScreen; CGSize screenSize = mainScreen.bounds.size; -#else // [TODO(macOS GH#774) +#else // [macOS NSScreen *mainScreen = NSScreen.mainScreen; CGSize screenSize = mainScreen.frame.size; -#endif // ]TODO(macOS GH#774) +#endif // macOS] constants = @{ @"const1" : @YES, diff --git a/ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.h b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.h index 64b97c1889fdc6..bb5160d5e48c50 100644 --- a/ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.h +++ b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.h @@ -6,7 +6,7 @@ */ #import -#import // TODO(macOS GH#774) +#import // [macOS] #include NS_ASSUME_NONNULL_BEGIN @@ -20,13 +20,13 @@ typedef void (^InterceptorBlock)(std::string eventName, folly::dynamic event); - (instancetype)initWithComponentData:(RCTComponentData *)componentData bridge:(RCTBridge *)bridge; -- (RCTUIView *)createPaperViewWithTag:(NSInteger)tag; // TODO(macOS GH#774) +- (RCTUIView *)createPaperViewWithTag:(NSInteger)tag; // [macOS] - (void)addObserveForTag:(NSInteger)tag usingBlock:(InterceptorBlock)block; - (void)removeObserveForTag:(NSInteger)tag; -- (void)setProps:(folly::dynamic const &)props forView:(RCTUIView *)view; // TODO(macOS GH#774) +- (void)setProps:(folly::dynamic const &)props forView:(RCTUIView *)view; // [macOS] - (NSString *)componentViewName; diff --git a/ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm index cbbd0010dc1f2d..ac8057c7bd035f 100644 --- a/ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm +++ b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm @@ -71,9 +71,9 @@ - (void)removeObserveForTag:(NSInteger)tag [_eventInterceptors removeObjectForKey:[NSNumber numberWithInteger:tag]]; } -- (RCTUIView *)createPaperViewWithTag:(NSInteger)tag; // TODO(macOS GH#774) +- (RCTUIView *)createPaperViewWithTag:(NSInteger)tag; // [macOS] { - RCTUIView *view = [_componentData createViewWithTag:[NSNumber numberWithInteger:tag] rootTag:NULL]; // TODO(macOS GH#774) + RCTUIView *view = [_componentData createViewWithTag:[NSNumber numberWithInteger:tag] rootTag:NULL]; // [macOS] if ([_componentData.bridgelessViewManager conformsToProtocol:@protocol(RCTWeakViewHolder)]) { id weakViewHolder = (id)_componentData.bridgelessViewManager; if (!weakViewHolder.weakViews) { @@ -84,7 +84,7 @@ - (RCTUIView *)createPaperViewWithTag:(NSInteger)tag; // TODO(macOS GH#774) return view; } -- (void)setProps:(folly::dynamic const &)props forView:(RCTUIView *)view // TODO(macOS GH#774) +- (void)setProps:(folly::dynamic const &)props forView:(RCTUIView *)view // [macOS] { if (props.isObject()) { NSDictionary *convertedProps = convertFollyDynamicToId(props); diff --git a/ReactCommon/react/renderer/graphics/React-graphics.podspec b/ReactCommon/react/renderer/graphics/React-graphics.podspec index 149147582d3310..09e2e47da10d68 100644 --- a/ReactCommon/react/renderer/graphics/React-graphics.podspec +++ b/ReactCommon/react/renderer/graphics/React-graphics.podspec @@ -27,7 +27,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "11.0", :osx => "10.15" } # TODO(macOS GH#774) + s.platforms = { :ios => "11.0", :osx => "10.15" } # [macOS] s.source = source s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags s.source_files = "**/*.{m,mm,cpp,h}" diff --git a/ReactCommon/react/renderer/graphics/platform/ios/RCTPlatformColorUtils.mm b/ReactCommon/react/renderer/graphics/platform/ios/RCTPlatformColorUtils.mm index 962d207fce1c82..dc3bc49199f8db 100644 --- a/ReactCommon/react/renderer/graphics/platform/ios/RCTPlatformColorUtils.mm +++ b/ReactCommon/react/renderer/graphics/platform/ios/RCTPlatformColorUtils.mm @@ -9,7 +9,7 @@ #import #import -#import // TODO(macOS GH#774) +#import // [macOS] #include @@ -131,7 +131,7 @@ return dict; } -static RCTUIColor *_UIColorFromHexValue(NSNumber *hexValue) // TODO(macOS GH#774) +static RCTUIColor *_UIColorFromHexValue(NSNumber *hexValue) // [macOS] { NSUInteger hexIntValue = [hexValue unsignedIntegerValue]; @@ -140,10 +140,10 @@ CGFloat blue = ((CGFloat)((hexIntValue & 0xFF00) >> 8)) / 255.0; CGFloat alpha = ((CGFloat)(hexIntValue & 0xFF)) / 255.0; - return [RCTUIColor colorWithRed:red green:green blue:blue alpha:alpha]; // TODO(macOS GH#774) + return [RCTUIColor colorWithRed:red green:green blue:blue alpha:alpha]; // [macOS] } -static RCTUIColor *_Nullable _UIColorFromSemanticString(NSString *semanticString) // TODO(macOS GH#774) +static RCTUIColor *_Nullable _UIColorFromSemanticString(NSString *semanticString) // [macOS] { NSString *platformColorString = [semanticString hasSuffix:kColorSuffix] ? [semanticString substringToIndex:[semanticString length] - [kColorSuffix length]] @@ -152,17 +152,17 @@ NSDictionary *colorInfo = platformColorSelectorsDict[platformColorString]; if (colorInfo) { SEL objcColorSelector = NSSelectorFromString([platformColorString stringByAppendingString:kColorSuffix]); - if (![RCTUIColor respondsToSelector:objcColorSelector]) { // TODO(macOS GH#774) + if (![RCTUIColor respondsToSelector:objcColorSelector]) { // [macOS] NSNumber *fallbackRGB = colorInfo[kFallbackARGBKey]; if (fallbackRGB) { return _UIColorFromHexValue(fallbackRGB); } } else { - Class uiColorClass = [RCTUIColor class]; // TODO(macOS GH#774) + Class uiColorClass = [RCTUIColor class]; // [macOS] IMP imp = [uiColorClass methodForSelector:objcColorSelector]; id (*getUIColor)(id, SEL) = ((id(*)(id, SEL))imp); id colorObject = getUIColor(uiColorClass, objcColorSelector); - if ([colorObject isKindOfClass:[RCTUIColor class]]) { // TODO(macOS GH#774) + if ([colorObject isKindOfClass:[RCTUIColor class]]) { // [macOS] return colorObject; } } @@ -177,7 +177,7 @@ return [NSString stringWithCString:string.c_str() encoding:encoding]; } -static inline facebook::react::ColorComponents _ColorComponentsFromUIColor(RCTUIColor *color) // TODO(macOS GH#774) +static inline facebook::react::ColorComponents _ColorComponentsFromUIColor(RCTUIColor *color) // [macOS] { CGFloat rgba[4]; RCTGetRGBAColorComponents(color.CGColor, rgba); @@ -188,7 +188,7 @@ { for (const auto &semanticCString : semanticItems) { NSString *semanticNSString = _NSStringFromCString(semanticCString); - RCTUIColor *uiColor = [RCTUIColor colorNamed:semanticNSString]; // TODO(macOS GH#774) + RCTUIColor *uiColor = [RCTUIColor colorNamed:semanticNSString]; // [macOS] if (uiColor != nil) { return _ColorComponentsFromUIColor(uiColor); } diff --git a/ReactCommon/react/renderer/imagemanager/platform/ios/RCTImageManager.h b/ReactCommon/react/renderer/imagemanager/platform/ios/RCTImageManager.h index 2d1803454c5ef3..f01c94a5e3bb98 100644 --- a/ReactCommon/react/renderer/imagemanager/platform/ios/RCTImageManager.h +++ b/ReactCommon/react/renderer/imagemanager/platform/ios/RCTImageManager.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import diff --git a/ReactCommon/react/renderer/imagemanager/platform/ios/RCTImagePrimitivesConversions.h b/ReactCommon/react/renderer/imagemanager/platform/ios/RCTImagePrimitivesConversions.h index 89ba290dc051a5..9e57070124aa5c 100644 --- a/ReactCommon/react/renderer/imagemanager/platform/ios/RCTImagePrimitivesConversions.h +++ b/ReactCommon/react/renderer/imagemanager/platform/ios/RCTImagePrimitivesConversions.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import diff --git a/ReactCommon/react/renderer/imagemanager/platform/ios/RCTSyncImageManager.h b/ReactCommon/react/renderer/imagemanager/platform/ios/RCTSyncImageManager.h index c028be86b5932d..65076b57d1c6e2 100644 --- a/ReactCommon/react/renderer/imagemanager/platform/ios/RCTSyncImageManager.h +++ b/ReactCommon/react/renderer/imagemanager/platform/ios/RCTSyncImageManager.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import diff --git a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/NSTextStorage+FontScaling.h b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/NSTextStorage+FontScaling.h index 7c9ab641081368..5fa455d4bba336 100644 --- a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/NSTextStorage+FontScaling.h +++ b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/NSTextStorage+FontScaling.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] @interface NSTextStorage (FontScaling) diff --git a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.h b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.h index 0c2deaf3ae11bf..e5170ae07c2241 100644 --- a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.h +++ b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #include #include diff --git a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.mm b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.mm index 25b40502709080..3ab1d8838104cf 100644 --- a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.mm +++ b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.mm @@ -83,9 +83,9 @@ inline static CGFloat RCTEffectiveFontSizeMultiplierFromTextAttributes(const Tex : 1.0; } -inline static RCTUIColor *RCTEffectiveForegroundColorFromTextAttributes(const TextAttributes &textAttributes) // TODO(macOS GH#774) +inline static RCTUIColor *RCTEffectiveForegroundColorFromTextAttributes(const TextAttributes &textAttributes) // [macOS] { - RCTUIColor *effectiveForegroundColor = RCTUIColorFromSharedColor(textAttributes.foregroundColor) ?: [RCTUIColor blackColor]; // TODO(macOS GH#774) + RCTUIColor *effectiveForegroundColor = RCTUIColorFromSharedColor(textAttributes.foregroundColor) ?: [RCTUIColor blackColor]; // [macOS] if (!isnan(textAttributes.opacity)) { effectiveForegroundColor = [effectiveForegroundColor @@ -95,16 +95,16 @@ inline static CGFloat RCTEffectiveFontSizeMultiplierFromTextAttributes(const Tex return effectiveForegroundColor; } -inline static RCTUIColor *RCTEffectiveBackgroundColorFromTextAttributes(const TextAttributes &textAttributes) // TODO(macOS GH#774) +inline static RCTUIColor *RCTEffectiveBackgroundColorFromTextAttributes(const TextAttributes &textAttributes) // [macOS] { - RCTUIColor *effectiveBackgroundColor = RCTUIColorFromSharedColor(textAttributes.backgroundColor); // TODO(macOS GH#774) + RCTUIColor *effectiveBackgroundColor = RCTUIColorFromSharedColor(textAttributes.backgroundColor); // [macOS] if (effectiveBackgroundColor && !isnan(textAttributes.opacity)) { effectiveBackgroundColor = [effectiveBackgroundColor colorWithAlphaComponent:CGColorGetAlpha(effectiveBackgroundColor.CGColor) * textAttributes.opacity]; } - return effectiveBackgroundColor ?: [RCTUIColor clearColor]; // TODO(macOS GH#774) + return effectiveBackgroundColor ?: [RCTUIColor clearColor]; // [macOS] } NSDictionary *RCTNSTextAttributesFromTextAttributes(TextAttributes const &textAttributes) @@ -118,7 +118,7 @@ inline static CGFloat RCTEffectiveFontSizeMultiplierFromTextAttributes(const Tex } // Colors - RCTUIColor *effectiveForegroundColor = RCTEffectiveForegroundColorFromTextAttributes(textAttributes); // TODO(macOS GH#774) + RCTUIColor *effectiveForegroundColor = RCTEffectiveForegroundColorFromTextAttributes(textAttributes); // [macOS] if (textAttributes.foregroundColor || !isnan(textAttributes.opacity)) { attributes[NSForegroundColorAttributeName] = effectiveForegroundColor; @@ -174,7 +174,7 @@ inline static CGFloat RCTEffectiveFontSizeMultiplierFromTextAttributes(const Tex NSUnderlineStyle style = RCTNSUnderlineStyleFromTextDecorationStyle( textAttributes.textDecorationStyle.value_or(TextDecorationStyle::Solid)); - RCTUIColor *textDecorationColor = RCTUIColorFromSharedColor(textAttributes.textDecorationColor); // TODO(macOS GH#774) + RCTUIColor *textDecorationColor = RCTUIColorFromSharedColor(textAttributes.textDecorationColor); // [macOS] // Underline if (textDecorationLineType == TextDecorationLineType::Underline || diff --git a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTFontProperties.h b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTFontProperties.h index af3e44f95a7a57..67751f5444fb37 100644 --- a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTFontProperties.h +++ b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTFontProperties.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] NS_ASSUME_NONNULL_BEGIN diff --git a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTFontUtils.h b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTFontUtils.h index d70c7a13500e03..0722edf97140fa 100644 --- a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTFontUtils.h +++ b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTFontUtils.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import diff --git a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTTextLayoutManager.h b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTTextLayoutManager.h index e973113b02f931..bfa534cb797715 100644 --- a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTTextLayoutManager.h +++ b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTTextLayoutManager.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import diff --git a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTTextPrimitivesConversions.h b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTTextPrimitivesConversions.h index 3c8a154f80a4eb..eb35f6306237af 100644 --- a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTTextPrimitivesConversions.h +++ b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTTextPrimitivesConversions.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #include #include @@ -71,24 +71,24 @@ inline static NSUnderlineStyle RCTNSUnderlineStyleFromTextDecorationStyle(TextDe } } -inline static RCTUIColor *RCTUIColorFromSharedColor(const SharedColor &sharedColor) // TODO(macOS GH#774) +inline static RCTUIColor *RCTUIColorFromSharedColor(const SharedColor &sharedColor) // [macOS] { if (!sharedColor) { return nil; } if (*facebook::react::clearColor() == *sharedColor) { - return [RCTUIColor clearColor]; // TODO(macOS GH#774) + return [RCTUIColor clearColor]; // [macOS] } if (*facebook::react::blackColor() == *sharedColor) { - return [RCTUIColor blackColor]; // TODO(macOS GH#774) + return [RCTUIColor blackColor]; // [macOS] } if (*facebook::react::whiteColor() == *sharedColor) { - return [RCTUIColor whiteColor]; // TODO(macOS GH#774) + return [RCTUIColor whiteColor]; // [macOS] } auto components = facebook::react::colorComponentsFromColor(sharedColor); - return [RCTUIColor colorWithRed:components.red green:components.green blue:components.blue alpha:components.alpha]; // TODO(macOS GH#774) + return [RCTUIColor colorWithRed:components.red green:components.green blue:components.blue alpha:components.alpha]; // [macOS] } diff --git a/ReactCommon/reactperflogger/React-perflogger.podspec b/ReactCommon/reactperflogger/React-perflogger.podspec index ad87fd8d8e4e13..2da8c1f196c4dd 100644 --- a/ReactCommon/reactperflogger/React-perflogger.podspec +++ b/ReactCommon/reactperflogger/React-perflogger.podspec @@ -27,7 +27,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "11.0", :osx => "10.15" } # TODO(macOS GH#774) + s.platforms = { :ios => "11.0", :osx => "10.15" } # [macOS] s.source = source s.source_files = "**/*.{cpp,h}" s.header_dir = "reactperflogger" diff --git a/ReactCommon/runtimeexecutor/React-runtimeexecutor.podspec b/ReactCommon/runtimeexecutor/React-runtimeexecutor.podspec index 0da13a85f9c1c6..ead7b0d06d672c 100644 --- a/ReactCommon/runtimeexecutor/React-runtimeexecutor.podspec +++ b/ReactCommon/runtimeexecutor/React-runtimeexecutor.podspec @@ -27,7 +27,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "11.0", :osx => "10.15" } # TODO(macOS GH#214) + s.platforms = { :ios => "11.0", :osx => "10.15" } # [macOS] s.source = source s.source_files = "**/*.{cpp,h}" s.header_dir = "ReactCommon" diff --git a/index.js b/index.js index ca224f802ee36e..579c26abb0e558 100644 --- a/index.js +++ b/index.js @@ -15,7 +15,7 @@ import typeof AccessibilityInfo from './Libraries/Components/AccessibilityInfo/A import typeof ActivityIndicator from './Libraries/Components/ActivityIndicator/ActivityIndicator'; import typeof Button from './Libraries/Components/Button'; import typeof DatePickerIOS from './Libraries/Components/DatePicker/DatePickerIOS'; -import typeof DatePickerMacOS from './Libraries/Components/DatePickerMacOS/DatePickerMacOS'; // TODO(macOS GH#774) +import typeof DatePickerMacOS from './Libraries/Components/DatePickerMacOS/DatePickerMacOS'; // [macOS] import typeof DrawerLayoutAndroid from './Libraries/Components/DrawerAndroid/DrawerLayoutAndroid'; import typeof FlatList from './Libraries/Lists/FlatList'; import typeof Image from './Libraries/Image/Image'; @@ -90,8 +90,8 @@ import typeof YellowBox from './Libraries/YellowBox/YellowBoxDeprecated'; // Plugins import typeof {DynamicColorIOS} from './Libraries/StyleSheet/PlatformColorValueTypesIOS'; -import typeof {DynamicColorMacOS} from './Libraries/StyleSheet/PlatformColorValueTypesMacOS'; // TODO(macOS GH#774) -import typeof {ColorWithSystemEffectMacOS} from './Libraries/StyleSheet/PlatformColorValueTypesMacOS'; // TODO(macOS GH#750) +import typeof {DynamicColorMacOS} from './Libraries/StyleSheet/PlatformColorValueTypesMacOS'; // [macOS] +import typeof {ColorWithSystemEffectMacOS} from './Libraries/StyleSheet/PlatformColorValueTypesMacOS'; // [macOS] import typeof NativeModules from './Libraries/BatchedBridge/NativeModules'; import typeof Platform from './Libraries/Utilities/Platform'; import typeof {PlatformColor} from './Libraries/StyleSheet/PlatformColorValueTypes'; @@ -129,7 +129,7 @@ module.exports = { ); return require('./Libraries/Components/DatePicker/DatePickerIOS'); }, - // [TODO(macOS GH#774) + // [macOS // $FlowFixMe[value-as-type] get DatePickerMacOS(): DatePickerMacOS { warnOnce( @@ -139,7 +139,7 @@ module.exports = { 'See https://github.com/microsoft/react-native-macos/issues/389', ); return require('./Libraries/Components/DatePickerMacOS/DatePickerMacOS'); - }, // ]TODO(macOS GH#774) + }, // macOS] // $FlowFixMe[value-as-type] get DrawerLayoutAndroid(): DrawerLayoutAndroid { return require('./Libraries/Components/DrawerAndroid/DrawerLayoutAndroid'); @@ -444,16 +444,15 @@ module.exports = { get processColor(): processColor { return require('./Libraries/StyleSheet/processColor'); }, - // [TODO(macOS GH#774) + // [macOS get DynamicColorMacOS(): DynamicColorMacOS { return require('./Libraries/StyleSheet/PlatformColorValueTypesMacOS') .DynamicColorMacOS; - }, // [TODO(macOS GH#774) - // [TODO(macOS GH#750) + }, get ColorWithSystemEffectMacOS(): ColorWithSystemEffectMacOS { return require('./Libraries/StyleSheet/PlatformColorValueTypesMacOS') .ColorWithSystemEffectMacOS; - }, // ]TODO(macOS GH#750) + }, // macOS] get requireNativeComponent(): ( uiViewClassName: string, ) => HostComponent { @@ -497,7 +496,7 @@ module.exports = { ); return require('deprecated-react-native-prop-types').ViewPropTypes; }, - // ]TODO(macOS GH#774) + // macOS] }; if (__DEV__) { diff --git a/packages/rn-tester/NativeModuleExample/ScreenshotManager.podspec b/packages/rn-tester/NativeModuleExample/ScreenshotManager.podspec index 86b32bee5621f9..57dcf00165671b 100644 --- a/packages/rn-tester/NativeModuleExample/ScreenshotManager.podspec +++ b/packages/rn-tester/NativeModuleExample/ScreenshotManager.podspec @@ -19,28 +19,28 @@ Pod::Spec.new do |s| s.description = "ScreenshotManager" s.homepage = "https://github.com/facebook/react-native.git" s.license = "MIT" - s.platforms = { :ios => "11.0", :osx => "10.15", :tvos => "11.0" } # TODO(macOS GH#774) + s.platforms = { :ios => "11.0", :osx => "10.15", :tvos => "11.0" } # [macOS] s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness' s.author = "Facebook, Inc. and its affiliates" s.source = { :git => "https://github.com/facebook/react-native.git", :tag => "#{s.version}" } s.source_files = "**/*.{h,m,mm,swift}" -# [TODO(macOS GH#774) +# [macOS s.ios.exclude_files = "ScreenshotMacOS.{h,mm}" s.osx.exclude_files = "Screenshot.{h,m}" -# ]TODO(macOS GH#774) +# macOS] s.requires_arc = true s.dependency "React" s.dependency "RCT-Folly", folly_version -# [TODO(macOS GH#774) +# [macOS s.osx.dependency "React-TurboModuleCxx-RNW" s.osx.pod_target_xcconfig = { "USE_HEADERMAP" => "YES", "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"", "CLANG_CXX_LANGUAGE_STANDARD" => "c++17", } -# ]TODO(macOS GH#774) +# macOS] # s.dependency "..." diff --git a/packages/rn-tester/Podfile b/packages/rn-tester/Podfile index 532a861ac020b6..7590347ec61693 100644 --- a/packages/rn-tester/Podfile +++ b/packages/rn-tester/Podfile @@ -21,7 +21,7 @@ end def pods(options = {}) project 'RNTesterPods.xcodeproj' - # [TODO(macOS GH#774) - don't enable Fabric on RNTester by default until it works on macOS + # [macOS don't enable Fabric on RNTester by default until it works on macOS fabric_enabled = false # To use fabric: set the environment variable `USE_FABRIC` to 1, like below @@ -33,20 +33,20 @@ def pods(options = {}) puts "Building RNTester with Fabric enabled." fabric_enabled = true end - # ]TODO(macOS GH#774) + # macOS] - # TODO(macOS GH#774) - uncomment once Fabric works on macOS + # [macOS] uncomment once Fabric works on macOS # puts "Building RNTester with Fabric #{fabric_enabled ? "enabled" : "disabled"}." # fabric_enabled = true prefix_path = "../.." - # [TODO(macOS GH#774) - don't enable Fabric on RNTester by default until it works on macOS + # [macOS don't enable Fabric on RNTester by default until it works on macOS # if ENV['USE_CODEGEN_DISCOVERY'] == '1' # # Custom fabric component is only supported when using codegen discovery. # pod 'MyNativeView', :path => "NativeComponentExample" # end - # ]TODO(macOS GH#774) + # macOS] use_react_native!( path: prefix_path, @@ -60,8 +60,8 @@ def pods(options = {}) # Additional Pods which aren't included in the default Podfile pod 'React-RCTPushNotification', :path => "#{prefix_path}/Libraries/PushNotificationIOS" pod 'Yoga', :path => "#{prefix_path}/ReactCommon/yoga", :modular_headers => true - pod 'React-TurboModuleCxx-WinRTPort', :path => "#{prefix_path}/ReactTurboModuleCxx" # TODO(macOS GH#774) - pod 'React-TurboModuleCxx-RNW', :podspec => "#{prefix_path}/ReactTurboModuleCxx/React-TurboModuleCxx-RNW.podspec" # TODO(macOS GH#774) + pod 'React-TurboModuleCxx-WinRTPort', :path => "#{prefix_path}/ReactTurboModuleCxx" # [macOS] + pod 'React-TurboModuleCxx-RNW', :podspec => "#{prefix_path}/ReactTurboModuleCxx/React-TurboModuleCxx-RNW.podspec" # [macOS] # Additional Pods which are classed as unstable # RNTester native modules and components diff --git a/packages/rn-tester/RCTTest/FBSnapshotTestCase/FBSnapshotTestCase.h b/packages/rn-tester/RCTTest/FBSnapshotTestCase/FBSnapshotTestCase.h index d08d7dfa01a79f..6774f7c29d25a0 100644 --- a/packages/rn-tester/RCTTest/FBSnapshotTestCase/FBSnapshotTestCase.h +++ b/packages/rn-tester/RCTTest/FBSnapshotTestCase/FBSnapshotTestCase.h @@ -7,7 +7,7 @@ #import -#import // TODO(macOS GH#774) +#import // [macOS] #import @@ -37,7 +37,7 @@ @param error An error to log in an XCTAssert() macro if the method fails (missing reference image, images differ, etc). @returns YES if the comparison (or saving of the reference image) succeeded. */ -- (BOOL)compareSnapshotOfView:(RCTUIView *)view // TODO(macOS GH#774) +- (BOOL)compareSnapshotOfView:(RCTUIView *)view // [macOS] referenceImagesDirectory:(NSString *)referenceImagesDirectory identifier:(NSString *)identifier error:(NSError **)errorPtr; diff --git a/packages/rn-tester/RCTTest/FBSnapshotTestCase/FBSnapshotTestCase.m b/packages/rn-tester/RCTTest/FBSnapshotTestCase/FBSnapshotTestCase.m index 43c19ed63d4f6b..d34f7ca9f8a42c 100644 --- a/packages/rn-tester/RCTTest/FBSnapshotTestCase/FBSnapshotTestCase.m +++ b/packages/rn-tester/RCTTest/FBSnapshotTestCase/FBSnapshotTestCase.m @@ -39,7 +39,7 @@ - (void)setRecordMode:(BOOL)recordMode self.snapshotController.recordMode = recordMode; } -- (BOOL)compareSnapshotOfView:(RCTUIView *)view // TODO(macOS GH#774) +- (BOOL)compareSnapshotOfView:(RCTUIView *)view // [macOS] referenceImagesDirectory:(NSString *)referenceImagesDirectory identifier:(NSString *)identifier error:(NSError **)errorPtr diff --git a/packages/rn-tester/RCTTest/FBSnapshotTestCase/FBSnapshotTestController.h b/packages/rn-tester/RCTTest/FBSnapshotTestCase/FBSnapshotTestController.h index 294f1a3652c464..72eb539ae5bc17 100644 --- a/packages/rn-tester/RCTTest/FBSnapshotTestCase/FBSnapshotTestController.h +++ b/packages/rn-tester/RCTTest/FBSnapshotTestCase/FBSnapshotTestController.h @@ -6,7 +6,7 @@ */ #import -#import // TODO(macOS GH#774) +#import // [macOS] typedef NS_ENUM(NSInteger, FBSnapshotTestControllerErrorCode) { FBSnapshotTestControllerErrorCodeUnknown, @@ -59,7 +59,7 @@ extern NSString *const FBReferenceImageFilePathKey; etc). @returns YES if the comparison (or saving of the reference image) succeeded. */ -- (BOOL)compareSnapshotOfView:(RCTUIView *)view // TODO(macOS ISS#3536887) +- (BOOL)compareSnapshotOfView:(RCTUIView *)view // [macOS] selector:(SEL)selector identifier:(NSString *)identifier error:(NSError **)errorPtr; diff --git a/packages/rn-tester/RCTTest/FBSnapshotTestCase/FBSnapshotTestController.m b/packages/rn-tester/RCTTest/FBSnapshotTestCase/FBSnapshotTestController.m index 4b6901fe2d5674..7ca16816453272 100644 --- a/packages/rn-tester/RCTTest/FBSnapshotTestCase/FBSnapshotTestController.m +++ b/packages/rn-tester/RCTTest/FBSnapshotTestCase/FBSnapshotTestController.m @@ -9,7 +9,7 @@ #import -#import // TODO(macOS GH#774) +#import // [macOS] #import "UIImage+Compare.h" #import "UIImage+Diff.h" @@ -53,19 +53,19 @@ - (instancetype)initWithTestName:(NSString *)testName #pragma mark - Properties -#if DEBUG // TODO(macOS GH#774) description is a debug-only feature +#if DEBUG // [macOS description is a debug-only feature - (NSString *)description { return [NSString stringWithFormat:@"%@ %@", [super description], _referenceImagesDirectory]; } -#endif // TODO(macOS GH#774) +#endif // macOS] #pragma mark - Public API - (UIImage *)referenceImageForSelector:(SEL)selector identifier:(NSString *)identifier error:(NSError **)errorPtr { NSString *filePath = [self _referenceFilePathForSelector:selector identifier:identifier]; - UIImage *image = UIImageWithContentsOfFile(filePath); // TODO(macOS GH#774) + UIImage *image = UIImageWithContentsOfFile(filePath); // [macOS] if (nil == image && NULL != errorPtr) { BOOL exists = [_fileManager fileExistsAtPath:filePath]; if (!exists) { @@ -240,19 +240,19 @@ - (NSString *)_fileNameForSelector:(SEL)selector if (0 < identifier.length) { fileName = [fileName stringByAppendingFormat:@"_%@", identifier]; } - CGFloat scale; // [TODO(macOS GH#774) + CGFloat scale; // [macOS #if !TARGET_OS_OSX scale = [[UIScreen mainScreen] scale]; #else scale = [[NSScreen mainScreen] backingScaleFactor]; #endif - if (scale > 1.0) { // ]TODO(macOS GH#774) + if (scale > 1.0) { // macOS] fileName = [fileName stringByAppendingFormat:@"@%.fx", scale]; } #if TARGET_OS_TV fileName = [fileName stringByAppendingString:@"_tvOS"]; -#elif TARGET_OS_OSX // TODO(macOS GH#774) - fileName = [fileName stringByAppendingString:@"_macOS"]; // TODO(macOS GH#774) +#elif TARGET_OS_OSX // [macOS] + fileName = [fileName stringByAppendingString:@"_macOS"]; // [macOS] #endif fileName = [fileName stringByAppendingPathExtension:@"png"]; return fileName; @@ -296,7 +296,7 @@ - (BOOL)compareSnapshotOfView:(id)view #pragma mark - Private API -- (BOOL)_performPixelComparisonWithView:(RCTUIView *)view // TODO(macOS ISS#3536887) +- (BOOL)_performPixelComparisonWithView:(RCTUIView *)view // [macOS] selector:(SEL)selector identifier:(NSString *)identifier error:(NSError **)errorPtr @@ -317,7 +317,7 @@ - (BOOL)_performPixelComparisonWithView:(RCTUIView *)view // TODO(macOS ISS#3536 return NO; } -- (BOOL)_recordSnapshotOfView:(RCTUIView *)view // TODO(macOS ISS#3536887) +- (BOOL)_recordSnapshotOfView:(RCTUIView *)view // [macOS] selector:(SEL)selector identifier:(NSString *)identifier error:(NSError **)errorPtr @@ -326,20 +326,20 @@ - (BOOL)_recordSnapshotOfView:(RCTUIView *)view // TODO(macOS ISS#3536887) return [self saveReferenceImage:snapshot selector:selector identifier:identifier error:errorPtr]; } -- (UIImage *)_snapshotView:(RCTUIView *)view // TODO(macOS ISS#3536887) +- (UIImage *)_snapshotView:(RCTUIView *)view // [macOS] { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [view layoutIfNeeded]; -#else // [TODO(macOS GH#774) +#else // [macOS [view layoutSubtreeIfNeeded]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] CGRect bounds = view.bounds; NSAssert1(CGRectGetWidth(bounds), @"Zero width for view %@", view); NSAssert1(CGRectGetHeight(bounds), @"Zero height for view %@", view); -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UIGraphicsBeginImageContextWithOptions(bounds.size, NO, 0); CGContextRef context = UIGraphicsGetCurrentContext(); NSAssert1(context, @"Could not generate context for view %@", view); @@ -355,7 +355,7 @@ - (UIImage *)_snapshotView:(RCTUIView *)view // TODO(macOS ISS#3536887) UIImage *snapshot = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); -#else // TARGET_OS_OSX // [TODO(macOS GH#774) +#else // [macOS // The macOS snapshot bitmap will *not* be scaled to the machine's current screen. // The snapshot image is used for integration testing so the consistent scale makes the test results machine // independent. @@ -363,7 +363,7 @@ - (UIImage *)_snapshotView:(RCTUIView *)view // TODO(macOS ISS#3536887) [view cacheDisplayInRect:bounds toBitmapImageRep:rep]; UIImage *snapshot = [[NSImage alloc] initWithSize:bounds.size]; [snapshot addRepresentation:rep]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] return snapshot; } diff --git a/packages/rn-tester/RCTTest/FBSnapshotTestCase/UIImage+Compare.h b/packages/rn-tester/RCTTest/FBSnapshotTestCase/UIImage+Compare.h index fb56bc78f6a99f..66b03175ecba9e 100644 --- a/packages/rn-tester/RCTTest/FBSnapshotTestCase/UIImage+Compare.h +++ b/packages/rn-tester/RCTTest/FBSnapshotTestCase/UIImage+Compare.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] @interface UIImage (Compare) diff --git a/packages/rn-tester/RCTTest/FBSnapshotTestCase/UIImage+Compare.m b/packages/rn-tester/RCTTest/FBSnapshotTestCase/UIImage+Compare.m index f5d4a7b94c0171..964efed23099cb 100644 --- a/packages/rn-tester/RCTTest/FBSnapshotTestCase/UIImage+Compare.m +++ b/packages/rn-tester/RCTTest/FBSnapshotTestCase/UIImage+Compare.m @@ -13,11 +13,11 @@ - (BOOL)compareWithImage:(UIImage *)image { NSAssert(CGSizeEqualToSize(self.size, image.size), @"Images must be same size."); - CGImageRef imageRef = UIImageGetCGImageRef(image); // TODO(macOS GH#774) + CGImageRef imageRef = UIImageGetCGImageRef(image); // [macOS] // The images have the equal size, so we could use the smallest amount of bytes because of byte padding - size_t minBytesPerRow = MIN(CGImageGetBytesPerRow(imageRef), CGImageGetBytesPerRow(imageRef)); // TODO(macOS GH#774) - size_t referenceImageSizeBytes = CGImageGetHeight(imageRef) * minBytesPerRow; // TODO(macOS GH#774) + size_t minBytesPerRow = MIN(CGImageGetBytesPerRow(imageRef), CGImageGetBytesPerRow(imageRef)); // [macOS] + size_t referenceImageSizeBytes = CGImageGetHeight(imageRef) * minBytesPerRow; // [macOS] void *referenceImagePixels = calloc(1, referenceImageSizeBytes); void *imagePixels = calloc(1, referenceImageSizeBytes); @@ -29,29 +29,29 @@ - (BOOL)compareWithImage:(UIImage *)image CGContextRef referenceImageContext = CGBitmapContextCreate( referenceImagePixels, - CGImageGetWidth(imageRef), // TODO(macOS GH#774) - CGImageGetHeight(imageRef), // TODO(macOS GH#774) - CGImageGetBitsPerComponent(imageRef), // TODO(macOS GH#774) + CGImageGetWidth(imageRef), // [macOS] + CGImageGetHeight(imageRef), // [macOS] + CGImageGetBitsPerComponent(imageRef), // [macOS] minBytesPerRow, - CGImageGetColorSpace(imageRef), // TODO(macOS GH#774) + CGImageGetColorSpace(imageRef), // [macOS] (CGBitmapInfo)kCGImageAlphaPremultipliedLast); CGContextRef imageContext = CGBitmapContextCreate( imagePixels, - CGImageGetWidth(imageRef), // TODO(macOS GH#774) - CGImageGetHeight(imageRef), // TODO(macOS GH#774) - CGImageGetBitsPerComponent(imageRef), // TODO(macOS GH#774) + CGImageGetWidth(imageRef), // [macOS] + CGImageGetHeight(imageRef), // [macOS] + CGImageGetBitsPerComponent(imageRef), // [macOS] minBytesPerRow, - CGImageGetColorSpace(imageRef), // TODO(macOS GH#774) + CGImageGetColorSpace(imageRef), // [macOS] (CGBitmapInfo)kCGImageAlphaPremultipliedLast); -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] CGFloat scaleFactor = [UIScreen mainScreen].scale; -#else // [TODO(macOS GH#774) +#else // [macOS // The compareWithImage: method is used for integration test snapshot image comparison. // The _snapshotView: method that creates snapshot images that are *not* scaled for the screen. // By not using the screen scale factor in this method the test results are machine independent. CGFloat scaleFactor = 1; -#endif // ]TODO(macOS GH#774) +#endif // macOS] CGContextScaleCTM(referenceImageContext, scaleFactor, scaleFactor); CGContextScaleCTM(imageContext, scaleFactor, scaleFactor); @@ -65,9 +65,9 @@ - (BOOL)compareWithImage:(UIImage *)image } CGContextDrawImage( - referenceImageContext, CGRectMake(0.0f, 0.0f, self.size.width, self.size.height), imageRef); // TODO(macOS GH#774) + referenceImageContext, CGRectMake(0.0f, 0.0f, self.size.width, self.size.height), imageRef); // [macOS] CGContextDrawImage( - imageContext, CGRectMake(0.0f, 0.0f, image.size.width, image.size.height), imageRef); // TODO(macOS GH#774) + imageContext, CGRectMake(0.0f, 0.0f, image.size.width, image.size.height), imageRef); // [macOS] CGContextRelease(referenceImageContext); CGContextRelease(imageContext); diff --git a/packages/rn-tester/RCTTest/FBSnapshotTestCase/UIImage+Diff.h b/packages/rn-tester/RCTTest/FBSnapshotTestCase/UIImage+Diff.h index 65333d7f0b6e65..0e11bc856cd6e9 100644 --- a/packages/rn-tester/RCTTest/FBSnapshotTestCase/UIImage+Diff.h +++ b/packages/rn-tester/RCTTest/FBSnapshotTestCase/UIImage+Diff.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] @interface UIImage (Diff) diff --git a/packages/rn-tester/RCTTest/FBSnapshotTestCase/UIImage+Diff.m b/packages/rn-tester/RCTTest/FBSnapshotTestCase/UIImage+Diff.m index 8f83390ad14e67..c46700cd8d794a 100644 --- a/packages/rn-tester/RCTTest/FBSnapshotTestCase/UIImage+Diff.m +++ b/packages/rn-tester/RCTTest/FBSnapshotTestCase/UIImage+Diff.m @@ -22,7 +22,7 @@ - (UIImage *)diffWithImage:(UIImage *)image CGContextBeginTransparencyLayer(context, NULL); [image drawInRect:CGRectMake(0, 0, image.size.width, image.size.height)]; CGContextSetBlendMode(context, kCGBlendModeDifference); - CGContextSetFillColorWithColor(context, [RCTUIColor whiteColor].CGColor); // TODO(macOS ISS#3536887) + CGContextSetFillColorWithColor(context, [RCTUIColor whiteColor].CGColor); // [macOS] CGContextFillRect(context, CGRectMake(0, 0, self.size.width, self.size.height)); CGContextEndTransparencyLayer(context); UIImage *returnImage = UIGraphicsGetImageFromCurrentImageContext(); diff --git a/packages/rn-tester/RCTTest/RCTSnapshotManager.m b/packages/rn-tester/RCTTest/RCTSnapshotManager.m index 4f86ccd07c72ac..4bb89436a16e40 100644 --- a/packages/rn-tester/RCTTest/RCTSnapshotManager.m +++ b/packages/rn-tester/RCTTest/RCTSnapshotManager.m @@ -7,7 +7,7 @@ #import "RCTSnapshotManager.h" -@interface RCTSnapshotView : RCTUIView // TODO(macOS ISS#3536887) +@interface RCTSnapshotView : RCTUIView // [macOS] @property (nonatomic, copy) RCTDirectEventBlock onSnapshotReady; @property (nonatomic, copy) NSString *testIdentifier; @@ -34,7 +34,7 @@ @implementation RCTSnapshotManager RCT_EXPORT_MODULE() -- (RCTUIView *)view // TODO(macOS ISS#3536887) +- (RCTUIView *)view // [macOS] { return [RCTSnapshotView new]; } diff --git a/packages/rn-tester/RCTTest/RCTTestModule.h b/packages/rn-tester/RCTTest/RCTTestModule.h index 0ac976e44dae89..cc3ad12a302463 100644 --- a/packages/rn-tester/RCTTest/RCTTestModule.h +++ b/packages/rn-tester/RCTTest/RCTTestModule.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import @@ -24,7 +24,7 @@ typedef NS_ENUM(NSInteger, RCTTestStatus) { RCTTestStatusPending = 0, RCTTestSta /** * This is the view to be snapshotted. */ -@property (nonatomic, strong) RCTUIView *view; // TODO(macOS ISS#3536887) +@property (nonatomic, strong) RCTUIView *view; // [macOS] /** * This is used to give meaningful names to snapshot image files. diff --git a/packages/rn-tester/RCTTest/RCTTestModule.mm b/packages/rn-tester/RCTTest/RCTTestModule.mm index e02c27d3928263..5a97972eb8848b 100644 --- a/packages/rn-tester/RCTTest/RCTTestModule.mm +++ b/packages/rn-tester/RCTTest/RCTTestModule.mm @@ -106,7 +106,7 @@ - (dispatch_queue_t)methodQueue [_bridge.uiManager addUIBlock:^( RCTUIManager *uiManager, - NSDictionary *viewRegistry) { // TODO(macOS ISS#3536887) + NSDictionary *viewRegistry) { // [macOS] NSString *testName = NSStringFromSelector(self->_testSelector); if (!self->_snapshotCounter) { self->_snapshotCounter = [NSMutableDictionary new]; @@ -163,7 +163,7 @@ - (dispatch_queue_t)methodQueue [_bridge.uiManager addUIBlock:^( __unused RCTUIManager *uiManager, - __unused NSDictionary *viewRegistry) { // TODO(macOS ISS#3536887) + __unused NSDictionary *viewRegistry) { // [macOS] self->_status = success ? RCTTestStatusPassed : RCTTestStatusFailed; }]; } diff --git a/packages/rn-tester/RCTTest/RCTTestRunner.m b/packages/rn-tester/RCTTest/RCTTestRunner.m index a851533c1dfb41..e52307c6c5d6cf 100644 --- a/packages/rn-tester/RCTTest/RCTTestRunner.m +++ b/packages/rn-tester/RCTTest/RCTTestRunner.m @@ -9,9 +9,9 @@ #import #import -#import // TODO(macOS GH#774) +#import // [macOS] #import -#import // TODO(OSS Candidate ISS#2710739) +#import // [macOS] #import #import #import @@ -61,7 +61,7 @@ - (instancetype)initWithApp:(NSString *)app RCTAssertParam(app); RCTAssertParam(referenceDirectory); - // TODO(macOS GH#774): uncomment to record snapshot images + // [macOS] uncomment to record snapshot images // referenceDirectory = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES).firstObject; // Search for `_runner.recordMode = ` and change instances to YES @@ -94,11 +94,11 @@ - (NSURL *)defaultScriptURL { if (getenv("CI_USE_PACKAGER") || _useBundler) { NSString *bundlePrefix = - [[[NSBundle mainBundle] infoDictionary] valueForKey:@"RN_BUNDLE_PREFIX"] ?: @""; // TODO(macOS GH#774) + [[[NSBundle mainBundle] infoDictionary] valueForKey:@"RN_BUNDLE_PREFIX"] ?: @""; // [macOS] return [NSURL URLWithString:[NSString stringWithFormat:@"http://localhost:8081/%@%@.bundle?platform=%@&dev=true", bundlePrefix, _appPath, - kRCTPlatformName]]; // TODO(macOS GH#774) + kRCTPlatformName]]; // [macOS] } else { return [[NSBundle bundleForClass:[RCTBridge class]] URLForResource:@"main" withExtension:@"jsbundle"]; } @@ -192,10 +192,10 @@ - (void)runTest:(SEL)test [bridge.devSettings setIsDebuggingRemotely:_useJSDebugger]; batchedBridge = [bridge batchedBridge]; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UIViewController *vc = RCTSharedApplication().delegate.window.rootViewController; vc.view = [UIView new]; -#endif // TODO(macOS GH#774) +#endif // [macOS] RCTTestModule *testModule = [bridge moduleForClass:[RCTTestModule class]]; RCTAssert(_testController != nil, @"_testController should not be nil"); @@ -217,20 +217,20 @@ - (void)runTest:(SEL)test rootTag = rootView.reactTag; testModule.view = rootView; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] [vc.view addSubview:rootView]; // Add as subview so it doesn't get resized -#endif // TODO(macOS GH#774) +#endif // [macOS] if (configurationBlock) { configurationBlock(rootView); } - RCTImageLoader *imageLoader = [bridge moduleForClass:[RCTImageLoader class]]; // TODO(OSS Candidate ISS#2710739) + RCTImageLoader *imageLoader = [bridge moduleForClass:[RCTImageLoader class]]; // [macOS] NSDate *date = [NSDate dateWithTimeIntervalSinceNow:kTestTimeoutSeconds]; while (date.timeIntervalSinceNow > 0 && (testModule.status == RCTTestStatusPending || [imageLoader activeTasks] > 0) && - errors == nil) { // TODO(OSS Candidate ISS#2710739) + errors == nil) { // [macOS] [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; } @@ -251,7 +251,7 @@ - (void)runTest:(SEL)test } }); -#if RCT_DEV && !TARGET_OS_OSX // TODO(macOS GH#774) +#if RCT_DEV && !TARGET_OS_OSX // [macOS] NSArray *nonLayoutSubviews = [vc.view.subviews filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(id subview, NSDictionary *bindings) { return ![NSStringFromClass([subview class]) isEqualToString:@"_UILayoutGuide"]; @@ -263,14 +263,14 @@ - (void)runTest:(SEL)test if (expectErrorBlock) { RCTAssert(expectErrorBlock(errors[0]), @"Expected an error but the first one was missing or did not match."); } else { - // [TODO(OSS Candidate ISS#2710739): xcpretty formats the test failure output to show only one line of the assert + // [macOS xcpretty formats the test failure output to show only one line of the assert // string followed by a snippet of source code including the assert statement and the lines just before and after. // Convert the `errors` array into a single line string delimited by \n so that CI logs contain meaningful // information. RCTAssert( errors == nil, @"RedBox errors: %@", - [[errors valueForKey:@"description"] componentsJoinedByString:@"\\n"]); // ]TODO(OSS Candidate ISS#2710739) + [[errors valueForKey:@"description"] componentsJoinedByString:@"\\n"]); // macOS] RCTAssert( testModule.status != RCTTestStatusPending, @"Test didn't finish within %0.f seconds", kTestTimeoutSeconds); RCTAssert(testModule.status == RCTTestStatusPassed, @"Test failed"); @@ -294,7 +294,7 @@ - (void)runTest:(SEL)test [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; } - if (!expectErrorBlock) { // TODO(tomun): need this to pass -[RNTesterIntegrationTests testTheTester_ExpectError] + if (!expectErrorBlock) { // [macOS] need this to pass -[RNTesterIntegrationTests testTheTester_ExpectError] RCTAssert(errors == nil, @"RedBox errors during bridge invalidation: %@", errors); } RCTAssert(batchedBridge == nil, @"Bridge should be deallocated after the test"); diff --git a/packages/rn-tester/RCTTest/React-RCTTest.podspec b/packages/rn-tester/RCTTest/React-RCTTest.podspec index 5211d8ff1fed4c..bdef4f7d9daabf 100644 --- a/packages/rn-tester/RCTTest/React-RCTTest.podspec +++ b/packages/rn-tester/RCTTest/React-RCTTest.podspec @@ -26,7 +26,7 @@ Pod::Spec.new do |s| s.homepage = "https://reactnative.dev/" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "11.0", :osx => "10.15" } # TODO(macOS GH#214) + s.platforms = { :ios => "11.0", :osx => "10.15" } # [macOS] s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness' s.source = source s.source_files = "**/*.{h,m,mm}" diff --git a/packages/rn-tester/RNTester/AppDelegate.mm b/packages/rn-tester/RNTester/AppDelegate.mm index 2c88e39ecae6a9..743f7bf66a98ef 100644 --- a/packages/rn-tester/RNTester/AppDelegate.mm +++ b/packages/rn-tester/RNTester/AppDelegate.mm @@ -62,7 +62,7 @@ #endif #endif -#import // TODO(OSS Candidate ISS#2710739) +#import // [macOS] #import #import "RNTesterTurboModuleProvider.h" @@ -86,11 +86,11 @@ - (BOOL)application:(__unused UIApplication *)application didFinishLaunchingWith _bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; - // [TODO(OSS Candidate ISS#2710739) + // [macOS // Optionally set the global `fontSmoothing` setting. // If not explicitly set, the default is subpixel-antialiased [RCTTextAttributes setFontSmoothingDefault:RCTFontSmoothingSubpixelAntialiased]; - // ]TODO(OSS Candidate ISS#2710739) + // macOS] // Appetizer.io params check NSDictionary *initProps = @{}; diff --git a/packages/rn-tester/RNTester/NativeExampleViews/FlexibleSizeExampleView.h b/packages/rn-tester/RNTester/NativeExampleViews/FlexibleSizeExampleView.h index 8d4cf869db4683..858a9b3255bae8 100644 --- a/packages/rn-tester/RNTester/NativeExampleViews/FlexibleSizeExampleView.h +++ b/packages/rn-tester/RNTester/NativeExampleViews/FlexibleSizeExampleView.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import diff --git a/packages/rn-tester/RNTester/NativeExampleViews/FlexibleSizeExampleView.m b/packages/rn-tester/RNTester/NativeExampleViews/FlexibleSizeExampleView.m index 8eed237e465f14..97d0e9dc9dc704 100644 --- a/packages/rn-tester/RNTester/NativeExampleViews/FlexibleSizeExampleView.m +++ b/packages/rn-tester/RNTester/NativeExampleViews/FlexibleSizeExampleView.m @@ -12,12 +12,12 @@ #import #import -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] #import "AppDelegate.h" -#else // [TODO(macOS GH#774) +#else // [macOS #import "../../RNTester-macOS/AppDelegate.h" #define UITextView NSTextView -#endif // ]TODO(macOS GH#774) +#endif // macOS] @interface FlexibleSizeExampleViewManager : RCTViewManager @@ -27,7 +27,7 @@ @implementation FlexibleSizeExampleViewManager RCT_EXPORT_MODULE(); -- (RCTUIView *)view // TODO(macOS GH#774) +- (RCTUIView *)view // [macOS] { return [FlexibleSizeExampleView new]; } @@ -61,13 +61,13 @@ - (instancetype)initWithFrame:(CGRect)frame #ifndef TARGET_OS_TV _currentSizeTextView.editable = NO; #endif -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] _currentSizeTextView.text = @"Resizable view has not been resized yet"; -#else // [TODO(macOS GH#774) +#else // [macOS _currentSizeTextView.string = @"Resizable view has not been resized yet"; -#endif // ]TODO(macOS GH#774) - _currentSizeTextView.textColor = [RCTUIColor blackColor]; // TODO(macOS GH#774) - _currentSizeTextView.backgroundColor = [RCTUIColor whiteColor]; // TODO(macOS GH#774) +#endif // macOS] + _currentSizeTextView.textColor = [RCTUIColor blackColor]; // [macOS] + _currentSizeTextView.backgroundColor = [RCTUIColor whiteColor]; // [macOS] _currentSizeTextView.font = [UIFont boldSystemFontOfSize:10]; _resizableRootView.delegate = self; @@ -88,7 +88,7 @@ - (void)layoutSubviews [_currentSizeTextView setFrame:CGRectMake(0, 0, self.frame.size.width, textViewHeight)]; } -- (NSArray *> *)reactSubviews // TODO(macOS GH#774) +- (NSArray *> *)reactSubviews // [macOS] { // this is to avoid unregistering our RCTRootView when the component is removed from RN hierarchy (void)[super reactSubviews]; @@ -104,21 +104,21 @@ - (void)rootViewDidChangeIntrinsicSize:(RCTRootView *)rootView if (!_sizeUpdated) { _sizeUpdated = TRUE; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] _currentSizeTextView.text = -#else // [TODO(macOS GH#774) +#else // [macOS _currentSizeTextView.string = -#endif // ]TODO(macOS GH#774) +#endif // macOS] [NSString stringWithFormat: @"RCTRootViewDelegate: content with initially unknown size has appeared, updating root view's size so the content fits."]; } else { -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] _currentSizeTextView.text = -#else // [TODO(macOS GH#774) +#else // [macOS _currentSizeTextView.string = -#endif // ]TODO(macOS GH#774) +#endif // macOS] [NSString stringWithFormat: @"RCTRootViewDelegate: content size has been changed to (%ld, %ld), updating root view's size.", (long)newFrame.size.width, diff --git a/packages/rn-tester/RNTester/NativeExampleViews/UpdatePropertiesExampleView.h b/packages/rn-tester/RNTester/NativeExampleViews/UpdatePropertiesExampleView.h index c11f414b865c5a..285645e93b4f1c 100644 --- a/packages/rn-tester/RNTester/NativeExampleViews/UpdatePropertiesExampleView.h +++ b/packages/rn-tester/RNTester/NativeExampleViews/UpdatePropertiesExampleView.h @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import diff --git a/packages/rn-tester/RNTester/NativeExampleViews/UpdatePropertiesExampleView.m b/packages/rn-tester/RNTester/NativeExampleViews/UpdatePropertiesExampleView.m index 3da73d0854af4d..c17aaa5b65d0fb 100644 --- a/packages/rn-tester/RNTester/NativeExampleViews/UpdatePropertiesExampleView.m +++ b/packages/rn-tester/RNTester/NativeExampleViews/UpdatePropertiesExampleView.m @@ -10,11 +10,11 @@ #import #import -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] #import "AppDelegate.h" -#else // [TODO(macOS GH#774) +#else // [macOS #import "../../RNTester-macOS/AppDelegate.h" -#endif // ]TODO(macOS GH#774) +#endif // macOS] @interface UpdatePropertiesExampleViewManager : RCTViewManager @@ -24,7 +24,7 @@ @implementation UpdatePropertiesExampleViewManager RCT_EXPORT_MODULE(); -- (RCTUIView *)view // TODO(macOS GH#774) +- (RCTUIView *)view // [macOS] { return [UpdatePropertiesExampleView new]; } @@ -33,11 +33,11 @@ - (RCTUIView *)view // TODO(macOS GH#774) @implementation UpdatePropertiesExampleView { RCTRootView *_rootView; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] UIButton *_button; -#else // [TODO(macOS GH#774) +#else // [macOS NSButton *_button; -#endif // ]TODO(macOS GH#774) +#endif // macOS] BOOL _beige; } @@ -53,19 +53,19 @@ - (instancetype)initWithFrame:(CGRect)frame moduleName:@"SetPropertiesExampleApp" initialProperties:@{@"color" : @"beige"}]; -#if !TARGET_OS_OSX // TODO(macOS GH#774) +#if !TARGET_OS_OSX // [macOS] _button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; [_button setTitle:@"Native Button" forState:UIControlStateNormal]; [_button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; [_button setBackgroundColor:[UIColor grayColor]]; [_button addTarget:self action:@selector(changeColor) forControlEvents:UIControlEventTouchUpInside]; -#else // [TODO(macOS GH#774) +#else // [macOS _button = [NSButton new]; [_button setTitle:@"Native Button"]; [_button setTarget:self]; [_button setAction:@selector(changeColor)]; -#endif // ]TODO(macOS GH#774) +#endif // macOS] [self addSubview:_button]; [self addSubview:_rootView]; @@ -90,7 +90,7 @@ - (void)changeColor [_rootView setAppProperties:@{@"color" : _beige ? @"beige" : @"purple"}]; } -- (NSArray *> *)reactSubviews // TODO(macOS GH#774) +- (NSArray *> *)reactSubviews // [macOS] { // this is to avoid unregistering our RCTRootView when the component is removed from RN hierarchy (void)[super reactSubviews]; diff --git a/packages/rn-tester/RNTesterIntegrationTests/RCTLoggingTests.m b/packages/rn-tester/RNTesterIntegrationTests/RCTLoggingTests.m index 3fac053fd6f492..8bfceab5e00ca6 100644 --- a/packages/rn-tester/RNTesterIntegrationTests/RCTLoggingTests.m +++ b/packages/rn-tester/RNTesterIntegrationTests/RCTLoggingTests.m @@ -29,11 +29,11 @@ - (void)setUp NSURL *scriptURL; if (getenv("CI_USE_PACKAGER")) { NSString *bundlePrefix = [[[NSBundle mainBundle] infoDictionary] valueForKey:@"RN_BUNDLE_PREFIX"]; - if (bundlePrefix == nil) { // [TODO(macOS GH#774) There's a convoluted crash if the bundler prefix is null, meaning + if (bundlePrefix == nil) { // [macOS There's a convoluted crash if the bundler prefix is null, meaning // the RN_BUNDLE_PREFIX wasn't set. New platforms won't have this set and don't need it // to run, so default to a reasonable fallback. bundlePrefix = @""; - } // TODO(macOS GH#774)] + } // macOS] NSString *app = @"IntegrationTests/IntegrationTestsApp"; scriptURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://localhost:8081/%@.bundle?platform=ios&dev=true", app]]; @@ -60,7 +60,7 @@ - (void)tearDown RCTSetLogFunction(RCTDefaultLogFunction); } -#define RCT_TEST_LOGGING_TIMEOUT dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC * 15) // TODO(OSS Candidate ISS#2710739) +#define RCT_TEST_LOGGING_TIMEOUT dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC * 15) // [macOS] - (void)testLogging { @@ -84,32 +84,32 @@ - (void)testLogging } }); // Wait for console log to signal the semaphore - dispatch_semaphore_wait(_logSem, RCT_TEST_LOGGING_TIMEOUT); // TODO(OSS Candidate ISS#2710739) + dispatch_semaphore_wait(_logSem, RCT_TEST_LOGGING_TIMEOUT); // [macOS] XCTAssertEqual(_lastLogLevel, RCTLogLevelInfo); XCTAssertEqual(_lastLogSource, RCTLogSourceJavaScript); XCTAssertEqualObjects(_lastLogMessage, @"Invoking console.log"); [_bridge enqueueJSCall:@"LoggingTestModule.warning" args:@[ @"Generating warning" ]]; - dispatch_semaphore_wait(_logSem, RCT_TEST_LOGGING_TIMEOUT); // TODO(OSS Candidate ISS#2710739) + dispatch_semaphore_wait(_logSem, RCT_TEST_LOGGING_TIMEOUT); // [macOS] XCTAssertEqual(_lastLogLevel, RCTLogLevelWarning); XCTAssertEqual(_lastLogSource, RCTLogSourceJavaScript); XCTAssertEqualObjects(_lastLogMessage, @"Generating warning"); [_bridge enqueueJSCall:@"LoggingTestModule.invariant" args:@[ @"Invariant failed" ]]; - dispatch_semaphore_wait(_logSem, RCT_TEST_LOGGING_TIMEOUT); // TODO(OSS Candidate ISS#2710739) + dispatch_semaphore_wait(_logSem, RCT_TEST_LOGGING_TIMEOUT); // [macOS] XCTAssertEqual(_lastLogLevel, RCTLogLevelError); XCTAssertEqual(_lastLogSource, RCTLogSourceJavaScript); XCTAssertTrue([_lastLogMessage containsString:@"Invariant Violation: Invariant failed"]); [_bridge enqueueJSCall:@"LoggingTestModule.logErrorToConsole" args:@[ @"Invoking console.error" ]]; - dispatch_semaphore_wait(_logSem, RCT_TEST_LOGGING_TIMEOUT); // TODO(OSS Candidate ISS#2710739) + dispatch_semaphore_wait(_logSem, RCT_TEST_LOGGING_TIMEOUT); // [macOS] // For local bundles, we'll first get a warning about symbolication if ([_bridge.bundleURL isFileURL]) { - dispatch_semaphore_wait(_logSem, RCT_TEST_LOGGING_TIMEOUT); // TODO(OSS Candidate ISS#2710739) + dispatch_semaphore_wait(_logSem, RCT_TEST_LOGGING_TIMEOUT); // [macOS] } XCTAssertEqual(_lastLogLevel, RCTLogLevelError); @@ -117,11 +117,11 @@ - (void)testLogging XCTAssertEqualObjects(_lastLogMessage, @"Invoking console.error"); [_bridge enqueueJSCall:@"LoggingTestModule.throwError" args:@[ @"Throwing an error" ]]; - dispatch_semaphore_wait(_logSem, RCT_TEST_LOGGING_TIMEOUT); // TODO(OSS Candidate ISS#2710739) + dispatch_semaphore_wait(_logSem, RCT_TEST_LOGGING_TIMEOUT); // [macOS] // For local bundles, we'll first get a warning about symbolication if ([_bridge.bundleURL isFileURL]) { - dispatch_semaphore_wait(_logSem, RCT_TEST_LOGGING_TIMEOUT); // TODO(OSS Candidate ISS#2710739) + dispatch_semaphore_wait(_logSem, RCT_TEST_LOGGING_TIMEOUT); // [macOS] } XCTAssertEqual(_lastLogLevel, RCTLogLevelError); diff --git a/packages/rn-tester/RNTesterIntegrationTests/RCTRootViewIntegrationTests.m b/packages/rn-tester/RNTesterIntegrationTests/RCTRootViewIntegrationTests.m index 6ab8b19e11ea45..51a69a107d7055 100644 --- a/packages/rn-tester/RNTesterIntegrationTests/RCTRootViewIntegrationTests.m +++ b/packages/rn-tester/RNTesterIntegrationTests/RCTRootViewIntegrationTests.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS ISS#3536887) +#import // [macOS] #import #import diff --git a/packages/rn-tester/RNTesterIntegrationTests/RCTUIManagerScenarioTests.m b/packages/rn-tester/RNTesterIntegrationTests/RCTUIManagerScenarioTests.m index 96cfa1dacb2b7e..5a5d620928eef1 100644 --- a/packages/rn-tester/RNTesterIntegrationTests/RCTUIManagerScenarioTests.m +++ b/packages/rn-tester/RNTesterIntegrationTests/RCTUIManagerScenarioTests.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS ISS#3536887) +#import // [macOS] #import #import @@ -21,7 +21,7 @@ - (void)_manageChildren:(NSNumber *)containerReactTag removeAtIndices:(NSArray *)removeAtIndices registry:(NSMutableDictionary> *)registry; -@property (nonatomic, readonly) NSMutableDictionary *viewRegistry; // TODO(macOS ISS#3536887) +@property (nonatomic, readonly) NSMutableDictionary *viewRegistry; // [macOS] @end @@ -41,7 +41,7 @@ - (void)setUp // Register 20 views to use in the tests for (NSInteger i = 1; i <= 20; i++) { - RCTUIView *registeredView = [RCTUIView new]; // TODO(macOS ISS#3536887) + RCTUIView *registeredView = [RCTUIView new]; // [macOS] registeredView.reactTag = @(i); _uiManager.viewRegistry[@(i)] = registeredView; } @@ -49,7 +49,7 @@ - (void)setUp - (void)testManagingChildrenToAddViews { - RCTUIView *containerView = _uiManager.viewRegistry[@20]; // TODO(macOS ISS#3536887) + RCTUIView *containerView = _uiManager.viewRegistry[@20]; // [macOS] NSMutableArray *addedViews = [NSMutableArray array]; NSArray *tagsToAdd = @[ @1, @2, @3, @4, @5 ]; @@ -74,7 +74,7 @@ - (void)testManagingChildrenToAddViews @"Expect to have 5 react subviews after calling manage children \ with 5 tags to add, instead have %lu", (unsigned long)[[containerView reactSubviews] count]); - for (RCTUIView *view in addedViews) { // TODO(macOS ISS#3536887) + for (RCTUIView *view in addedViews) { // [macOS] XCTAssertTrue([view superview] == containerView, @"Expected to have manage children successfully add children"); [view removeFromSuperview]; } @@ -82,7 +82,7 @@ - (void)testManagingChildrenToAddViews - (void)testManagingChildrenToRemoveViews { - RCTUIView *containerView = _uiManager.viewRegistry[@20]; // TODO(macOS ISS#3536887) + RCTUIView *containerView = _uiManager.viewRegistry[@20]; // [macOS] NSMutableArray *removedViews = [NSMutableArray array]; NSArray *removeAtIndices = @[ @0, @4, @8, @12, @16 ]; @@ -91,7 +91,7 @@ - (void)testManagingChildrenToRemoveViews [removedViews addObject:_uiManager.viewRegistry[reactTag]]; } for (NSInteger i = 2; i < 20; i++) { - RCTUIView *view = _uiManager.viewRegistry[@(i)]; // TODO(macOS ISS#3536887) + RCTUIView *view = _uiManager.viewRegistry[@(i)]; // [macOS] [containerView insertReactSubview:view atIndex:containerView.reactSubviews.count]; } @@ -112,13 +112,13 @@ - (void)testManagingChildrenToRemoveViews @"Expect to have 13 react subviews after calling manage children\ with 5 tags to remove and 18 prior children, instead have %zd", containerView.reactSubviews.count); - for (RCTUIView *view in removedViews) { // TODO(macOS ISS#3536887) + for (RCTUIView *view in removedViews) { // [macOS] XCTAssertTrue([view superview] == nil, @"Expected to have manage children successfully remove children"); // After removing views are unregistered - we need to reregister _uiManager.viewRegistry[view.reactTag] = view; } for (NSInteger i = 2; i < 20; i++) { - RCTUIView *view = _uiManager.viewRegistry[@(i)]; // TODO(macOS ISS#3536887) + RCTUIView *view = _uiManager.viewRegistry[@(i)]; // [macOS] if (![removedViews containsObject:view]) { XCTAssertTrue( [view superview] == containerView, @@ -139,7 +139,7 @@ - (void)testManagingChildrenToRemoveViews // [11,5,1,2,7,8,12,10] - (void)testManagingChildrenToAddRemoveAndMove { - RCTUIView *containerView = _uiManager.viewRegistry[@20]; // TODO(macOS ISS#3536887) + RCTUIView *containerView = _uiManager.viewRegistry[@20]; // [macOS] NSArray *removeAtIndices = @[ @2, @3, @5, @8 ]; NSArray *addAtIndices = @[ @0, @6 ]; @@ -151,12 +151,12 @@ - (void)testManagingChildrenToAddRemoveAndMove NSMutableArray *viewsToRemove = [NSMutableArray array]; for (NSUInteger i = 0; i < removeAtIndices.count; i++) { NSNumber *reactTagToRemove = @([removeAtIndices[i] integerValue] + 1); - RCTUIView *viewToRemove = _uiManager.viewRegistry[reactTagToRemove]; // TODO(macOS ISS#3536887) + RCTUIView *viewToRemove = _uiManager.viewRegistry[reactTagToRemove]; // [macOS] [viewsToRemove addObject:viewToRemove]; } for (NSInteger i = 1; i < 11; i++) { - RCTUIView *view = _uiManager.viewRegistry[@(i)]; // TODO(macOS ISS#3536887) + RCTUIView *view = _uiManager.viewRegistry[@(i)]; // [macOS] [containerView insertReactSubview:view atIndex:containerView.reactSubviews.count]; } @@ -187,10 +187,10 @@ - (void)testManagingChildrenToAddRemoveAndMove // Clean up after ourselves for (NSInteger i = 1; i < 13; i++) { - RCTUIView *view = _uiManager.viewRegistry[@(i)]; // TODO(macOS ISS#3536887) + RCTUIView *view = _uiManager.viewRegistry[@(i)]; // [macOS] [view removeFromSuperview]; } - for (RCTUIView *view in viewsToRemove) { // TODO(macOS ISS#3536887) + for (RCTUIView *view in viewsToRemove) { // [macOS] _uiManager.viewRegistry[view.reactTag] = view; } } diff --git a/packages/rn-tester/RNTesterIntegrationTests/RNTesterIntegrationTests.m b/packages/rn-tester/RNTesterIntegrationTests/RNTesterIntegrationTests.m index da24684c83a54e..af0e93f51a935b 100644 --- a/packages/rn-tester/RNTesterIntegrationTests/RNTesterIntegrationTests.m +++ b/packages/rn-tester/RNTesterIntegrationTests/RNTesterIntegrationTests.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS ISS#3536887) +#import // [macOS] #import #import @@ -72,9 +72,9 @@ - (void)testTheTester_waitOneFrame RCT_TEST(SyncMethodTest) RCT_TEST(PromiseTest) RCT_TEST_ONLY_WITH_PACKAGER(WebSocketTest) // Requires a WebSocket test server, see scripts/objc-test.sh -#if !TARGET_OS_OSX // ios specific +#if !TARGET_OS_OSX // [macOS] iOS specific RCT_TEST(AccessibilityManagerTest) -#endif +#endif // [macOS] RCT_TEST(GlobalEvalWithSourceUrlTest) @end diff --git a/packages/rn-tester/RNTesterIntegrationTests/RNTesterLoadAllPages.m b/packages/rn-tester/RNTesterIntegrationTests/RNTesterLoadAllPages.m index 8854143975515d..0375e9bbb5ad15 100644 --- a/packages/rn-tester/RNTesterIntegrationTests/RNTesterLoadAllPages.m +++ b/packages/rn-tester/RNTesterIntegrationTests/RNTesterLoadAllPages.m @@ -6,7 +6,7 @@ * */ -// TODO(OSS Candidate ISS#2710739) +// [macOS] #import #import diff --git a/packages/rn-tester/RNTesterIntegrationTests/RNTesterSnapshotTests.m b/packages/rn-tester/RNTesterIntegrationTests/RNTesterSnapshotTests.m index c9d151e7d5f750..7c32245439bd9f 100644 --- a/packages/rn-tester/RNTesterIntegrationTests/RNTesterSnapshotTests.m +++ b/packages/rn-tester/RNTesterIntegrationTests/RNTesterSnapshotTests.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS ISS#3536887) +#import // [macOS] #import #import @@ -20,14 +20,14 @@ @implementation RNTesterSnapshotTests - (void)setUp { -#if !TARGET_OS_OSX // TODO(macOS ISS#3536887) +#if !TARGET_OS_OSX // [macOS] _runner = RCTInitRunnerForApp(@"packages/rn-tester/js/RNTesterApp.ios", nil, nil); if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 10) { _runner.testSuffix = [NSString stringWithFormat:@"-iOS%d", UIDevice.currentDevice.systemVersion.intValue]; } -#else // [TODO(macOS ISS#3536887) +#else // [macOS _runner = RCTInitRunnerForApp(@"packages/rn-tester/js/RNTesterApp.macos", nil, nil); -#endif // ]TODO(macOS ISS#3536887) +#endif // macOS] // --------- // WHEN SNAPSHOTS ARE FAILING LOCALLY diff --git a/packages/rn-tester/RNTesterUnitTests/RCTAllocationTests.m b/packages/rn-tester/RNTesterUnitTests/RCTAllocationTests.m index 7478d6a366da4e..5f97d8691f8d3a 100644 --- a/packages/rn-tester/RNTesterUnitTests/RCTAllocationTests.m +++ b/packages/rn-tester/RNTesterUnitTests/RCTAllocationTests.m @@ -161,7 +161,7 @@ - (void)testModuleMethodsAreDeallocated - (void)testContentViewIsInvalidated { RCTBridge *bridge = [[RCTBridge alloc] initWithBundleURL:_bundleURL moduleProvider:nil launchOptions:nil]; - __weak RCTUIView *rootContentView; // TODO(macOS ISS#3536887) + __weak RCTUIView *rootContentView; // [macOS] @autoreleasepool { RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"" initialProperties:nil]; RCT_RUN_RUNLOOP_WHILE(!(rootContentView = [rootView valueForKey:@"contentView"])) diff --git a/packages/rn-tester/RNTesterUnitTests/RCTBundleURLProviderTests.m b/packages/rn-tester/RNTesterUnitTests/RCTBundleURLProviderTests.m index 22d23b4f9740bc..25a16cc177eab5 100644 --- a/packages/rn-tester/RNTesterUnitTests/RCTBundleURLProviderTests.m +++ b/packages/rn-tester/RNTesterUnitTests/RCTBundleURLProviderTests.m @@ -29,7 +29,7 @@ stringWithFormat: @"http://localhost:8081/%@.bundle?platform=%@&dev=true&minify=false&modulesOnly=false&runModule=true&runtimeBytecodeVersion=%u&app=com.apple.dt.xctest.tool", testFile, - kRCTPlatformName, // TODO(macOS GH#774) + kRCTPlatformName, // [macOS] HERMES_BYTECODE_VERSION]]; #else return [NSURL @@ -38,7 +38,7 @@ stringWithFormat: @"http://localhost:8081/%@.bundle?platform=%@&dev=true&minify=false&modulesOnly=false&runModule=true&app=com.apple.dt.xctest.tool", testFile, - kRCTPlatformName]]; // TODO(macOS GH#774) + kRCTPlatformName]]; // [macOS] #endif } @@ -51,7 +51,7 @@ stringWithFormat: @"http://192.168.1.1:8081/%@.bundle?platform=%@&dev=true&minify=false&modulesOnly=false&runModule=true&runtimeBytecodeVersion=%u&app=com.apple.dt.xctest.tool", testFile, - kRCTPlatformName, // TODO(macOS GH#774) + kRCTPlatformName, // [macOS] HERMES_BYTECODE_VERSION]]; #else return [NSURL @@ -60,7 +60,7 @@ stringWithFormat: @"http://192.168.1.1:8081/%@.bundle?platform=%@&dev=true&minify=false&modulesOnly=false&runModule=true&app=com.apple.dt.xctest.tool", testFile, - kRCTPlatformName]]; // TODO(macOS GH#774) + kRCTPlatformName]]; // [macOS] #endif } diff --git a/packages/rn-tester/RNTesterUnitTests/RCTComponentPropsTests.m b/packages/rn-tester/RNTesterUnitTests/RCTComponentPropsTests.m index 0dc873800e3402..8bdd3be73f234d 100644 --- a/packages/rn-tester/RNTesterUnitTests/RCTComponentPropsTests.m +++ b/packages/rn-tester/RNTesterUnitTests/RCTComponentPropsTests.m @@ -27,7 +27,7 @@ - (void)updateView:(nonnull NSNumber *)reactTag viewName:(NSString *)viewName pr @end -@interface RCTPropsTestView : RCTUIView // TODO(macOS ISS#3536887) +@interface RCTPropsTestView : RCTUIView // [macOS] @property (nonatomic, assign) NSInteger integerProp; @property (nonatomic, strong) id objectProp; @@ -46,7 +46,7 @@ @implementation RCTPropsTestViewManager RCT_EXPORT_MODULE() -- (RCTUIView *)view // TODO(macOS ISS#3536887) +- (RCTUIView *)view // [macOS] { RCTPropsTestView *view = [RCTPropsTestView new]; view.integerProp = 57; @@ -107,7 +107,7 @@ - (void)testSetProps [uiManager createView:@2 viewName:@"RCTPropsTestView" rootTag:self->_rootViewReactTag props:props]; [uiManager addUIBlock:^( __unused RCTUIManager *_uiManager, - NSDictionary *viewRegistry) { // TODO(macOS ISS#3536887) + NSDictionary *viewRegistry) { // [macOS] view = (RCTPropsTestView *)viewRegistry[@2]; XCTAssertEqual(view.integerProp, 58); XCTAssertEqualObjects(view.objectProp, @10); @@ -132,7 +132,7 @@ - (void)testNeedsOffscreenAlphaCompositing [uiManager createView:@2 viewName:@"RCTPropsTestView" rootTag:self->_rootViewReactTag props:@{}]; [uiManager addUIBlock:^( __unused RCTUIManager *_uiManager, - NSDictionary *viewRegistry) { // TODO(macOS ISS#3536887) + NSDictionary *viewRegistry) { // [macOS] view = (RCTPropsTestView *)viewRegistry[@2]; XCTAssertEqual(view.layer.allowsGroupOpacity, TRUE); [initialExpectation fulfill]; @@ -140,7 +140,7 @@ - (void)testNeedsOffscreenAlphaCompositing [uiManager updateView:@2 viewName:@"RCTPropsTestView" props:@{@"needsOffscreenAlphaCompositing" : @NO}]; [uiManager addUIBlock:^( __unused RCTUIManager *_uiManager, - NSDictionary *viewRegistry) { // TODO(macOS ISS#3536887) + NSDictionary *viewRegistry) { // [macOS] view = (RCTPropsTestView *)viewRegistry[@2]; XCTAssertEqual(view.layer.allowsGroupOpacity, FALSE); [updateExpectation fulfill]; @@ -170,7 +170,7 @@ - (void)testResetProps [uiManager updateView:@2 viewName:@"RCTPropsTestView" props:resetProps]; [uiManager addUIBlock:^( __unused RCTUIManager *_uiManager, - NSDictionary *viewRegistry) { // TODO(macOS ISS#3536887) + NSDictionary *viewRegistry) { // [macOS] view = (RCTPropsTestView *)viewRegistry[@2]; XCTAssertEqual(view.integerProp, 57); XCTAssertEqualObjects(view.objectProp, @9); @@ -194,14 +194,14 @@ - (void)testResetBackgroundColor [uiManager createView:@2 viewName:@"RCTView" rootTag:self->_rootViewReactTag props:props]; [uiManager addUIBlock:^( __unused RCTUIManager *_uiManager, - NSDictionary *viewRegistry) { // TODO(macOS ISS#3536887) + NSDictionary *viewRegistry) { // [macOS] view = (RCTView *)viewRegistry[@2]; XCTAssertEqualObjects(view.backgroundColor, [RCTConvert UIColor:@0xffffffff]); }]; [uiManager updateView:@2 viewName:@"RCTView" props:resetProps]; [uiManager addUIBlock:^( __unused RCTUIManager *_uiManager, - __unused NSDictionary *viewRegistry) { // TODO(macOS ISS#3536887) + __unused NSDictionary *viewRegistry) { // [macOS] view = (RCTView *)viewRegistry[@2]; XCTAssertNil(view.backgroundColor); }]; diff --git a/packages/rn-tester/RNTesterUnitTests/RCTConvert_NSColorTests.m b/packages/rn-tester/RNTesterUnitTests/RCTConvert_NSColorTests.m index 83a805e1fb7034..1e52967ddabd18 100644 --- a/packages/rn-tester/RNTesterUnitTests/RCTConvert_NSColorTests.m +++ b/packages/rn-tester/RNTesterUnitTests/RCTConvert_NSColorTests.m @@ -6,7 +6,7 @@ * */ -// TODO(macOS ISS#3536887) +// [macOS] #import diff --git a/packages/rn-tester/RNTesterUnitTests/RCTConvert_UIColorTests.m b/packages/rn-tester/RNTesterUnitTests/RCTConvert_UIColorTests.m index 6b06f749c940fb..0356591619fb02 100644 --- a/packages/rn-tester/RNTesterUnitTests/RCTConvert_UIColorTests.m +++ b/packages/rn-tester/RNTesterUnitTests/RCTConvert_UIColorTests.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -// TODO(macOS ISS#3536887) +// [macOS] #import diff --git a/packages/rn-tester/RNTesterUnitTests/RCTEventDispatcherTests.m b/packages/rn-tester/RNTesterUnitTests/RCTEventDispatcherTests.m index b87301b08ad503..db8c10a646dffe 100644 --- a/packages/rn-tester/RNTesterUnitTests/RCTEventDispatcherTests.m +++ b/packages/rn-tester/RNTesterUnitTests/RCTEventDispatcherTests.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS ISS#3536887) +#import // [macOS] #import #import "OCMock/OCMock.h" diff --git a/packages/rn-tester/RNTesterUnitTests/RCTFontTests.m b/packages/rn-tester/RNTesterUnitTests/RCTFontTests.m index 994441d5ac99af..5752a75665893b 100644 --- a/packages/rn-tester/RNTesterUnitTests/RCTFontTests.m +++ b/packages/rn-tester/RNTesterUnitTests/RCTFontTests.m @@ -27,16 +27,16 @@ @implementation RCTFontTests - (void)testWeight { -#if !TARGET_OS_OSX +#if !TARGET_OS_OSX // [macOS] // VSO#1878630: macOS: some RCTFontTests failing - // macOS: expected = .AppleSystemUIFontBold 14.00 pt., result = .AppleSystemUIFontEmphasized 14.00 pt. + // [macOS] expected = .AppleSystemUIFontBold 14.00 pt., result = .AppleSystemUIFontEmphasized 14.00 pt. { UIFont *expected = [UIFont systemFontOfSize:14 weight:UIFontWeightBold]; UIFont *result = [RCTConvert UIFont:@{@"fontWeight" : @"bold"}]; RCTAssertEqualFonts(expected, result); } -#endif +#endif // [macOS] { UIFont *expected = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium]; UIFont *result = [RCTConvert UIFont:@{@"fontWeight" : @"500"}]; @@ -86,8 +86,8 @@ - (void)testFamily - (void)testStyle { -#if !TARGET_OS_OSX - // macOS: expected = .SFNSText-Italic 14.00 pt., result = .AppleSystemUIFontItalic 14.00 pt. +#if !TARGET_OS_OSX // [macOS] + // [macOS] expected = .SFNSText-Italic 14.00 pt., result = .AppleSystemUIFontItalic 14.00 pt. { UIFont *font = [UIFont systemFontOfSize:14]; UIFontDescriptor *fontDescriptor = [font fontDescriptor]; @@ -98,7 +98,7 @@ - (void)testStyle UIFont *result = [RCTConvert UIFont:@{@"fontStyle" : @"italic"}]; RCTAssertEqualFonts(expected, result); } -#endif +#endif // [macOS] { UIFont *expected = [UIFont systemFontOfSize:14]; UIFont *result = [RCTConvert UIFont:@{@"fontStyle" : @"normal"}]; @@ -108,8 +108,8 @@ - (void)testStyle - (void)testStyleAndWeight { -#if !TARGET_OS_OSX - // macOS: expected = .SFNSText-LightItalic 14.00 pt., result = .AppleSystemUIFontUltraLightItalic 14.00 pt. +#if !TARGET_OS_OSX // [macOS] + // [macOS] expected = .SFNSText-LightItalic 14.00 pt., result = .AppleSystemUIFontUltraLightItalic 14.00 pt. { UIFont *font = [UIFont systemFontOfSize:14 weight:UIFontWeightUltraLight]; UIFontDescriptor *fontDescriptor = [font fontDescriptor]; @@ -120,7 +120,7 @@ - (void)testStyleAndWeight UIFont *result = [RCTConvert UIFont:@{@"fontStyle" : @"italic", @"fontWeight" : @"100"}]; RCTAssertEqualFonts(expected, result); } - // macOS: expected = .SFNSText-BoldItalic 14.00 pt., result = .AppleSystemUIFontEmphasizedItalic 14.00 pt. + // [macOS] expected = .SFNSText-BoldItalic 14.00 pt., result = .AppleSystemUIFontEmphasizedItalic 14.00 pt. { UIFont *font = [UIFont systemFontOfSize:14 weight:UIFontWeightBold]; UIFontDescriptor *fontDescriptor = [font fontDescriptor]; @@ -131,7 +131,7 @@ - (void)testStyleAndWeight UIFont *result = [RCTConvert UIFont:@{@"fontStyle" : @"italic", @"fontWeight" : @"bold"}]; RCTAssertEqualFonts(expected, result); } -#endif +#endif // [macOS] } - (void)testFamilyAndWeight @@ -198,7 +198,7 @@ - (void)testFamilyStyleAndWeight - (void)testVariant { -#if !TARGET_OS_OSX +#if !TARGET_OS_OSX // [macOS] // expected = .AppleSystemUIFont 14.00 pt., result = .SFNSText 14.00 pt. { UIFont *expected = [UIFont monospacedDigitSystemFontOfSize:14 weight:UIFontWeightRegular]; @@ -218,7 +218,7 @@ - (void)testVariant UIFont *result = [RCTConvert UIFont:@{@"fontVariant" : @[ @"tabular-nums", @"small-caps" ]}]; RCTAssertEqualFonts(expected, result); } -#endif +#endif // [macOS] } - (void)testInvalidFont @@ -228,14 +228,14 @@ - (void)testInvalidFont UIFont *result = [RCTConvert UIFont:@{@"fontFamily" : @"foobar"}]; RCTAssertEqualFonts(expected, result); } -#if !TARGET_OS_OSX +#if !TARGET_OS_OSX // [macOS] // expected = .AppleSystemUIFontBold 14.00 pt., result = .AppleSystemUIFontDemi 14.00 pt. { UIFont *expected = [UIFont systemFontOfSize:14 weight:UIFontWeightBold]; UIFont *result = [RCTConvert UIFont:@{@"fontFamily" : @"foobar", @"fontWeight" : @"bold"}]; RCTAssertEqualFonts(expected, result); } -#endif +#endif // [macOS] } @end diff --git a/packages/rn-tester/RNTesterUnitTests/RCTImageUtilTests.m b/packages/rn-tester/RNTesterUnitTests/RCTImageUtilTests.m index b539b6f66523d1..2d13fa98318af9 100644 --- a/packages/rn-tester/RNTesterUnitTests/RCTImageUtilTests.m +++ b/packages/rn-tester/RNTesterUnitTests/RCTImageUtilTests.m @@ -7,7 +7,7 @@ #import #import -// TODO(OSS Candidate ISS#2710739) #import +// #import // [macOS] #import #import diff --git a/packages/rn-tester/RNTesterUnitTests/RCTJSONTests.m b/packages/rn-tester/RNTesterUnitTests/RCTJSONTests.m index 137bdbab59f0ce..730becf3257202 100644 --- a/packages/rn-tester/RNTesterUnitTests/RCTJSONTests.m +++ b/packages/rn-tester/RNTesterUnitTests/RCTJSONTests.m @@ -104,7 +104,7 @@ - (void)testNaN XCTAssertEqualObjects(json, RCTJSONStringify(obj, NULL)); } -/* TODO(OSS Candidate ISS#2710739): crashes in XCode 11 +/* [macOS crashes in Xcode 11 - (void)testNotUTF8Convertible { // see https://gist.github.com/0xced/56035d2f57254cf518b5 @@ -113,7 +113,7 @@ - (void)testNotUTF8Convertible NSString *json = @"{\"foo\":null}"; XCTAssertEqualObjects(json, RCTJSONStringify(obj, NULL)); } -TODO(OSS Candidate ISS#2710739) */ +macOS] */ - (void)testErrorPointer { diff --git a/packages/rn-tester/RNTesterUnitTests/RCTMethodArgumentTests.m b/packages/rn-tester/RNTesterUnitTests/RCTMethodArgumentTests.m index 50619810abcc16..4296d4f9f48f32 100644 --- a/packages/rn-tester/RNTesterUnitTests/RCTMethodArgumentTests.m +++ b/packages/rn-tester/RNTesterUnitTests/RCTMethodArgumentTests.m @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import diff --git a/packages/rn-tester/RNTesterUnitTests/RCTModuleMethodTests.mm b/packages/rn-tester/RNTesterUnitTests/RCTModuleMethodTests.mm index 1d626b55cb0ee1..c9e9709694ddfc 100644 --- a/packages/rn-tester/RNTesterUnitTests/RCTModuleMethodTests.mm +++ b/packages/rn-tester/RNTesterUnitTests/RCTModuleMethodTests.mm @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#import // TODO(macOS GH#774) +#import // [macOS] #import #import diff --git a/packages/rn-tester/RNTesterUnitTests/RCTNativeAnimatedNodesManagerTests.m b/packages/rn-tester/RNTesterUnitTests/RCTNativeAnimatedNodesManagerTests.m index a0ecc134fbd07c..2b73a8fbe2e795 100644 --- a/packages/rn-tester/RNTesterUnitTests/RCTNativeAnimatedNodesManagerTests.m +++ b/packages/rn-tester/RNTesterUnitTests/RCTNativeAnimatedNodesManagerTests.m @@ -10,13 +10,13 @@ #import "OCMock/OCMock.h" #import -#import // TODO(macOS GH#774) +#import // [macOS] #import #import static const NSTimeInterval FRAME_LENGTH = 1.0 / 60.0; -@interface RCTFakeDisplayLink : RCTPlatformDisplayLink // TODO(macOS GH#774) +@interface RCTFakeDisplayLink : RCTPlatformDisplayLink // [macOS] @end diff --git a/packages/rn-tester/RNTesterUnitTests/RCTUIManagerTests.m b/packages/rn-tester/RNTesterUnitTests/RCTUIManagerTests.m index 02f7cb3f686a9d..e2767a4deccde9 100644 --- a/packages/rn-tester/RNTesterUnitTests/RCTUIManagerTests.m +++ b/packages/rn-tester/RNTesterUnitTests/RCTUIManagerTests.m @@ -21,7 +21,7 @@ - (void)_manageChildren:(NSNumber *)containerReactTag registry:(NSDictionary> *)registry; @property (nonatomic, copy, readonly) - NSMutableDictionary *viewRegistry; // TODO(macOS ISS#3536887) + NSMutableDictionary *viewRegistry; // [macOS] @end @@ -41,7 +41,7 @@ - (void)setUp // Register 20 views to use in the tests for (NSInteger i = 1; i <= 20; i++) { - RCTUIView *registeredView = [RCTUIView new]; // TODO(macOS ISS#3536887) + RCTUIView *registeredView = [RCTUIView new]; // [macOS] registeredView.reactTag = @(i); _uiManager.viewRegistry[@(i)] = registeredView; } @@ -49,7 +49,7 @@ - (void)setUp - (void)testManagingChildrenToAddViews { - RCTUIView *containerView = _uiManager.viewRegistry[@20]; // TODO(macOS ISS#3536887) + RCTUIView *containerView = _uiManager.viewRegistry[@20]; // [macOS] NSMutableArray *addedViews = [NSMutableArray array]; NSArray *tagsToAdd = @[ @1, @2, @3, @4, @5 ]; @@ -74,7 +74,7 @@ - (void)testManagingChildrenToAddViews @"Expect to have 5 react subviews after calling manage children \ with 5 tags to add, instead have %lu", (unsigned long)[[containerView reactSubviews] count]); - for (RCTUIView *view in addedViews) { // TODO(macOS ISS#3536887) + for (RCTUIView *view in addedViews) { // [macOS] XCTAssertTrue( [view reactSuperview] == containerView, @"Expected to have manage children successfully add children"); [view removeFromSuperview]; @@ -83,7 +83,7 @@ - (void)testManagingChildrenToAddViews - (void)testManagingChildrenToRemoveViews { - RCTUIView *containerView = _uiManager.viewRegistry[@20]; // TODO(macOS ISS#3536887) + RCTUIView *containerView = _uiManager.viewRegistry[@20]; // [macOS] NSMutableArray *removedViews = [NSMutableArray array]; NSArray *removeAtIndices = @[ @0, @4, @8, @12, @16 ]; @@ -92,7 +92,7 @@ - (void)testManagingChildrenToRemoveViews [removedViews addObject:_uiManager.viewRegistry[reactTag]]; } for (NSInteger i = 2; i < 20; i++) { - RCTUIView *view = _uiManager.viewRegistry[@(i)]; // TODO(macOS ISS#3536887) + RCTUIView *view = _uiManager.viewRegistry[@(i)]; // [macOS] [containerView insertReactSubview:view atIndex:containerView.reactSubviews.count]; } @@ -113,13 +113,13 @@ - (void)testManagingChildrenToRemoveViews @"Expect to have 13 react subviews after calling manage children\ with 5 tags to remove and 18 prior children, instead have %zd", containerView.reactSubviews.count); - for (RCTUIView *view in removedViews) { // TODO(macOS ISS#3536887) + for (RCTUIView *view in removedViews) { // [macOS] XCTAssertTrue([view reactSuperview] == nil, @"Expected to have manage children successfully remove children"); // After removing views are unregistered - we need to reregister _uiManager.viewRegistry[view.reactTag] = view; } for (NSInteger i = 2; i < 20; i++) { - RCTUIView *view = _uiManager.viewRegistry[@(i)]; // TODO(macOS ISS#3536887) + RCTUIView *view = _uiManager.viewRegistry[@(i)]; // [macOS] if (![removedViews containsObject:view]) { XCTAssertTrue( [view superview] == containerView, @@ -140,7 +140,7 @@ - (void)testManagingChildrenToRemoveViews // [11,5,1,2,7,8,12,10] - (void)testManagingChildrenToAddRemoveAndMove { - RCTUIView *containerView = _uiManager.viewRegistry[@20]; // TODO(macOS ISS#3536887) + RCTUIView *containerView = _uiManager.viewRegistry[@20]; // [macOS] NSArray *removeAtIndices = @[ @2, @3, @5, @8 ]; NSArray *addAtIndices = @[ @0, @6 ]; @@ -152,12 +152,12 @@ - (void)testManagingChildrenToAddRemoveAndMove NSMutableArray *viewsToRemove = [NSMutableArray array]; for (NSUInteger i = 0; i < removeAtIndices.count; i++) { NSNumber *reactTagToRemove = @([removeAtIndices[i] integerValue] + 1); - RCTUIView *viewToRemove = _uiManager.viewRegistry[reactTagToRemove]; // TODO(macOS ISS#3536887) + RCTUIView *viewToRemove = _uiManager.viewRegistry[reactTagToRemove]; // [macOS] [viewsToRemove addObject:viewToRemove]; } for (NSInteger i = 1; i < 11; i++) { - RCTUIView *view = _uiManager.viewRegistry[@(i)]; // TODO(macOS ISS#3536887) + RCTUIView *view = _uiManager.viewRegistry[@(i)]; // [macOS] [containerView insertReactSubview:view atIndex:containerView.reactSubviews.count]; } @@ -190,10 +190,10 @@ - (void)testManagingChildrenToAddRemoveAndMove // Clean up after ourselves for (NSInteger i = 1; i < 13; i++) { - RCTUIView *view = _uiManager.viewRegistry[@(i)]; // TODO(macOS ISS#3536887) + RCTUIView *view = _uiManager.viewRegistry[@(i)]; // [macOS] [view removeFromSuperview]; } - for (RCTUIView *view in viewsToRemove) { // TODO(macOS ISS#3536887) + for (RCTUIView *view in viewsToRemove) { // [macOS] _uiManager.viewRegistry[view.reactTag] = view; } } diff --git a/packages/rn-tester/js/RNTesterApp.ios.js b/packages/rn-tester/js/RNTesterApp.ios.js index 1c58f3eb1dcf1a..e7b5ce5e0ee179 100644 --- a/packages/rn-tester/js/RNTesterApp.ios.js +++ b/packages/rn-tester/js/RNTesterApp.ios.js @@ -8,7 +8,7 @@ * @flow */ -import {AppRegistry, NativeModules, Platform, View} from 'react-native'; // TODO(OSS Candidate ISS#2710739): everything but AppRegistry +import {AppRegistry, NativeModules, Platform, View} from 'react-native'; // [macOS] everything but AppRegistry import React from 'react'; import SnapshotViewIOS from './examples/Snapshot/SnapshotViewIOS.ios'; @@ -17,7 +17,7 @@ import RNTesterList from './utils/RNTesterList'; import RNTesterApp from './RNTesterAppShared'; import type {RNTesterModuleInfo} from './types/RNTesterTypes'; -const {TestModule} = NativeModules; // TODO(OSS Candidate ISS#2710739) +const {TestModule} = NativeModules; // [macOS] AppRegistry.registerComponent('SetPropertiesExampleApp', () => require('./examples/SetPropertiesExample/SetPropertiesExampleApp'), @@ -51,7 +51,7 @@ RNTesterList.Components.concat(RNTesterList.APIs).forEach( ); } - // [TODO(OSS Candidate ISS#2710739) + // [macOS class LoadPageTest extends React.Component<{}> { componentDidMount() { requestAnimationFrame(() => { @@ -68,11 +68,11 @@ RNTesterList.Components.concat(RNTesterList.APIs).forEach( 'LoadPageTest_' + Example.key, () => LoadPageTest, ); - // ]TODO(OSS Candidate ISS#2710739) + // macOS] }, ); -// [TODO(OSS Candidate ISS#2710739) +// [macOS class EnumerateExamplePages extends React.Component<{}> { render() { RNTesterList.Components.concat(RNTesterList.APIs).forEach( @@ -98,6 +98,6 @@ AppRegistry.registerComponent( 'EnumerateExamplePages', () => EnumerateExamplePages, ); -// ]TODO(OSS Candidate ISS#2710739) +// macOS] module.exports = RNTesterApp; diff --git a/packages/rn-tester/js/RNTesterApp.macos.js b/packages/rn-tester/js/RNTesterApp.macos.js index dab7a863ddab15..f8f9e4d05814b5 100644 --- a/packages/rn-tester/js/RNTesterApp.macos.js +++ b/packages/rn-tester/js/RNTesterApp.macos.js @@ -8,7 +8,7 @@ * @flow */ -// TODO(macOS GH#774) +// [macOS] /* $FlowFixMe allow macOS to share iOS file */ const RNTesterApp = require('./RNTesterApp.ios'); diff --git a/packages/rn-tester/js/components/ListExampleShared.js b/packages/rn-tester/js/components/ListExampleShared.js index 1b616a7417f625..0288f699eff8fb 100644 --- a/packages/rn-tester/js/components/ListExampleShared.js +++ b/packages/rn-tester/js/components/ListExampleShared.js @@ -22,7 +22,7 @@ const { Text, TextInput, View, - PlatformColor, // TODO(macOS GH#774) + PlatformColor, // [macOS] } = require('react-native'); export type Item = { @@ -59,16 +59,16 @@ class ItemComponent extends React.PureComponent<{ onShowUnderlay?: () => void, onHideUnderlay?: () => void, textSelectable?: ?boolean, - isSelected?: ?Boolean, // TODO(macOS GH#774) + isSelected?: ?Boolean, // [macOS] ... }> { _onPress = () => { this.props.onPress(this.props.item.key); }; render(): React.Node { - // [TODO(macOS GH#774) + // [macOS const {fixedHeight, horizontal, item, textSelectable, isSelected} = - this.props; // TODO(macOS GH#774)] + this.props; // macOS] const itemHash = Math.abs(hashCode(item.title)); const imgSource = THUMB_URLS[itemHash % THUMB_URLS.length]; return ( @@ -82,11 +82,11 @@ class ItemComponent extends React.PureComponent<{ styles.row, horizontal && {width: HORIZ_WIDTH}, fixedHeight && {height: ITEM_HEIGHT}, - isSelected && styles.selectedItem, // TODO(macOS GH#774) + isSelected && styles.selectedItem, // [macOS] ]}> {!item.noImage && } {item.title} - {item.text} @@ -357,7 +357,7 @@ const styles = StyleSheet.create({ text: { flex: 1, }, - // [TODO(macOS GH#774) + // [macOS selectedItem: { backgroundColor: Platform.select({ macos: PlatformColor('selectedContentBackgroundColor'), @@ -372,7 +372,7 @@ const styles = StyleSheet.create({ default: 'white', }), }, - // [TODO(macOS GH#774)] + // macOS] }); module.exports = { diff --git a/packages/rn-tester/js/components/RNTesterBlock.js b/packages/rn-tester/js/components/RNTesterBlock.js index 4328d4faf91a51..e2563a37fa4316 100644 --- a/packages/rn-tester/js/components/RNTesterBlock.js +++ b/packages/rn-tester/js/components/RNTesterBlock.js @@ -11,7 +11,7 @@ import * as React from 'react'; import {RNTesterThemeContext} from './RNTesterTheme'; import {PlatformColor, StyleSheet, Text, View} from 'react-native'; -import {Platform} from 'react-native'; // TODO(macOS GH#774) +import {Platform} from 'react-native'; // [macOS] type Props = $ReadOnly<{| children?: React.Node, @@ -102,7 +102,7 @@ const styles = StyleSheet.create({ descriptionText: { fontSize: 12, opacity: 0.5, - // [ TODO(macOS GH#774) Fix tester block description color in DarkMode + // [macOS Fix tester block description color in DarkMode ...Platform.select({ macos: { color: PlatformColor('secondaryLabelColor'), @@ -111,7 +111,7 @@ const styles = StyleSheet.create({ color: PlatformColor('secondaryLabelColor'), }, default: undefined, - }), // TODO(macOS GH#774) ] + }), // macOS] }, children: { marginHorizontal: 20, diff --git a/packages/rn-tester/js/components/RNTesterModuleContainer.js b/packages/rn-tester/js/components/RNTesterModuleContainer.js index 37b4769b3f08b8..62c8bce5cd9d1b 100644 --- a/packages/rn-tester/js/components/RNTesterModuleContainer.js +++ b/packages/rn-tester/js/components/RNTesterModuleContainer.js @@ -127,7 +127,7 @@ function Header(props: { props.noBottomPadding === true ? styles.headerNoBottomPadding : null, { backgroundColor: - Platform.OS === 'ios' || Platform.OS === 'macos' // TODO(macOS GH#774) + Platform.OS === 'ios' || Platform.OS === 'macos' // [macOS] ? props.theme.SystemBackgroundColor : props.theme.BackgroundColor, }, diff --git a/packages/rn-tester/js/components/RNTesterModuleList.js b/packages/rn-tester/js/components/RNTesterModuleList.js index 76b86ac24842a6..1e6483219927ee 100644 --- a/packages/rn-tester/js/components/RNTesterModuleList.js +++ b/packages/rn-tester/js/components/RNTesterModuleList.js @@ -38,7 +38,7 @@ const ExampleModuleRow = ({ const onAndroid = !platform || platform === 'android'; const rightAddOn = ( toggleBookmark({ @@ -152,8 +152,8 @@ const RNTesterModuleList: React$AbstractComponent = React.memo( extraData={filteredSections} renderItem={renderListItem} keyboardShouldPersistTaps="handled" - focusable={true} // TODO(macOS GH#774) - enableSelectionOnKeyPress={true} // TODO(macOS GH#774) + focusable={true} // [macOS] + enableSelectionOnKeyPress={true} // [macOS] automaticallyAdjustContentInsets={false} keyboardDismissMode="on-drag" renderSectionHeader={renderSectionHeader} @@ -172,7 +172,7 @@ const styles = StyleSheet.create({ }, sectionHeader: { ...Platform.select({ - // [TODO(macOS GH#774) + // [macOS macos: { backgroundColor: { semantic: 'unemphasizedSelectedContentBackgroundColor', @@ -186,11 +186,11 @@ const styles = StyleSheet.create({ color: PlatformColor('secondaryLabelColor'), }, default: { - // ]TODO(macOS GH#774) + // macOS] backgroundColor: '#eeeeee', color: 'black', - }, // [TODO(macOS GH#774) - }), // ]TODO(macOS GH#774) + }, // [macOS + }), // macOS] padding: 5, fontWeight: '500', fontSize: 11, diff --git a/packages/rn-tester/js/examples/Accessibility/AccessibilityExample.js b/packages/rn-tester/js/examples/Accessibility/AccessibilityExample.js index 0eb9f703e9afd6..287dd39d346f7c 100644 --- a/packages/rn-tester/js/examples/Accessibility/AccessibilityExample.js +++ b/packages/rn-tester/js/examples/Accessibility/AccessibilityExample.js @@ -736,7 +736,7 @@ class AccessibilityActionsExample extends React.Component<{}> { /> - {/* TODO(macOS GH#774) - This doesn't work, see https://github.com/facebook/react-native/issues/32616 + {/* [macOS This doesn't work, see https://github.com/facebook/react-native/issues/32616 { Text - */} + macOS] */} ); } @@ -1123,7 +1123,7 @@ class EnabledExample extends React.Component< class DisplayOptionsStatusExample extends React.Component<{}> { render(): React.Node { const isAndroid = Platform.OS === 'android'; - const isMacOS = Platform.OS === 'macos'; // TODO(macOS GH#774) + const isMacOS = Platform.OS === 'macos'; // [macOS] return ( { notification={'grayscaleChanged'} /> { - isMacOS ? ( // [TODO(maCOS GH#774) + isMacOS ? ( // [macOS - ) : null /* ]TODO(maCOS GH#774) */ + ) : null /* macOS] */ } { } } -// [TODO(macOS GH#774) +// [macOS const PromptPresentation = () => { return ( @@ -214,7 +214,7 @@ const PromptStyle = () => { ); }; -// ]TODO(macOS GH#774) +// [macOS] const styles = StyleSheet.create({ wrapper: { @@ -235,7 +235,7 @@ const styles = StyleSheet.create({ exports.framework = 'React'; exports.title = 'Alerts'; -exports.description = 'iOS / macOS alerts and action sheets'; // TODO(macOS GH#774) +exports.description = 'iOS / macOS alerts and action sheets'; // [macOS] exports.documentationURL = 'https://reactnative.dev/docs/alert'; exports.examples = ([ ...SharedAlertExamples, @@ -279,7 +279,7 @@ exports.examples = ([ ); }, }, - // [TODO(macOS GH#774) + // [macOS { title: 'Prompt Presentation', platform: 'macos', @@ -294,5 +294,5 @@ exports.examples = ([ return ; }, }, - // ]TODO(macOS GH#774) + // [macOS] ]: Array); diff --git a/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExSet.js b/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExSet.js index 6f91e2632c145a..9e746ab2ff4870 100644 --- a/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExSet.js +++ b/packages/rn-tester/js/examples/AnimatedGratuitousApp/AnExSet.js @@ -139,11 +139,11 @@ const styles = StyleSheet.create({ headerText: { fontSize: 25, color: 'white', - // [TODO(macOS GH#1409) + // [macOS Github#1409 textShadowRadius: 3, textShadowColor: 'rgba(0, 0, 0, 1.0)', textShadowOffset: {height: 1, width: 0}, - // ]TODO(macOS GH#1409) + // macOS] }, }); diff --git a/packages/rn-tester/js/examples/Border/BorderExample.js b/packages/rn-tester/js/examples/Border/BorderExample.js index 23c92fe9b030bb..1f518ab3f0a832 100644 --- a/packages/rn-tester/js/examples/Border/BorderExample.js +++ b/packages/rn-tester/js/examples/Border/BorderExample.js @@ -185,7 +185,7 @@ const styles = StyleSheet.create({ borderWidth: 10, borderColor: Platform.select({ ios: PlatformColor('systemGray4'), - macos: PlatformColor('systemGray'), // TODO(macOS GH#774) + macos: PlatformColor('systemGray'), // [macOS] android: PlatformColor('@android:color/holo_orange_dark'), windows: PlatformColor('SystemAccentColorDark1'), default: 'black', diff --git a/packages/rn-tester/js/examples/DarkModeExample/DarkModeExample.js b/packages/rn-tester/js/examples/DarkModeExample/DarkModeExample.js index 1d3961a045e84f..a5468094a4004f 100644 --- a/packages/rn-tester/js/examples/DarkModeExample/DarkModeExample.js +++ b/packages/rn-tester/js/examples/DarkModeExample/DarkModeExample.js @@ -8,7 +8,7 @@ * @flow */ -'use strict'; // TODO(OSS Candidate ISS#2710739) +'use strict'; // [macOS] const React = require('react'); const ReactNative = require('react-native'); diff --git a/packages/rn-tester/js/examples/FlatList/FlatList-basic.js b/packages/rn-tester/js/examples/FlatList/FlatList-basic.js index e3e2e529cbf2b8..64431eed54663e 100644 --- a/packages/rn-tester/js/examples/FlatList/FlatList-basic.js +++ b/packages/rn-tester/js/examples/FlatList/FlatList-basic.js @@ -63,11 +63,11 @@ type State = {| fadingEdgeLength: number, onPressDisabled: boolean, textSelectable: boolean, - // [TODO(macOS GH#774) + // [macOS enableSelectionOnKeyPress: boolean, focusable: boolean, enableFocusRing: boolean, - // ]TODO(macOS GH#774) + // macOS] |}; class FlatListExample extends React.PureComponent { @@ -85,11 +85,11 @@ class FlatListExample extends React.PureComponent { fadingEdgeLength: 0, onPressDisabled: false, textSelectable: true, - // [TODO(macOS GH#774) + // [macOS enableSelectionOnKeyPress: false, focusable: true, enableFocusRing: true, - // ]TODO(macOS GH#774) + // macOS] }; _onChangeFilterText = filterText => { @@ -192,7 +192,7 @@ class FlatListExample extends React.PureComponent { this.state.useFlatListItemComponent, this._setBooleanValue('useFlatListItemComponent'), )} - {/* [TODO(macOS GH#774) */} + {/* [macOS */} {Platform.OS === 'macos' && renderSmallSwitchOption( 'Keyboard Navigation', @@ -211,7 +211,7 @@ class FlatListExample extends React.PureComponent { this.state.enableFocusRing, this._setBooleanValue('enableFocusRing'), )} - {/* TODO(macOS GH#774)] */} + {/* macOS] */} {Platform.OS === 'android' && ( { } @@ -313,7 +313,7 @@ class FlatListExample extends React.PureComponent { * This comment suppresses an error found when Flow v0.111 was deployed. * To see the error, delete this comment and run Flow. */ [flatListPropKey]: props => { - const {item, separators, isSelected} = props; // TODO(macOS GH#774) + const {item, separators, isSelected} = props; // [macOS] return ( { onShowUnderlay={separators.highlight} onHideUnderlay={separators.unhighlight} textSelectable={this.state.textSelectable} - isSelected={isSelected} // TODO(macOS GH#774) + isSelected={isSelected} // [macOS] /> ); }, @@ -354,10 +354,10 @@ class FlatListExample extends React.PureComponent { _pressItem = (key: string) => { this._listRef && this._listRef.recordInteraction(); const index = Number(key); - // [TODO(macOS GH#774) + // [macOS if (this.state.enableSelectionOnKeyPress) { this._listRef && this._listRef.selectRowAtIndex(index); - } // ]TODO(macOS GH#774) + } // macOS] const itemState = pressItem(this.state.data[index]); this.setState(state => ({ ...state, diff --git a/packages/rn-tester/js/examples/FocusEventsExample/FocusEventsExample.js b/packages/rn-tester/js/examples/FocusEventsExample/FocusEventsExample.js index 62fee2f2771dbe..1522401efb2fe2 100644 --- a/packages/rn-tester/js/examples/FocusEventsExample/FocusEventsExample.js +++ b/packages/rn-tester/js/examples/FocusEventsExample/FocusEventsExample.js @@ -8,7 +8,7 @@ * @flow */ -'use strict'; // TODO(OSS Candidate ISS#2710739) +'use strict'; // [macOS] const React = require('react'); const ReactNative = require('react-native'); diff --git a/packages/rn-tester/js/examples/FocusOnMount/FocusOnMount.js b/packages/rn-tester/js/examples/FocusOnMount/FocusOnMount.js index a20e01e05660b3..dae4a224e2d810 100644 --- a/packages/rn-tester/js/examples/FocusOnMount/FocusOnMount.js +++ b/packages/rn-tester/js/examples/FocusOnMount/FocusOnMount.js @@ -7,7 +7,7 @@ * @format * @flow */ -// [TODO(macOS GH #1412) +// [macOS] Github#1412) 'use strict'; const React = require('react'); @@ -51,4 +51,3 @@ exports.examples = [ }, }, ]; -// TODO(macOS GH #1412)] diff --git a/packages/rn-tester/js/examples/FocusRing/FocusRingExample.js b/packages/rn-tester/js/examples/FocusRing/FocusRingExample.js index 7b4dc8232ad086..f6db2d77ab5267 100644 --- a/packages/rn-tester/js/examples/FocusRing/FocusRingExample.js +++ b/packages/rn-tester/js/examples/FocusRing/FocusRingExample.js @@ -8,7 +8,7 @@ * @flow */ -'use strict'; // TODO(OSS Candidate ISS#2710739) +'use strict'; // [macOS] const React = require('react'); const ReactNative = require('react-native'); diff --git a/packages/rn-tester/js/examples/Image/ImageExample.js b/packages/rn-tester/js/examples/Image/ImageExample.js index e2290cfdf17bdf..e741f10a6e4eb9 100644 --- a/packages/rn-tester/js/examples/Image/ImageExample.js +++ b/packages/rn-tester/js/examples/Image/ImageExample.js @@ -14,7 +14,7 @@ const React = require('react'); const { Image, - Platform, // TODO(OSS Candidate ISS#2710739) + Platform, // [macOS] StyleSheet, Text, View, @@ -1055,7 +1055,7 @@ exports.examples = [ /> ); }, - platform: ['ios', 'macos'], // TODO(OSS Candidate ISS#2710739) + platform: ['ios', 'macos'], // [macOS] }, { title: 'Base64 image', @@ -1130,7 +1130,7 @@ exports.examples = [ ); }, - platform: ['ios', 'macos'], // TODO(OSS Candidate ISS#2710739) + platform: ['ios', 'macos'], // [macOS] }, { title: 'Blur Radius', diff --git a/packages/rn-tester/js/examples/KeyViewLoopExample/KeyViewLoopExample.js b/packages/rn-tester/js/examples/KeyViewLoopExample/KeyViewLoopExample.js index 37e5e7839124a0..c636bbed9f3db6 100644 --- a/packages/rn-tester/js/examples/KeyViewLoopExample/KeyViewLoopExample.js +++ b/packages/rn-tester/js/examples/KeyViewLoopExample/KeyViewLoopExample.js @@ -8,7 +8,7 @@ * @flow */ -'use strict'; // TODO(OSS Candidate ISS#2710739) +'use strict'; // [macOS] const React = require('react'); const ReactNative = require('react-native'); diff --git a/packages/rn-tester/js/examples/KeyboardEventsExample/KeyboardEventsExample.js b/packages/rn-tester/js/examples/KeyboardEventsExample/KeyboardEventsExample.js index 76018606ccbc31..16171d2fff7a2c 100644 --- a/packages/rn-tester/js/examples/KeyboardEventsExample/KeyboardEventsExample.js +++ b/packages/rn-tester/js/examples/KeyboardEventsExample/KeyboardEventsExample.js @@ -8,7 +8,7 @@ * @flow */ -'use strict'; // TODO(OSS Candidate ISS#2710739) +'use strict'; // [macOS] const React = require('react'); const ReactNative = require('react-native'); diff --git a/packages/rn-tester/js/examples/Layout/LayoutEventsExample.js b/packages/rn-tester/js/examples/Layout/LayoutEventsExample.js index 6e6e293f969a7c..e05cebf71d4a46 100644 --- a/packages/rn-tester/js/examples/Layout/LayoutEventsExample.js +++ b/packages/rn-tester/js/examples/Layout/LayoutEventsExample.js @@ -15,7 +15,7 @@ const React = require('react'); const { Image, LayoutAnimation, - Platform, // TODO(macOS GH#774) + Platform, // [macOS] StyleSheet, Text, View, @@ -45,7 +45,7 @@ class LayoutEventExample extends React.Component { }; animateViewLayout = () => { - // TODO(macOS GH#774): LayoutAnimation.Presets.spring isn't available on macOS + // [macOS] LayoutAnimation.Presets.spring isn't available on macOS const animationConfig = Platform.OS === 'macos' ? LayoutAnimation.Presets.easeInEaseOut diff --git a/packages/rn-tester/js/examples/PlatformColor/PlatformColorExample.js b/packages/rn-tester/js/examples/PlatformColor/PlatformColorExample.js index 3eda20b1cce7c5..abc0c3f27e6bfb 100644 --- a/packages/rn-tester/js/examples/PlatformColor/PlatformColorExample.js +++ b/packages/rn-tester/js/examples/PlatformColor/PlatformColorExample.js @@ -12,7 +12,7 @@ const React = require('react'); const ReactNative = require('react-native'); import Platform from 'react-native/Libraries/Utilities/Platform'; const { - ColorWithSystemEffectMacOS, // TODO(macOS GH#750) + ColorWithSystemEffectMacOS, // [macOS] DynamicColorIOS, DynamicColorMacOS, PlatformColor, @@ -199,7 +199,7 @@ function FallbackColorsExample() { let color = {}; if ( Platform.OS === 'ios' || - Platform.OS === 'macos' // TODO(macOS GH#774) + Platform.OS === 'macos' // [macOS] ) { color = { label: "PlatformColor('bogus', 'systemGreenColor')", @@ -233,7 +233,7 @@ function FallbackColorsExample() { } function DynamicColorsExample() { - // [TODO(macOS GH#774) + // [macOS return Platform.OS === 'macos' ? ( @@ -288,7 +288,7 @@ function DynamicColorsExample() { /> - ) : // ]TODO(macOS GH#774) + ) : // macOS] Platform.OS === 'ios' ? ( @@ -347,14 +347,14 @@ function VariantColorsExample() { { - // [TODO(OSS Candidate ISS#2710739) + // [macOS Platform.select({ ios: "DynamicColorIOS({light: 'red', dark: 'blue'})", android: "PlatformColor('?attr/colorAccent')", macos: "DynamicColorMacOS({light: 'red', dark: 'blue'})", default: 'Unexpected Platform.OS: ' + Platform.OS, }) - // ]TODO(OSS Candidate ISS#2710739) + // macOS] } Not applicable on this platform ); -} // ]TODO(macOS GH#750) +} // macOS] const styles = StyleSheet.create({ column: {flex: 1, flexDirection: 'column'}, @@ -521,7 +521,7 @@ const styles = StyleSheet.create({ labelCell: { flex: 1, alignItems: 'stretch', - // TODO(macOS GH#774) + // [macOS] // Remove need to specify label color }, colorCell: {flex: 0.25, alignItems: 'stretch'}, @@ -546,7 +546,7 @@ exports.examples = [ }, }, { - title: 'Dynamic Colors', // TODO(OSS Candidate ISS#2710739) + title: 'Dynamic Colors', // [macOS] render(): React.Element { return ; }, @@ -557,11 +557,11 @@ exports.examples = [ return ; }, }, - // [TODO(macOS GH#750) + // [macOS { title: 'Color With System Effect macOS', render(): React.Element { return ; }, - }, // ]TODO(macOS GH#750) + }, // macOS] ]; diff --git a/packages/rn-tester/js/examples/Pressable/PressableExample.js b/packages/rn-tester/js/examples/Pressable/PressableExample.js index 2da9f3899d5f1d..96c91ac51ffcac 100644 --- a/packages/rn-tester/js/examples/Pressable/PressableExample.js +++ b/packages/rn-tester/js/examples/Pressable/PressableExample.js @@ -98,12 +98,12 @@ function PressableFeedbackEvents() { testID="pressable_feedback_events_button" accessibilityLabel="pressable feedback events" accessibilityRole="button" - // [TODO(macOS GH#774) + // [macOS onHoverIn={() => appendEvent('hoverIn')} onHoverOut={() => appendEvent('hoverOut')} onFocus={() => appendEvent('focus')} onBlur={() => appendEvent('blur')} - // ]TODO(macOS GH#774) + // macOS] onPress={() => appendEvent('press')} onPressIn={() => appendEvent('pressIn')} onPressOut={() => appendEvent('pressOut')} diff --git a/packages/rn-tester/js/examples/ScrollView/ScrollViewExample.js b/packages/rn-tester/js/examples/ScrollView/ScrollViewExample.js index 3b5a2ce9eda5ab..6077bd8540fb88 100644 --- a/packages/rn-tester/js/examples/ScrollView/ScrollViewExample.js +++ b/packages/rn-tester/js/examples/ScrollView/ScrollViewExample.js @@ -491,7 +491,7 @@ if (Platform.OS === 'ios') { } exports.examples = examples; -// TODO [(macOS GH#774) +// [macOS if (Platform.OS === 'macos') { examples.push({ title: ' (inverted = true/false)\n', @@ -531,7 +531,7 @@ const InvertedContentExample = () => { ); }; -// ]TODO(macOS GH#774) +// macOS] const AndroidScrollBarOptions = () => { const [persistentScrollBar, setPersistentScrollBar] = useState(false); diff --git a/packages/rn-tester/js/examples/ScrollView/ScrollViewIndicatorInsetsExample.macos.js b/packages/rn-tester/js/examples/ScrollView/ScrollViewIndicatorInsetsExample.macos.js index 0ef49b259bccaf..1c32f71674f7e7 100644 --- a/packages/rn-tester/js/examples/ScrollView/ScrollViewIndicatorInsetsExample.macos.js +++ b/packages/rn-tester/js/examples/ScrollView/ScrollViewIndicatorInsetsExample.macos.js @@ -1,10 +1,12 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ +// [macOS] + 'use strict'; import * as React from 'react'; diff --git a/packages/rn-tester/js/examples/Snapshot/SnapshotExample.js b/packages/rn-tester/js/examples/Snapshot/SnapshotExample.js index 356df32d151f6e..5c1682b09f07ff 100644 --- a/packages/rn-tester/js/examples/Snapshot/SnapshotExample.js +++ b/packages/rn-tester/js/examples/Snapshot/SnapshotExample.js @@ -30,7 +30,7 @@ class ScreenshotExample extends React.Component<{...}, $FlowFixMeState> { ); } - // TODO(macOS GH#774): alert needs two string arguments, passing an error results in crashing + // [macOS] alert needs two string arguments, passing an error results in crashing takeScreenshot = () => { if (ScreenshotManager !== undefined && ScreenshotManager !== null) { ScreenshotManager.takeScreenshot('window', {format: 'jpeg', quality: 0.8}) // See UIManager.js for options diff --git a/packages/rn-tester/js/examples/Text/TextExample.ios.js b/packages/rn-tester/js/examples/Text/TextExample.ios.js index 9b625537c1ec3b..46c339cdb55e2f 100644 --- a/packages/rn-tester/js/examples/Text/TextExample.ios.js +++ b/packages/rn-tester/js/examples/Text/TextExample.ios.js @@ -520,7 +520,7 @@ exports.category = 'Basic'; exports.description = 'Base component for rendering styled text.'; exports.displayName = 'TextExample'; exports.examples = [ - // [TODO(OSS Candidate ISS#2710739) + // [macOS { title: 'Apple Font Smoothing', render: function (): React.Node { @@ -556,7 +556,7 @@ exports.examples = [ ); }, }, - // ]TODO(OSS Candidate ISS#2710739) + // macOS] { title: 'Wrap', render: function (): React.Node { @@ -714,7 +714,7 @@ exports.examples = [ ); }, }, - // [TODO(macOS GH#774) + // [macOS { title: 'Focusable', render: function (): React.Node { @@ -753,7 +753,7 @@ exports.examples = [ ); }, }, - // [TODO(macOS GH#774) + // [macOS { title: 'Text Decoration', render: function (): React.Node { @@ -1304,7 +1304,7 @@ exports.examples = [ ); }, }, - // [TODO(macOS GH#774) + // [macOS { title: 'Cursor', render: function (): React.Node { @@ -1332,5 +1332,5 @@ exports.examples = [ ); }, }, - // ]TODO(macOS GH#774) + // [macOS] ]; diff --git a/packages/rn-tester/js/examples/TextInput/TextInputExample.ios.js b/packages/rn-tester/js/examples/TextInput/TextInputExample.ios.js index d9a9a4d4ed589f..96fc4505f95672 100644 --- a/packages/rn-tester/js/examples/TextInput/TextInputExample.ios.js +++ b/packages/rn-tester/js/examples/TextInput/TextInputExample.ios.js @@ -18,8 +18,8 @@ const { Text, TextInput, View, - Image, // TODO(macOS GH#774) - Platform, // TODO(macOS GH#774) + Image, // [macOS] + Platform, // [macOS] StyleSheet, Slider, Switch, @@ -29,7 +29,7 @@ import type { KeyboardType, SettingChangeEvent, PasteEvent, -} from 'react-native/Libraries/Components/TextInput/TextInput'; // [TODO(macOS GH#774) +} from 'react-native/Libraries/Components/TextInput/TextInput'; // [macOS const TextInputSharedExamples = require('./TextInputSharedExamples.js'); @@ -332,7 +332,7 @@ const styles = StyleSheet.create({ }, }); -// [TODO(macOS GH#774) +// [macOS function AutoCorrectSpellCheckGrammarCheckCallbacks(): React.Node { const [enableAutoCorrect, setEnableAutoCorrect] = React.useState(false); const [enableSpellSpeck, setEnableSpellSpeck] = React.useState(false); @@ -454,7 +454,7 @@ function OnPaste(): React.Node { ); } -// ]TODO(macOS GH#774) +// [macOS] exports.displayName = (undefined: ?string); exports.title = 'TextInput'; @@ -742,14 +742,14 @@ exports.examples = ([ multiline={true} style={styles.multiline} /> - {/* [TODO(macOS GH#774) */} + {/* [macOS */} - {/* [TODO(macOS GH#774) */} + {/* macOS] */} ); -// [TODO(macOS GH#774) +// [macOS if (Platform.OS === 'macos') { exports.examples.push( { @@ -1026,4 +1026,4 @@ if (Platform.OS === 'macos') { }, ); } -// ]TODO(macOS GH#774) +// [macOS] diff --git a/packages/rn-tester/js/examples/TextInput/TextInputSharedExamples.js b/packages/rn-tester/js/examples/TextInput/TextInputSharedExamples.js index 901282af2800de..4300eab469ce7a 100644 --- a/packages/rn-tester/js/examples/TextInput/TextInputSharedExamples.js +++ b/packages/rn-tester/js/examples/TextInput/TextInputSharedExamples.js @@ -604,13 +604,11 @@ module.exports = ([ title: 'fontFamily, fontWeight and fontStyle', render: function (): React.Node { const fontFamilyA = - Platform.OS === 'ios' || - Platform.OS === 'macos' /* TODO(macOS GH#774) */ + Platform.OS === 'ios' || Platform.OS === 'macos' /* [macOS] */ ? 'Cochin' : 'sans-serif'; const fontFamilyB = - Platform.OS === 'ios' || - Platform.OS === 'macos' /* TODO(macOS GH#774) */ + Platform.OS === 'ios' || Platform.OS === 'macos' /* [macOS] */ ? 'Courier' : 'serif'; diff --git a/packages/rn-tester/js/examples/Touchable/TouchableExample.js b/packages/rn-tester/js/examples/Touchable/TouchableExample.js index cea6d450a15797..3cc1b0c816faa9 100644 --- a/packages/rn-tester/js/examples/Touchable/TouchableExample.js +++ b/packages/rn-tester/js/examples/Touchable/TouchableExample.js @@ -473,7 +473,7 @@ function CustomRippleRadius() { ); } -// [TODO(macOS GH#774) +// [macOS class TouchableHover extends React.Component<{}, $FlowFixMeState> { state = { hoverOver: false, @@ -580,7 +580,7 @@ class TouchableMouseEvents extends React.Component<{}, $FlowFixMeState> { this.setState({eventLog}); }; } -// ]TODO(macOS GH#774) +// macOS] const remoteImage = { uri: 'https://www.facebook.com/favicon.ico', @@ -894,7 +894,7 @@ exports.examples = [ }, }, { - // [TODO(macOS GH#774) + // [macOS title: 'Touchable Hover', description: (' components reacts to mouse events ' + 'onMouseEnter and onMouseLeave': string), @@ -910,5 +910,5 @@ exports.examples = [ return ; }, platform: 'macos', - }, // ]TODO(macOS GH#774) + }, // macOS] ]; diff --git a/packages/rn-tester/js/examples/TurboModule/SampleTurboModuleExample.js b/packages/rn-tester/js/examples/TurboModule/SampleTurboModuleExample.js index b83e0e76b3dcb3..a79f76df0a9bbf 100644 --- a/packages/rn-tester/js/examples/TurboModule/SampleTurboModuleExample.js +++ b/packages/rn-tester/js/examples/TurboModule/SampleTurboModuleExample.js @@ -169,7 +169,7 @@ const styles = StyleSheet.create({ }, value: { fontFamily: - Platform.OS === 'ios' || Platform.OS === 'macos' ? 'Menlo' : 'monospace', // TODO(macOS GH#774) + Platform.OS === 'ios' || Platform.OS === 'macos' ? 'Menlo' : 'monospace', // [macOS] fontSize: 12, }, type: { diff --git a/packages/rn-tester/js/types/RNTesterTypes.js b/packages/rn-tester/js/types/RNTesterTypes.js index ce66a59eb90213..acf584523362ac 100644 --- a/packages/rn-tester/js/types/RNTesterTypes.js +++ b/packages/rn-tester/js/types/RNTesterTypes.js @@ -10,14 +10,14 @@ import * as React from 'react'; -// TODO(macOS GH#774) - useful since RNTesterModuleExample.platform can either be +// [macOS] useful since RNTesterModuleExample.platform can either be // one of these strings or an array of said strings type RNTesterPlatform = 'ios' | 'android' | 'macos'; export type RNTesterModuleExample = $ReadOnly<{| name?: string, title: string, - platform?: RNTesterPlatform | Array, // TODO(OSS Candidate ISS#2710739) + platform?: RNTesterPlatform | Array, // [macOS] description?: string, expect?: string, render: () => React.Node, @@ -44,7 +44,7 @@ export type RNTesterModuleInfo = $ReadOnly<{| ios?: string, macos?: string, default?: string, - }, // TODO(OSS Candidate ISS#2710739) + }, // [macOS] category?: string, supportsTVOS?: boolean, documentationURL?: string, diff --git a/packages/rn-tester/js/utils/RNTesterList.ios.js b/packages/rn-tester/js/utils/RNTesterList.ios.js index 7b862441843b8c..072c7c6af2f7df 100644 --- a/packages/rn-tester/js/utils/RNTesterList.ios.js +++ b/packages/rn-tester/js/utils/RNTesterList.ios.js @@ -25,51 +25,52 @@ const Components: Array = [ category: 'UI', supportsTVOS: true, }, - // [TODO(OSS Candidate ISS#2710739) + // [macOS { key: 'DarkModeExample', module: require('../examples/DarkModeExample/DarkModeExample'), - }, // ]TODO(OSS Candidate ISS#2710739) - // [TODO(macOS GH#774) + }, // macOS] + // [macOS { key: 'DatePickerMacOSExample', module: require('../examples/DatePicker/DatePickerMacOSExample'), - }, // ]TODO(macOS GH#774) + }, // macOS] { key: 'FlatListExampleIndex', module: require('../examples/FlatList/FlatListExampleIndex').default, category: 'ListView', supportsTVOS: true, }, - // [TODO(OSS Candidate ISS#2710739) + // [macOS { key: 'FocusEvents', module: require('../examples/FocusEventsExample/FocusEventsExample'), - }, // ]TODO(OSS Candidate ISS#2710739) - // [TODO(macOS GH #1412) + }, + // [macOS Github#1412 { key: 'FocusOnMount', module: require('../examples/FocusOnMount/FocusOnMount'), - }, // ]TODO(macOS GH #1412) + }, + // macOS] { key: 'KeyboardEvents', module: require('../examples/KeyboardEventsExample/KeyboardEventsExample'), - }, // ]TODO(OSS Candidate ISS#2710739) + }, { key: 'Key-View Accessibility Looping', module: require('../examples/KeyViewLoopExample/KeyViewLoopExample'), - }, // ]TODO(OSS Candidate GH#768) + }, { key: 'AccessibilityShowMenu', module: require('../examples/AccessibilityShowMenu/AccessibilityShowMenu'), - }, // ]TODO(OSS Candidate ISS#2710739) + }, // macOS] { key: 'ImageExample', module: require('../examples/Image/ImageExample'), skipTest: { - // [TODO(OSS Candidate ISS#2710739) + // [macOS ios: 'Reason: -[NSURLResponse allHeaderFields]: unrecognized selector exception. Occurs upstream also.', - }, // ]TODO(OSS Candidate ISS#2710739) + }, // macOS] category: 'Basic', supportsTVOS: true, }, @@ -136,8 +137,7 @@ const Components: Array = [ }, { key: 'ScrollViewIndicatorInsetsExample', - /* $FlowFixMe TODO(macOS GH#774): allow macOS to share iOS test */ - module: require('../examples/ScrollView/ScrollViewIndicatorInsetsExample.ios'), + module: require('../examples/ScrollView/ScrollViewIndicatorInsetsExample'), }, { key: 'SectionListIndex', @@ -164,14 +164,12 @@ const Components: Array = [ }, { key: 'TextExample', - /* $FlowFixMe TODO(macOS GH#774): allow macOS to share iOS test */ module: require('../examples/Text/TextExample.ios'), category: 'Basic', supportsTVOS: true, }, { key: 'TextInputExample', - /* $FlowFixMe TODO(macOS GH#774): allow macOS to share iOS test */ module: require('../examples/TextInput/TextInputExample.ios'), category: 'Basic', supportsTVOS: true, @@ -196,14 +194,14 @@ const Components: Array = [ category: 'Basic', supportsTVOS: true, }, - /* [TODO(macOS GH#774) - NewArchitectureExample depends on Fabric, which we don't have on macOS yet + /* [macOS NewArchitectureExample depends on Fabric, which we don't have on macOS yet { key: 'NewArchitectureExample', category: 'UI', module: require('../examples/NewArchitecture/NewArchitectureExample'), supportsTVOS: false, }, - ]TODO(macOS GH#774) */ + macOS] */ ]; const APIs: Array = [ @@ -327,11 +325,11 @@ const APIs: Array = [ { key: 'RCTRootViewIOSExample', module: require('../examples/RCTRootView/RCTRootViewIOSExample'), - // [TODO(OSS Candidate ISS#2710739) + // [macOS skipTest: { default: 'Reason: requires native components and is convered by RCTRootViewIntegrationTests', - }, // ]TODO(OSS Candidate ISS#2710739) + }, // macOS] supportsTVOS: true, }, { @@ -357,19 +355,19 @@ const APIs: Array = [ { key: 'TransformExample', module: require('../examples/Transform/TransformExample'), - // [TODO(OSS Candidate ISS#2710739) + // [macOS skipTest: { default: 'Reason: Stack overflow in jsi, upstream issue.', - }, // ]TODO(OSS Candidate ISS#2710739) + }, // macOS] supportsTVOS: true, }, { key: 'TurboModuleExample', module: require('../examples/TurboModule/TurboModuleExample'), - // [TODO(OSS Candidate ISS#2710739) + // [macOS skipTest: { default: 'Reason: requires TurboModule to be configured in host app.', - }, // ]TODO(OSS Candidate ISS#2710739) + }, // macOS] supportsTVOS: false, }, { diff --git a/packages/rn-tester/js/utils/RNTesterList.macos.js b/packages/rn-tester/js/utils/RNTesterList.macos.js index 417597de265b5e..ea52ac2579a706 100644 --- a/packages/rn-tester/js/utils/RNTesterList.macos.js +++ b/packages/rn-tester/js/utils/RNTesterList.macos.js @@ -8,7 +8,7 @@ * @flow */ -// TODO(macOS GH#774) +// [macOS] /* $FlowFixMe allow macOS to share iOS file */ const RNTesterList = require('./RNTesterList.ios.js'); diff --git a/scripts/generate-artifacts.js b/scripts/generate-artifacts.js index ce041d1eaee4bd..45d5cbde1f0be4 100644 --- a/scripts/generate-artifacts.js +++ b/scripts/generate-artifacts.js @@ -185,7 +185,7 @@ function main(appRootDir, outputPath) { console.log( '\n\n[Codegen] >>>>> Building react-native-codegen package', ); - // [TODO(macOS GH#774) - use execFileSync to help keep shell commands clean + // [macOS - use execFileSync to help keep shell commands clean execFileSync('yarn', ['install'], { cwd: codegenCliPath, stdio: 'inherit', @@ -194,7 +194,7 @@ function main(appRootDir, outputPath) { cwd: codegenCliPath, stdio: 'inherit', }); - // ]TODO(macOS GH#774) + // [macOS] } } else if (fs.existsSync(CODEGEN_NPM_PATH)) { codegenCliPath = CODEGEN_NPM_PATH; @@ -236,7 +236,7 @@ function main(appRootDir, outputPath) { console.log(`\n\n[Codegen] >>>>> Processing ${library.config.name}`); // Generate one schema for the entire library... - // [TODO(macOS GH#774) - use execFileSync to help keep shell commands clean + // [macOS use execFileSync to help keep shell commands clean execFileSync('node', [ path.join( codegenCliPath, @@ -247,16 +247,16 @@ function main(appRootDir, outputPath) { ), pathToSchema, pathToJavaScriptSources, - ]); // ]TODO(macOS GH#774) + ]); // macOS] console.log(`[Codegen] Generated schema: ${pathToSchema}`); // ...then generate native code artifacts. - // [TODO(macOS GH#774) - use execFileSync to help keep shell commands clean + // [macOS use execFileSync to help keep shell commands clean const libraryTypeArg = library.config.type ? ['--libraryType', library.config.type] - : null; // ]TODO(macOS GH#774) + : null; // macOS] fs.mkdirSync(pathToTempOutputDir, {recursive: true}); - // [TODO(macOS GH#774) - use execFileSync to help keep shell commands clean + // [macOS use execFileSync to help keep shell commands clean execFileSync('node', [ path.join(RN_ROOT, 'scripts', 'generate-specs-cli.js'), '--platform', @@ -268,16 +268,16 @@ function main(appRootDir, outputPath) { '--libraryName', library.config.name, ...libraryTypeArg, - ]); // ]TODO(macOS GH#774) + ]); // macOS] // Finally, copy artifacts to the final output directory. fs.mkdirSync(pathToOutputDirIOS, {recursive: true}); - // [TODO(macOS GH#774) - use execFileSync to help keep shell commands clean + // [macOS use execFileSync to help keep shell commands clean execFileSync('cp', [ '-R', path.join(pathToTempOutputDir, '/'), pathToOutputDirIOS, - ]); // ]TODO(macOS GH#774) + ]); // macOS] console.log(`[Codegen] Generated artifacts: ${pathToOutputDirIOS}`); // Filter the react native core library out. @@ -299,7 +299,7 @@ function main(appRootDir, outputPath) { // Generate FabricComponentProvider. // Only for iOS at this moment. - // [TODO(macOS GH#774) - use execFileSync to help keep shell commands clean + // [macOS use execFileSync to help keep shell commands clean execFileSync('node', [ path.join(RN_ROOT, 'scripts', 'generate-provider-cli.js'), '--platform', @@ -308,7 +308,7 @@ function main(appRootDir, outputPath) { schemaListTmpPath, '--outputDir', iosOutputDir, - ]); // ]TODO(macOS GH#774) + ]); // macOS] console.log(`Generated provider in: ${iosOutputDir}`); } } catch (err) { diff --git a/scripts/react_native_pods.rb b/scripts/react_native_pods.rb index abd0ab00892b96..f2faca90ea3bb2 100644 --- a/scripts/react_native_pods.rb +++ b/scripts/react_native_pods.rb @@ -106,7 +106,7 @@ def use_react_native! (options={}) pod 'React-RCTFabric', :path => "#{prefix}/React" pod 'RCT-Folly/Fabric', :podspec => "#{prefix}/third-party-podspecs/RCT-Folly.podspec" else - # TODO(macOS GH#774) - Even without Fabric, we still need to build react-native-codegen + # [macOS] Even without Fabric, we still need to build react-native-codegen build_codegen!(prefix) end @@ -357,7 +357,7 @@ def get_react_codegen_spec(options={}) 'header_mappings_dir' => './', 'platforms' => { 'ios' => '11.0', - 'osx' => '10.15', # TODO(macOS GH#774) + 'osx' => '10.15', # [macOS] }, 'source_files' => "**/*.{h,mm,cpp}", 'pod_target_xcconfig' => { "HEADER_SEARCH_PATHS" => diff --git a/scripts/run-ci-e2e-tests.js b/scripts/run-ci-e2e-tests.js index aef9a6cab1d98b..97c47fbafe0b3e 100644 --- a/scripts/run-ci-e2e-tests.js +++ b/scripts/run-ci-e2e-tests.js @@ -88,9 +88,9 @@ try { mv('_watchmanconfig', '.watchmanconfig'); mv('_bundle', '.bundle'); - // [TODO(macOS GH#774) + // [macOS process.env.REACT_NATIVE_RUNNING_E2E_TESTS = 'true'; - // ]TODO(macOS GH#774) + // macOS] describe('Install React Native package'); exec(`npm install ${REACT_NATIVE_PACKAGE}`); diff --git a/scripts/set-rn-version.js b/scripts/set-rn-version.js index f94fa323e16726..6ef6bcf81989e3 100755 --- a/scripts/set-rn-version.js +++ b/scripts/set-rn-version.js @@ -25,7 +25,7 @@ let argv = yargs .option('v', { alias: 'to-version', type: 'string', - // TODO(macOS GH#774): Extra options used during RNM's publish pipelines + // [macOS Extra options used during RNM's publish pipelines }) .option('p', { alias: 'rnmpublish', @@ -43,11 +43,11 @@ let argv = yargs default: false, }) .option('S', { - // [TODO(macOS GH#1148): Remove this option once version bumping scripts have been refactored + // [macOS Remove this option once version bumping scripts have been refactored alias: 'skip-update-ruby', type: 'boolean', - default: false, // ]TODO(macOS GH#1148) - // ]TODO(macOS GH#774) + default: false, // macOS] + // macOS] }).argv; const autogenerateVersionNumber = argv.autogenerateVersionNumber; @@ -58,19 +58,19 @@ let version = argv.toVersion; if (!version) { if (nightlyBuild && autogenerateVersionNumber) { - // [TODO(macOS GH#774): Some of our calls to set-rn-version.js still depend on an automatically generated version number + // [macOS Some of our calls to set-rn-version.js still depend on an automatically generated version number const currentCommit = exec('git rev-parse HEAD', { silent: true, }).stdout.trim(); version = `0.0.0-${currentCommit.slice(0, 9)}`; - // ]TODO(macOS GH#774) + // macOS] } else { echo('You must specify a version using -v'); exit(1); } } -// [TODO(macOS GH#774) +// [macOS let branch; if (!nightlyBuild) { // Check we are in release branch, e.g. 0.33-stable @@ -168,7 +168,7 @@ fs.writeFileSync( let packageJson = JSON.parse(cat('package.json')); packageJson.version = version; -// [TODO(macOS GH#774): We do this separately in a non-destructive way as part of our publish steps +// [macOS We do this separately in a non-destructive way as part of our publish steps // delete packageJson.workspaces; // delete packageJson.private; @@ -184,7 +184,7 @@ packageJson.version = version; // ...packageJson.dependencies, // 'react-native-codegen': repoConfigJson.dependencies['react-native-codegen'], // }; -// TODO(macOS GH#774)] +// macOS] fs.writeFileSync('package.json', JSON.stringify(packageJson, null, 2), 'utf-8'); @@ -204,7 +204,7 @@ if ( // Change react-native version in the template's package.json exec(`node scripts/set-rn-template-version.js ${version}`); -// [TODO(macOS GH#774) +// [macOS if (updatePodfileLock) { echo('Updating RNTester Podfile.lock...'); if (exec('source scripts/update_podfile_lock.sh && update_pods').code) { @@ -213,11 +213,11 @@ if (updatePodfileLock) { exit(1); } } -// ]TODO(macOS GH#774) +// macOS] // Make sure to update ruby version if (!argv.skipUpdateRuby && exec('scripts/update-ruby.sh').code) { - // TODO(macOS GH#1148) + // [macOS] echo('Failed to update Ruby version'); exit(1); } diff --git a/template/_flowconfig b/template/_flowconfig index fa5f4bd023a033..9eb48b885fb415 100644 --- a/template/_flowconfig +++ b/template/_flowconfig @@ -11,7 +11,7 @@ node_modules/react-native/Libraries/polyfills/.* ; Flow doesn't support platforms .*/Libraries/Utilities/LoadingView.js -; TODO(macOS GH#774): Ignore metro.config.js +; [macOS Ignore metro.config.js /metro.config.js [untyped] diff --git a/third-party-podspecs/DoubleConversion.podspec b/third-party-podspecs/DoubleConversion.podspec index 1bf5001e906ef6..2cb52660089575 100644 --- a/third-party-podspecs/DoubleConversion.podspec +++ b/third-party-podspecs/DoubleConversion.podspec @@ -21,6 +21,6 @@ Pod::Spec.new do |spec| spec.user_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/DoubleConversion\"" } # Pinning to the same version as React.podspec. - spec.platforms = { :ios => "11.0", :osx => "10.15" } # TODO(macOS GH#214) + spec.platforms = { :ios => "11.0", :osx => "10.15" } # [macOS] end diff --git a/third-party-podspecs/RCT-Folly.podspec b/third-party-podspecs/RCT-Folly.podspec index eaeacffd24d379..de637b6abcf7c9 100644 --- a/third-party-podspecs/RCT-Folly.podspec +++ b/third-party-podspecs/RCT-Folly.podspec @@ -144,5 +144,5 @@ Pod::Spec.new do |spec| end # Pinning to the same version as React.podspec. - spec.platforms = { :ios => "9.0", :tvos => "9.0", :osx => "10.15" } # TODO(macOS GH#214) + spec.platforms = { :ios => "9.0", :tvos => "9.0", :osx => "10.15" } # [macOS] end diff --git a/third-party-podspecs/boost.podspec b/third-party-podspecs/boost.podspec index 035be4753b58ec..f40f59e82c511e 100644 --- a/third-party-podspecs/boost.podspec +++ b/third-party-podspecs/boost.podspec @@ -14,7 +14,7 @@ Pod::Spec.new do |spec| :sha256 => 'f0397ba6e982c4450f27bf32a2a83292aba035b827a5623a14636ea583318c41' } # Pinning to the same version as React.podspec. - spec.platforms = { :ios => '11.0', :tvos => '11.0', :osx => "10.15" } # TODO(macOS GH#214) + spec.platforms = { :ios => '11.0', :tvos => '11.0', :osx => "10.15" } # [macOS] spec.requires_arc = false spec.module_name = 'boost' diff --git a/third-party-podspecs/glog.podspec b/third-party-podspecs/glog.podspec index ee3db0b87d8e5b..f7ca18a9c3c7e1 100644 --- a/third-party-podspecs/glog.podspec +++ b/third-party-podspecs/glog.podspec @@ -33,6 +33,6 @@ Pod::Spec.new do |spec| "HEADER_SEARCH_PATHS" => "$(PODS_TARGET_SRCROOT)/src" } # Pinning to the same version as React.podspec. - spec.platforms = { :ios => "11.0", :osx => "10.15" } # TODO(macOS GH#214) + spec.platforms = { :ios => "11.0", :osx => "10.15" } # [macOS] end From 8af53867dad48182cd414ff0df5698cbe81b7a8a Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Mon, 19 Dec 2022 23:21:10 -0600 Subject: [PATCH 2/3] Add documentation --- README.md | 2 +- docs/DiffsWithUpstream.md | 97 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 docs/DiffsWithUpstream.md diff --git a/README.md b/README.md index fc2a0ef8c5de7d..b2cf14c66c52b7 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ This repository is a working fork of **facebook/react-native** that adds support [new-app]: https://reactnative.dev/docs/getting-started [existing]: https://reactnative.dev/docs/integration-with-existing-apps -You can read more about the macOS implementation in our website - [React Native for Windows + macOS](https://microsoft.github.io/react-native-windows/) +You can read more about the macOS implementation in our website - [React Native for Windows + macOS](https://microsoft.github.io/react-native-windows/). You can read about how we manage this fork in our [docs](docs/) folder. ## Requirements diff --git a/docs/DiffsWithUpstream.md b/docs/DiffsWithUpstream.md new file mode 100644 index 00000000000000..77f9b6dc98c657 --- /dev/null +++ b/docs/DiffsWithUpstream.md @@ -0,0 +1,97 @@ +# How React Native macOS differs from React Native + +React Native macOS elected to implement our fork via inline diffs of existing React Native code. This means additions and changes of extra code to support macOS, usually in the same file as the existing iOS or JS implementation. + +# Rationale + +UIKit (The native iOS framework that React Native's iOS implementation is built off) is quite similar to Appkit (the macOS equivalent) which encourages a lot of code sharing and re-use. We found that to encourage maximum code sharing, the use of preprocessor `#ifdef` blocks was best to modify the existing iOS implementation to compile on macOS. This also aides in merging upstream changes from React Native, as it's easier to compare and update our diffs when they're in the same file than if macOS was in a separate implementation file altogether. + +# How do we track diffs? + +We track diffs through the use of "diff tags" in code comments. Wherever we add or modify code, we try to add a diff tag to mark the beginning and end of the modified code. The diff tags are designed so that you can easily do a search of the string "[macOS" across the entire repository and collect a list of all of our diffs. + +## Diff tag format + +- Single Line diff +``` +// [macOS] +``` +- Single Line diff with comment +``` +// [macOS] comment explaining change +``` +- Block Diff +``` +... +// [macOS +... +// macOS] +... +``` +- Block Diff with comment +``` +... +// [macOS comment explaining change +... +// macOS] +... +``` +- Inline diff +``` +/* blah blah blah `RCTUIView` [macOS] blah blah */ +``` + +## Forked files + +We try to make changes in the same file where possible. However, we sometimes find the need to make completely new files for macOS only code, or for a parallel implementation to the iOS and Android implementations. For these entirely new files, we find it sufficient to simply add a single line diff tag near the top to show that the _file_ is an addition by React Native macOS. + +``` +Foo.macos.js +==================== +/** + * Copyright notice + */ + +// [macOS] + +... rest of file +===================== +``` + +## ifdef blocks + +Oftentimes we add a few types of ifdef blocks to React Native's iOS code. We follow a few guidelines to keep these consistent and manageable between merges. + +1. ifdef macOS only code + +``` +#if TARGET_OS_OSX // [macOS + ...macOS only code +#endif // macOS] +``` +Here, we used the block start and end tags to signify the code inside the ifdef is an _addition_ from React Native macOS. + + +2. ifdef iOS only code + +``` +#if !TARGET_OS_OSX // [macOS] + ...iOS only code +#endif // [macOS] +``` +Here, we used single line diff tags to show that the code inside the tags is the original React Native code (as opposed to an iOS block added by React Native macOS) + + +3. ifdef between an iOS and macOS block + +``` +#if !TARGET_OS_OSX // [macOS] + ...original iOS only code +#else // [macOS + ...macOS only code +#endif // macOS] +``` +This case is a mix of the earlier two cases. We use a single line tag for the starting if tag to show that the first block of iOS only code is the original code from React Native. Then, we use block tags with the else/endif to show that the macOS code is an addition by Raect Native macOS. + + + From 2b8c3fe91eeb4711d94738e0a96c40b95f26c88b Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Mon, 9 Jan 2023 23:13:17 -0800 Subject: [PATCH 3/3] Address PR comments --- .circleci/Dockerfiles/Dockerfile.android | 2 +- .circleci/config.yml | 2 +- .flowconfig | 2 +- .flowconfig.android | 2 +- Libraries/Animated/AnimatedMock.js | 4 ++-- Libraries/Components/Button.js | 5 +++-- Libraries/Components/View/ViewPropTypes.js | 5 +---- Libraries/Image/RCTImageView.mm | 4 ++-- Libraries/Image/RCTUIImageViewAnimated.m | 4 ++-- Libraries/Text/RCTTextAttributes.m | 4 +--- Libraries/Text/Text/RCTDynamicTypeRamp.h | 4 ++-- Libraries/Text/Text/RCTDynamicTypeRamp.m | 4 ++-- Libraries/Text/Text/RCTTextView.m | 8 ++++---- .../TextInput/Multiline/RCTMultilineTextInputView.m | 2 +- .../Text/TextInput/RCTBackedTextInputDelegateAdapter.m | 2 +- Libraries/Text/TextInput/Singleline/RCTUITextField.m | 10 +++++----- Libraries/Utilities/Platform.macos.js | 2 +- React/CoreModules/RCTLogBox.mm | 6 +++--- React/Views/RCTView.m | 2 +- docs/DiffsWithUpstream.md | 2 +- scripts/generate-artifacts.js | 2 +- 21 files changed, 37 insertions(+), 41 deletions(-) diff --git a/.circleci/Dockerfiles/Dockerfile.android b/.circleci/Dockerfiles/Dockerfile.android index b3a0434dd84460..81ec524f8af794 100644 --- a/.circleci/Dockerfiles/Dockerfile.android +++ b/.circleci/Dockerfiles/Dockerfile.android @@ -22,7 +22,7 @@ # and then build this customized step on top of it. # # Disabling this is okay because per (Github#774) this test, which is redundant to Azure Devops test, -# failsin the fork because of Microsoft's V8 upgrade to Android +# fails in the fork because of Microsoft's V8 upgrade to Android # #FROM reactnativecommunity/react-native-android:5.2 diff --git a/.circleci/config.yml b/.circleci/config.yml index 688732101c359e..a5892859d82a76 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1013,7 +1013,7 @@ workflows: filters: branches: ignore: /.*/ - # [macOS] + # macOS] nightly: unless: << pipeline.parameters.run_package_release_workflow_only >> triggers: diff --git a/.flowconfig b/.flowconfig index ff5a7e1fcfc793..34fda34c1faa4f 100644 --- a/.flowconfig +++ b/.flowconfig @@ -13,7 +13,7 @@ ; Ignore "BUCK" generated dirs /\.buckd/ -; [macOS Ignore metro.config.js +; [macOS] Ignore metro.config.js /metro.config.js ; Flow doesn't support platforms diff --git a/.flowconfig.android b/.flowconfig.android index 25f04d616c9308..4156e60b6499a4 100644 --- a/.flowconfig.android +++ b/.flowconfig.android @@ -13,7 +13,7 @@ ; Ignore "BUCK" generated dirs /\.buckd/ -; [macOS Ignore metro.config.js +; [macOS] Ignore metro.config.js /metro.config.js ; Flow doesn't support platforms diff --git a/Libraries/Animated/AnimatedMock.js b/Libraries/Animated/AnimatedMock.js index b4f0608b4cfe77..ee9241514a70ba 100644 --- a/Libraries/Animated/AnimatedMock.js +++ b/Libraries/Animated/AnimatedMock.js @@ -98,11 +98,11 @@ const spring = function ( return { ...emptyAnimation, start: mockAnimationStart((callback?: ?EndCallback): void => { - // [macOS - setValue can't handle AnimatedNodes + // [macOS setValue can't handle AnimatedNodes if (config.toValue instanceof AnimatedNode) { anyValue.setValue(config.toValue.__getValue()); } else { - // [macOS] + // macOS] anyValue.setValue(config.toValue); } callback?.({finished: true}); diff --git a/Libraries/Components/Button.js b/Libraries/Components/Button.js index fbfca927ed6e08..416f4e7bb5f6e4 100644 --- a/Libraries/Components/Button.js +++ b/Libraries/Components/Button.js @@ -454,10 +454,11 @@ const styles = StyleSheet.create({ ios: { color: '#cdcdcd', }, + // [macOS macos: { - // [macOS color: '#cdcdcd', - }, // macOS] + }, + // macOS] android: { color: '#a1a1a1', }, diff --git a/Libraries/Components/View/ViewPropTypes.js b/Libraries/Components/View/ViewPropTypes.js index bd0437f7b9a419..626106488558ca 100644 --- a/Libraries/Components/View/ViewPropTypes.js +++ b/Libraries/Components/View/ViewPropTypes.js @@ -30,10 +30,7 @@ import type { AccessibilityActionEvent, AccessibilityActionInfo, } from './ViewAccessibility'; - -// [macOS -import type {DraggedTypesType} from '../View/DraggedType'; -// macOS] +import type {DraggedTypesType} from '../View/DraggedType'; // [macOS] export type ViewLayout = Layout; export type ViewLayoutEvent = LayoutEvent; diff --git a/Libraries/Image/RCTImageView.mm b/Libraries/Image/RCTImageView.mm index 488272613b1eca..8151289befbcbf 100644 --- a/Libraries/Image/RCTImageView.mm +++ b/Libraries/Image/RCTImageView.mm @@ -578,8 +578,8 @@ - (void)reactSetFrame:(CGRect)frame // Don't reload if the current image or target image size is close enough if ((!RCTShouldReloadImageForSizeChange(imageSize, idealSize) || !RCTShouldReloadImageForSizeChange(_targetSize, idealSize)) // [macOS -#if TARGET_OS_OSX - // Since mac doen't suport UIViewContentModeScaleAspectFill, we have to manually resample the image +#if TARGET_OS_OSX + // Since macOS doen't support UIViewContentModeScaleAspectFill, we have to manually resample the image // If we're in cover mode we need to ensure that the image is re-sampled to the correct size when the container size (shrinking // being the most obvious case) otherwise we will end up in a state an image will not properly scale inside its container && (resizeMode != RCTResizeModeCover || (imageSize.width == idealSize.width && imageSize.height == idealSize.height)) diff --git a/Libraries/Image/RCTUIImageViewAnimated.m b/Libraries/Image/RCTUIImageViewAnimated.m index 526f0c1c5b0174..03d6964b673b81 100644 --- a/Libraries/Image/RCTUIImageViewAnimated.m +++ b/Libraries/Image/RCTUIImageViewAnimated.m @@ -44,9 +44,9 @@ @interface RCTUIImageViewAnimated () @property (nonatomic, strong) NSOperationQueue *fetchQueue; @property (nonatomic, strong) dispatch_semaphore_t lock; @property (nonatomic, assign) CGFloat animatedImageScale; -#if !TARGET_OS_OSX // [macOS +#if !TARGET_OS_OSX // [macOS] @property (nonatomic, strong) CADisplayLink *displayLink; -#endif // macOS] +#endif // [macOS] @end diff --git a/Libraries/Text/RCTTextAttributes.m b/Libraries/Text/RCTTextAttributes.m index 897365c84ec72c..4be7bd894ec299 100644 --- a/Libraries/Text/RCTTextAttributes.m +++ b/Libraries/Text/RCTTextAttributes.m @@ -46,9 +46,7 @@ - (instancetype)init _textShadowRadius = NAN; _opacity = NAN; _textTransform = RCTTextTransformUndefined; - // [macOS - _foregroundColor = [RCTTextAttributes defaultForegroundColor]; - // macOS] + _foregroundColor = [RCTTextAttributes defaultForegroundColor]; // [macOS] #if TARGET_OS_OSX // [macOS _cursor = RCTCursorAuto; #endif // macOS] diff --git a/Libraries/Text/Text/RCTDynamicTypeRamp.h b/Libraries/Text/Text/RCTDynamicTypeRamp.h index bc7109dbd93275..bee66f668cd2cb 100644 --- a/Libraries/Text/Text/RCTDynamicTypeRamp.h +++ b/Libraries/Text/Text/RCTDynamicTypeRamp.h @@ -32,9 +32,9 @@ typedef NS_ENUM(NSInteger, RCTDynamicTypeRamp) { @end -#if !TARGET_OS_OSX // [macOS +#if !TARGET_OS_OSX // [macOS] /// Generates a `UIFontMetrics` instance representing a particular Dynamic Type ramp. UIFontMetrics * _Nonnull RCTUIFontMetricsForDynamicTypeRamp(RCTDynamicTypeRamp dynamicTypeRamp); /// The "reference" size for a particular font scale ramp, equal to a text element's size under default text size settings. CGFloat RCTBaseSizeForDynamicTypeRamp(RCTDynamicTypeRamp dynamicTypeRamp); -#endif // macOS] +#endif // [macOS] diff --git a/Libraries/Text/Text/RCTDynamicTypeRamp.m b/Libraries/Text/Text/RCTDynamicTypeRamp.m index 4b4b03244cd98e..2e2285c341974e 100644 --- a/Libraries/Text/Text/RCTDynamicTypeRamp.m +++ b/Libraries/Text/Text/RCTDynamicTypeRamp.m @@ -27,7 +27,7 @@ @implementation RCTConvert (DynamicTypeRamp) @end -#if !TARGET_OS_OSX // [macOS +#if !TARGET_OS_OSX // [macOS] UIFontMetrics *RCTUIFontMetricsForDynamicTypeRamp(RCTDynamicTypeRamp dynamicTypeRamp) { static NSDictionary *mapping; static dispatch_once_t onceToken; @@ -74,4 +74,4 @@ CGFloat RCTBaseSizeForDynamicTypeRamp(RCTDynamicTypeRamp dynamicTypeRamp) { NSNumber *baseSize = mapping[@(dynamicTypeRamp)] ?: @17; // Default to body size if we don't recognize the specified ramp return CGFLOAT_IS_DOUBLE ? [baseSize doubleValue] : [baseSize floatValue]; } -#endif // macOS] +#endif // [macOS] diff --git a/Libraries/Text/Text/RCTTextView.m b/Libraries/Text/Text/RCTTextView.m index b675a16a71f7c2..9b8331207d1e19 100644 --- a/Libraries/Text/Text/RCTTextView.m +++ b/Libraries/Text/Text/RCTTextView.m @@ -96,7 +96,7 @@ - (instancetype)initWithFrame:(CGRect)frame return self; } -#if DEBUG // [macOS description is a debug-only feature +#if DEBUG // [macOS] description is a debug-only feature - (NSString *)description { // [macOS we shouldn't make assumptions on what super's description is. Just append additional content. @@ -104,7 +104,7 @@ - (NSString *)description return [[super description] stringByAppendingString:stringToAppend]; // macOS] } -#endif // macOS] +#endif // [macOS] - (void)setSelectable:(BOOL)selectable { @@ -521,7 +521,7 @@ - (void)copy:(id)sender NSData *rtf = [attributedText dataFromRange:NSMakeRange(0, attributedText.length) documentAttributes:@{NSDocumentTypeDocumentAttribute: NSRTFDTextDocumentType} error:nil]; -#if TARGET_OS_IPHONE // [macOS +#if !TARGET_OS_OSX // [macOS] NSMutableDictionary *item = [NSMutableDictionary new]; // [macOS] if (rtf) { @@ -532,7 +532,7 @@ - (void)copy:(id)sender UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; pasteboard.items = @[item]; -#elif TARGET_OS_OSX // [macOS] +#else // [macOS [_textView copy:sender]; NSPasteboard *pasteboard = [NSPasteboard generalPasteboard]; diff --git a/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.m b/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.m index dce0a08108b311..829017de51a564 100644 --- a/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.m +++ b/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.m @@ -30,7 +30,7 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge _backedTextInputView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; #if TARGET_OS_OSX // [macOS self.hideVerticalScrollIndicator = NO; - _scrollView = [[RCTUIScrollView alloc] initWithFrame:self.bounds]; // [macOS] + _scrollView = [[RCTUIScrollView alloc] initWithFrame:self.bounds]; _scrollView.backgroundColor = [RCTUIColor clearColor]; _scrollView.drawsBackground = NO; _scrollView.borderType = NSNoBorder; diff --git a/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m b/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m index b598d16f419dfd..71e795008f0f82 100644 --- a/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m +++ b/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m @@ -466,7 +466,7 @@ - (void)textViewProbablyDidChangeSelection return; } - _previousSelectedTextRange = [_backedTextInputView selectedTextRange]; // macOS setter not defined for mac + _previousSelectedTextRange = [_backedTextInputView selectedTextRange]; // [macOS] [_backedTextInputView.textInputDelegate textInputDidChangeSelection]; } diff --git a/Libraries/Text/TextInput/Singleline/RCTUITextField.m b/Libraries/Text/TextInput/Singleline/RCTUITextField.m index cf570c958782c0..926108a862bc16 100644 --- a/Libraries/Text/TextInput/Singleline/RCTUITextField.m +++ b/Libraries/Text/TextInput/Singleline/RCTUITextField.m @@ -242,12 +242,12 @@ - (BOOL)isGrammarCheckingEnabled return ((RCTUITextFieldCell*)self.cell).isGrammarCheckingEnabled; } -- (void)setSelectionColor:(RCTUIColor *)selectionColor // [macOS] +- (void)setSelectionColor:(RCTUIColor *)selectionColor { ((RCTUITextFieldCell*)self.cell).selectionColor = selectionColor; } -- (RCTUIColor*)selectionColor // [macOS] +- (RCTUIColor*)selectionColor { return ((RCTUITextFieldCell*)self.cell).selectionColor; } @@ -290,10 +290,10 @@ - (NSString*)placeholder // [macOS { #if !TARGET_OS_OSX // [macOS] return super.placeholder; -#else // [macOS +#else return self.placeholderAttributedString.string ?: self.placeholderString; -#endif // macOS] -} +#endif +} // macOS] - (void)setPlaceholderColor:(RCTUIColor *)placeholderColor // [macOS] { diff --git a/Libraries/Utilities/Platform.macos.js b/Libraries/Utilities/Platform.macos.js index a7bec027962ba8..36ff6ec42c2d69 100644 --- a/Libraries/Utilities/Platform.macos.js +++ b/Libraries/Utilities/Platform.macos.js @@ -8,7 +8,7 @@ * @flow strict */ -// macOS Copied from Platform.ios.js +// [macOS] Copied from Platform.ios.js 'use strict'; diff --git a/React/CoreModules/RCTLogBox.mm b/React/CoreModules/RCTLogBox.mm index 01f3cfed06bb34..575b6d0dbc15ad 100644 --- a/React/CoreModules/RCTLogBox.mm +++ b/React/CoreModules/RCTLogBox.mm @@ -59,7 +59,7 @@ - (void)setSurfacePresenter:(id)surfacePresenter strongSelf->_view = [[RCTLogBoxView alloc] initWithFrame:RCTKeyWindow().frame surfacePresenter:strongSelf->_bridgelessSurfacePresenter]; #else // [macOS - strongSelf->_view = [[RCTLogBoxView alloc] initWithSurfacePresenter:strongSelf->_bridgelessSurfacePresenter]; // [macOS] + strongSelf->_view = [[RCTLogBoxView alloc] initWithSurfacePresenter:strongSelf->_bridgelessSurfacePresenter]; #endif // macOS] } else if (strongSelf->_bridge && strongSelf->_bridge.valid) { if (strongSelf->_bridge.surfacePresenter) { @@ -67,13 +67,13 @@ - (void)setSurfacePresenter:(id)surfacePresenter strongSelf->_view = [[RCTLogBoxView alloc] initWithFrame:RCTKeyWindow().frame surfacePresenter:strongSelf->_bridge.surfacePresenter]; #else // [macOS - strongSelf->_view = [[RCTLogBoxView alloc] initWithSurfacePresenter:strongSelf->_bridge.surfacePresenter]; // [macOS] + strongSelf->_view = [[RCTLogBoxView alloc] initWithSurfacePresenter:strongSelf->_bridge.surfacePresenter]; #endif // macOS] } else { #if !TARGET_OS_OSX // [macOS] strongSelf->_view = [[RCTLogBoxView alloc] initWithWindow:RCTKeyWindow() bridge:strongSelf->_bridge]; #else // [macOS - strongSelf->_view = [[RCTLogBoxView alloc] initWithBridge:self->_bridge]; // [macOS] + strongSelf->_view = [[RCTLogBoxView alloc] initWithBridge:self->_bridge]; #endif // macOS] } } diff --git a/React/Views/RCTView.m b/React/Views/RCTView.m index 23d469a097ea47..a93b87e4a2f438 100644 --- a/React/Views/RCTView.m +++ b/React/Views/RCTView.m @@ -1004,7 +1004,7 @@ - (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection #pragma mark - Borders -- (RCTUIColor *)backgroundColor // macOS RCTUIColor +- (RCTUIColor *)backgroundColor // [macOS] RCTUIColor { return _backgroundColor; } diff --git a/docs/DiffsWithUpstream.md b/docs/DiffsWithUpstream.md index 77f9b6dc98c657..0396882582294d 100644 --- a/docs/DiffsWithUpstream.md +++ b/docs/DiffsWithUpstream.md @@ -91,7 +91,7 @@ Here, we used single line diff tags to show that the code inside the tags is the ...macOS only code #endif // macOS] ``` -This case is a mix of the earlier two cases. We use a single line tag for the starting if tag to show that the first block of iOS only code is the original code from React Native. Then, we use block tags with the else/endif to show that the macOS code is an addition by Raect Native macOS. +This case is a mix of the earlier two cases. We use a single line tag for the starting if tag to show that the first block of iOS only code is the original code from React Native. Then, we use block tags with the else/endif to show that the macOS code is an addition by React Native macOS. diff --git a/scripts/generate-artifacts.js b/scripts/generate-artifacts.js index 45d5cbde1f0be4..fcd23590efa5be 100644 --- a/scripts/generate-artifacts.js +++ b/scripts/generate-artifacts.js @@ -185,7 +185,7 @@ function main(appRootDir, outputPath) { console.log( '\n\n[Codegen] >>>>> Building react-native-codegen package', ); - // [macOS - use execFileSync to help keep shell commands clean + // [macOS use execFileSync to help keep shell commands clean execFileSync('yarn', ['install'], { cwd: codegenCliPath, stdio: 'inherit',