react-native-macos 0.0.0-eefd4a8e0 → 0.0.0-ef6f55605
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Libraries/AddressSanitizerCrash/RCTAddressSanitizerCrash.js +2 -3
- package/Libraries/Alert/Alert.js +2 -2
- package/Libraries/Alert/RCTAlertManager.android.js +1 -1
- package/Libraries/Animated/AnimatedImplementation.js +53 -53
- package/Libraries/Animated/AnimatedMock.js +8 -8
- package/Libraries/Animated/NativeAnimatedHelper.js +23 -20
- package/Libraries/Animated/nodes/AnimatedColor.js +1 -1
- package/Libraries/Animated/nodes/AnimatedNode.js +10 -9
- package/Libraries/Animated/nodes/AnimatedValueXY.js +1 -1
- package/Libraries/AppState/AppState.js +8 -7
- package/Libraries/BatchedBridge/__mocks__/MessageQueueTestModule.js +2 -2
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +22 -20
- package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +1 -2
- package/Libraries/Components/Button.js +1 -2
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +6 -7
- package/Libraries/Components/Keyboard/Keyboard.js +8 -7
- package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +5 -10
- package/Libraries/Components/Pressable/Pressable.js +1 -2
- package/Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js +2 -1
- package/Libraries/Components/RefreshControl/RefreshControl.js +2 -7
- package/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +2 -3
- package/Libraries/Components/SafeAreaView/SafeAreaView.js +2 -2
- package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +3 -5
- package/Libraries/Components/ScrollView/ScrollContentViewNativeComponent.js +3 -5
- package/Libraries/Components/ScrollView/ScrollView.js +34 -68
- package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +5 -4
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +1 -2
- package/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.ios.js +2 -8
- package/Libraries/Components/Sound/SoundManager.js +1 -1
- package/Libraries/Components/TextInput/InputAccessoryView.js +1 -2
- package/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js +3 -5
- package/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js +3 -5
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +2 -0
- package/Libraries/Components/TextInput/TextInput.js +137 -11
- package/Libraries/Components/ToastAndroid/ToastAndroid.android.js +3 -3
- package/Libraries/Components/ToastAndroid/ToastAndroid.ios.js +3 -3
- package/Libraries/Components/Touchable/BoundingDimensions.js +2 -2
- package/Libraries/Components/Touchable/PooledClass.js +6 -6
- package/Libraries/Components/Touchable/Position.js +1 -1
- package/Libraries/Components/Touchable/Touchable.js +26 -25
- package/Libraries/Components/Touchable/TouchableBounce.js +1 -2
- package/Libraries/Components/Touchable/TouchableHighlight.js +1 -2
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +4 -11
- package/Libraries/Components/Touchable/TouchableOpacity.js +1 -2
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +1 -0
- package/Libraries/Components/View/ReactNativeViewAttributes.js +1 -0
- package/Libraries/Components/View/ReactNativeViewViewConfig.js +1 -0
- package/Libraries/Components/View/ReactNativeViewViewConfigMacOS.js +3 -3
- package/Libraries/Components/View/View.js +0 -7
- package/Libraries/Components/View/ViewNativeComponent.js +3 -4
- package/Libraries/Components/View/ViewPropTypes.js +10 -6
- package/Libraries/Core/Devtools/parseHermesStack.js +2 -1
- package/Libraries/Core/ExceptionsManager.js +2 -2
- package/Libraries/Core/NativeExceptionsManager.js +2 -3
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Core/Timers/JSTimers.js +17 -13
- package/Libraries/Core/setUpAlert.js +1 -1
- package/Libraries/Core/setUpDeveloperTools.js +1 -1
- package/Libraries/Core/setUpPerformance.js +1 -1
- package/Libraries/Core/setUpRegeneratorRuntime.js +1 -1
- package/Libraries/Core/setUpSegmentFetcher.js +4 -4
- package/Libraries/EventEmitter/NativeEventEmitter.js +2 -1
- package/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js +2 -1
- package/Libraries/HeapCapture/HeapCapture.js +1 -1
- package/Libraries/Image/AssetSourceResolver.js +2 -4
- package/Libraries/Image/Image.android.js +4 -4
- package/Libraries/Image/Image.ios.js +3 -3
- package/Libraries/Image/ImageAnalyticsTagContext.js +2 -3
- package/Libraries/Image/ImageBackground.js +1 -2
- package/Libraries/Image/ImagePickerIOS.js +6 -6
- package/Libraries/Image/ImageViewNativeComponent.js +2 -4
- package/Libraries/Image/NativeImageLoaderAndroid.js +1 -3
- package/Libraries/Image/RCTImageCache.m +1 -1
- package/Libraries/Image/RCTImageView.mm +14 -10
- package/Libraries/Image/TextInlineImageNativeComponent.js +3 -5
- package/Libraries/Inspector/ElementProperties.js +2 -4
- package/Libraries/Inspector/InspectorOverlay.js +1 -2
- package/Libraries/Inspector/InspectorPanel.js +1 -2
- package/Libraries/Inspector/NetworkOverlay.js +5 -11
- package/Libraries/Interaction/BridgeSpyStallHandler.js +1 -1
- package/Libraries/Interaction/FrameRateLogger.js +2 -2
- package/Libraries/Interaction/InteractionManager.js +2 -4
- package/Libraries/Interaction/JSEventLoopWatchdog.js +4 -4
- package/Libraries/Interaction/PanResponder.js +3 -4
- package/Libraries/Interaction/TouchHistoryMath.js +7 -7
- package/Libraries/JSInspector/NetworkAgent.js +1 -6
- package/Libraries/LayoutAnimation/LayoutAnimation.js +3 -3
- package/Libraries/LinkingIOS/RCTLinkingManager.h +1 -0
- package/Libraries/LinkingIOS/macos/RCTLinkingManager.mm +12 -5
- package/Libraries/Lists/FillRateHelper.js +1 -3
- package/Libraries/Lists/FlatList.js +29 -6
- package/Libraries/Lists/ViewabilityHelper.js +4 -10
- package/Libraries/Lists/VirtualizeUtils.js +2 -6
- package/Libraries/Lists/VirtualizedList.js +136 -148
- package/Libraries/Lists/VirtualizedListContext.js +3 -5
- package/Libraries/Lists/VirtualizedSectionList.js +63 -68
- package/Libraries/LogBox/Data/LogBoxData.js +1 -1
- package/Libraries/LogBox/Data/parseLogBoxLog.js +12 -23
- package/Libraries/LogBox/UI/LogBoxButton.js +2 -4
- package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js +2 -4
- package/Libraries/LogBox/UI/LogBoxInspectorFooter.js +1 -2
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +1 -2
- package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js +3 -6
- package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +1 -2
- package/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js +2 -4
- package/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js +2 -4
- package/Libraries/LogBox/UI/LogBoxNotification.js +2 -4
- package/Libraries/Modal/Modal.js +2 -4
- package/Libraries/NativeComponent/NativeComponentRegistry.js +2 -4
- package/Libraries/Network/XHRInterceptor.js +5 -6
- package/Libraries/NewAppScreen/components/Header.js +2 -4
- package/Libraries/NewAppScreen/components/HermesBadge.js +1 -2
- package/Libraries/NewAppScreen/components/LearnMoreLinks.js +2 -4
- package/Libraries/Performance/SamplingProfiler.js +3 -3
- package/Libraries/PermissionsAndroid/PermissionsAndroid.js +4 -3
- package/Libraries/Pressability/Pressability.js +2 -2
- package/Libraries/Pressability/PressabilityPerformanceEventEmitter.js +4 -2
- package/Libraries/PushNotificationIOS/PushNotificationIOS.js +8 -7
- package/Libraries/ReactNative/AppContainer.js +4 -6
- package/Libraries/ReactNative/AppRegistry.js +2 -3
- package/Libraries/ReactNative/I18nManager.js +2 -5
- package/Libraries/ReactNative/PaperUIManager.js +2 -3
- package/Libraries/ReactNative/RootTag.js +2 -3
- package/Libraries/ReactNative/renderApplication.js +1 -2
- package/Libraries/Storage/AsyncStorage.js +21 -21
- package/Libraries/StyleSheet/StyleSheet.js +2 -1
- package/Libraries/StyleSheet/StyleSheetTypes.js +26 -1
- package/Libraries/StyleSheet/processColor.js +2 -2
- package/Libraries/StyleSheet/splitLayoutProps.js +1 -3
- package/Libraries/Text/BaseText/RCTBaseTextViewManager.m +1 -0
- package/Libraries/Text/RCTTextAttributes.h +2 -0
- package/Libraries/Text/RCTTextAttributes.m +29 -13
- package/Libraries/Text/Text/RCTDynamicTypeRamp.h +40 -0
- package/Libraries/Text/Text/RCTDynamicTypeRamp.m +77 -0
- package/Libraries/Text/Text/RCTTextView.m +118 -47
- package/Libraries/Text/Text.js +2 -9
- package/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.h +8 -0
- package/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.m +66 -1
- package/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputViewManager.m +13 -0
- package/Libraries/Text/TextInput/Multiline/RCTUITextView.h +2 -1
- package/Libraries/Text/TextInput/Multiline/RCTUITextView.m +105 -7
- package/Libraries/Text/TextInput/RCTBackedTextInputDelegate.h +13 -1
- package/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m +20 -3
- package/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h +1 -0
- package/Libraries/Text/TextInput/RCTBaseTextInputShadowView.m +12 -0
- package/Libraries/Text/TextInput/RCTBaseTextInputView.h +9 -1
- package/Libraries/Text/TextInput/RCTBaseTextInputView.m +128 -4
- package/Libraries/Text/TextInput/RCTBaseTextInputViewManager.m +15 -3
- package/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputView.m +4 -0
- package/Libraries/Text/TextInput/Singleline/RCTUITextField.h +2 -0
- package/Libraries/Text/TextInput/Singleline/RCTUITextField.m +68 -2
- package/Libraries/Text/TextNativeComponent.js +5 -5
- package/Libraries/Text/TextProps.js +29 -0
- package/Libraries/Types/CoreEventTypes.js +0 -1
- package/Libraries/Utilities/Appearance.js +8 -5
- package/Libraries/Utilities/BackHandler.android.js +4 -4
- package/Libraries/Utilities/HMRClient.js +2 -2
- package/Libraries/Utilities/JSDevSupportModule.js +3 -4
- package/Libraries/Utilities/MatrixMath.js +19 -19
- package/Libraries/Utilities/PerformanceLoggerContext.js +2 -3
- package/Libraries/Utilities/ReactNativeTestTools.js +2 -4
- package/Libraries/Utilities/SceneTracker.js +1 -3
- package/Libraries/Utilities/__mocks__/BackHandler.js +3 -3
- package/Libraries/Utilities/buildStyleInterpolator.js +9 -9
- package/Libraries/Utilities/codegenNativeComponent.js +4 -2
- package/Libraries/Utilities/differ/deepDiffer.js +1 -1
- package/Libraries/Utilities/differ/insetsDiffer.js +1 -1
- package/Libraries/Utilities/differ/matricesDiffer.js +1 -1
- package/Libraries/Utilities/differ/pointsDiffer.js +1 -1
- package/Libraries/Utilities/differ/sizesDiffer.js +1 -1
- package/Libraries/Utilities/logError.js +1 -1
- package/Libraries/Utilities/mergeIntoFast.js +1 -1
- package/Libraries/Utilities/truncate.js +1 -1
- package/Libraries/Vibration/Vibration.js +2 -2
- package/Libraries/WebSocket/WebSocketInterceptor.js +4 -4
- package/Libraries/promiseRejectionTrackingOptions.js +1 -1
- package/Libraries/vendor/emitter/_EmitterSubscription.js +2 -1
- package/Libraries/vendor/emitter/_EventEmitter.js +2 -1
- package/Libraries/vendor/emitter/_EventSubscription.js +2 -1
- package/Libraries/vendor/emitter/_EventSubscriptionVendor.js +1 -1
- package/React/Base/RCTAssert.h +4 -3
- package/React/Base/RCTAssert.m +11 -2
- package/React/Base/RCTBridge.m +1 -1
- package/React/Base/RCTConstants.h +3 -3
- package/React/Base/RCTConstants.m +6 -6
- package/React/Base/RCTConvert.m +8 -4
- package/React/Base/RCTEventDispatcherProtocol.h +5 -0
- package/React/Base/RCTRootView.m +0 -51
- package/React/Base/RCTTouchHandler.m +15 -1
- package/React/Base/RCTUIKit.h +10 -13
- package/React/Base/RCTUtils.m +33 -3
- package/React/Base/RCTVersion.m +1 -1
- package/React/Base/macOS/RCTPlatformDisplayLink.m +3 -1
- package/React/Base/macOS/RCTUIKit.m +53 -0
- package/React/CoreModules/RCTAppearance.mm +21 -5
- package/React/CoreModules/RCTDevLoadingView.mm +1 -1
- package/React/CoreModules/RCTEventDispatcher.mm +6 -1
- package/React/CoreModules/RCTPerfMonitor.mm +1 -1
- package/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm +6 -2
- package/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm +2 -1
- package/React/Fabric/Mounting/ComponentViews/SafeAreaView/RCTSafeAreaViewComponentView.mm +0 -1
- package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.mm +1 -1
- package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +35 -9
- package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +8 -1
- package/React/Fabric/Mounting/RCTComponentViewFactory.mm +2 -9
- package/React/Fabric/Mounting/RCTComponentViewRegistry.h +0 -5
- package/React/Fabric/Mounting/RCTComponentViewRegistry.mm +0 -39
- package/React/Fabric/Mounting/RCTMountingManager.h +1 -1
- package/React/Fabric/Mounting/RCTMountingManager.mm +10 -9
- package/React/Fabric/Mounting/RCTMountingTransactionObserverCoordinator.h +5 -3
- package/React/Fabric/Mounting/RCTMountingTransactionObserverCoordinator.mm +10 -8
- package/React/Fabric/Mounting/RCTMountingTransactionObserving.h +5 -3
- package/React/Fabric/RCTConversions.h +9 -1
- package/React/Fabric/RCTImageResponseObserverProxy.h +1 -0
- package/React/Fabric/RCTLocalizationProvider.mm +10 -4
- package/React/Fabric/RCTScheduler.h +7 -0
- package/React/Fabric/RCTScheduler.mm +15 -0
- package/React/Fabric/RCTSurfacePresenter.h +2 -0
- package/React/Fabric/RCTSurfacePresenter.mm +44 -23
- package/React/Fabric/RCTSurfaceTouchHandler.mm +0 -1
- package/React/Modules/RCTUIManager.m +33 -13
- package/React/React-RCTFabric.podspec +1 -1
- package/React/Tests/Mounting/RCTComponentViewRegistryTests.mm +1 -0
- package/React/Views/RCTActivityIndicatorView.m +2 -1
- package/React/Views/RCTCursor.h +39 -0
- package/React/Views/RCTCursor.m +105 -0
- package/React/Views/RCTView.h +16 -0
- package/React/Views/RCTView.m +141 -188
- package/React/Views/RCTViewKeyboardEvent.h +6 -28
- package/React/Views/RCTViewKeyboardEvent.m +66 -61
- package/React/Views/RCTViewManager.m +18 -13
- package/React/Views/ScrollView/RCTScrollContentView.h +4 -0
- package/React/Views/ScrollView/RCTScrollContentView.m +18 -0
- package/React/Views/ScrollView/RCTScrollContentViewManager.m +2 -0
- package/React/Views/ScrollView/RCTScrollView.h +2 -1
- package/React/Views/ScrollView/RCTScrollView.m +70 -63
- package/React/Views/ScrollView/RCTScrollViewManager.m +1 -1
- package/React/Views/UIView+React.h +2 -0
- package/React/Views/UIView+React.m +23 -14
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/androidTest/js/AnimatedTransformTestModule.js +1 -2
- package/ReactAndroid/src/androidTest/js/Asserts.js +2 -2
- package/ReactAndroid/src/androidTest/js/CatalystRootViewTestModule.js +1 -1
- package/ReactAndroid/src/androidTest/js/JSResponderTestApp.js +1 -2
- package/ReactAndroid/src/androidTest/js/LayoutEventsTestApp.js +1 -2
- package/ReactAndroid/src/androidTest/js/MeasureLayoutTestModule.js +54 -54
- package/ReactAndroid/src/androidTest/js/ProgressBarTestModule.js +1 -1
- package/ReactAndroid/src/androidTest/js/ScrollViewTestModule.js +6 -7
- package/ReactAndroid/src/androidTest/js/ShareTestModule.js +1 -1
- package/ReactAndroid/src/androidTest/js/SubviewsClippingTestModule.js +12 -19
- package/ReactAndroid/src/androidTest/js/SwipeRefreshLayoutTestModule.js +2 -3
- package/ReactAndroid/src/androidTest/js/TestJSLocaleModule.js +2 -2
- package/ReactAndroid/src/androidTest/js/TestJSToJavaParametersModule.js +17 -17
- package/ReactAndroid/src/androidTest/js/TestJavaToJSArgumentsModule.js +10 -10
- package/ReactAndroid/src/androidTest/js/TestJavaToJSReturnValuesModule.js +2 -2
- package/ReactAndroid/src/androidTest/js/TextInputTestModule.js +2 -3
- package/ReactAndroid/src/androidTest/js/TouchBubblingTestAppModule.js +3 -6
- package/ReactAndroid/src/androidTest/js/UIManagerTestModule.js +3 -6
- package/ReactAndroid/src/androidTest/js/ViewRenderingTestModule.js +5 -5
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
- package/ReactCommon/React-Fabric.podspec +1 -1
- package/ReactCommon/React-rncore.podspec +1 -1
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/ReactCommon/hermes/inspector/tools/msggen/src/HeaderWriter.js +1 -1
- package/ReactCommon/hermes/inspector/tools/msggen/src/index.js +1 -1
- package/ReactCommon/react/renderer/core/EventDispatcher.cpp +21 -0
- package/ReactCommon/react/renderer/core/EventDispatcher.h +15 -0
- package/ReactCommon/react/renderer/core/EventListener.cpp +39 -0
- package/ReactCommon/react/renderer/core/EventListener.h +44 -0
- package/ReactCommon/react/renderer/graphics/React-graphics.podspec +1 -1
- package/ReactCommon/react/renderer/mounting/TelemetryController.cpp +6 -9
- package/ReactCommon/react/renderer/mounting/TelemetryController.h +7 -7
- package/ReactCommon/react/renderer/scheduler/Scheduler.cpp +18 -0
- package/ReactCommon/react/renderer/scheduler/Scheduler.h +9 -0
- package/ReactCommon/react/utils/ManagedObjectWrapper.h +1 -1
- package/ReactCommon/react/utils/ManagedObjectWrapper.mm +1 -3
- package/jest/assetFileTransformer.js +2 -2
- package/jest/preprocessor.js +2 -2
- package/jest/setup.js +3 -3
- package/package.json +22 -25
- package/scripts/generate-artifacts.js +21 -17
- package/scripts/react_native_pods.rb +0 -3
- package/template/App.js +4 -8
- package/template/Gemfile.lock +7 -7
- package/template/android/gradlew.bat +89 -89
- package/template/ios/HelloWorldTests/HelloWorldTests.m +1 -0
- package/template/package.json +1 -1
- package/Libraries/Types/RootTagTypes.js~merged +0 -23
- package/ReactCommon/react/renderer/mounting/MountingTransactionMetadata.cpp +0 -12
- package/ReactCommon/react/renderer/mounting/MountingTransactionMetadata.h +0 -32
- package/third-party-podspecs/boost-for-react-native.podspec +0 -20
package/React/Base/RCTRootView.m
CHANGED
|
@@ -33,10 +33,6 @@
|
|
|
33
33
|
#import "RCTDevMenu.h"
|
|
34
34
|
#endif // ]TODO(OSS Candidate ISS#2710739)
|
|
35
35
|
|
|
36
|
-
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
37
|
-
#define RCT_LAYOUT_THROTTLE 0.25
|
|
38
|
-
#endif // ]TODO(macOS GH#774)
|
|
39
|
-
|
|
40
36
|
NSString *const RCTContentDidAppearNotification = @"RCTContentDidAppearNotification";
|
|
41
37
|
|
|
42
38
|
@interface RCTUIManager (RCTRootView)
|
|
@@ -51,11 +47,6 @@ NSString *const RCTContentDidAppearNotification = @"RCTContentDidAppearNotificat
|
|
|
51
47
|
RCTRootContentView *_contentView;
|
|
52
48
|
BOOL _passThroughTouches;
|
|
53
49
|
CGSize _intrinsicContentSize;
|
|
54
|
-
|
|
55
|
-
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
56
|
-
NSDate *_lastLayout;
|
|
57
|
-
BOOL _throttleLayout;
|
|
58
|
-
#endif // ]TODO(macOS GH#774)
|
|
59
50
|
}
|
|
60
51
|
|
|
61
52
|
- (instancetype)initWithFrame:(CGRect)frame
|
|
@@ -85,10 +76,6 @@ NSString *const RCTContentDidAppearNotification = @"RCTContentDidAppearNotificat
|
|
|
85
76
|
_sizeFlexibility = RCTRootViewSizeFlexibilityNone;
|
|
86
77
|
_minimumSize = CGSizeZero;
|
|
87
78
|
|
|
88
|
-
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
89
|
-
_lastLayout = [NSDate new];
|
|
90
|
-
#endif // ]TODO(macOS GH#774)
|
|
91
|
-
|
|
92
79
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
93
80
|
selector:@selector(bridgeDidReload)
|
|
94
81
|
name:RCTJavaScriptWillStartLoadingNotification
|
|
@@ -182,35 +169,6 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)aDecoder)
|
|
|
182
169
|
return fitSize;
|
|
183
170
|
}
|
|
184
171
|
|
|
185
|
-
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
186
|
-
// TODO: https://github.com/microsoft/react-native-macos/issues/459
|
|
187
|
-
// This is a workaround for window resizing events overloading the shadow queue:
|
|
188
|
-
// - https://github.com/microsoft/react-native-macos/issues/322
|
|
189
|
-
// - https://github.com/microsoft/react-native-macos/issues/422
|
|
190
|
-
// We should revisit this issue when we switch over to Fabric.
|
|
191
|
-
- (void)layout
|
|
192
|
-
{
|
|
193
|
-
if (self.window != nil && !_throttleLayout) {
|
|
194
|
-
NSTimeInterval interval = [[NSDate date] timeIntervalSinceDate:_lastLayout];
|
|
195
|
-
if (interval >= RCT_LAYOUT_THROTTLE) {
|
|
196
|
-
_lastLayout = [NSDate new];
|
|
197
|
-
[self layoutSubviews];
|
|
198
|
-
} else {
|
|
199
|
-
_throttleLayout = YES;
|
|
200
|
-
__weak typeof(self) weakSelf = self;
|
|
201
|
-
int64_t delta = (RCT_LAYOUT_THROTTLE - interval) * NSEC_PER_SEC;
|
|
202
|
-
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, delta), dispatch_get_main_queue(), ^{
|
|
203
|
-
typeof(self) strongSelf = weakSelf;
|
|
204
|
-
if (strongSelf != nil) {
|
|
205
|
-
strongSelf->_throttleLayout = NO;
|
|
206
|
-
[strongSelf setNeedsLayout];
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
#endif // ]TODO(macOS GH#774)
|
|
213
|
-
|
|
214
172
|
- (void)layoutSubviews
|
|
215
173
|
{
|
|
216
174
|
[super layoutSubviews];
|
|
@@ -473,15 +431,6 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)aDecoder)
|
|
|
473
431
|
RCTUserInterfaceStyleDidChangeNotificationTraitCollectionKey : self.traitCollection,
|
|
474
432
|
}];
|
|
475
433
|
}
|
|
476
|
-
#else // [TODO(macOS GH#774)
|
|
477
|
-
- (void)viewDidChangeEffectiveAppearance {
|
|
478
|
-
[[NSNotificationCenter defaultCenter] postNotificationName:RCTUserInterfaceStyleDidChangeNotification
|
|
479
|
-
object:self
|
|
480
|
-
userInfo:@{
|
|
481
|
-
RCTUserInterfaceStyleDidChangeNotificationTraitCollectionKey: self.effectiveAppearance,
|
|
482
|
-
}];
|
|
483
|
-
|
|
484
|
-
}
|
|
485
434
|
#endif // ]TODO(macOS GH#774)
|
|
486
435
|
|
|
487
436
|
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
#if !TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
11
11
|
#import <UIKit/UIGestureRecognizerSubclass.h>
|
|
12
12
|
#endif // ]TODO(macOS GH#774)
|
|
13
|
+
#import <React/RCTUITextField.h> // TODO(macOS GH#774)
|
|
13
14
|
|
|
14
15
|
#import "RCTAssert.h"
|
|
15
16
|
#import "RCTBridge.h"
|
|
@@ -129,11 +130,18 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)coder)
|
|
|
129
130
|
// The assumption here is that a RCTUIView/RCTSurfaceView will always have a superview.
|
|
130
131
|
CGPoint touchLocation = [self.view.superview convertPoint:touch.locationInWindow fromView:nil];
|
|
131
132
|
NSView *targetView = [self.view hitTest:touchLocation];
|
|
133
|
+
// Don't record clicks on scrollbars.
|
|
134
|
+
if ([targetView isKindOfClass:[NSScroller class]]) {
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
132
137
|
// Pair the mouse down events with mouse up events so our _nativeTouches cache doesn't get stale
|
|
133
138
|
if ([targetView isKindOfClass:[NSControl class]]) {
|
|
134
139
|
_shouldSendMouseUpOnSystemBehalf = [(NSControl*)targetView isEnabled];
|
|
135
140
|
} else if ([targetView isKindOfClass:[NSText class]]) {
|
|
136
141
|
_shouldSendMouseUpOnSystemBehalf = [(NSText*)targetView isSelectable];
|
|
142
|
+
}
|
|
143
|
+
else if ([targetView.superview isKindOfClass:[RCTUITextField class]]) {
|
|
144
|
+
_shouldSendMouseUpOnSystemBehalf = [(RCTUITextField*)targetView.superview isSelectable];
|
|
137
145
|
} else {
|
|
138
146
|
_shouldSendMouseUpOnSystemBehalf = NO;
|
|
139
147
|
}
|
|
@@ -221,7 +229,8 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)coder)
|
|
|
221
229
|
NSEvent *nativeTouch = _nativeTouches[touchIndex];
|
|
222
230
|
CGPoint location = nativeTouch.locationInWindow;
|
|
223
231
|
CGPoint rootViewLocation = CGPointMake(location.x, CGRectGetHeight(self.view.window.frame) - location.y);
|
|
224
|
-
|
|
232
|
+
NSView *touchView = _touchViews[touchIndex];
|
|
233
|
+
CGPoint touchViewLocation = [touchView convertPoint:location fromView:nil];
|
|
225
234
|
#endif // ]TODO(macOS GH#774)
|
|
226
235
|
|
|
227
236
|
NSMutableDictionary *reactTouch = _reactTouches[touchIndex];
|
|
@@ -394,6 +403,11 @@ static BOOL RCTAnyTouchesChanged(NSSet *touches) // [TODO(macOS GH#774)
|
|
|
394
403
|
// "end"/"cancel" needs to remove the touch *after* extracting the event.
|
|
395
404
|
[self _recordNewTouches:touches];
|
|
396
405
|
|
|
406
|
+
// [TODO(macOS GH#774) - Filter out touches that were ignored.
|
|
407
|
+
touches = [touches objectsPassingTest:^(id touch, BOOL *stop) {
|
|
408
|
+
return [_nativeTouches containsObject:touch];
|
|
409
|
+
}]; // ]TODO(macOS GH#774)
|
|
410
|
+
|
|
397
411
|
[self _updateAndDispatchTouches:touches eventName:@"touchStart"];
|
|
398
412
|
|
|
399
413
|
if (self.state == UIGestureRecognizerStatePossible) {
|
package/React/Base/RCTUIKit.h
CHANGED
|
@@ -80,11 +80,6 @@ UIKIT_STATIC_INLINE void RCTUIViewSetContentModeRedraw(UIView *view)
|
|
|
80
80
|
view.contentMode = UIViewContentModeRedraw;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
UIKIT_STATIC_INLINE BOOL RCTUIViewDrawViewHierarchyInRectAfterScreenUpdates(RCTPlatformView *view, CGRect rect, BOOL afterUpdates)
|
|
84
|
-
{
|
|
85
|
-
return [view drawViewHierarchyInRect:rect afterScreenUpdates:afterUpdates];
|
|
86
|
-
}
|
|
87
|
-
|
|
88
83
|
UIKIT_STATIC_INLINE BOOL RCTUIViewIsDescendantOfView(RCTPlatformView *view, RCTPlatformView *parent)
|
|
89
84
|
{
|
|
90
85
|
return [view isDescendantOfView:parent];
|
|
@@ -425,9 +420,19 @@ CGPathRef UIBezierPathCreateCGPathRef(UIBezierPath *path);
|
|
|
425
420
|
@property (nonatomic, assign) CGFloat zoomScale;
|
|
426
421
|
@property (nonatomic, assign) BOOL alwaysBounceHorizontal;
|
|
427
422
|
@property (nonatomic, assign) BOOL alwaysBounceVertical;
|
|
423
|
+
// macOS specific properties
|
|
424
|
+
@property (nonatomic, assign) BOOL enableFocusRing;
|
|
425
|
+
@property (nonatomic, assign, getter=isScrollEnabled) BOOL scrollEnabled;
|
|
428
426
|
|
|
429
427
|
@end
|
|
430
428
|
|
|
429
|
+
@interface RCTClipView : NSClipView // [TODO(macOS GH#774)
|
|
430
|
+
|
|
431
|
+
@property (nonatomic, assign) BOOL constrainScrolling;
|
|
432
|
+
|
|
433
|
+
@end // ]TODO(macOS GH#774)
|
|
434
|
+
|
|
435
|
+
|
|
431
436
|
NS_INLINE RCTPlatformView *RCTUIViewHitTestWithEvent(RCTPlatformView *view, CGPoint point, __unused UIEvent *event)
|
|
432
437
|
{
|
|
433
438
|
return [view hitTest:point];
|
|
@@ -440,14 +445,6 @@ NS_INLINE void RCTUIViewSetContentModeRedraw(RCTPlatformView *view)
|
|
|
440
445
|
view.layerContentsRedrawPolicy = NSViewLayerContentsRedrawDuringViewResize;
|
|
441
446
|
}
|
|
442
447
|
|
|
443
|
-
NS_INLINE BOOL RCTUIViewDrawViewHierarchyInRectAfterScreenUpdates(RCTPlatformView *view, CGRect rect, __unused BOOL afterUpdates)
|
|
444
|
-
{
|
|
445
|
-
RCTAssert(afterUpdates, @"We're redrawing the view so it will necessarily include the latest changes.");
|
|
446
|
-
(void) afterUpdates;
|
|
447
|
-
[view displayRectIgnoringOpacity:NSRectToCGRect(rect)];
|
|
448
|
-
return YES;
|
|
449
|
-
}
|
|
450
|
-
|
|
451
448
|
NS_INLINE BOOL RCTUIViewIsDescendantOfView(RCTPlatformView *view, RCTPlatformView *parent)
|
|
452
449
|
{
|
|
453
450
|
return [view isDescendantOf:parent];
|
package/React/Base/RCTUtils.m
CHANGED
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
#import "RCTAssert.h"
|
|
22
22
|
#import "RCTLog.h"
|
|
23
23
|
|
|
24
|
+
static const NSUInteger RCTMaxCachableImageCount = 100;
|
|
25
|
+
|
|
24
26
|
NSString *const RCTErrorUnspecified = @"EUNSPECIFIED";
|
|
25
27
|
|
|
26
28
|
// Returns the Path of Home directory
|
|
@@ -829,11 +831,29 @@ UIImage *__nullable RCTImageFromLocalBundleAssetURL(NSURL *imageURL)
|
|
|
829
831
|
return RCTImageFromLocalAssetURL(bundleImageUrl);
|
|
830
832
|
}
|
|
831
833
|
|
|
834
|
+
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
835
|
+
static NSCache<NSURL *, UIImage *> *RCTLocalImageCache()
|
|
836
|
+
{
|
|
837
|
+
static NSCache *imageCache;
|
|
838
|
+
static dispatch_once_t onceToken;
|
|
839
|
+
dispatch_once(&onceToken, ^{
|
|
840
|
+
imageCache = [NSCache new];
|
|
841
|
+
imageCache.countLimit = RCTMaxCachableImageCount;
|
|
842
|
+
});
|
|
843
|
+
return imageCache;
|
|
844
|
+
}
|
|
845
|
+
#endif // ]TODO(macOS GH#774)
|
|
846
|
+
|
|
832
847
|
UIImage *__nullable RCTImageFromLocalAssetURL(NSURL *imageURL)
|
|
833
848
|
{
|
|
834
849
|
NSString *imageName = RCTBundlePathForURL(imageURL);
|
|
835
850
|
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
836
851
|
NSURL *bundleImageURL = nil;
|
|
852
|
+
|
|
853
|
+
UIImage *cachedImage = [RCTLocalImageCache() objectForKey:imageURL];
|
|
854
|
+
if (cachedImage) {
|
|
855
|
+
return cachedImage;
|
|
856
|
+
}
|
|
837
857
|
#endif // ]TODO(macOS GH#774)
|
|
838
858
|
|
|
839
859
|
NSBundle *bundle = nil;
|
|
@@ -885,9 +905,12 @@ UIImage *__nullable RCTImageFromLocalAssetURL(NSURL *imageURL)
|
|
|
885
905
|
}
|
|
886
906
|
#if !TARGET_OS_OSX // TODO(macOS GH#774)
|
|
887
907
|
image = [UIImage imageWithContentsOfFile:filePath];
|
|
888
|
-
#else // TODO(macOS GH#774)
|
|
889
|
-
|
|
890
|
-
|
|
908
|
+
#else // [TODO(macOS GH#774)
|
|
909
|
+
// macOS keeps file handles in open state for lifetime of image if "initWithContentsOfFile:" is used with path inside app bundle
|
|
910
|
+
// Workaround is to load file in data and then convert data to image
|
|
911
|
+
NSData *data = [NSData dataWithContentsOfFile:filePath];
|
|
912
|
+
image = [[NSImage alloc] initWithData:data];
|
|
913
|
+
#endif // ]TODO(macOS GH#774)
|
|
891
914
|
}
|
|
892
915
|
}
|
|
893
916
|
|
|
@@ -911,6 +934,13 @@ UIImage *__nullable RCTImageFromLocalAssetURL(NSURL *imageURL)
|
|
|
911
934
|
}
|
|
912
935
|
}
|
|
913
936
|
}
|
|
937
|
+
|
|
938
|
+
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
939
|
+
if (image) {
|
|
940
|
+
[RCTLocalImageCache() setObject:image forKey:imageURL];
|
|
941
|
+
}
|
|
942
|
+
#endif // ]TODO(macOS GH#774)
|
|
943
|
+
|
|
914
944
|
return image;
|
|
915
945
|
}
|
|
916
946
|
|
package/React/Base/RCTVersion.m
CHANGED
|
@@ -51,7 +51,9 @@ static CVReturn RCTPlatformDisplayLinkCallBack(__unused CVDisplayLinkRef display
|
|
|
51
51
|
if (rctDisplayLink->_runLoop != nil) {
|
|
52
52
|
CFRunLoopRef cfRunLoop = [rctDisplayLink->_runLoop getCFRunLoop];
|
|
53
53
|
CFRunLoopPerformBlock(cfRunLoop, (__bridge CFArrayRef)rctDisplayLink->_modes, ^{
|
|
54
|
-
|
|
54
|
+
@autoreleasepool {
|
|
55
|
+
[rctDisplayLink tick];
|
|
56
|
+
}
|
|
55
57
|
});
|
|
56
58
|
CFRunLoopWakeUp(cfRunLoop);
|
|
57
59
|
}
|
|
@@ -423,12 +423,41 @@ static RCTUIView *RCTUIViewCommonInit(RCTUIView *self)
|
|
|
423
423
|
}
|
|
424
424
|
}
|
|
425
425
|
|
|
426
|
+
// We purposely don't use RCTCursor for the parameter type here because it would introduce an import cycle:
|
|
427
|
+
// RCTUIKit > RCTCursor > RCTConvert > RCTUIKit
|
|
428
|
+
- (void)setCursor:(NSInteger)cursor
|
|
429
|
+
{
|
|
430
|
+
// This method is required to be defined due to [RCTVirtualTextViewManager view] returning a RCTUIView.
|
|
431
|
+
}
|
|
432
|
+
|
|
426
433
|
@end
|
|
427
434
|
|
|
428
435
|
// RCTUIScrollView
|
|
429
436
|
|
|
430
437
|
@implementation RCTUIScrollView // TODO(macOS ISS#3536887)
|
|
431
438
|
|
|
439
|
+
- (instancetype)initWithFrame:(CGRect)frame
|
|
440
|
+
{
|
|
441
|
+
if (self = [super initWithFrame:frame]) {
|
|
442
|
+
self.scrollEnabled = YES;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
return self;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
- (void)setEnableFocusRing:(BOOL)enableFocusRing {
|
|
449
|
+
if (_enableFocusRing != enableFocusRing) {
|
|
450
|
+
_enableFocusRing = enableFocusRing;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
if (enableFocusRing) {
|
|
454
|
+
// NSTextView has no focus ring by default so let's use the standard Aqua focus ring.
|
|
455
|
+
[self setFocusRingType:NSFocusRingTypeExterior];
|
|
456
|
+
} else {
|
|
457
|
+
[self setFocusRingType:NSFocusRingTypeNone];
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
|
|
432
461
|
// UIScrollView properties missing from NSScrollView
|
|
433
462
|
- (CGPoint)contentOffset
|
|
434
463
|
{
|
|
@@ -522,6 +551,7 @@ static RCTUIView *RCTUIViewCommonInit(RCTUIView *self)
|
|
|
522
551
|
self.verticalScrollElasticity = alwaysBounceVertical ? NSScrollElasticityAllowed : NSScrollElasticityNone;
|
|
523
552
|
}
|
|
524
553
|
|
|
554
|
+
|
|
525
555
|
@end
|
|
526
556
|
|
|
527
557
|
BOOL RCTUIViewSetClipsToBounds(RCTPlatformView *view)
|
|
@@ -537,3 +567,26 @@ BOOL RCTUIViewSetClipsToBounds(RCTPlatformView *view)
|
|
|
537
567
|
|
|
538
568
|
return clipsToBounds;
|
|
539
569
|
}
|
|
570
|
+
|
|
571
|
+
@implementation RCTClipView
|
|
572
|
+
|
|
573
|
+
- (instancetype)initWithFrame:(NSRect)frameRect
|
|
574
|
+
{
|
|
575
|
+
if (self = [super initWithFrame:frameRect]) {
|
|
576
|
+
self.constrainScrolling = NO;
|
|
577
|
+
self.drawsBackground = NO;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
return self;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
- (NSRect)constrainBoundsRect:(NSRect)proposedBounds
|
|
584
|
+
{
|
|
585
|
+
if (self.constrainScrolling) {
|
|
586
|
+
return NSMakeRect(0, 0, 0, 0);
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
return [super constrainBoundsRect:proposedBounds];
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
@end
|
|
@@ -137,21 +137,26 @@ RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSString *, getColorScheme)
|
|
|
137
137
|
return _currentColorScheme;
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
+
#if !TARGET_OS_OSX // TODO(macOS GH#774)
|
|
140
141
|
- (void)appearanceChanged:(NSNotification *)notification
|
|
141
142
|
{
|
|
142
143
|
NSDictionary *userInfo = [notification userInfo];
|
|
143
|
-
#if !TARGET_OS_OSX // TODO(macOS GH#774)
|
|
144
144
|
UITraitCollection *traitCollection = nil;
|
|
145
145
|
if (userInfo) {
|
|
146
146
|
traitCollection = userInfo[RCTUserInterfaceStyleDidChangeNotificationTraitCollectionKey];
|
|
147
147
|
}
|
|
148
148
|
NSString *newColorScheme = RCTColorSchemePreference(traitCollection);
|
|
149
149
|
#else // [TODO(macOS GH#774)
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
150
|
+
- (void)observeValueForKeyPath:(NSString *)keyPath
|
|
151
|
+
ofObject:(id)object
|
|
152
|
+
change:(NSDictionary *)change
|
|
153
|
+
context:(void *)context
|
|
154
|
+
{
|
|
155
|
+
if (object != NSApp || ![keyPath isEqualToString:@"effectiveAppearance"]) {
|
|
156
|
+
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
|
|
157
|
+
return;
|
|
153
158
|
}
|
|
154
|
-
NSString *newColorScheme = RCTColorSchemePreference(
|
|
159
|
+
NSString *newColorScheme = RCTColorSchemePreference(nil);
|
|
155
160
|
#endif // ]TODO(macOS GH#774)
|
|
156
161
|
if (![_currentColorScheme isEqualToString:newColorScheme]) {
|
|
157
162
|
_currentColorScheme = newColorScheme;
|
|
@@ -168,19 +173,30 @@ RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSString *, getColorScheme)
|
|
|
168
173
|
|
|
169
174
|
- (void)startObserving
|
|
170
175
|
{
|
|
176
|
+
#if !TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
171
177
|
if (@available(iOS 13.0, *)) {
|
|
172
178
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
173
179
|
selector:@selector(appearanceChanged:)
|
|
174
180
|
name:RCTUserInterfaceStyleDidChangeNotification
|
|
175
181
|
object:nil];
|
|
176
182
|
}
|
|
183
|
+
#else
|
|
184
|
+
[NSApp addObserver:self
|
|
185
|
+
forKeyPath:@"effectiveAppearance"
|
|
186
|
+
options:NSKeyValueObservingOptionNew
|
|
187
|
+
context:nil];
|
|
188
|
+
#endif // ]TODO(macOS GH#774)
|
|
177
189
|
}
|
|
178
190
|
|
|
179
191
|
- (void)stopObserving
|
|
180
192
|
{
|
|
193
|
+
#if !TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
181
194
|
if (@available(iOS 13.0, *)) {
|
|
182
195
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
|
183
196
|
}
|
|
197
|
+
#else
|
|
198
|
+
[NSApp removeObserver:self forKeyPath:@"effectiveAppearance" context:nil];
|
|
199
|
+
#endif // ]TODO(macOS GH#774)
|
|
184
200
|
}
|
|
185
201
|
|
|
186
202
|
@end
|
|
@@ -226,7 +226,7 @@ RCT_EXPORT_METHOD(hide)
|
|
|
226
226
|
[NSAnimationContext runAnimationGroup:^(__unused NSAnimationContext *context) {
|
|
227
227
|
self->_window.animator.alphaValue = 0.0;
|
|
228
228
|
} completionHandler:^{
|
|
229
|
-
[self->_window
|
|
229
|
+
[self->_window close];
|
|
230
230
|
self->_window = nil;
|
|
231
231
|
}];
|
|
232
232
|
});
|
|
@@ -110,7 +110,7 @@ RCT_EXPORT_MODULE()
|
|
|
110
110
|
[self sendEvent:event];
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
- (void)
|
|
113
|
+
- (void)notifyObserversOfEvent:(id<RCTEvent>)event
|
|
114
114
|
{
|
|
115
115
|
[_observersLock lock];
|
|
116
116
|
|
|
@@ -119,6 +119,11 @@ RCT_EXPORT_MODULE()
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
[_observersLock unlock];
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
- (void)sendEvent:(id<RCTEvent>)event
|
|
125
|
+
{
|
|
126
|
+
[self notifyObserversOfEvent:event];
|
|
122
127
|
|
|
123
128
|
[_eventQueueLock lock];
|
|
124
129
|
|
|
@@ -176,7 +176,7 @@ RCT_EXPORT_MODULE()
|
|
|
176
176
|
{
|
|
177
177
|
if (!_devMenuItem) {
|
|
178
178
|
__weak __typeof__(self) weakSelf = self;
|
|
179
|
-
__weak RCTDevSettings *devSettings = [self
|
|
179
|
+
__weak RCTDevSettings *devSettings = [[self bridge] devSettings]; // TODO(macOS GH#774)
|
|
180
180
|
if (devSettings.isPerfMonitorShown) {
|
|
181
181
|
[weakSelf show];
|
|
182
182
|
}
|
|
@@ -29,8 +29,6 @@ static NSString *const kRCTLegacyInteropChildIndexKey = @"index";
|
|
|
29
29
|
- (instancetype)initWithFrame:(CGRect)frame
|
|
30
30
|
{
|
|
31
31
|
if (self = [super initWithFrame:frame]) {
|
|
32
|
-
RCTWarnNotAllowedForNewArchitecture(
|
|
33
|
-
self, @"ViewManager with interop layer is not allowed in the new architecture.");
|
|
34
32
|
static const auto defaultProps = std::make_shared<const LegacyViewManagerInteropViewProps>();
|
|
35
33
|
_props = defaultProps;
|
|
36
34
|
_viewsToBeMounted = [NSMutableArray new];
|
|
@@ -67,6 +65,12 @@ static NSString *const kRCTLegacyInteropChildIndexKey = @"index";
|
|
|
67
65
|
|
|
68
66
|
+ (BOOL)isSupported:(NSString *)componentName
|
|
69
67
|
{
|
|
68
|
+
RCTLogNotAllowedForNewArchitecture(
|
|
69
|
+
self,
|
|
70
|
+
[NSString
|
|
71
|
+
stringWithFormat:
|
|
72
|
+
@"Legacy ViewManagers should be migrated to Fabric ComponentViews in the new architecture to reduce risk. Component using interop layer: %@",
|
|
73
|
+
componentName]);
|
|
70
74
|
return [[RCTLegacyViewManagerInteropComponentView supportedViewManagers] containsObject:componentName];
|
|
71
75
|
}
|
|
72
76
|
|
|
@@ -192,7 +192,8 @@ static ModalHostViewEventEmitter::OnOrientationChange onOrientationChangeStruct(
|
|
|
192
192
|
|
|
193
193
|
#pragma mark - RCTMountingTransactionObserving
|
|
194
194
|
|
|
195
|
-
- (void)
|
|
195
|
+
- (void)mountingTransactionWillMount:(MountingTransaction const &)transaction
|
|
196
|
+
withSurfaceTelemetry:(facebook::react::SurfaceTelemetry const &)surfaceTelemetry
|
|
196
197
|
{
|
|
197
198
|
_modalContentsSnapshot = [self.viewController.view snapshotViewAfterScreenUpdates:NO];
|
|
198
199
|
}
|
package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.mm
CHANGED
|
@@ -25,7 +25,7 @@ using namespace facebook::react;
|
|
|
25
25
|
|
|
26
26
|
@implementation RCTPullToRefreshViewComponentView {
|
|
27
27
|
UIRefreshControl *_refreshControl;
|
|
28
|
-
RCTScrollViewComponentView *_scrollViewComponentView;
|
|
28
|
+
RCTScrollViewComponentView *__weak _scrollViewComponentView;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
- (instancetype)initWithFrame:(CGRect)frame
|
|
@@ -52,7 +52,11 @@ static UIScrollViewIndicatorStyle RCTUIScrollViewIndicatorStyleFromProps(ScrollV
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
// Once Fabric implements proper NativeAnimationDriver, this should be removed.
|
|
56
|
+
// This is just a workaround to allow animations based on onScroll event.
|
|
57
|
+
// This is only used to animate sticky headers in ScrollViews, and only the contentOffset and tag is used.
|
|
58
|
+
// TODO: T116850910 [Fabric][iOS] Make Fabric not use legacy RCTEventDispatcher for native-driven AnimatedEvents
|
|
59
|
+
static void RCTSendScrollEventForNativeAnimations_DEPRECATED(UIScrollView *scrollView, NSInteger tag)
|
|
56
60
|
{
|
|
57
61
|
static uint16_t coalescingKey = 0;
|
|
58
62
|
RCTScrollEvent *scrollEvent = [[RCTScrollEvent alloc] initWithEventName:@"onScroll"
|
|
@@ -64,7 +68,15 @@ static void RCTSendPaperScrollEvent_DEPRECATED(UIScrollView *scrollView, NSInteg
|
|
|
64
68
|
scrollViewZoomScale:scrollView.zoomScale
|
|
65
69
|
userData:nil
|
|
66
70
|
coalescingKey:coalescingKey];
|
|
67
|
-
[
|
|
71
|
+
RCTBridge *bridge = [RCTBridge currentBridge];
|
|
72
|
+
if (bridge) {
|
|
73
|
+
[bridge.eventDispatcher sendEvent:scrollEvent];
|
|
74
|
+
} else {
|
|
75
|
+
NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:scrollEvent, @"event", nil];
|
|
76
|
+
[[NSNotificationCenter defaultCenter] postNotificationName:@"RCTNotifyEventDispatcherObserversOfEvent_DEPRECATED"
|
|
77
|
+
object:nil
|
|
78
|
+
userInfo:userInfo];
|
|
79
|
+
}
|
|
68
80
|
}
|
|
69
81
|
|
|
70
82
|
@interface RCTScrollViewComponentView () <
|
|
@@ -85,6 +97,7 @@ static void RCTSendPaperScrollEvent_DEPRECATED(UIScrollView *scrollView, NSInteg
|
|
|
85
97
|
// This helps to only update state from `scrollViewDidScroll` in case
|
|
86
98
|
// some other part of the system scrolls scroll view.
|
|
87
99
|
BOOL _isUserTriggeredScrolling;
|
|
100
|
+
BOOL _shouldUpdateContentInsetAdjustmentBehavior;
|
|
88
101
|
|
|
89
102
|
CGPoint _contentOffsetWhenClipped;
|
|
90
103
|
}
|
|
@@ -108,6 +121,7 @@ static void RCTSendPaperScrollEvent_DEPRECATED(UIScrollView *scrollView, NSInteg
|
|
|
108
121
|
_scrollView.delaysContentTouches = NO;
|
|
109
122
|
((RCTEnhancedScrollView *)_scrollView).overridingDelegate = self;
|
|
110
123
|
_isUserTriggeredScrolling = NO;
|
|
124
|
+
_shouldUpdateContentInsetAdjustmentBehavior = YES;
|
|
111
125
|
[self addSubview:_scrollView];
|
|
112
126
|
|
|
113
127
|
_containerView = [[UIView alloc] initWithFrame:CGRectZero];
|
|
@@ -135,7 +149,8 @@ static void RCTSendPaperScrollEvent_DEPRECATED(UIScrollView *scrollView, NSInteg
|
|
|
135
149
|
|
|
136
150
|
#pragma mark - RCTMountingTransactionObserving
|
|
137
151
|
|
|
138
|
-
- (void)
|
|
152
|
+
- (void)mountingTransactionDidMount:(MountingTransaction const &)transaction
|
|
153
|
+
withSurfaceTelemetry:(facebook::react::SurfaceTelemetry const &)surfaceTelemetry
|
|
139
154
|
{
|
|
140
155
|
[self _remountChildren];
|
|
141
156
|
}
|
|
@@ -253,7 +268,8 @@ static void RCTSendPaperScrollEvent_DEPRECATED(UIScrollView *scrollView, NSInteg
|
|
|
253
268
|
}
|
|
254
269
|
}
|
|
255
270
|
|
|
256
|
-
if (oldScrollViewProps.contentInsetAdjustmentBehavior != newScrollViewProps.contentInsetAdjustmentBehavior)
|
|
271
|
+
if ((oldScrollViewProps.contentInsetAdjustmentBehavior != newScrollViewProps.contentInsetAdjustmentBehavior) ||
|
|
272
|
+
_shouldUpdateContentInsetAdjustmentBehavior) {
|
|
257
273
|
auto const contentInsetAdjustmentBehavior = newScrollViewProps.contentInsetAdjustmentBehavior;
|
|
258
274
|
if (contentInsetAdjustmentBehavior == ContentInsetAdjustmentBehavior::Never) {
|
|
259
275
|
scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
|
@@ -264,6 +280,7 @@ static void RCTSendPaperScrollEvent_DEPRECATED(UIScrollView *scrollView, NSInteg
|
|
|
264
280
|
} else if (contentInsetAdjustmentBehavior == ContentInsetAdjustmentBehavior::Always) {
|
|
265
281
|
scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentAlways;
|
|
266
282
|
}
|
|
283
|
+
_shouldUpdateContentInsetAdjustmentBehavior = NO;
|
|
267
284
|
}
|
|
268
285
|
|
|
269
286
|
MAP_SCROLL_VIEW_PROP(disableIntervalMomentum);
|
|
@@ -377,8 +394,16 @@ static void RCTSendPaperScrollEvent_DEPRECATED(UIScrollView *scrollView, NSInteg
|
|
|
377
394
|
{
|
|
378
395
|
const auto &props = *std::static_pointer_cast<const ScrollViewProps>(_props);
|
|
379
396
|
_scrollView.contentOffset = RCTCGPointFromPoint(props.contentOffset);
|
|
397
|
+
// We set the default behavior to "never" so that iOS
|
|
398
|
+
// doesn't do weird things to UIScrollView insets automatically
|
|
399
|
+
// and keeps it as an opt-in behavior.
|
|
400
|
+
_scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
|
401
|
+
_shouldUpdateContentInsetAdjustmentBehavior = YES;
|
|
380
402
|
_state.reset();
|
|
381
403
|
_isUserTriggeredScrolling = NO;
|
|
404
|
+
CGRect oldFrame = self.frame;
|
|
405
|
+
self.frame = CGRectZero;
|
|
406
|
+
self.frame = oldFrame;
|
|
382
407
|
[super prepareForRecycle];
|
|
383
408
|
}
|
|
384
409
|
|
|
@@ -403,9 +428,8 @@ static void RCTSendPaperScrollEvent_DEPRECATED(UIScrollView *scrollView, NSInteg
|
|
|
403
428
|
if (_eventEmitter) {
|
|
404
429
|
std::static_pointer_cast<ScrollViewEventEmitter const>(_eventEmitter)->onScroll([self _scrollViewMetrics]);
|
|
405
430
|
}
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
RCTSendPaperScrollEvent_DEPRECATED(scrollView, self.tag);
|
|
431
|
+
|
|
432
|
+
RCTSendScrollEventForNativeAnimations_DEPRECATED(scrollView, self.tag);
|
|
409
433
|
}
|
|
410
434
|
|
|
411
435
|
[self _remountChildrenIfNeeded];
|
|
@@ -566,7 +590,6 @@ static void RCTSendPaperScrollEvent_DEPRECATED(UIScrollView *scrollView, NSInteg
|
|
|
566
590
|
offset = CGPointMake(localX, localY);
|
|
567
591
|
}
|
|
568
592
|
|
|
569
|
-
[self _forceDispatchNextScrollEvent];
|
|
570
593
|
[self scrollToOffset:offset animated:animated];
|
|
571
594
|
}
|
|
572
595
|
|
|
@@ -621,12 +644,15 @@ static void RCTSendPaperScrollEvent_DEPRECATED(UIScrollView *scrollView, NSInteg
|
|
|
621
644
|
|
|
622
645
|
- (void)scrollToOffset:(CGPoint)offset
|
|
623
646
|
{
|
|
624
|
-
[self _forceDispatchNextScrollEvent];
|
|
625
647
|
[self scrollToOffset:offset animated:YES];
|
|
626
648
|
}
|
|
627
649
|
|
|
628
650
|
- (void)scrollToOffset:(CGPoint)offset animated:(BOOL)animated
|
|
629
651
|
{
|
|
652
|
+
if (CGPointEqualToPoint(_scrollView.contentOffset, offset)) {
|
|
653
|
+
return;
|
|
654
|
+
}
|
|
655
|
+
|
|
630
656
|
[self _forceDispatchNextScrollEvent];
|
|
631
657
|
|
|
632
658
|
if (_layoutMetrics.layoutDirection == LayoutDirection::RightToLeft) {
|
|
@@ -591,6 +591,12 @@ static RCTBorderStyle RCTBorderStyleFromBorderStyle(BorderStyle borderStyle)
|
|
|
591
591
|
|
|
592
592
|
RCTBorderColors borderColors = RCTCreateRCTBorderColorsFromBorderColors(borderMetrics.borderColors);
|
|
593
593
|
|
|
594
|
+
#if TARGET_OS_OSX // [TODO(macOS GH#774)
|
|
595
|
+
CGFloat scaleFactor = self.window.backingScaleFactor;
|
|
596
|
+
#else
|
|
597
|
+
// On iOS setting the scaleFactor to 0.0 will default to the device's native scale factor.
|
|
598
|
+
CGFloat scaleFactor = 0.0;
|
|
599
|
+
#endif // ]TODO(macOS GH#774)
|
|
594
600
|
UIImage *image = RCTGetBorderImage(
|
|
595
601
|
RCTBorderStyleFromBorderStyle(borderMetrics.borderStyles.left),
|
|
596
602
|
layer.bounds.size,
|
|
@@ -598,7 +604,8 @@ static RCTBorderStyle RCTBorderStyleFromBorderStyle(BorderStyle borderStyle)
|
|
|
598
604
|
RCTUIEdgeInsetsFromEdgeInsets(borderMetrics.borderWidths),
|
|
599
605
|
borderColors,
|
|
600
606
|
_backgroundColor.CGColor,
|
|
601
|
-
self.clipsToBounds
|
|
607
|
+
self.clipsToBounds,
|
|
608
|
+
scaleFactor); // TODO(macOS GH#774)
|
|
602
609
|
|
|
603
610
|
RCTReleaseRCTBorderColors(borderColors);
|
|
604
611
|
|