not-react-native-macos 0.87.1-rc.1 → 0.87.1-rc.2
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/Alert/RCTAlertManager.macos.js +21 -0
- package/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.macos.js +23 -0
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.macos.js +23 -0
- package/Libraries/Components/ToastAndroid/ToastAndroid.macos.js +23 -0
- package/Libraries/Image/Image.macos.js +23 -0
- package/Libraries/NativeComponent/BaseViewConfig.macos.js +23 -0
- package/Libraries/Network/RCTNetworking.macos.js +23 -0
- package/Libraries/Settings/Settings.macos.js +33 -0
- package/Libraries/StyleSheet/PlatformColorValueTypes.macos.js +21 -0
- package/Libraries/Utilities/BackHandler.macos.js +23 -0
- package/Libraries/Utilities/Platform.macos.js +23 -0
- package/React/Base/RCTRootView.h +1 -1
- package/React/Base/RCTTextView.h +31 -0
- package/React/Base/RCTUIKit.h +121 -0
- package/React/Base/RCTUIKit.m +29 -0
- package/React/Base/Surface/RCTSurfaceView.h +1 -1
- package/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.h +1 -1
- package/React/CoreModules/RCTDevLoadingView.mm +1 -1
- package/React/CoreModules/RCTFPSGraph.h +1 -1
- package/React/CoreModules/RCTPerfMonitor.mm +1 -1
- package/React/CoreModules/RCTRedBox2Controller.mm +4 -4
- package/React/CoreModules/RCTRedBoxController.mm +2 -2
- package/React/CoreModules/React-CoreModules.podspec +0 -6
- package/React/DevSupport/RCTPausedInDebuggerOverlayController.mm +2 -2
- package/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryContentView.h +1 -1
- package/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryContentView.mm +1 -1
- package/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.mm +1 -1
- package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +1 -1
- package/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm +1 -1
- package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +1 -1
- package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h +1 -1
- package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +2 -2
- package/React/Fabric/Mounting/RCTComponentViewDescriptor.h +1 -1
- package/React/Fabric/Mounting/RCTComponentViewRegistry.h +1 -1
- package/React/Modules/RCTRedBoxExtraDataViewController.m +1 -1
- package/React/Views/RCTDebuggingOverlay.m +2 -2
- package/React/Views/RCTView.h +1 -1
- package/React/Views/RCTWrapperViewController.m +1 -1
- package/React-Core.podspec +0 -2
- package/macos/UIKitCompat/RCTPlatformViewCompat.h +9 -4
- package/macos/UIKitCompat/React-UIKitCompat.podspec +10 -2
- package/macos/UIKitCompat/UIKit/UIApplicationDelegate.h +13 -0
- package/macos/UIKitCompat/UIKit/UIControls.m +1 -1
- package/macos/UIKitCompat/UIKit/UIEvent.h +12 -0
- package/macos/UIKitCompat/UIKit/UIEvent.m +4 -1
- package/macos/UIKitCompat/UIKit/UIPlatformGaps.h +1 -1
- package/macos/UIKitCompat/UIKit/UIPlatformGaps.m +15 -1
- package/macos/UIKitCompat/UIKit/UITouch.h +24 -0
- package/macos/UIKitCompat/UIKit/UIView.h +18 -5
- package/macos/UIKitCompat/UIKit/UIView.m +24 -6
- package/macos/UIKitCompat/UIKit/UIViewController.h +24 -0
- package/macos/UIKitCompat/UIKit/UIWindow.h +24 -0
- package/macos/UIKitCompat/macos-excludes.txt +12 -33
- package/macos/metro-config.js +47 -25
- package/package.json +1 -1
- package/scripts/cocoapods/autolinking.rb +11 -2
- package/scripts/cocoapods/codegen.rb +3 -1
- package/scripts/cocoapods/codegen_utils.rb +7 -2
- package/scripts/codegen/generate-artifacts-executor/generateRCTThirdPartyComponents.js +3 -1
- package/scripts/codegen/generate-artifacts-executor/index.js +52 -4
- package/scripts/codegen/templates/RCTThirdPartyComponentsProviderMM.template +22 -1
- package/src/private/devsupport/rndevtools/ReactDevToolsSettingsManager.macos.js +17 -0
|
@@ -36,7 +36,7 @@ using namespace facebook::react;
|
|
|
36
36
|
|
|
37
37
|
// ParagraphTextView is an auxiliary view we set as contentView so the drawing
|
|
38
38
|
// can happen on top of the layers manipulated by RCTViewComponentView (the parent view)
|
|
39
|
-
@interface RCTParagraphTextView :
|
|
39
|
+
@interface RCTParagraphTextView : RCTUIView // [macOS] concrete flipped, layer-backed view; UIView is an alias for NSView
|
|
40
40
|
|
|
41
41
|
@property (nonatomic) ParagraphShadowNode::ConcreteState::Shared state;
|
|
42
42
|
@property (nonatomic) ParagraphAttributes paragraphAttributes;
|
|
@@ -844,7 +844,7 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
|
|
|
844
844
|
}
|
|
845
845
|
} else {
|
|
846
846
|
// Hides keyboard, but keeps blinking cursor.
|
|
847
|
-
_backedTextInputView.inputView = [
|
|
847
|
+
_backedTextInputView.inputView = [RCTUIView new]; // [macOS] needs a flipped, layer-backed view
|
|
848
848
|
}
|
|
849
849
|
}
|
|
850
850
|
|
|
@@ -22,7 +22,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
22
22
|
/**
|
|
23
23
|
* UIView class for <View> component.
|
|
24
24
|
*/
|
|
25
|
-
@interface RCTViewComponentView :
|
|
25
|
+
@interface RCTViewComponentView : RCTUIView <RCTComponentViewProtocol, RCTTouchableComponentViewProtocol> { // [macOS] concrete flipped, layer-backed view; UIView is an alias for NSView
|
|
26
26
|
@protected
|
|
27
27
|
facebook::react::LayoutMetrics _layoutMetrics;
|
|
28
28
|
facebook::react::SharedViewProps _props;
|
|
@@ -916,7 +916,7 @@ static RCTBorderStyle RCTBorderStyleFromOutlineStyle(OutlineStyle outlineStyle)
|
|
|
916
916
|
if (self.styleNeedsSwiftUIContainer) {
|
|
917
917
|
if (_swiftUIWrapper == nullptr) {
|
|
918
918
|
_swiftUIWrapper = [RCTSwiftUIContainerViewWrapper new];
|
|
919
|
-
UIView *swiftUIContentView = [[
|
|
919
|
+
UIView *swiftUIContentView = [[RCTUIView alloc] init]; // [macOS] needs a flipped, layer-backed view
|
|
920
920
|
for (UIView *subview = nullptr in self.subviews) {
|
|
921
921
|
[swiftUIContentView addSubview:subview];
|
|
922
922
|
}
|
|
@@ -960,7 +960,7 @@ static RCTBorderStyle RCTBorderStyleFromOutlineStyle(OutlineStyle outlineStyle)
|
|
|
960
960
|
|
|
961
961
|
if (_useCustomContainerView) {
|
|
962
962
|
if (!_containerView) {
|
|
963
|
-
_containerView = [[
|
|
963
|
+
_containerView = [[RCTUIView alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height)]; // [macOS] needs a flipped, layer-backed view
|
|
964
964
|
for (UIView *subview = nullptr in effectiveContentView.subviews) {
|
|
965
965
|
[_containerView addSubview:subview];
|
|
966
966
|
}
|
|
@@ -21,7 +21,7 @@ class RCTComponentViewDescriptor final {
|
|
|
21
21
|
/*
|
|
22
22
|
* Associated (and owned) native view instance.
|
|
23
23
|
*/
|
|
24
|
-
__strong
|
|
24
|
+
__strong RCTUIView<RCTComponentViewProtocol> *const view = nil; // [macOS] see RCTComponentViewRegistry.h
|
|
25
25
|
|
|
26
26
|
/*
|
|
27
27
|
* Indicates a requirement to call on the view methods from
|
|
@@ -48,7 +48,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
48
48
|
* Finds a native component view by given `tag`.
|
|
49
49
|
* Returns `nil` if there is no registered component with the `tag`.
|
|
50
50
|
*/
|
|
51
|
-
- (nullable
|
|
51
|
+
- (nullable RCTUIView<RCTComponentViewProtocol> *)findComponentViewWithTag:(facebook::react::Tag)tag; // [macOS] every component view derives from RCTUIView, and third-party Fabric code is written against that signature
|
|
52
52
|
|
|
53
53
|
@end
|
|
54
54
|
|
|
@@ -178,7 +178,7 @@
|
|
|
178
178
|
|
|
179
179
|
- (UIView *)tableView:(__unused UITableView *)tableView viewForHeaderInSection:(NSInteger)section
|
|
180
180
|
{
|
|
181
|
-
UIView *header = [
|
|
181
|
+
UIView *header = [RCTUIView new]; // [macOS] needs a flipped, layer-backed view
|
|
182
182
|
header.backgroundColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
|
|
183
183
|
|
|
184
184
|
UILabel *headerLabel = [UILabel new];
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
continue;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
UIView *box = [[
|
|
74
|
+
UIView *box = [[RCTUIView alloc] initWithFrame:rect]; // [macOS] needs a flipped, layer-backed view
|
|
75
75
|
box.backgroundColor = [UIColor clearColor];
|
|
76
76
|
|
|
77
77
|
box.layer.borderWidth = 2.0f;
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
for (NSDictionary *rectangle in rectangles) {
|
|
103
|
-
UIView *view = [[
|
|
103
|
+
UIView *view = [[RCTUIView alloc] initWithFrame:[RCTConvert CGRect:rectangle]]; // [macOS] needs a flipped, layer-backed view
|
|
104
104
|
view.backgroundColor = [UIColor colorWithRed:200 / 255.0 green:230 / 255.0 blue:255 / 255.0 alpha:0.8];
|
|
105
105
|
|
|
106
106
|
[self addSubview:view];
|
package/React/Views/RCTView.h
CHANGED
|
@@ -17,7 +17,7 @@ extern const UIAccessibilityTraits SwitchAccessibilityTrait;
|
|
|
17
17
|
|
|
18
18
|
@protocol RCTAutoInsetsProtocol;
|
|
19
19
|
|
|
20
|
-
@interface RCTView :
|
|
20
|
+
@interface RCTView : RCTUIView // [macOS] concrete flipped, layer-backed view; UIView is an alias for NSView
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Accessibility event handlers
|
|
@@ -74,7 +74,7 @@ static BOOL RCTFindScrollViewAndRefreshContentInsetInView(UIView *view)
|
|
|
74
74
|
// Add a wrapper so that the wrapper view managed by the
|
|
75
75
|
// UINavigationController doesn't end up resetting the frames for
|
|
76
76
|
//`contentView` which is a react-managed view.
|
|
77
|
-
_wrapperView = [[
|
|
77
|
+
_wrapperView = [[RCTUIView alloc] initWithFrame:_contentView.bounds]; // [macOS] needs a flipped, layer-backed view
|
|
78
78
|
[_wrapperView addSubview:_contentView];
|
|
79
79
|
self.view = _wrapperView;
|
|
80
80
|
}
|
package/React-Core.podspec
CHANGED
|
@@ -68,7 +68,6 @@ Pod::Spec.new do |s|
|
|
|
68
68
|
s# [macOS] SCDynamicStoreCopyComputerName, used by RCTInspectorUtils on macOS.
|
|
69
69
|
ss.osx.frameworks = "SystemConfiguration"
|
|
70
70
|
ss.source_files = podspec_sources("React/**/*.{c,h,m,mm,S,cpp}", "React/**/*.h")
|
|
71
|
-
ss.osx.exclude_files = macos_excluded_files # [macOS]
|
|
72
71
|
exclude_files = [
|
|
73
72
|
"React/CoreModules/**/*",
|
|
74
73
|
"React/DevSupport/**/*",
|
|
@@ -88,7 +87,6 @@ Pod::Spec.new do |s|
|
|
|
88
87
|
end
|
|
89
88
|
|
|
90
89
|
s.subspec "DevSupport" do |ss|
|
|
91
|
-
ss.osx.exclude_files = macos_excluded_files # [macOS]
|
|
92
90
|
ss.source_files = podspec_sources(["React/DevSupport/*.{h,mm,m}",
|
|
93
91
|
"React/Inspector/*.{h,mm,m}"],
|
|
94
92
|
["React/DevSupport/*.h",
|
|
@@ -15,12 +15,16 @@
|
|
|
15
15
|
* transitive import supplies them. A build flag fixes all of those at
|
|
16
16
|
* once, with no upstream edit.
|
|
17
17
|
*
|
|
18
|
-
* 2. On every platform, define the
|
|
18
|
+
* 2. On every platform, define the platform types:
|
|
19
19
|
*
|
|
20
|
-
* RCTPlatformView iOS: UIView macOS:
|
|
20
|
+
* RCTPlatformView iOS: UIView macOS: NSView (pointer type)
|
|
21
|
+
* RCTUIView iOS: UIView macOS: flipped, layer-backed NSView
|
|
21
22
|
* RCTPlatformDisplayLink iOS: CADisplayLink macOS: CADisplayLink on 14+, NSTimer below
|
|
22
23
|
* RCTPlatformTouchesForEvent iOS: -allTouches macOS: synthesised from NSEvent
|
|
23
24
|
*
|
|
25
|
+
* The RCTPlatformView / RCTUIView split matches react-native-macos, so
|
|
26
|
+
* modules written against that fork compile here unchanged.
|
|
27
|
+
*
|
|
24
28
|
* Both are aliases on iOS, so those builds gain two names and change in no
|
|
25
29
|
* other way. Upstream already uses the RCTPlatformDisplayLink name itself:
|
|
26
30
|
* RCTAnimatedModuleProvider.mm ships a TARGET_OS_OSX branch for it.
|
|
@@ -37,7 +41,7 @@
|
|
|
37
41
|
|
|
38
42
|
#if TARGET_OS_OSX
|
|
39
43
|
|
|
40
|
-
// Resolves to macos/UIKitCompat/UIKit/UIKit.h, which declares
|
|
44
|
+
// Resolves to macos/UIKitCompat/UIKit/UIKit.h, which declares both names.
|
|
41
45
|
#import <UIKit/UIKit.h>
|
|
42
46
|
|
|
43
47
|
#else
|
|
@@ -46,8 +50,9 @@
|
|
|
46
50
|
|
|
47
51
|
#import <QuartzCore/QuartzCore.h>
|
|
48
52
|
|
|
49
|
-
// On iOS, tvOS and visionOS
|
|
53
|
+
// On iOS, tvOS and visionOS both names are simply UIView.
|
|
50
54
|
@compatibility_alias RCTPlatformView UIView;
|
|
55
|
+
@compatibility_alias RCTUIView UIView;
|
|
51
56
|
@compatibility_alias RCTPlatformDisplayLink CADisplayLink;
|
|
52
57
|
|
|
53
58
|
// -[UIEvent allTouches] is unavailable under its own name on macOS, because
|
|
@@ -42,9 +42,17 @@ Pod::Spec.new do |s|
|
|
|
42
42
|
|
|
43
43
|
# Consumers reach the shim as <UIKit/UIKit.h>. That requires the *parent* of
|
|
44
44
|
# the UIKit directory on the search path, not the directory itself.
|
|
45
|
+
# DEFINES_MODULE is deliberately off. Turning it on makes CocoaPods emit a
|
|
46
|
+
# clang module map declaring `module UIKit`, and a module by that name on
|
|
47
|
+
# macOS poisons Swift's explicit-module graph: AuthenticationServices fails to
|
|
48
|
+
# precompile because ASFoundation.h resolves the wrong branch of its
|
|
49
|
+
# UIKit-versus-AppKit probe.
|
|
50
|
+
#
|
|
51
|
+
# Nothing needs the module. `#import <UIKit/UIKit.h>` is satisfied by the
|
|
52
|
+
# header *directory* being on the search path, which is what the line below
|
|
53
|
+
# does -- the parent of UIKit/, not UIKit/ itself.
|
|
45
54
|
s.pod_target_xcconfig = {
|
|
46
|
-
"HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)\""
|
|
47
|
-
"DEFINES_MODULE" => "YES"
|
|
55
|
+
"HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)\""
|
|
48
56
|
}
|
|
49
57
|
# No user_target_xcconfig. The app reaches these headers through the
|
|
50
58
|
# `post_install` hook in its Podfile, which is required anyway to force-include
|
|
@@ -140,4 +140,17 @@ extern NSString *const UIKeyboardAnimationDurationUserInfoKey;
|
|
|
140
140
|
extern NSString *const UIKeyboardAnimationCurveUserInfoKey;
|
|
141
141
|
extern NSString *const UIKeyboardIsLocalUserInfoKey;
|
|
142
142
|
|
|
143
|
+
/**
|
|
144
|
+
* A window delegate, which is the closest AppKit has to a scene delegate. macOS
|
|
145
|
+
* has no scene lifecycle, so this is the protocol's shape and nothing more.
|
|
146
|
+
* expo-modules-core declares it in its own macOS header; having it here means
|
|
147
|
+
* that header can defer to this one wholesale.
|
|
148
|
+
*/
|
|
149
|
+
@protocol UISceneDelegate <NSWindowDelegate>
|
|
150
|
+
@end
|
|
151
|
+
|
|
152
|
+
// No UIHostingController. NSHostingController is a Swift-only type -- SwiftUI
|
|
153
|
+
// does not vend it to Objective-C -- so there is nothing to alias it to. Code
|
|
154
|
+
// that needs a hosting controller has to reach it from Swift.
|
|
155
|
+
|
|
143
156
|
NS_ASSUME_NONNULL_END
|
|
@@ -477,7 +477,7 @@
|
|
|
477
477
|
- (NSView *)contentView
|
|
478
478
|
{
|
|
479
479
|
if (_contentView == nil) {
|
|
480
|
-
_contentView = [[
|
|
480
|
+
_contentView = [[RCTUIView alloc] initWithFrame:self.bounds];
|
|
481
481
|
_contentView.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
|
|
482
482
|
[self addSubview:_contentView];
|
|
483
483
|
}
|
|
@@ -60,6 +60,18 @@ typedef NS_ENUM(NSInteger, UITouchType) {
|
|
|
60
60
|
- (CGVector)azimuthUnitVectorInView:(nullable NSView *)view;
|
|
61
61
|
@property (nonatomic, readonly) CGFloat maximumPossibleForce;
|
|
62
62
|
|
|
63
|
+
/**
|
|
64
|
+
* The touch location in window coordinates, bottom-left origin -- AppKit's
|
|
65
|
+
* convention, not UIKit's.
|
|
66
|
+
*
|
|
67
|
+
* UITouch has no such member; -locationInView: is the UIKit spelling. It is
|
|
68
|
+
* here because react-native-macos makes its RCTUITouch an NSEvent subclass, so
|
|
69
|
+
* every module written against that fork reaches for NSEvent's
|
|
70
|
+
* -locationInWindow on a touch. react-native-gesture-handler does it in three
|
|
71
|
+
* places. The value is already captured at init, so exposing it costs nothing.
|
|
72
|
+
*/
|
|
73
|
+
@property (nonatomic, readonly) CGPoint locationInWindow;
|
|
74
|
+
|
|
63
75
|
- (instancetype)initWithEvent:(NSEvent *)event phase:(UITouchPhase)phase view:(nullable NSView *)view;
|
|
64
76
|
|
|
65
77
|
- (CGPoint)locationInView:(nullable NSView *)view;
|
|
@@ -9,10 +9,13 @@
|
|
|
9
9
|
|
|
10
10
|
@implementation UITouch {
|
|
11
11
|
NSEvent *_event;
|
|
12
|
-
CGPoint _locationInWindow;
|
|
13
12
|
CGPoint _previousLocationInWindow;
|
|
14
13
|
}
|
|
15
14
|
|
|
15
|
+
// _locationInWindow is now the backing store for the readonly property, so the
|
|
16
|
+
// compiler synthesises the ivar.
|
|
17
|
+
@synthesize locationInWindow = _locationInWindow;
|
|
18
|
+
|
|
16
19
|
- (instancetype)initWithEvent:(NSEvent *)event phase:(UITouchPhase)phase view:(NSView *)view
|
|
17
20
|
{
|
|
18
21
|
if ((self = [super init])) {
|
|
@@ -218,7 +218,7 @@ typedef NS_ENUM(NSInteger, UIImageResizingMode) {
|
|
|
218
218
|
|
|
219
219
|
@interface NSView (UIKitCompatCallbacks)
|
|
220
220
|
// UIKit lifecycle hooks with no AppKit counterpart. Declared so any view can be
|
|
221
|
-
// sent them;
|
|
221
|
+
// sent them; RCTUIView drives the trait one from -viewDidChangeEffectiveAppearance.
|
|
222
222
|
- (void)safeAreaInsetsDidChange;
|
|
223
223
|
- (void)traitCollectionDidChange:(nullable id)previousTraitCollection;
|
|
224
224
|
- (CGSize)sizeThatFits:(CGSize)size;
|
|
@@ -402,7 +402,21 @@ static NSAppearance *_Nullable UIKitCompatAppearanceForStyle(UIUserInterfaceStyl
|
|
|
402
402
|
|
|
403
403
|
- (void)setRootViewController:(NSViewController *)rootViewController
|
|
404
404
|
{
|
|
405
|
+
// Assigning -contentViewController makes NSWindow resize itself to fit that
|
|
406
|
+
// controller's view. UIWindow does the opposite: the window keeps its frame
|
|
407
|
+
// and the root view is stretched to fill it.
|
|
408
|
+
//
|
|
409
|
+
// React Native's root view has no useful size when it is installed -- Fabric
|
|
410
|
+
// has not laid anything out yet -- so the AppKit behaviour collapses the
|
|
411
|
+
// window to a point, and the app runs with nothing on screen. Keep the frame
|
|
412
|
+
// the caller chose, and let the view follow it.
|
|
413
|
+
NSRect frame = self.frame;
|
|
405
414
|
self.contentViewController = rootViewController;
|
|
415
|
+
if (!NSIsEmptyRect(frame)) {
|
|
416
|
+
[self setFrame:frame display:YES];
|
|
417
|
+
rootViewController.view.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
|
|
418
|
+
rootViewController.view.frame = self.contentLayoutRect;
|
|
419
|
+
}
|
|
406
420
|
}
|
|
407
421
|
|
|
408
422
|
- (instancetype)initWithWindowScene:(__unused id)windowScene
|
|
@@ -559,7 +573,7 @@ static NSAppearance *_Nullable UIKitCompatAppearanceForStyle(UIUserInterfaceStyl
|
|
|
559
573
|
|
|
560
574
|
- (void)traitCollectionDidChange:(__unused id)previousTraitCollection
|
|
561
575
|
{
|
|
562
|
-
// Driven by -viewDidChangeEffectiveAppearance on
|
|
576
|
+
// Driven by -viewDidChangeEffectiveAppearance on RCTUIView.
|
|
563
577
|
}
|
|
564
578
|
|
|
565
579
|
- (CGSize)sizeThatFits:(CGSize)size
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* Per-class forwarding header, matching real UIKit's layout.
|
|
8
|
+
*
|
|
9
|
+
* UIKit ships one header per class, and code probes for them by name to decide
|
|
10
|
+
* which platform it is on. Apple's own SDK does it -- AuthenticationServices
|
|
11
|
+
* takes its UIKit branch on `__has_include(<UIKit/UIKit.h>)`, then asks for
|
|
12
|
+
* <UIKit/UIViewController.h> and <UIKit/UIWindow.h> to decide what
|
|
13
|
+
* ASViewController and ASPresentationAnchor are. With the umbrella present but
|
|
14
|
+
* those absent, it takes the UIKit branch and then defines neither, and the
|
|
15
|
+
* framework fails to compile.
|
|
16
|
+
*
|
|
17
|
+
* So the rule is: this directory carries a per-class header for exactly the
|
|
18
|
+
* classes the shim defines, and for no others. A probe for something we do not
|
|
19
|
+
* have must keep failing, or the caller is told a lie.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
#pragma once
|
|
23
|
+
|
|
24
|
+
#import <UIKit/UIKit.h>
|
|
@@ -86,10 +86,23 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
86
86
|
*
|
|
87
87
|
* What the alias cannot carry is behaviour. A plain NSView is not flipped, is
|
|
88
88
|
* not layer-backed, and has no -layoutSubviews. Views that React Native
|
|
89
|
-
* creates itself need all three, and they get them from
|
|
89
|
+
* creates itself need all three, and they get them from RCTUIView below.
|
|
90
90
|
*/
|
|
91
91
|
@compatibility_alias UIView NSView;
|
|
92
92
|
|
|
93
|
+
/**
|
|
94
|
+
* `RCTPlatformView` is the name react-native-macos gives to "whatever a view is
|
|
95
|
+
* on this platform", and published macOS modules use it as a pointer type --
|
|
96
|
+
* react-native-reanimated assigns an `NSView<RCTComponentViewProtocol> *` to
|
|
97
|
+
* one. It has to mean NSView, not a subclass, or that assignment does not
|
|
98
|
+
* compile.
|
|
99
|
+
*
|
|
100
|
+
* So the two names divide the same way they do in react-native-macos:
|
|
101
|
+
* `RCTPlatformView` is the pointer type, `RCTUIView` is the concrete class.
|
|
102
|
+
* Here `UIView` is a third spelling of the first one.
|
|
103
|
+
*/
|
|
104
|
+
@compatibility_alias RCTPlatformView NSView;
|
|
105
|
+
|
|
93
106
|
/**
|
|
94
107
|
* The concrete view class for anything React Native instantiates or subclasses.
|
|
95
108
|
*
|
|
@@ -103,19 +116,19 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
103
116
|
* Upstream uses this name in exactly two positions, and never as a pointer
|
|
104
117
|
* type:
|
|
105
118
|
*
|
|
106
|
-
* @interface RCTView :
|
|
107
|
-
* [[
|
|
119
|
+
* @interface RCTView : RCTUIView // superclass
|
|
120
|
+
* [[RCTUIView alloc] initWithFrame:f] // instantiation
|
|
108
121
|
*
|
|
109
122
|
* Everything else keeps saying `UIView *`. That restriction is what keeps this
|
|
110
123
|
* to about 20 upstream files instead of the 538 that react-native-macos edits,
|
|
111
124
|
* and macos/ci/check-budget.sh enforces it.
|
|
112
125
|
*/
|
|
113
|
-
@interface
|
|
126
|
+
@interface RCTUIView : NSView
|
|
114
127
|
|
|
115
128
|
// NSView already provides -clipsToBounds (10.9+), so it is not redeclared here.
|
|
116
129
|
|
|
117
130
|
// UIKit subclasses override -canBecomeFirstResponder and expect the framework
|
|
118
|
-
// to honour it.
|
|
131
|
+
// to honour it. RCTUIView bridges that to AppKit's
|
|
119
132
|
// -acceptsFirstResponder, and terminates the chain at NSView's own
|
|
120
133
|
// implementation rather than bouncing back through the category.
|
|
121
134
|
@property (nonatomic, readonly) BOOL canBecomeFirstResponder;
|
|
@@ -289,9 +289,9 @@ static const void *kContentModeKey = &kContentModeKey;
|
|
|
289
289
|
|
|
290
290
|
@end
|
|
291
291
|
|
|
292
|
-
#pragma mark -
|
|
292
|
+
#pragma mark - RCTUIView
|
|
293
293
|
|
|
294
|
-
@implementation
|
|
294
|
+
@implementation RCTUIView {
|
|
295
295
|
UIColor *_backgroundColor;
|
|
296
296
|
BOOL _respondsToDisplayLayer;
|
|
297
297
|
BOOL _hasCustomTransform3D;
|
|
@@ -316,7 +316,7 @@ static const void *kContentModeKey = &kContentModeKey;
|
|
|
316
316
|
return keyPaths;
|
|
317
317
|
}
|
|
318
318
|
|
|
319
|
-
static
|
|
319
|
+
static RCTUIView *RCTUIViewCommonInit(RCTUIView *self)
|
|
320
320
|
{
|
|
321
321
|
if (self != nil) {
|
|
322
322
|
self.wantsLayer = YES;
|
|
@@ -330,12 +330,12 @@ static RCTPlatformView *RCTPlatformViewCommonInit(RCTPlatformView *self)
|
|
|
330
330
|
|
|
331
331
|
- (instancetype)initWithFrame:(NSRect)frameRect
|
|
332
332
|
{
|
|
333
|
-
return
|
|
333
|
+
return RCTUIViewCommonInit([super initWithFrame:frameRect]);
|
|
334
334
|
}
|
|
335
335
|
|
|
336
336
|
- (instancetype)initWithCoder:(NSCoder *)coder
|
|
337
337
|
{
|
|
338
|
-
return
|
|
338
|
+
return RCTUIViewCommonInit([super initWithCoder:coder]);
|
|
339
339
|
}
|
|
340
340
|
|
|
341
341
|
// UIKit's origin is top-left. Everything React Native computes assumes it.
|
|
@@ -369,10 +369,28 @@ static RCTPlatformView *RCTPlatformViewCommonInit(RCTPlatformView *self)
|
|
|
369
369
|
frame.origin.x = center.x - bounds.size.width / 2;
|
|
370
370
|
frame.origin.y = center.y - bounds.size.height / 2;
|
|
371
371
|
[super setFrame:frame];
|
|
372
|
+
|
|
373
|
+
// UIKit calls -layoutSubviews whenever a view's bounds change. AppKit calls
|
|
374
|
+
// -layout only when the view is marked as needing it, so a size change
|
|
375
|
+
// alone never reaches -layoutSubviews. Components that recompute on resize
|
|
376
|
+
// silently stop: react-native-safe-area-context measures its insets there,
|
|
377
|
+
// and until it reports them SafeAreaProvider renders no children at all.
|
|
378
|
+
self.needsLayout = YES;
|
|
372
379
|
}
|
|
373
380
|
[super setBounds:NSMakeRect(bounds.origin.x, bounds.origin.y, bounds.size.width, bounds.size.height)];
|
|
374
381
|
}
|
|
375
382
|
|
|
383
|
+
- (void)setFrameSize:(NSSize)newSize
|
|
384
|
+
{
|
|
385
|
+
BOOL changed = !NSEqualSizes(self.frame.size, newSize);
|
|
386
|
+
[super setFrameSize:newSize];
|
|
387
|
+
if (changed) {
|
|
388
|
+
// Same reason as -setBounds:. Fabric assigns frames directly in places, so
|
|
389
|
+
// both paths have to mark the view.
|
|
390
|
+
self.needsLayout = YES;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
|
|
376
394
|
- (BOOL)acceptsFirstMouse:(NSEvent *)event
|
|
377
395
|
{
|
|
378
396
|
if (_acceptsFirstMouse || [super acceptsFirstMouse:event]) {
|
|
@@ -381,7 +399,7 @@ static RCTPlatformView *RCTPlatformViewCommonInit(RCTPlatformView *self)
|
|
|
381
399
|
// Honour the flag if any ancestor set it, so a whole subtree can opt in.
|
|
382
400
|
NSView *view = self;
|
|
383
401
|
while ((view = view.superview)) {
|
|
384
|
-
if ([view isKindOfClass:[
|
|
402
|
+
if ([view isKindOfClass:[RCTUIView class]] && ((RCTUIView *)view).acceptsFirstMouse) {
|
|
385
403
|
return YES;
|
|
386
404
|
}
|
|
387
405
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* Per-class forwarding header, matching real UIKit's layout.
|
|
8
|
+
*
|
|
9
|
+
* UIKit ships one header per class, and code probes for them by name to decide
|
|
10
|
+
* which platform it is on. Apple's own SDK does it -- AuthenticationServices
|
|
11
|
+
* takes its UIKit branch on `__has_include(<UIKit/UIKit.h>)`, then asks for
|
|
12
|
+
* <UIKit/UIViewController.h> and <UIKit/UIWindow.h> to decide what
|
|
13
|
+
* ASViewController and ASPresentationAnchor are. With the umbrella present but
|
|
14
|
+
* those absent, it takes the UIKit branch and then defines neither, and the
|
|
15
|
+
* framework fails to compile.
|
|
16
|
+
*
|
|
17
|
+
* So the rule is: this directory carries a per-class header for exactly the
|
|
18
|
+
* classes the shim defines, and for no others. A probe for something we do not
|
|
19
|
+
* have must keep failing, or the caller is told a lie.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
#pragma once
|
|
23
|
+
|
|
24
|
+
#import <UIKit/UIKit.h>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* Per-class forwarding header, matching real UIKit's layout.
|
|
8
|
+
*
|
|
9
|
+
* UIKit ships one header per class, and code probes for them by name to decide
|
|
10
|
+
* which platform it is on. Apple's own SDK does it -- AuthenticationServices
|
|
11
|
+
* takes its UIKit branch on `__has_include(<UIKit/UIKit.h>)`, then asks for
|
|
12
|
+
* <UIKit/UIViewController.h> and <UIKit/UIWindow.h> to decide what
|
|
13
|
+
* ASViewController and ASPresentationAnchor are. With the umbrella present but
|
|
14
|
+
* those absent, it takes the UIKit branch and then defines neither, and the
|
|
15
|
+
* framework fails to compile.
|
|
16
|
+
*
|
|
17
|
+
* So the rule is: this directory carries a per-class header for exactly the
|
|
18
|
+
* classes the shim defines, and for no others. A probe for something we do not
|
|
19
|
+
* have must keep failing, or the caller is told a lie.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
#pragma once
|
|
23
|
+
|
|
24
|
+
#import <UIKit/UIKit.h>
|
|
@@ -1,43 +1,22 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Files macos/scripts/syntax-check.sh does not attempt to parse.
|
|
2
2
|
#
|
|
3
|
-
#
|
|
4
|
-
#
|
|
3
|
+
# This is the syntax checker's list of known-hard files, and nothing else. It
|
|
4
|
+
# used to be wired into React-Core.podspec and React-CoreModules.podspec as
|
|
5
|
+
# `osx.exclude_files` too, which was wrong twice over:
|
|
5
6
|
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
7
|
+
# - It never took effect. `s.macos` and `s.osx` are the same platform proxy,
|
|
8
|
+
# and React-CoreModules assigns `s.macos.exclude_files` further down, which
|
|
9
|
+
# silently replaced it. Every file listed here was being compiled anyway.
|
|
10
|
+
# - Making it take effect breaks the link. RCTDevMenu, RCTActionSheetManager
|
|
11
|
+
# and RCTPerfMonitor are all referenced from CoreModulesPlugins.mm and from
|
|
12
|
+
# RCTRootViewFactory, so dropping them leaves undefined symbols.
|
|
9
13
|
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
# no macOS concept the feature does not exist on the platform
|
|
13
|
-
# deferred it exists and we intend to port it, just not yet
|
|
14
|
-
|
|
15
|
-
# --- no macOS concept ---------------------------------------------------------
|
|
14
|
+
# They compile on macOS regardless, which is the useful discovery. So the list
|
|
15
|
+
# stays advisory: it marks what the checker skips, not what the build omits.
|
|
16
16
|
|
|
17
|
-
# Remote/local notifications route through UserNotifications and an app
|
|
18
|
-
# delegate shape macOS does not share.
|
|
19
17
|
Libraries/PushNotificationIOS/
|
|
20
|
-
|
|
21
|
-
# No haptics.
|
|
22
18
|
Libraries/Vibration/
|
|
23
|
-
|
|
24
|
-
# No status bar. The menu bar is not a per-app, per-window equivalent.
|
|
25
19
|
React/CoreModules/RCTStatusBarManager
|
|
26
|
-
|
|
27
|
-
# UIActivityViewController has no AppKit counterpart; a Mac would use NSMenu or
|
|
28
|
-
# NSSharingServicePicker, which is a different API, not a port.
|
|
29
20
|
React/CoreModules/RCTActionSheetManager
|
|
30
|
-
|
|
31
|
-
# --- deferred -----------------------------------------------------------------
|
|
32
|
-
#
|
|
33
|
-
# Dev-surface UI. A window-and-chrome port rather than framework work, and not
|
|
34
|
-
# needed to render an app.
|
|
35
|
-
#
|
|
36
|
-
# RedBox is deliberately NOT here. It was excluded at first, but excluding half
|
|
37
|
-
# of it broke the other half: RCTRedBox.mm imports the extra-data view
|
|
38
|
-
# controller's header, which lived in a different pod and so a different
|
|
39
|
-
# exclusion. Completing the UITableView shim was less work than splitting the
|
|
40
|
-
# exclusion correctly, and it keeps the error overlay -- which is worth having.
|
|
41
|
-
|
|
42
21
|
React/CoreModules/RCTDevMenu
|
|
43
22
|
React/CoreModules/RCTPerfMonitor
|