react-native-macos 0.72.15 → 0.72.16
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/AppDelegate/RCTAppDelegate.h +2 -1
- package/Libraries/AppDelegate/RCTAppDelegate.mm +17 -1
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Image/RCTUIImageViewAnimated.m +0 -5
- package/Libraries/Network/React-RCTNetwork.podspec +4 -1
- package/Libraries/PushNotificationIOS/RCTPushNotificationManager.h +2 -2
- package/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm +9 -111
- package/Libraries/Text/React-RCTText.podspec +1 -0
- package/Libraries/Text/Text/RCTTextView.m +7 -15
- package/Libraries/Text/TextInput/RCTBaseTextInputView.m +2 -6
- package/Libraries/Text/TextInput/Singleline/macOS/RCTUISecureTextField.h +3 -0
- package/Libraries/Text/TextInput/Singleline/macOS/RCTUISecureTextField.m +2 -0
- package/React/Base/RCTConstants.h +2 -0
- package/React/Base/RCTConstants.m +2 -0
- package/React/Base/RCTConvert.m +2 -0
- package/React/Base/RCTKeyCommands.m +5 -1
- package/React/Base/RCTRootContentView.m +2 -6
- package/React/Base/RCTUIKit.h +4 -2
- package/React/Base/RCTUtils.h +8 -3
- package/React/Base/RCTUtils.m +19 -3
- package/React/Base/RCTVersion.m +1 -1
- package/React/Base/macOS/RCTUIKit.m +8 -4
- package/React/CoreModules/RCTDeviceInfo.h +0 -7
- package/React/CoreModules/RCTDeviceInfo.mm +41 -47
- package/React/CoreModules/RCTPerfMonitor.mm +7 -1
- package/React/CoreModules/RCTRedBox.mm +6 -0
- package/React/CoreModules/RCTStatusBarManager.mm +50 -15
- package/React/CoreModules/React-CoreModules.podspec +1 -1
- package/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.mm +8 -0
- package/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.mm +4 -0
- package/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.mm +8 -0
- package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +6 -4
- package/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm +7 -15
- package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +3 -1
- package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm +2 -2
- package/React/Fabric/RCTSurfacePointerHandler.mm +8 -1
- package/React/Fabric/RCTSurfaceTouchHandler.mm +4 -0
- package/React/Modules/RCTUIManager.m +4 -2
- package/React/UIUtils/RCTUIUtils.h +0 -4
- package/React/UIUtils/RCTUIUtils.m +39 -45
- package/React/Views/RCTActivityIndicatorView.m +8 -4
- package/React/Views/RCTActivityIndicatorViewManager.m +11 -1
- package/React/Views/RCTModalHostView.m +2 -0
- package/React/Views/RCTModalHostViewController.m +8 -0
- package/React/Views/RCTWrapperViewController.m +2 -0
- package/React/Views/ScrollView/RCTScrollView.m +4 -0
- package/React/Views/ScrollView/RCTScrollViewManager.h +2 -0
- package/React/Views/ScrollView/RCTScrollViewManager.m +4 -2
- package/React-Core.podspec +1 -1
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
- package/ReactAndroid/src/main/jni/third-party/fmt/CMakeLists.txt +1 -1
- package/ReactCommon/React-Fabric.podspec +1 -0
- package/ReactCommon/ReactCommon.podspec +1 -0
- package/ReactCommon/cxxreact/React-cxxreact.podspec +1 -0
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/ReactCommon/hermes/React-hermes.podspec +1 -0
- package/ReactCommon/jsi/React-jsi.podspec +1 -0
- package/ReactCommon/jsiexecutor/React-jsiexecutor.podspec +1 -0
- package/ReactCommon/react/nativemodule/samples/platform/ios/ReactCommon/RCTSampleTurboModule.mm +4 -0
- package/package.json +1 -1
- package/scripts/react_native_pods.rb +2 -0
- package/template/package.json +1 -1
- package/third-party-podspecs/RCT-Folly.podspec +1 -1
- package/third-party-podspecs/SocketRocket.podspec +30 -0
- package/third-party-podspecs/fmt.podspec +25 -0
|
@@ -28,12 +28,11 @@ using namespace facebook::react;
|
|
|
28
28
|
@implementation RCTDeviceInfo {
|
|
29
29
|
#if !TARGET_OS_OSX // [macOS]
|
|
30
30
|
UIInterfaceOrientation _currentInterfaceOrientation;
|
|
31
|
+
#endif // [macOS]
|
|
31
32
|
NSDictionary *_currentInterfaceDimensions;
|
|
32
33
|
BOOL _isFullscreen;
|
|
33
|
-
#endif // [macOS]
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
@synthesize bridge = _bridge;
|
|
37
36
|
@synthesize moduleRegistry = _moduleRegistry;
|
|
38
37
|
|
|
39
38
|
RCT_EXPORT_MODULE()
|
|
@@ -56,31 +55,40 @@ RCT_EXPORT_MODULE()
|
|
|
56
55
|
name:RCTAccessibilityManagerDidUpdateMultiplierNotification
|
|
57
56
|
object:[_moduleRegistry moduleForName:"AccessibilityManager"]];
|
|
58
57
|
|
|
58
|
+
#if TARGET_OS_IOS // [visionOS]
|
|
59
59
|
_currentInterfaceOrientation = [RCTSharedApplication() statusBarOrientation];
|
|
60
60
|
|
|
61
61
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
62
62
|
selector:@selector(interfaceOrientationDidChange)
|
|
63
63
|
name:UIApplicationDidChangeStatusBarOrientationNotification
|
|
64
64
|
object:nil];
|
|
65
|
+
#endif // [visionOS]
|
|
66
|
+
#endif // [macOS]
|
|
65
67
|
|
|
66
|
-
_currentInterfaceDimensions =
|
|
68
|
+
_currentInterfaceDimensions = [self _exportedDimensions];
|
|
67
69
|
|
|
70
|
+
#if TARGET_OS_IOS // [macOS] [visionOS]
|
|
68
71
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
69
72
|
selector:@selector(interfaceOrientationDidChange)
|
|
70
73
|
name:UIApplicationDidBecomeActiveNotification
|
|
71
74
|
object:nil];
|
|
75
|
+
#endif // [macOS] [visionOS]
|
|
72
76
|
|
|
73
77
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
74
78
|
selector:@selector(interfaceFrameDidChange)
|
|
75
79
|
name:RCTUserInterfaceStyleDidChangeNotification
|
|
76
80
|
object:nil];
|
|
77
|
-
|
|
81
|
+
|
|
82
|
+
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
83
|
+
selector:@selector(interfaceFrameDidChange)
|
|
84
|
+
name:RCTWindowFrameDidChangeNotification
|
|
85
|
+
object:nil];
|
|
78
86
|
}
|
|
79
87
|
|
|
80
88
|
static BOOL RCTIsIPhoneX()
|
|
81
89
|
{
|
|
82
90
|
static BOOL isIPhoneX = NO;
|
|
83
|
-
#if
|
|
91
|
+
#if TARGET_OS_IOS // [macOS] [visionOS]
|
|
84
92
|
static dispatch_once_t onceToken;
|
|
85
93
|
|
|
86
94
|
dispatch_once(&onceToken, ^{
|
|
@@ -100,31 +108,14 @@ static BOOL RCTIsIPhoneX()
|
|
|
100
108
|
CGSizeEqualToSize(screenSize, iPhone12ProMaxScreenSize);
|
|
101
109
|
;
|
|
102
110
|
});
|
|
103
|
-
#endif // [macOS]
|
|
111
|
+
#endif // [macOS] [visionOS]
|
|
104
112
|
return isIPhoneX;
|
|
105
113
|
}
|
|
106
114
|
|
|
107
|
-
|
|
108
|
-
static NSDictionary *RCTExportedDimensions(RCTModuleRegistry *moduleRegistry, RCTBridge *bridge)
|
|
109
|
-
#else // [macOS
|
|
110
|
-
NSDictionary *RCTExportedDimensions(RCTPlatformView *rootView, RCTBridge *bridge)
|
|
111
|
-
#endif // macOS]
|
|
115
|
+
static NSDictionary *RCTExportedDimensions(CGFloat fontScale)
|
|
112
116
|
{
|
|
113
117
|
RCTAssertMainQueue();
|
|
114
|
-
|
|
115
|
-
#if !TARGET_OS_OSX // [macOS]
|
|
116
|
-
RCTDimensions dimensions;
|
|
117
|
-
if (moduleRegistry) {
|
|
118
|
-
RCTAccessibilityManager *accessibilityManager =
|
|
119
|
-
(RCTAccessibilityManager *)[moduleRegistry moduleForName:"AccessibilityManager"];
|
|
120
|
-
dimensions = RCTGetDimensions(accessibilityManager ? accessibilityManager.multiplier : 1.0);
|
|
121
|
-
} else {
|
|
122
|
-
RCTAssert(false, @"ModuleRegistry must be set to properly init dimensions. Bridge exists: %d", bridge != nil);
|
|
123
|
-
}
|
|
124
|
-
#else // [macOS
|
|
125
|
-
RCTDimensions dimensions = RCTGetDimensions(rootView);
|
|
126
|
-
#endif // macOS]
|
|
127
|
-
|
|
118
|
+
RCTDimensions dimensions = RCTGetDimensions(fontScale);
|
|
128
119
|
__typeof(dimensions.window) window = dimensions.window;
|
|
129
120
|
NSDictionary<NSString *, NSNumber *> *dimsWindow = @{
|
|
130
121
|
@"width" : @(window.width),
|
|
@@ -142,6 +133,21 @@ NSDictionary *RCTExportedDimensions(RCTPlatformView *rootView, RCTBridge *bridge
|
|
|
142
133
|
return @{@"window" : dimsWindow, @"screen" : dimsScreen};
|
|
143
134
|
}
|
|
144
135
|
|
|
136
|
+
- (NSDictionary *)_exportedDimensions
|
|
137
|
+
{
|
|
138
|
+
RCTAssert(_moduleRegistry, @"ModuleRegistry must be set to properly init dimensions");
|
|
139
|
+
RCTAccessibilityManager *accessibilityManager =
|
|
140
|
+
(RCTAccessibilityManager *)[_moduleRegistry moduleForName:"AccessibilityManager"];
|
|
141
|
+
RCTAssert(accessibilityManager, @"Failed to get exported dimensions: AccessibilityManager is nil");
|
|
142
|
+
#if !TARGET_OS_OSX // [macOS]
|
|
143
|
+
CGFloat fontScale = accessibilityManager ? accessibilityManager.multiplier : 1.0;
|
|
144
|
+
#else // [macOS
|
|
145
|
+
CGFloat fontScale = 1.0;
|
|
146
|
+
#endif // macOS]
|
|
147
|
+
|
|
148
|
+
return RCTExportedDimensions(fontScale);
|
|
149
|
+
}
|
|
150
|
+
|
|
145
151
|
- (NSDictionary<NSString *, id> *)constantsToExport
|
|
146
152
|
{
|
|
147
153
|
return [self getConstants];
|
|
@@ -150,15 +156,10 @@ NSDictionary *RCTExportedDimensions(RCTPlatformView *rootView, RCTBridge *bridge
|
|
|
150
156
|
- (NSDictionary<NSString *, id> *)getConstants
|
|
151
157
|
{
|
|
152
158
|
__block NSDictionary<NSString *, id> *constants;
|
|
153
|
-
|
|
154
|
-
RCTBridge *bridge = _bridge;
|
|
159
|
+
__weak __typeof(self) weakSelf = self;
|
|
155
160
|
RCTUnsafeExecuteOnMainQueueSync(^{
|
|
156
161
|
constants = @{
|
|
157
|
-
|
|
158
|
-
@"Dimensions" : RCTExportedDimensions(moduleRegistry, bridge),
|
|
159
|
-
#else // [macOS
|
|
160
|
-
@"Dimensions": RCTExportedDimensions(nil, bridge),
|
|
161
|
-
#endif // macOS]
|
|
162
|
+
@"Dimensions" : [weakSelf _exportedDimensions],
|
|
162
163
|
// Note:
|
|
163
164
|
// This prop is deprecated and will be removed in a future release.
|
|
164
165
|
// Please use this only for a quick and temporary solution.
|
|
@@ -172,25 +173,19 @@ NSDictionary *RCTExportedDimensions(RCTPlatformView *rootView, RCTBridge *bridge
|
|
|
172
173
|
|
|
173
174
|
- (void)didReceiveNewContentSizeMultiplier
|
|
174
175
|
{
|
|
176
|
+
__weak __typeof(self) weakSelf = self;
|
|
175
177
|
RCTModuleRegistry *moduleRegistry = _moduleRegistry;
|
|
176
|
-
RCTBridge *bridge = _bridge;
|
|
177
178
|
RCTExecuteOnMainQueue(^{
|
|
178
179
|
// Report the event across the bridge.
|
|
179
180
|
#pragma clang diagnostic push
|
|
180
181
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
181
|
-
[[moduleRegistry moduleForName:"EventDispatcher"]
|
|
182
|
-
|
|
183
|
-
#if !TARGET_OS_OSX // [macOS]
|
|
184
|
-
body:RCTExportedDimensions(moduleRegistry, bridge)];
|
|
185
|
-
#else // [macOS
|
|
186
|
-
body:RCTExportedDimensions(nil, bridge)];
|
|
187
|
-
#endif // macOS]
|
|
182
|
+
[[moduleRegistry moduleForName:"EventDispatcher"] sendDeviceEventWithName:@"didUpdateDimensions"
|
|
183
|
+
body:[weakSelf _exportedDimensions]];
|
|
188
184
|
#pragma clang diagnostic pop
|
|
189
185
|
});
|
|
190
186
|
}
|
|
191
187
|
|
|
192
|
-
#if
|
|
193
|
-
|
|
188
|
+
#if TARGET_OS_IOS // [macOS] [visionOS]
|
|
194
189
|
- (void)interfaceOrientationDidChange
|
|
195
190
|
{
|
|
196
191
|
__weak __typeof(self) weakSelf = self;
|
|
@@ -222,9 +217,8 @@ NSDictionary *RCTExportedDimensions(RCTPlatformView *rootView, RCTBridge *bridge
|
|
|
222
217
|
if ((isOrientationChanging || isResizingOrChangingToFullscreen) && RCTIsAppActive()) {
|
|
223
218
|
#pragma clang diagnostic push
|
|
224
219
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
225
|
-
[[_moduleRegistry moduleForName:"EventDispatcher"]
|
|
226
|
-
|
|
227
|
-
body:RCTExportedDimensions(_moduleRegistry, _bridge)];
|
|
220
|
+
[[_moduleRegistry moduleForName:"EventDispatcher"] sendDeviceEventWithName:@"didUpdateDimensions"
|
|
221
|
+
body:[self _exportedDimensions]];
|
|
228
222
|
// We only want to track the current _currentInterfaceOrientation and _isFullscreen only
|
|
229
223
|
// when it happens and only when it is published.
|
|
230
224
|
_currentInterfaceOrientation = nextOrientation;
|
|
@@ -232,6 +226,7 @@ NSDictionary *RCTExportedDimensions(RCTPlatformView *rootView, RCTBridge *bridge
|
|
|
232
226
|
#pragma clang diagnostic pop
|
|
233
227
|
}
|
|
234
228
|
}
|
|
229
|
+
#endif // [macOS] [visionOS]
|
|
235
230
|
|
|
236
231
|
- (void)interfaceFrameDidChange
|
|
237
232
|
{
|
|
@@ -243,7 +238,7 @@ NSDictionary *RCTExportedDimensions(RCTPlatformView *rootView, RCTBridge *bridge
|
|
|
243
238
|
|
|
244
239
|
- (void)_interfaceFrameDidChange
|
|
245
240
|
{
|
|
246
|
-
NSDictionary *nextInterfaceDimensions =
|
|
241
|
+
NSDictionary *nextInterfaceDimensions = [self _exportedDimensions];
|
|
247
242
|
|
|
248
243
|
// update and publish the even only when the app is in active state
|
|
249
244
|
if (!([nextInterfaceDimensions isEqual:_currentInterfaceDimensions]) && RCTIsAppActive()) {
|
|
@@ -257,7 +252,6 @@ NSDictionary *RCTExportedDimensions(RCTPlatformView *rootView, RCTBridge *bridge
|
|
|
257
252
|
#pragma clang diagnostic pop
|
|
258
253
|
}
|
|
259
254
|
}
|
|
260
|
-
#endif // [macOS]
|
|
261
255
|
|
|
262
256
|
- (std::shared_ptr<TurboModule>)getTurboModule:(const ObjCTurboModule::InitParams &)params
|
|
263
257
|
{
|
|
@@ -211,7 +211,13 @@ RCT_EXPORT_MODULE()
|
|
|
211
211
|
- (UIView *)container
|
|
212
212
|
{
|
|
213
213
|
if (!_container) {
|
|
214
|
-
|
|
214
|
+
#if !TARGET_OS_VISION // [visionOS]
|
|
215
|
+
CGSize statusBarSize = RCTSharedApplication().statusBarFrame.size;
|
|
216
|
+
#else // [visionOS
|
|
217
|
+
CGSize statusBarSize = RCTUIStatusBarManager().statusBarFrame.size;
|
|
218
|
+
#endif // visionOS]
|
|
219
|
+
CGFloat statusBarHeight = statusBarSize.height;
|
|
220
|
+
_container = [[UIView alloc] initWithFrame:CGRectMake(10, statusBarHeight, 180, RCTPerfMonitorBarHeight)];
|
|
215
221
|
_container.layer.borderWidth = 2;
|
|
216
222
|
_container.layer.borderColor = [UIColor lightGrayColor].CGColor;
|
|
217
223
|
[_container addGestureRecognizer:self.gestureRecognizer];
|
|
@@ -955,9 +955,15 @@ RCT_EXPORT_MODULE()
|
|
|
955
955
|
|
|
956
956
|
if (!self->_window) {
|
|
957
957
|
#if !TARGET_OS_OSX // [macOS]
|
|
958
|
+
#if !TARGET_OS_VISION // [macOS]
|
|
958
959
|
self->_window = [[RCTRedBoxWindow alloc] initWithFrame:[UIScreen mainScreen].bounds
|
|
959
960
|
customButtonTitles:self->_customButtonTitles
|
|
960
961
|
customButtonHandlers:self->_customButtonHandlers];
|
|
962
|
+
#else // [visionOS
|
|
963
|
+
self->_window = [[RCTRedBoxWindow alloc] initWithFrame:CGRectMake(0, 0, 1280, 720)
|
|
964
|
+
customButtonTitles:self->_customButtonTitles
|
|
965
|
+
customButtonHandlers:self->_customButtonHandlers];
|
|
966
|
+
#endif // visionOS]
|
|
961
967
|
#else // [macOS
|
|
962
968
|
self->_window = [RCTRedBoxWindow new];
|
|
963
969
|
#endif // macOS]
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
#import <React/RCTLog.h>
|
|
13
13
|
#import <React/RCTUtils.h>
|
|
14
14
|
|
|
15
|
-
#if !TARGET_OS_OSX // [macOS]
|
|
16
15
|
#import <FBReactNativeSpec/FBReactNativeSpec.h>
|
|
17
16
|
|
|
17
|
+
#if !TARGET_OS_OSX // [macOS]
|
|
18
18
|
@implementation RCTConvert (UIStatusBar)
|
|
19
19
|
|
|
20
20
|
+ (UIStatusBarStyle)UIStatusBarStyle:(id)json RCT_DYNAMIC
|
|
@@ -58,14 +58,14 @@ RCT_ENUM_CONVERTER(
|
|
|
58
58
|
integerValue);
|
|
59
59
|
|
|
60
60
|
@end
|
|
61
|
+
#endif // [macOS]
|
|
61
62
|
|
|
62
63
|
@interface RCTStatusBarManager () <NativeStatusBarManagerIOSSpec>
|
|
63
64
|
@end
|
|
64
65
|
|
|
65
|
-
#endif // [macOS]
|
|
66
|
-
|
|
67
66
|
@implementation RCTStatusBarManager
|
|
68
67
|
|
|
68
|
+
#if !TARGET_OS_OSX // [macOS]
|
|
69
69
|
static BOOL RCTViewControllerBasedStatusBarAppearance()
|
|
70
70
|
{
|
|
71
71
|
static BOOL value;
|
|
@@ -78,6 +78,7 @@ static BOOL RCTViewControllerBasedStatusBarAppearance()
|
|
|
78
78
|
|
|
79
79
|
return value;
|
|
80
80
|
}
|
|
81
|
+
#endif // [macOS]
|
|
81
82
|
|
|
82
83
|
RCT_EXPORT_MODULE()
|
|
83
84
|
|
|
@@ -86,15 +87,15 @@ RCT_EXPORT_MODULE()
|
|
|
86
87
|
return YES;
|
|
87
88
|
}
|
|
88
89
|
|
|
90
|
+
#if TARGET_OS_OSX // [macOS]
|
|
89
91
|
- (NSArray<NSString *> *)supportedEvents
|
|
90
92
|
{
|
|
91
93
|
return @[ @"statusBarFrameDidChange", @"statusBarFrameWillChange" ];
|
|
92
94
|
}
|
|
93
95
|
|
|
94
|
-
#if !TARGET_OS_OSX // [macOS]
|
|
95
|
-
|
|
96
96
|
- (void)startObserving
|
|
97
97
|
{
|
|
98
|
+
#if TARGET_OS_IOS // [visionOS]
|
|
98
99
|
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
|
99
100
|
[nc addObserver:self
|
|
100
101
|
selector:@selector(applicationDidChangeStatusBarFrame:)
|
|
@@ -104,6 +105,7 @@ RCT_EXPORT_MODULE()
|
|
|
104
105
|
selector:@selector(applicationWillChangeStatusBarFrame:)
|
|
105
106
|
name:UIApplicationWillChangeStatusBarFrameNotification
|
|
106
107
|
object:nil];
|
|
108
|
+
#endif // [visionOS]
|
|
107
109
|
}
|
|
108
110
|
|
|
109
111
|
- (void)stopObserving
|
|
@@ -118,6 +120,7 @@ RCT_EXPORT_MODULE()
|
|
|
118
120
|
|
|
119
121
|
- (void)emitEvent:(NSString *)eventName forNotification:(NSNotification *)notification
|
|
120
122
|
{
|
|
123
|
+
#if TARGET_OS_IOS // [visionOS]
|
|
121
124
|
CGRect frame = [notification.userInfo[UIApplicationStatusBarFrameUserInfoKey] CGRectValue];
|
|
122
125
|
NSDictionary *event = @{
|
|
123
126
|
@"frame" : @{
|
|
@@ -128,6 +131,7 @@ RCT_EXPORT_MODULE()
|
|
|
128
131
|
},
|
|
129
132
|
};
|
|
130
133
|
[self sendEventWithName:eventName body:event];
|
|
134
|
+
#endif // [visionOS]
|
|
131
135
|
}
|
|
132
136
|
|
|
133
137
|
- (void)applicationDidChangeStatusBarFrame:(NSNotification *)notification
|
|
@@ -139,19 +143,34 @@ RCT_EXPORT_MODULE()
|
|
|
139
143
|
{
|
|
140
144
|
[self emitEvent:@"statusBarFrameWillChange" forNotification:notification];
|
|
141
145
|
}
|
|
146
|
+
#endif
|
|
142
147
|
|
|
143
148
|
RCT_EXPORT_METHOD(getHeight : (RCTResponseSenderBlock)callback)
|
|
144
149
|
{
|
|
150
|
+
#if !TARGET_OS_OSX // [macOS]
|
|
151
|
+
#if !TARGET_OS_VISION // [visionOS]
|
|
145
152
|
callback(@[ @{
|
|
146
153
|
@"height" : @(RCTSharedApplication().statusBarFrame.size.height),
|
|
147
154
|
} ]);
|
|
155
|
+
#else // [visionOS
|
|
156
|
+
callback(@[ @{
|
|
157
|
+
@"height" : @(RCTUIStatusBarManager().statusBarFrame.size),
|
|
158
|
+
} ]);
|
|
159
|
+
#endif // visionOS]
|
|
160
|
+
#else // [macOS
|
|
161
|
+
callback(@[ @{
|
|
162
|
+
@"height" : @(0),
|
|
163
|
+
} ]);
|
|
164
|
+
#endif // macOS]
|
|
148
165
|
}
|
|
149
166
|
|
|
150
167
|
RCT_EXPORT_METHOD(setStyle : (NSString *)style animated : (BOOL)animated)
|
|
151
168
|
{
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
169
|
+
#if TARGET_OS_IOS // [macOS] [visionOS]
|
|
170
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
171
|
+
UIStatusBarStyle statusBarStyle = [RCTConvert UIStatusBarStyle:style];
|
|
172
|
+
if (RCTViewControllerBasedStatusBarAppearance()) {
|
|
173
|
+
RCTLogError(@"RCTStatusBarManager module requires that the \
|
|
155
174
|
UIViewControllerBasedStatusBarAppearance key in the Info.plist is set to NO");
|
|
156
175
|
} else {
|
|
157
176
|
#pragma clang diagnostic push
|
|
@@ -159,25 +178,35 @@ RCT_EXPORT_METHOD(setStyle : (NSString *)style animated : (BOOL)animated)
|
|
|
159
178
|
[RCTSharedApplication() setStatusBarStyle:statusBarStyle animated:animated];
|
|
160
179
|
}
|
|
161
180
|
#pragma clang diagnostic pop
|
|
181
|
+
});
|
|
182
|
+
#endif // [macOS] [visionOS]
|
|
162
183
|
}
|
|
163
184
|
|
|
164
185
|
RCT_EXPORT_METHOD(setHidden : (BOOL)hidden withAnimation : (NSString *)withAnimation)
|
|
165
186
|
{
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
187
|
+
#if TARGET_OS_IOS // [macOS] [visionOS]
|
|
188
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
189
|
+
UIStatusBarAnimation animation = [RCTConvert UIStatusBarAnimation:withAnimation];
|
|
190
|
+
if (RCTViewControllerBasedStatusBarAppearance()) {
|
|
191
|
+
RCTLogError(@"RCTStatusBarManager module requires that the \
|
|
169
192
|
UIViewControllerBasedStatusBarAppearance key in the Info.plist is set to NO");
|
|
170
193
|
} else {
|
|
171
194
|
#pragma clang diagnostic push
|
|
172
195
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
173
196
|
[RCTSharedApplication() setStatusBarHidden:hidden withAnimation:animation];
|
|
174
197
|
#pragma clang diagnostic pop
|
|
175
|
-
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
#endif // [macOS] [visionOS]
|
|
176
201
|
}
|
|
177
202
|
|
|
178
203
|
RCT_EXPORT_METHOD(setNetworkActivityIndicatorVisible : (BOOL)visible)
|
|
179
204
|
{
|
|
180
|
-
|
|
205
|
+
#if TARGET_OS_IOS // [visionOS]
|
|
206
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
207
|
+
RCTSharedApplication().networkActivityIndicatorVisible = visible;
|
|
208
|
+
});
|
|
209
|
+
#endif // [visionOS]
|
|
181
210
|
}
|
|
182
211
|
|
|
183
212
|
- (facebook::react::ModuleConstants<JS::NativeStatusBarManagerIOS::Constants>)getConstants
|
|
@@ -185,7 +214,15 @@ RCT_EXPORT_METHOD(setNetworkActivityIndicatorVisible : (BOOL)visible)
|
|
|
185
214
|
__block facebook::react::ModuleConstants<JS::NativeStatusBarManagerIOS::Constants> constants;
|
|
186
215
|
RCTUnsafeExecuteOnMainQueueSync(^{
|
|
187
216
|
constants = facebook::react::typedConstants<JS::NativeStatusBarManagerIOS::Constants>({
|
|
217
|
+
#if !TARGET_OS_OSX // [macOS]
|
|
218
|
+
#if !TARGET_OS_VISION // [visionOS]
|
|
188
219
|
.HEIGHT = RCTSharedApplication().statusBarFrame.size.height,
|
|
220
|
+
#else // [visionOS
|
|
221
|
+
.HEIGHT = RCTUIStatusBarManager().statusBarFrame.size.height,
|
|
222
|
+
#endif // visionOS]
|
|
223
|
+
#else // [macOS
|
|
224
|
+
.HEIGHT = 0,
|
|
225
|
+
#endif // macOS]
|
|
189
226
|
.DEFAULT_BACKGROUND_COLOR = std::nullopt,
|
|
190
227
|
});
|
|
191
228
|
});
|
|
@@ -204,8 +241,6 @@ RCT_EXPORT_METHOD(setNetworkActivityIndicatorVisible : (BOOL)visible)
|
|
|
204
241
|
return std::make_shared<facebook::react::NativeStatusBarManagerIOSSpecJSI>(params);
|
|
205
242
|
}
|
|
206
243
|
|
|
207
|
-
#endif // [macOS]
|
|
208
|
-
|
|
209
244
|
@end
|
|
210
245
|
|
|
211
246
|
Class RCTStatusBarManagerCls(void)
|
|
@@ -18,7 +18,7 @@ end
|
|
|
18
18
|
|
|
19
19
|
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
|
20
20
|
folly_version = '2021.07.22.00'
|
|
21
|
-
socket_rocket_version = '0.7.0' # [macOS]
|
|
21
|
+
socket_rocket_version = '0.7.0' # [macOS] [visionOS]
|
|
22
22
|
|
|
23
23
|
header_search_paths = [
|
|
24
24
|
"\"$(PODS_TARGET_SRCROOT)/React/CoreModules\"",
|
|
@@ -20,11 +20,19 @@ using namespace facebook::react;
|
|
|
20
20
|
|
|
21
21
|
static UIActivityIndicatorViewStyle convertActivityIndicatorViewStyle(const ActivityIndicatorViewSize &size)
|
|
22
22
|
{
|
|
23
|
+
|
|
23
24
|
switch (size) {
|
|
25
|
+
#if TARGET_OS_IOS // [visionOS]
|
|
24
26
|
case ActivityIndicatorViewSize::Small:
|
|
25
27
|
return UIActivityIndicatorViewStyleWhite;
|
|
26
28
|
case ActivityIndicatorViewSize::Large:
|
|
27
29
|
return UIActivityIndicatorViewStyleWhiteLarge;
|
|
30
|
+
#else // [visionOS
|
|
31
|
+
case ActivityIndicatorViewSize::Small:
|
|
32
|
+
return UIActivityIndicatorViewStyleMedium;
|
|
33
|
+
case ActivityIndicatorViewSize::Large:
|
|
34
|
+
return UIActivityIndicatorViewStyleLarge;
|
|
35
|
+
#endif // visionOS]
|
|
28
36
|
}
|
|
29
37
|
}
|
|
30
38
|
|
package/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.mm
CHANGED
|
@@ -68,7 +68,9 @@ static RCTUIView<RCTBackedTextInputViewProtocol> *_Nullable RCTFindTextInputWith
|
|
|
68
68
|
if (self.nativeId) {
|
|
69
69
|
#if !TARGET_OS_OSX // [macOS]
|
|
70
70
|
_textInput = RCTFindTextInputWithNativeId(self.window, self.nativeId);
|
|
71
|
+
#if !TARGET_OS_VISION // [visionOS]
|
|
71
72
|
_textInput.inputAccessoryView = _contentView;
|
|
73
|
+
#endif // [visionOS]
|
|
72
74
|
#else // [macOS
|
|
73
75
|
_textInput = RCTFindTextInputWithNativeId(self.window.contentView, self.nativeId);
|
|
74
76
|
#endif // macOS]
|
|
@@ -87,10 +89,12 @@ static RCTUIView<RCTBackedTextInputViewProtocol> *_Nullable RCTFindTextInputWith
|
|
|
87
89
|
return true;
|
|
88
90
|
}
|
|
89
91
|
|
|
92
|
+
#if !TARGET_OS_VISION // [visionOS]
|
|
90
93
|
- (RCTUIView *)inputAccessoryView // [macOS]
|
|
91
94
|
{
|
|
92
95
|
return _contentView;
|
|
93
96
|
}
|
|
97
|
+
#endif // [visionOS]
|
|
94
98
|
|
|
95
99
|
#pragma mark - RCTComponentViewProtocol
|
|
96
100
|
|
|
@@ -48,10 +48,12 @@
|
|
|
48
48
|
[_touchHandler attachToView:self.view];
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
#if TARGET_OS_IOS // [visionOS]
|
|
51
52
|
- (UIStatusBarStyle)preferredStatusBarStyle
|
|
52
53
|
{
|
|
53
54
|
return [RCTSharedApplication() statusBarStyle];
|
|
54
55
|
}
|
|
56
|
+
#endif // [visionOS]
|
|
55
57
|
|
|
56
58
|
- (void)viewDidDisappear:(BOOL)animated
|
|
57
59
|
{
|
|
@@ -59,16 +61,22 @@
|
|
|
59
61
|
_lastViewBounds = CGRectZero;
|
|
60
62
|
}
|
|
61
63
|
|
|
64
|
+
#if TARGET_OS_IOS // [visionOS]
|
|
62
65
|
- (BOOL)prefersStatusBarHidden
|
|
63
66
|
{
|
|
64
67
|
return [RCTSharedApplication() isStatusBarHidden];
|
|
65
68
|
}
|
|
69
|
+
#endif // [visionOS]
|
|
66
70
|
|
|
67
71
|
#if RCT_DEV
|
|
68
72
|
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
|
|
69
73
|
{
|
|
74
|
+
#if !TARGET_OS_VISION // [visionOS]
|
|
70
75
|
UIInterfaceOrientationMask appSupportedOrientationsMask =
|
|
71
76
|
[RCTSharedApplication() supportedInterfaceOrientationsForWindow:[RCTSharedApplication() keyWindow]];
|
|
77
|
+
#else // [visionOS
|
|
78
|
+
UIInterfaceOrientationMask appSupportedOrientationsMask = UIInterfaceOrientationMaskLandscape;
|
|
79
|
+
#endif // visonOS]
|
|
72
80
|
if (!(_supportedInterfaceOrientations & appSupportedOrientationsMask)) {
|
|
73
81
|
RCTLogError(
|
|
74
82
|
@"Modal was presented with 0x%x orientations mask but the application only supports 0x%x."
|
|
@@ -28,7 +28,7 @@ using namespace facebook::react;
|
|
|
28
28
|
|
|
29
29
|
static CGFloat const kClippingLeeway = 44.0;
|
|
30
30
|
|
|
31
|
-
#if
|
|
31
|
+
#if TARGET_OS_IOS // [macOS] [visionOS]
|
|
32
32
|
static UIScrollViewKeyboardDismissMode RCTUIKeyboardDismissModeFromProps(ScrollViewProps const &props)
|
|
33
33
|
{
|
|
34
34
|
switch (props.keyboardDismissMode) {
|
|
@@ -40,7 +40,9 @@ static UIScrollViewKeyboardDismissMode RCTUIKeyboardDismissModeFromProps(ScrollV
|
|
|
40
40
|
return UIScrollViewKeyboardDismissModeInteractive;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
+
#endif // [macOS] [visionOS]
|
|
43
44
|
|
|
45
|
+
#if !TARGET_OS_OSX // [macOS]
|
|
44
46
|
static UIScrollViewIndicatorStyle RCTUIScrollViewIndicatorStyleFromProps(ScrollViewProps const &props)
|
|
45
47
|
{
|
|
46
48
|
switch (props.indicatorStyle) {
|
|
@@ -52,6 +54,7 @@ static UIScrollViewIndicatorStyle RCTUIScrollViewIndicatorStyleFromProps(ScrollV
|
|
|
52
54
|
return UIScrollViewIndicatorStyleWhite;
|
|
53
55
|
}
|
|
54
56
|
}
|
|
57
|
+
#endif // [macOS]
|
|
55
58
|
|
|
56
59
|
// Once Fabric implements proper NativeAnimationDriver, this should be removed.
|
|
57
60
|
// This is just a workaround to allow animations based on onScroll event.
|
|
@@ -79,7 +82,6 @@ static void RCTSendScrollEventForNativeAnimations_DEPRECATED(RCTUIScrollView *sc
|
|
|
79
82
|
userInfo:userInfo];
|
|
80
83
|
}
|
|
81
84
|
}
|
|
82
|
-
#endif // [macOS]
|
|
83
85
|
|
|
84
86
|
@interface RCTScrollViewComponentView () <
|
|
85
87
|
#if !TARGET_OS_OSX // [macOS]
|
|
@@ -328,9 +330,9 @@ static void RCTSendScrollEventForNativeAnimations_DEPRECATED(RCTUIScrollView *sc
|
|
|
328
330
|
MAP_SCROLL_VIEW_PROP(snapToInterval);
|
|
329
331
|
|
|
330
332
|
if (oldScrollViewProps.keyboardDismissMode != newScrollViewProps.keyboardDismissMode) {
|
|
331
|
-
#if
|
|
333
|
+
#if TARGET_OS_IOS // [macOS] [visionOS]
|
|
332
334
|
scrollView.keyboardDismissMode = RCTUIKeyboardDismissModeFromProps(newScrollViewProps);
|
|
333
|
-
#endif // [macOS]
|
|
335
|
+
#endif // [macOS] [visionOS]
|
|
334
336
|
}
|
|
335
337
|
|
|
336
338
|
[super updateProps:props oldProps:oldProps];
|
|
@@ -251,29 +251,21 @@ using namespace facebook::react;
|
|
|
251
251
|
|
|
252
252
|
- (void)handleLongPress:(UILongPressGestureRecognizer *)gesture
|
|
253
253
|
{
|
|
254
|
-
|
|
255
|
-
if (@available(iOS 16.0, *)) {
|
|
254
|
+
if (@available(iOS 16.0, macCatalyst 16.0, *)) {
|
|
256
255
|
CGPoint location = [gesture locationInView:self];
|
|
257
256
|
UIEditMenuConfiguration *config = [UIEditMenuConfiguration configurationWithIdentifier:nil sourcePoint:location];
|
|
258
257
|
if (_editMenuInteraction) {
|
|
259
258
|
[_editMenuInteraction presentEditMenuWithConfiguration:config];
|
|
260
259
|
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
// TODO: Adopt showMenuFromRect (necessary for UIKitForMac)
|
|
264
|
-
UIMenuController *menuController = [UIMenuController sharedMenuController];
|
|
260
|
+
} else {
|
|
261
|
+
UIMenuController *menuController = [UIMenuController sharedMenuController];
|
|
265
262
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
263
|
+
if (menuController.isMenuVisible) {
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
269
266
|
|
|
270
|
-
|
|
271
|
-
[self becomeFirstResponder];
|
|
267
|
+
[menuController showMenuFromView:self rect:self.bounds];
|
|
272
268
|
}
|
|
273
|
-
|
|
274
|
-
[menuController setTargetRect:self.bounds inView:self];
|
|
275
|
-
[menuController setMenuVisible:YES animated:YES];
|
|
276
|
-
#endif
|
|
277
269
|
}
|
|
278
270
|
#endif // [macOS]
|
|
279
271
|
|
|
@@ -562,6 +562,7 @@ using namespace facebook::react;
|
|
|
562
562
|
keyboardType == UIKeyboardTypeDecimalPad || keyboardType == UIKeyboardTypeASCIICapableNumberPad) &&
|
|
563
563
|
_backedTextInputView.returnKeyType == UIReturnKeyDone;
|
|
564
564
|
|
|
565
|
+
#if !TARGET_OS_VISION // [visionOS]
|
|
565
566
|
if ((_backedTextInputView.inputAccessoryView != nil) == shouldHaveInputAccessoryView) {
|
|
566
567
|
return;
|
|
567
568
|
}
|
|
@@ -580,7 +581,8 @@ using namespace facebook::react;
|
|
|
580
581
|
} else {
|
|
581
582
|
_backedTextInputView.inputAccessoryView = nil;
|
|
582
583
|
}
|
|
583
|
-
|
|
584
|
+
#endif // [visionOS]
|
|
585
|
+
|
|
584
586
|
if (_backedTextInputView.isFirstResponder) {
|
|
585
587
|
[_backedTextInputView reloadInputViews];
|
|
586
588
|
}
|
|
@@ -32,9 +32,9 @@ void RCTCopyBackedTextInput(
|
|
|
32
32
|
toTextInput.placeholder = fromTextInput.placeholder;
|
|
33
33
|
toTextInput.placeholderColor = fromTextInput.placeholderColor;
|
|
34
34
|
toTextInput.textContainerInset = fromTextInput.textContainerInset;
|
|
35
|
-
#if
|
|
35
|
+
#if TARGET_OS_IOS // [macOS] [visionOS]
|
|
36
36
|
toTextInput.inputAccessoryView = fromTextInput.inputAccessoryView;
|
|
37
|
-
#endif // [macOS]
|
|
37
|
+
#endif // [macOS] [visionOS]
|
|
38
38
|
toTextInput.textInputDelegate = fromTextInput.textInputDelegate;
|
|
39
39
|
toTextInput.placeholderColor = fromTextInput.placeholderColor;
|
|
40
40
|
toTextInput.defaultTextAttributes = fromTextInput.defaultTextAttributes;
|
|
@@ -281,9 +281,11 @@ static PointerEvent CreatePointerEventFromActivePointer(
|
|
|
281
281
|
|
|
282
282
|
if (eventType == RCTPointerEventTypeCancel) {
|
|
283
283
|
event.clientPoint = RCTPointFromCGPoint(CGPointZero);
|
|
284
|
+
#if !TARGET_OS_VISION // [visionOS]
|
|
284
285
|
event.screenPoint =
|
|
285
286
|
RCTPointFromCGPoint([rootComponentView convertPoint:CGPointZero
|
|
286
287
|
toCoordinateSpace:rootComponentView.window.screen.coordinateSpace]);
|
|
288
|
+
#endif // [visionOS]
|
|
287
289
|
event.offsetPoint = RCTPointFromCGPoint([rootComponentView convertPoint:CGPointZero
|
|
288
290
|
toView:activePointer.componentView]);
|
|
289
291
|
} else {
|
|
@@ -375,8 +377,10 @@ static void UpdateActivePointerWithUITouch(
|
|
|
375
377
|
|
|
376
378
|
#if !TARGET_OS_OSX // [macOS]
|
|
377
379
|
activePointer.clientPoint = [uiTouch locationInView:rootComponentView];
|
|
380
|
+
#if !TARGET_OS_VISION // [visionOS]
|
|
378
381
|
activePointer.screenPoint = [rootComponentView convertPoint:activePointer.clientPoint
|
|
379
382
|
toCoordinateSpace:rootComponentView.window.screen.coordinateSpace];
|
|
383
|
+
#endif // [visionOS]
|
|
380
384
|
activePointer.offsetPoint = [uiTouch locationInView:activePointer.componentView];
|
|
381
385
|
#else // [macOS
|
|
382
386
|
activePointer.offsetPoint = [activePointer.componentView convertPoint:uiTouch.locationInWindow fromView:nil];
|
|
@@ -899,9 +903,12 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithTarget : (id)target action : (SEL)act
|
|
|
899
903
|
{
|
|
900
904
|
UIView *listenerView = recognizer.view;
|
|
901
905
|
CGPoint clientLocation = [recognizer locationInView:listenerView];
|
|
906
|
+
#if !TARGET_OS_VISION // [visionOS]
|
|
902
907
|
CGPoint screenLocation = [listenerView convertPoint:clientLocation
|
|
903
908
|
toCoordinateSpace:listenerView.window.screen.coordinateSpace];
|
|
904
|
-
|
|
909
|
+
#else // [visionOS
|
|
910
|
+
CGPoint screenLocation = CGPointZero;
|
|
911
|
+
#endif // visionOS]
|
|
905
912
|
UIView *targetView = [listenerView hitTest:clientLocation withEvent:nil];
|
|
906
913
|
targetView = FindClosestFabricManagedTouchableView(targetView);
|
|
907
914
|
|
|
@@ -58,8 +58,12 @@ static void UpdateActiveTouchWithUITouch(
|
|
|
58
58
|
#if !TARGET_OS_OSX // [macOS]
|
|
59
59
|
CGPoint offsetPoint = [uiTouch locationInView:activeTouch.componentView];
|
|
60
60
|
CGPoint pagePoint = [uiTouch locationInView:rootComponentView];
|
|
61
|
+
#if !TARGET_OS_VISION // [visionOS]
|
|
61
62
|
CGPoint screenPoint = [rootComponentView convertPoint:pagePoint
|
|
62
63
|
toCoordinateSpace:rootComponentView.window.screen.coordinateSpace];
|
|
64
|
+
#else // [visionOS
|
|
65
|
+
CGPoint screenPoint = CGPointZero;
|
|
66
|
+
#endif // visionOS]
|
|
63
67
|
pagePoint = CGPointMake(pagePoint.x + rootViewOriginOffset.x, pagePoint.y + rootViewOriginOffset.y);
|
|
64
68
|
#else // [macOS
|
|
65
69
|
CGPoint offsetPoint = [activeTouch.componentView convertPoint:uiTouch.locationInWindow fromView:nil];
|