react-native-macos 0.73.5 → 0.73.7
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/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Text/Text/RCTTextView.mm +22 -3
- package/React/Base/RCTUtils.m +16 -10
- package/React/Base/RCTVersion.m +1 -1
- package/React/CoreModules/RCTAlertController.mm +1 -23
- package/React/CoreModules/RCTDevLoadingView.mm +7 -9
- package/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm +26 -1
- package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +1 -1
- package/React/UIUtils/RCTUIUtils.m +1 -2
- package/React/Views/RCTViewManager.m +1 -1
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/package.json +1 -1
- package/sdks/hermes-engine/hermes-engine.podspec +4 -1
- package/sdks/hermes-engine/hermes-utils.rb +23 -0
|
@@ -37,11 +37,18 @@
|
|
|
37
37
|
|
|
38
38
|
@end
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
#endif // macOS]
|
|
41
|
+
|
|
42
|
+
#if !TARGET_OS_OSX // [macOS]
|
|
43
|
+
@interface RCTTextView () <UIEditMenuInteractionDelegate>
|
|
42
44
|
|
|
45
|
+
@property (nonatomic, nullable) UIEditMenuInteraction *editMenuInteraction API_AVAILABLE(ios(16.0));
|
|
46
|
+
#else // [macOS
|
|
47
|
+
@interface RCTTextView () <NSTextViewDelegate>
|
|
43
48
|
#endif // macOS]
|
|
44
49
|
|
|
50
|
+
@end
|
|
51
|
+
|
|
45
52
|
#import <QuartzCore/QuartzCore.h>
|
|
46
53
|
|
|
47
54
|
@implementation RCTTextView {
|
|
@@ -351,6 +358,10 @@
|
|
|
351
358
|
{
|
|
352
359
|
_longPressGestureRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self
|
|
353
360
|
action:@selector(handleLongPress:)];
|
|
361
|
+
if (@available(iOS 16.0, *)) {
|
|
362
|
+
_editMenuInteraction = [[UIEditMenuInteraction alloc] initWithDelegate:self];
|
|
363
|
+
[self addInteraction:_editMenuInteraction];
|
|
364
|
+
}
|
|
354
365
|
[self addGestureRecognizer:_longPressGestureRecognizer];
|
|
355
366
|
}
|
|
356
367
|
|
|
@@ -362,8 +373,16 @@
|
|
|
362
373
|
|
|
363
374
|
- (void)handleLongPress:(UILongPressGestureRecognizer *)gesture
|
|
364
375
|
{
|
|
365
|
-
// TODO: Adopt showMenuFromRect (necessary for UIKitForMac)
|
|
366
376
|
#if !TARGET_OS_UIKITFORMAC
|
|
377
|
+
if (@available(iOS 16.0, *)) {
|
|
378
|
+
CGPoint location = [gesture locationInView:self];
|
|
379
|
+
UIEditMenuConfiguration *config = [UIEditMenuConfiguration configurationWithIdentifier:nil sourcePoint:location];
|
|
380
|
+
if (_editMenuInteraction) {
|
|
381
|
+
[_editMenuInteraction presentEditMenuWithConfiguration:config];
|
|
382
|
+
}
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
// TODO: Adopt showMenuFromRect (necessary for UIKitForMac)
|
|
367
386
|
UIMenuController *menuController = [UIMenuController sharedMenuController];
|
|
368
387
|
|
|
369
388
|
if (menuController.isMenuVisible) {
|
package/React/Base/RCTUtils.m
CHANGED
|
@@ -305,14 +305,14 @@ static CGFloat screenScale;
|
|
|
305
305
|
void RCTComputeScreenScale(void)
|
|
306
306
|
{
|
|
307
307
|
dispatch_once(&onceTokenScreenScale, ^{
|
|
308
|
-
screenScale = [
|
|
308
|
+
screenScale = [UITraitCollection currentTraitCollection].displayScale;
|
|
309
309
|
});
|
|
310
310
|
}
|
|
311
311
|
|
|
312
312
|
CGFloat RCTScreenScale(void)
|
|
313
313
|
{
|
|
314
314
|
RCTUnsafeExecuteOnMainQueueOnceSync(&onceTokenScreenScale, ^{
|
|
315
|
-
screenScale = [
|
|
315
|
+
screenScale = [UITraitCollection currentTraitCollection].displayScale;
|
|
316
316
|
});
|
|
317
317
|
|
|
318
318
|
return screenScale;
|
|
@@ -600,12 +600,20 @@ RCTUIWindow *__nullable RCTKeyWindow(void) // [macOS]
|
|
|
600
600
|
return nil;
|
|
601
601
|
}
|
|
602
602
|
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
603
|
+
for (UIScene *scene in RCTSharedApplication().connectedScenes) {
|
|
604
|
+
if (scene.activationState != UISceneActivationStateForegroundActive ||
|
|
605
|
+
![scene isKindOfClass:[UIWindowScene class]]) {
|
|
606
|
+
continue;
|
|
607
|
+
}
|
|
608
|
+
UIWindowScene *windowScene = (UIWindowScene *)scene;
|
|
609
|
+
|
|
610
|
+
for (UIWindow *window in windowScene.windows) {
|
|
611
|
+
if (window.isKeyWindow) {
|
|
612
|
+
return window;
|
|
613
|
+
}
|
|
607
614
|
}
|
|
608
615
|
}
|
|
616
|
+
|
|
609
617
|
return nil;
|
|
610
618
|
#else // [macOS
|
|
611
619
|
return [NSApp keyWindow];
|
|
@@ -634,12 +642,10 @@ BOOL RCTForceTouchAvailable(void)
|
|
|
634
642
|
static BOOL forceSupported;
|
|
635
643
|
static dispatch_once_t onceToken;
|
|
636
644
|
dispatch_once(&onceToken, ^{
|
|
637
|
-
forceSupported =
|
|
638
|
-
[UITraitCollection class] && [UITraitCollection instancesRespondToSelector:@selector(forceTouchCapability)];
|
|
645
|
+
forceSupported = [UITraitCollection currentTraitCollection].forceTouchCapability == UIForceTouchCapabilityAvailable;
|
|
639
646
|
});
|
|
640
647
|
|
|
641
|
-
return forceSupported
|
|
642
|
-
(RCTKeyWindow() ?: [UIView new]).traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable;
|
|
648
|
+
return forceSupported;
|
|
643
649
|
}
|
|
644
650
|
#endif // [macOS]
|
|
645
651
|
|
package/React/Base/RCTVersion.m
CHANGED
|
@@ -23,17 +23,7 @@
|
|
|
23
23
|
- (UIWindow *)alertWindow
|
|
24
24
|
{
|
|
25
25
|
if (_alertWindow == nil) {
|
|
26
|
-
_alertWindow = [
|
|
27
|
-
|
|
28
|
-
if (_alertWindow == nil) {
|
|
29
|
-
UIWindow *keyWindow = RCTSharedApplication().keyWindow;
|
|
30
|
-
if (keyWindow) {
|
|
31
|
-
_alertWindow = [[UIWindow alloc] initWithFrame:keyWindow.bounds];
|
|
32
|
-
} else {
|
|
33
|
-
// keyWindow is nil, so we cannot create and initialize _alertWindow
|
|
34
|
-
NSLog(@"Unable to create alert window: keyWindow is nil");
|
|
35
|
-
}
|
|
36
|
-
}
|
|
26
|
+
_alertWindow = [[UIWindow alloc] initWithWindowScene:RCTKeyWindow().windowScene];
|
|
37
27
|
|
|
38
28
|
if (_alertWindow) {
|
|
39
29
|
_alertWindow.rootViewController = [UIViewController new];
|
|
@@ -67,18 +57,6 @@
|
|
|
67
57
|
|
|
68
58
|
_alertWindow = nil;
|
|
69
59
|
}
|
|
70
|
-
|
|
71
|
-
- (UIWindow *)getUIWindowFromScene
|
|
72
|
-
{
|
|
73
|
-
for (UIScene *scene in RCTSharedApplication().connectedScenes) {
|
|
74
|
-
if (scene.activationState == UISceneActivationStateForegroundActive &&
|
|
75
|
-
[scene isKindOfClass:[UIWindowScene class]]) {
|
|
76
|
-
return [[UIWindow alloc] initWithWindowScene:(UIWindowScene *)scene];
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return nil;
|
|
81
|
-
}
|
|
82
60
|
#endif // [macOS]
|
|
83
61
|
|
|
84
62
|
@end
|
|
@@ -120,15 +120,15 @@ RCT_EXPORT_MODULE()
|
|
|
120
120
|
|
|
121
121
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
122
122
|
self->_showDate = [NSDate date];
|
|
123
|
+
|
|
123
124
|
if (!self->_window && !RCTRunningInTestEnvironment()) {
|
|
124
125
|
#if !TARGET_OS_OSX // [macOS]
|
|
125
|
-
|
|
126
|
+
UIWindow *window = RCTKeyWindow();
|
|
127
|
+
CGFloat windowWidth = window.bounds.size.width;
|
|
126
128
|
|
|
127
|
-
UIWindow
|
|
128
|
-
self->_window =
|
|
129
|
-
|
|
130
|
-
self->_label =
|
|
131
|
-
[[UILabel alloc] initWithFrame:CGRectMake(0, window.safeAreaInsets.top - 10, screenSize.width, 20)];
|
|
129
|
+
self->_window = [[UIWindow alloc] initWithWindowScene:window.windowScene];
|
|
130
|
+
self->_window.frame = CGRectMake(0, 0, windowWidth, window.safeAreaInsets.top + 10);
|
|
131
|
+
self->_label = [[UILabel alloc] initWithFrame:CGRectMake(0, window.safeAreaInsets.top - 10, windowWidth, 20)];
|
|
132
132
|
[self->_window addSubview:self->_label];
|
|
133
133
|
|
|
134
134
|
self->_window.windowLevel = UIWindowLevelStatusBar + 1;
|
|
@@ -164,12 +164,10 @@ RCT_EXPORT_MODULE()
|
|
|
164
164
|
|
|
165
165
|
self->_window.backgroundColor = backgroundColor;
|
|
166
166
|
self->_window.hidden = NO;
|
|
167
|
-
|
|
168
|
-
UIWindowScene *scene = (UIWindowScene *)RCTSharedApplication().connectedScenes.anyObject;
|
|
169
|
-
self->_window.windowScene = scene;
|
|
170
167
|
#else // [macOS
|
|
171
168
|
self->_label.stringValue = message;
|
|
172
169
|
self->_label.textColor = color;
|
|
170
|
+
|
|
173
171
|
self->_label.backgroundColor = backgroundColor;
|
|
174
172
|
[self->_window orderFront:nil];
|
|
175
173
|
#endif // macOS]
|
|
@@ -27,6 +27,14 @@
|
|
|
27
27
|
|
|
28
28
|
using namespace facebook::react;
|
|
29
29
|
|
|
30
|
+
#if !TARGET_OS_OSX // [macOS]
|
|
31
|
+
@interface RCTParagraphComponentView () <UIEditMenuInteractionDelegate>
|
|
32
|
+
|
|
33
|
+
@property (nonatomic, nullable) UIEditMenuInteraction *editMenuInteraction API_AVAILABLE(ios(16.0));
|
|
34
|
+
|
|
35
|
+
@end
|
|
36
|
+
#endif // [macOS]
|
|
37
|
+
|
|
30
38
|
@implementation RCTParagraphComponentView {
|
|
31
39
|
ParagraphShadowNode::ConcreteState::Shared _state;
|
|
32
40
|
ParagraphAttributes _paragraphAttributes;
|
|
@@ -223,19 +231,36 @@ using namespace facebook::react;
|
|
|
223
231
|
{
|
|
224
232
|
_longPressGestureRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self
|
|
225
233
|
action:@selector(handleLongPress:)];
|
|
234
|
+
|
|
235
|
+
if (@available(iOS 16.0, *)) {
|
|
236
|
+
_editMenuInteraction = [[UIEditMenuInteraction alloc] initWithDelegate:self];
|
|
237
|
+
[self addInteraction:_editMenuInteraction];
|
|
238
|
+
}
|
|
226
239
|
[self addGestureRecognizer:_longPressGestureRecognizer];
|
|
227
240
|
}
|
|
228
241
|
|
|
229
242
|
- (void)disableContextMenu
|
|
230
243
|
{
|
|
231
244
|
[self removeGestureRecognizer:_longPressGestureRecognizer];
|
|
245
|
+
if (@available(iOS 16.0, *)) {
|
|
246
|
+
[self removeInteraction:_editMenuInteraction];
|
|
247
|
+
_editMenuInteraction = nil;
|
|
248
|
+
}
|
|
232
249
|
_longPressGestureRecognizer = nil;
|
|
233
250
|
}
|
|
234
251
|
|
|
235
252
|
- (void)handleLongPress:(UILongPressGestureRecognizer *)gesture
|
|
236
253
|
{
|
|
237
|
-
// TODO: Adopt showMenuFromRect (necessary for UIKitForMac)
|
|
238
254
|
#if !TARGET_OS_UIKITFORMAC
|
|
255
|
+
if (@available(iOS 16.0, *)) {
|
|
256
|
+
CGPoint location = [gesture locationInView:self];
|
|
257
|
+
UIEditMenuConfiguration *config = [UIEditMenuConfiguration configurationWithIdentifier:nil sourcePoint:location];
|
|
258
|
+
if (_editMenuInteraction) {
|
|
259
|
+
[_editMenuInteraction presentEditMenuWithConfiguration:config];
|
|
260
|
+
}
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
// TODO: Adopt showMenuFromRect (necessary for UIKitForMac)
|
|
239
264
|
UIMenuController *menuController = [UIMenuController sharedMenuController];
|
|
240
265
|
|
|
241
266
|
if (menuController.isMenuVisible) {
|
|
@@ -263,7 +263,7 @@ using namespace facebook::react;
|
|
|
263
263
|
if (oldViewProps.shouldRasterize != newViewProps.shouldRasterize) {
|
|
264
264
|
self.layer.shouldRasterize = newViewProps.shouldRasterize;
|
|
265
265
|
#if !TARGET_OS_OSX // [macOS]
|
|
266
|
-
self.layer.rasterizationScale = newViewProps.shouldRasterize ?
|
|
266
|
+
self.layer.rasterizationScale = newViewProps.shouldRasterize ? self.traitCollection.displayScale : 1.0;
|
|
267
267
|
#else // [macOS
|
|
268
268
|
self.layer.rasterizationScale = 1.0;
|
|
269
269
|
#endif // macOS]
|
|
@@ -15,8 +15,7 @@ RCTDimensions RCTGetDimensions(CGFloat fontScale)
|
|
|
15
15
|
UIScreen *mainScreen = UIScreen.mainScreen;
|
|
16
16
|
CGSize screenSize = mainScreen.bounds.size;
|
|
17
17
|
|
|
18
|
-
UIView *mainWindow;
|
|
19
|
-
mainWindow = RCTKeyWindow();
|
|
18
|
+
UIView *mainWindow = RCTKeyWindow();
|
|
20
19
|
// We fallback to screen size if a key window is not found.
|
|
21
20
|
CGSize windowSize = mainWindow ? mainWindow.bounds.size : screenSize;
|
|
22
21
|
#else // [macOS
|
|
@@ -285,7 +285,7 @@ RCT_CUSTOM_VIEW_PROPERTY(shouldRasterizeIOS, BOOL, RCTView)
|
|
|
285
285
|
{
|
|
286
286
|
view.layer.shouldRasterize = json ? [RCTConvert BOOL:json] : defaultView.layer.shouldRasterize;
|
|
287
287
|
view.layer.rasterizationScale =
|
|
288
|
-
view.layer.shouldRasterize ?
|
|
288
|
+
view.layer.shouldRasterize ? view.traitCollection.displayScale : defaultView.layer.rasterizationScale;
|
|
289
289
|
}
|
|
290
290
|
#endif // [macOS]
|
|
291
291
|
|
package/package.json
CHANGED
|
@@ -10,7 +10,10 @@ react_native_path = File.join(__dir__, "..", "..")
|
|
|
10
10
|
|
|
11
11
|
# package.json
|
|
12
12
|
package = JSON.parse(File.read(File.join(react_native_path, "package.json")))
|
|
13
|
-
|
|
13
|
+
# [macOS
|
|
14
|
+
rn_version = package['version']
|
|
15
|
+
version = findLastestVersionWithArtifact(rn_version) || rn_version
|
|
16
|
+
# macOS]
|
|
14
17
|
|
|
15
18
|
source_type = hermes_source_type(version, react_native_path)
|
|
16
19
|
source = podspec_source(source_type, version, react_native_path)
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
require 'net/http'
|
|
7
7
|
require 'rexml/document'
|
|
8
|
+
require 'open3' # [macOS]
|
|
8
9
|
|
|
9
10
|
HERMES_GITHUB_URL = "https://github.com/facebook/hermes.git"
|
|
10
11
|
|
|
@@ -233,6 +234,28 @@ def resolve_url_redirects(url)
|
|
|
233
234
|
return (`curl -Ls -o /dev/null -w %{url_effective} \"#{url}\"`)
|
|
234
235
|
end
|
|
235
236
|
|
|
237
|
+
# [macOS react-native-macos does not publish macos specific hermes artifacts
|
|
238
|
+
# so we attempt to find the latest patch version of the iOS artifacts and use that
|
|
239
|
+
def findLastestVersionWithArtifact(version)
|
|
240
|
+
versionWithoutPatch = version.match(/^(\d+\.\d+)/)
|
|
241
|
+
xml_data, = Open3.capture3("curl -s https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/maven-metadata.xml")
|
|
242
|
+
|
|
243
|
+
metadata = REXML::Document.new(xml_data)
|
|
244
|
+
versions = metadata.elements.to_a('//metadata/versioning/versions/version')
|
|
245
|
+
|
|
246
|
+
# Extract version numbers and sort them
|
|
247
|
+
filtered_versions = versions.select { |version| version.text.match?(/^#{versionWithoutPatch}\.\d+$/) }
|
|
248
|
+
if filtered_versions.empty?
|
|
249
|
+
return
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
version_numbers = filtered_versions.map { |version| version.text }
|
|
253
|
+
sorted_versions = version_numbers.sort_by { |v| Gem::Version.new(v) }
|
|
254
|
+
|
|
255
|
+
return sorted_versions.last
|
|
256
|
+
end
|
|
257
|
+
# macOS]
|
|
258
|
+
|
|
236
259
|
# This function checks that Hermes artifact exists.
|
|
237
260
|
# As of now it should check it on the Maven repo.
|
|
238
261
|
#
|