react-native-macos 0.73.17 → 0.73.18

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.
@@ -144,7 +144,7 @@ const ReactNativeStyleAttributes: {[string]: AnyAttributeType, ...} = {
144
144
  borderTopLeftRadius: true,
145
145
  borderTopRightRadius: true,
146
146
  borderTopStartRadius: true,
147
- cursor: true,
147
+ cursor: true, // [macOS] [visionOS]
148
148
  opacity: true,
149
149
  pointerEvents: true,
150
150
 
@@ -12,6 +12,6 @@
12
12
  exports.version = {
13
13
  major: 0,
14
14
  minor: 73,
15
- patch: 17,
15
+ patch: 18,
16
16
  prerelease: null,
17
17
  };
@@ -27,6 +27,30 @@ export type DimensionValue =
27
27
  type AnimatableNumericValue = number | Animated.AnimatedNode;
28
28
  type AnimatableStringValue = string | Animated.AnimatedNode;
29
29
 
30
+ // [macOS
31
+ export type CursorValue =
32
+ | 'alias'
33
+ | 'auto'
34
+ | 'col-resize'
35
+ | 'context-menu'
36
+ | 'copy'
37
+ | 'crosshair'
38
+ | 'default'
39
+ | 'disappearing-item'
40
+ | 'e-resize'
41
+ | 'grab'
42
+ | 'grabbing'
43
+ | 'n-resize'
44
+ | 'no-drop'
45
+ | 'not-allowed'
46
+ | 'pointer'
47
+ | 'row-resize'
48
+ | 's-resize'
49
+ | 'text'
50
+ | 'vertical-text'
51
+ | 'w-resize';
52
+ // macOS]
53
+
30
54
  /**
31
55
  * Flex Prop Types
32
56
  * @see https://reactnative.dev/docs/flexbox
@@ -273,6 +297,7 @@ export interface ViewStyle extends FlexStyle, ShadowStyleIOS, TransformsStyle {
273
297
  * Controls whether the View can be the target of touch events.
274
298
  */
275
299
  pointerEvents?: 'box-none' | 'none' | 'box-only' | 'auto' | undefined;
300
+ cursor?: CursorValue | undefined;
276
301
  }
277
302
 
278
303
  export type FontVariant =
@@ -363,4 +388,5 @@ export interface ImageStyle extends FlexStyle, ShadowStyleIOS, TransformsStyle {
363
388
  tintColor?: ColorValue | undefined;
364
389
  opacity?: AnimatableNumericValue | undefined;
365
390
  objectFit?: 'cover' | 'contain' | 'fill' | 'scale-down' | undefined;
391
+ cursor?: CursorValue | undefined;
366
392
  }
@@ -20,8 +20,25 @@ import type {
20
20
  } from './private/_StyleSheetTypesOverrides';
21
21
  import type {____TransformStyle_Internal} from './private/_TransformStyle';
22
22
 
23
+ declare export opaque type NativeColorValue;
24
+ export type ____ColorValue_Internal = null | string | number | NativeColorValue;
25
+ export type ColorArrayValue = null | $ReadOnlyArray<____ColorValue_Internal>;
26
+ export type PointValue = {
27
+ x: number,
28
+ y: number,
29
+ };
30
+ export type EdgeInsetsValue = {
31
+ top: number,
32
+ left: number,
33
+ right: number,
34
+ bottom: number,
35
+ };
36
+
37
+ export type DimensionValue = number | string | 'auto' | AnimatedNode | null;
38
+ export type AnimatableNumericValue = number | AnimatedNode;
39
+
23
40
  // [macOS
24
- export type CursorValue = ?(
41
+ export type CursorValue =
25
42
  | 'alias'
26
43
  | 'auto'
27
44
  | 'col-resize'
@@ -41,27 +58,9 @@ export type CursorValue = ?(
41
58
  | 's-resize'
42
59
  | 'text'
43
60
  | 'vertical-text'
44
- | 'w-resize'
45
- );
61
+ | 'w-resize';
46
62
  // macOS]
47
63
 
48
- declare export opaque type NativeColorValue;
49
- export type ____ColorValue_Internal = null | string | number | NativeColorValue;
50
- export type ColorArrayValue = null | $ReadOnlyArray<____ColorValue_Internal>;
51
- export type PointValue = {
52
- x: number,
53
- y: number,
54
- };
55
- export type EdgeInsetsValue = {
56
- top: number,
57
- left: number,
58
- right: number,
59
- bottom: number,
60
- };
61
-
62
- export type DimensionValue = number | string | 'auto' | AnimatedNode | null;
63
- export type AnimatableNumericValue = number | AnimatedNode;
64
-
65
64
  /**
66
65
  * React Native's layout system is based on Flexbox and is powered both
67
66
  * on iOS and Android by an open source project called `Yoga`:
@@ -752,7 +751,7 @@ export type ____ViewStyle_InternalCore = $ReadOnly<{
752
751
  opacity?: AnimatableNumericValue,
753
752
  elevation?: number,
754
753
  pointerEvents?: 'auto' | 'none' | 'box-none' | 'box-only',
755
- cursor?: CursorValue, // [macOS]
754
+ cursor?: CursorValue, // [macOS][visionOS]
756
755
  }>;
757
756
 
758
757
  export type ____ViewStyle_Internal = $ReadOnly<{
@@ -6,9 +6,7 @@
6
6
  */
7
7
 
8
8
  #import <React/RCTBaseTextViewManager.h>
9
- #if TARGET_OS_OSX // [macOS
10
- #import <React/RCTCursor.h>
11
- #endif // macOS]
9
+ #import <React/RCTCursor.h> // [macOS]
12
10
 
13
11
  @implementation RCTBaseTextViewManager
14
12
 
@@ -7,15 +7,12 @@
7
7
 
8
8
  #import <React/RCTUIKit.h> // [macOS]
9
9
 
10
+ #import <React/RCTCursor.h> // [macOS]
10
11
  #import <React/RCTDynamicTypeRamp.h>
11
12
  #import <React/RCTTextDecorationLineType.h>
12
13
 
13
14
  #import "RCTTextTransform.h"
14
15
 
15
- #if TARGET_OS_OSX // [macOS
16
- #import <React/RCTCursor.h>
17
- #endif // macOS]
18
-
19
16
  NS_ASSUME_NONNULL_BEGIN
20
17
 
21
18
  extern NSString *const RCTTextAttributesIsHighlightedAttributeName;
@@ -8,13 +8,10 @@
8
8
  #import <React/RCTTextAttributes.h>
9
9
 
10
10
  #import <React/RCTAssert.h>
11
+ #import <React/RCTCursor.h> // [macOS]
11
12
  #import <React/RCTFont.h>
12
13
  #import <React/RCTLog.h>
13
14
 
14
- #if TARGET_OS_OSX // [macOS
15
- #import <React/RCTCursor.h>
16
- #endif // macOS]
17
-
18
15
  NSString *const RCTTextAttributesIsHighlightedAttributeName = @"RCTTextAttributesIsHighlightedAttributeName";
19
16
  NSString *const RCTTextAttributesTagAttributeName = @"RCTTextAttributesTagAttributeName";
20
17
 
@@ -235,7 +232,7 @@ NSString *const RCTTextAttributesTagAttributeName = @"RCTTextAttributesTagAttrib
235
232
 
236
233
  #if TARGET_OS_OSX // [macOS
237
234
  if (_cursor != RCTCursorAuto) {
238
- attributes[NSCursorAttributeName] = [RCTConvert NSCursor:_cursor];
235
+ attributes[NSCursorAttributeName] = NSCursorFromRCTCursor(_cursor);
239
236
  }
240
237
  #endif // macOS]
241
238
 
@@ -11,6 +11,7 @@
11
11
  #import <React/RCTAnimationType.h>
12
12
  #import <React/RCTBorderCurve.h>
13
13
  #import <React/RCTBorderStyle.h>
14
+ #import <React/RCTCursor.h> // [macOS] [visionOS]
14
15
  #import <React/RCTDefines.h>
15
16
  #import <React/RCTLog.h>
16
17
  #import <React/RCTPointerEvents.h>
@@ -91,6 +92,8 @@ typedef NSURL RCTFileURL;
91
92
  #endif
92
93
  #endif // [macOS]
93
94
 
95
+ + (RCTCursor)RCTCursor:(id)json; // [macOS] [visionOS]
96
+
94
97
  #if TARGET_OS_OSX // [macOS
95
98
  + (NSTextCheckingTypes)NSTextCheckingTypes:(id)json;
96
99
  #endif // macOS]
@@ -562,7 +562,38 @@ RCT_ENUM_CONVERTER(
562
562
  }),
563
563
  UIBarStyleDefault,
564
564
  integerValue)
565
- #else // [macOS
565
+ #endif // [macOS]
566
+
567
+ // [macOS [visionOS]
568
+ RCT_ENUM_CONVERTER(
569
+ RCTCursor,
570
+ (@{
571
+ @"alias" : @(RCTCursorAlias),
572
+ @"auto" : @(RCTCursorAuto),
573
+ @"col-resize" : @(RCTCursorColumnResize),
574
+ @"context-menu" : @(RCTCursorContextualMenu),
575
+ @"copy" : @(RCTCursorCopy),
576
+ @"crosshair" : @(RCTCursorCrosshair),
577
+ @"default" : @(RCTCursorDefault),
578
+ @"disappearing-item" : @(RCTCursorDisappearingItem),
579
+ @"e-resize" : @(RCTCursorEastResize),
580
+ @"grab" : @(RCTCursorGrab),
581
+ @"grabbing" : @(RCTCursorGrabbing),
582
+ @"n-resize" : @(RCTCursorNorthResize),
583
+ @"no-drop" : @(RCTCursorNoDrop),
584
+ @"not-allowed" : @(RCTCursorNotAllowed),
585
+ @"pointer" : @(RCTCursorPointer),
586
+ @"row-resize" : @(RCTCursorRowResize),
587
+ @"s-resize" : @(RCTCursorSouthResize),
588
+ @"text" : @(RCTCursorText),
589
+ @"vertical-text" : @(RCTCursorVerticalText),
590
+ @"w-resize" : @(RCTCursorWestResize),
591
+ }),
592
+ RCTCursorAuto,
593
+ integerValue)
594
+ // macOS] [visionOS]
595
+
596
+ #if TARGET_OS_OSX // [macOS
566
597
  RCT_MULTI_ENUM_CONVERTER(NSTextCheckingTypes, (@{
567
598
  @"ortography": @(NSTextCheckingTypeOrthography),
568
599
  @"spelling": @(NSTextCheckingTypeSpelling),
@@ -23,7 +23,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
23
23
  __rnVersion = @{
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(73),
26
- RCTVersionPatch: @(17),
26
+ RCTVersionPatch: @(18),
27
27
  RCTVersionPrerelease: [NSNull null],
28
28
  };
29
29
  });
@@ -102,6 +102,18 @@ using namespace facebook::react;
102
102
  _backgroundColor = backgroundColor;
103
103
  }
104
104
 
105
+ #if TARGET_OS_OSX // [macOS
106
+ - (void)resetCursorRects
107
+ {
108
+ [self discardCursorRects];
109
+ if (_props->cursor != Cursor::Auto)
110
+ {
111
+ NSCursor *cursor = NSCursorFromCursor(_props->cursor);
112
+ [self addCursorRect:self.bounds cursor:cursor];
113
+ }
114
+ }
115
+ #endif // macOS]
116
+
105
117
  #pragma mark - RCTComponentViewProtocol
106
118
 
107
119
  + (ComponentDescriptorProvider)componentDescriptorProvider
@@ -258,6 +270,11 @@ using namespace facebook::react;
258
270
  if (oldViewProps.backfaceVisibility != newViewProps.backfaceVisibility) {
259
271
  self.layer.doubleSided = newViewProps.backfaceVisibility == BackfaceVisibility::Visible;
260
272
  }
273
+
274
+ // `cursor`
275
+ if (oldViewProps.cursor != newViewProps.cursor) {
276
+ needsInvalidateLayer = YES;
277
+ }
261
278
 
262
279
  // `shouldRasterize`
263
280
  if (oldViewProps.shouldRasterize != newViewProps.shouldRasterize) {
@@ -579,6 +596,55 @@ static RCTBorderStyle RCTBorderStyleFromBorderStyle(BorderStyle borderStyle)
579
596
  }
580
597
  }
581
598
 
599
+ #if TARGET_OS_OSX // [macOS
600
+ static NSCursor *NSCursorFromCursor(Cursor cursor)
601
+ {
602
+ switch (cursor) {
603
+ case Cursor::Auto:
604
+ return [NSCursor arrowCursor];
605
+ case Cursor::Alias:
606
+ return [NSCursor dragLinkCursor];
607
+ case Cursor::ColumnResize:
608
+ return [NSCursor resizeLeftRightCursor];
609
+ case Cursor::ContextualMenu:
610
+ return [NSCursor contextualMenuCursor];
611
+ case Cursor::Copy:
612
+ return [NSCursor dragCopyCursor];
613
+ case Cursor::Crosshair:
614
+ return [NSCursor crosshairCursor];
615
+ case Cursor::Default:
616
+ return [NSCursor arrowCursor];
617
+ case Cursor::DisappearingItem:
618
+ return [NSCursor disappearingItemCursor];
619
+ case Cursor::EastResize:
620
+ return [NSCursor resizeRightCursor];
621
+ case Cursor::Grab:
622
+ return [NSCursor openHandCursor];
623
+ case Cursor::Grabbing:
624
+ return [NSCursor closedHandCursor];
625
+ case Cursor::NorthResize:
626
+ return [NSCursor resizeUpCursor];
627
+ case Cursor::NoDrop:
628
+ return [NSCursor operationNotAllowedCursor];
629
+ case Cursor::NotAllowed:
630
+ return [NSCursor operationNotAllowedCursor];
631
+ case Cursor::Pointer:
632
+ return [NSCursor pointingHandCursor];
633
+ case Cursor::RowResize:
634
+ return [NSCursor resizeUpDownCursor];
635
+ case Cursor::SouthResize:
636
+ return [NSCursor resizeDownCursor];
637
+ case Cursor::Text:
638
+ return [NSCursor IBeamCursor];
639
+ case Cursor::VerticalText:
640
+ return [NSCursor IBeamCursorForVerticalLayout];
641
+ case Cursor::WestResize:
642
+ return [NSCursor resizeLeftCursor];
643
+ }
644
+ }
645
+ #endif // macOS]
646
+
647
+
582
648
  - (void)invalidateLayer
583
649
  {
584
650
  CALayer *layer = self.layer;
@@ -606,6 +672,33 @@ static RCTBorderStyle RCTBorderStyleFromBorderStyle(BorderStyle borderStyle)
606
672
  } else {
607
673
  layer.shadowPath = nil;
608
674
  }
675
+
676
+ #if !TARGET_OS_OSX // [visionOS]
677
+ // Stage 1.5. Cursor / Hover Effects
678
+ if (@available(iOS 17.0, *)) {
679
+ UIHoverStyle *hoverStyle = nil;
680
+ if (_props->cursor == Cursor::Pointer) {
681
+ const RCTCornerInsets cornerInsets =
682
+ RCTGetCornerInsets(RCTCornerRadiiFromBorderRadii(borderMetrics.borderRadii), UIEdgeInsetsZero);
683
+ #if TARGET_OS_IOS
684
+ // Due to an Apple bug, it seems on iOS, UIShapes made with `[UIShape shapeWithBezierPath:]`
685
+ // evaluate their shape on the superviews' coordinate space. This leads to the hover shape
686
+ // rendering incorrectly on iOS, iOS apps in compatibility mode on visionOS, but not on visionOS.
687
+ // To work around this, for iOS, we can calculate the border path based on `view.frame` (the
688
+ // superview's coordinate space) instead of view.bounds.
689
+ CGPathRef borderPath = RCTPathCreateWithRoundedRect(self.frame, cornerInsets, NULL);
690
+ #else // TARGET_OS_VISION
691
+ CGPathRef borderPath = RCTPathCreateWithRoundedRect(self.bounds, cornerInsets, NULL);
692
+ #endif
693
+ UIBezierPath *bezierPath = [UIBezierPath bezierPathWithCGPath:borderPath];
694
+ CGPathRelease(borderPath);
695
+ UIShape *shape = [UIShape shapeWithBezierPath:bezierPath];
696
+
697
+ hoverStyle = [UIHoverStyle styleWithEffect:[UIHoverAutomaticEffect effect] shape:shape];
698
+ }
699
+ [self setHoverStyle:hoverStyle];
700
+ }
701
+ #endif // [visionOS]
609
702
 
610
703
  // Stage 2. Border Rendering
611
704
  const bool useCoreAnimationBorderRendering =
@@ -5,35 +5,76 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- #import <React/RCTConvert.h>
8
+ #import <Foundation/Foundation.h>
9
9
 
10
10
  typedef NS_ENUM(NSInteger, RCTCursor) {
11
+ RCTCursorAlias,
11
12
  RCTCursorAuto,
12
- RCTCursorArrow,
13
- RCTCursorIBeam,
13
+ RCTCursorColumnResize,
14
+ RCTCursorContextualMenu,
15
+ RCTCursorCopy,
14
16
  RCTCursorCrosshair,
15
- RCTCursorClosedHand,
16
- RCTCursorOpenHand,
17
- RCTCursorPointingHand,
18
- RCTCursorResizeLeft,
19
- RCTCursorResizeRight,
20
- RCTCursorResizeLeftRight,
21
- RCTCursorResizeUp,
22
- RCTCursorResizeDown,
23
- RCTCursorResizeUpDown,
17
+ RCTCursorDefault,
24
18
  RCTCursorDisappearingItem,
25
- RCTCursorIBeamCursorForVerticalLayout,
26
- RCTCursorOperationNotAllowed,
27
- RCTCursorDragLink,
28
- RCTCursorDragCopy,
29
- RCTCursorContextualMenu,
19
+ RCTCursorEastResize,
20
+ RCTCursorGrab,
21
+ RCTCursorGrabbing,
22
+ RCTCursorNorthResize,
23
+ RCTCursorNoDrop,
24
+ RCTCursorNotAllowed,
25
+ RCTCursorPointer,
26
+ RCTCursorRowResize,
27
+ RCTCursorSouthResize,
28
+ RCTCursorText,
29
+ RCTCursorVerticalText,
30
+ RCTCursorWestResize,
30
31
  };
31
32
 
32
- @interface RCTConvert (RCTCursor)
33
-
34
- + (RCTCursor)RCTCursor:(id)json;
35
33
  #if TARGET_OS_OSX // [macOS
36
- + (NSCursor *)NSCursor:(RCTCursor)rctCursor;
34
+ inline static NSCursor *NSCursorFromRCTCursor(RCTCursor cursor)
35
+ {
36
+ switch (cursor) {
37
+ case RCTCursorAlias:
38
+ return [NSCursor dragLinkCursor];
39
+ case RCTCursorAuto:
40
+ return [NSCursor arrowCursor];
41
+ case RCTCursorColumnResize:
42
+ return [NSCursor resizeLeftRightCursor];
43
+ case RCTCursorContextualMenu:
44
+ return [NSCursor contextualMenuCursor];
45
+ case RCTCursorCopy:
46
+ return [NSCursor dragCopyCursor];
47
+ case RCTCursorCrosshair:
48
+ return [NSCursor crosshairCursor];
49
+ case RCTCursorDefault:
50
+ return [NSCursor arrowCursor];
51
+ case RCTCursorDisappearingItem:
52
+ return [NSCursor disappearingItemCursor];
53
+ case RCTCursorEastResize:
54
+ return [NSCursor resizeRightCursor];
55
+ case RCTCursorGrab:
56
+ return [NSCursor openHandCursor];
57
+ case RCTCursorGrabbing:
58
+ return [NSCursor closedHandCursor];
59
+ case RCTCursorNorthResize:
60
+ return [NSCursor resizeUpCursor];
61
+ case RCTCursorNoDrop:
62
+ return [NSCursor operationNotAllowedCursor];
63
+ case RCTCursorNotAllowed:
64
+ return [NSCursor operationNotAllowedCursor];
65
+ case RCTCursorPointer:
66
+ return [NSCursor pointingHandCursor];
67
+ case RCTCursorRowResize:
68
+ return [NSCursor resizeUpDownCursor];
69
+ case RCTCursorSouthResize:
70
+ return [NSCursor resizeDownCursor];
71
+ case RCTCursorText:
72
+ return [NSCursor IBeamCursor];
73
+ case RCTCursorVerticalText:
74
+ return [NSCursor IBeamCursorForVerticalLayout];
75
+ case RCTCursorWestResize:
76
+ return [NSCursor resizeLeftCursor];
77
+ }
78
+ }
37
79
  #endif // macOS]
38
80
 
39
- @end
@@ -10,13 +10,10 @@
10
10
  #import <React/RCTBorderCurve.h>
11
11
  #import <React/RCTBorderStyle.h>
12
12
  #import <React/RCTComponent.h>
13
+ #import <React/RCTCursor.h> // [macOS] [visionOS]
13
14
  #import <React/RCTEventDispatcherProtocol.h> // [macOS]
14
15
  #import <React/RCTPointerEvents.h>
15
16
 
16
- #if TARGET_OS_OSX // [macOS
17
- #import <React/RCTCursor.h>
18
- #endif // macOS]
19
-
20
17
  #if !TARGET_OS_OSX // [macOS]
21
18
  extern const UIAccessibilityTraits SwitchAccessibilityTrait;
22
19
  #endif // [macOS]
@@ -143,6 +140,8 @@ extern const UIAccessibilityTraits SwitchAccessibilityTrait;
143
140
  */
144
141
  @property (nonatomic, assign) UIEdgeInsets hitTestEdgeInsets;
145
142
 
143
+ @property (nonatomic, assign) RCTCursor cursor;
144
+
146
145
  /**
147
146
  * (Experimental and unused for Paper) Pointer event handlers.
148
147
  */
@@ -162,8 +161,6 @@ extern const UIAccessibilityTraits SwitchAccessibilityTrait;
162
161
  /**
163
162
  * macOS Properties
164
163
  */
165
- @property (nonatomic, assign) RCTCursor cursor;
166
-
167
164
  @property (nonatomic, assign) CATransform3D transform3D;
168
165
 
169
166
  // `allowsVibrancy` is readonly on NSView, so let's create a new property to make it assignable
@@ -179,6 +179,7 @@ static NSString *RCTRecursiveAccessibilityLabel(RCTUIView *view) // [macOS]
179
179
  _borderCurve = RCTBorderCurveCircular;
180
180
  _borderStyle = RCTBorderStyleSolid;
181
181
  _hitTestEdgeInsets = UIEdgeInsetsZero;
182
+ _cursor = RCTCursorAuto;
182
183
  #if TARGET_OS_OSX // [macOS
183
184
  _transform3D = CATransform3DIdentity;
184
185
  _shadowColor = nil;
@@ -1208,7 +1209,11 @@ static CGFloat RCTDefaultIfNegativeTo(CGFloat defaultValue, CGFloat x)
1208
1209
  }
1209
1210
 
1210
1211
  RCTUpdateShadowPathForView(self);
1211
-
1212
+
1213
+ #if !TARGET_OS_OSX // [visionOS]
1214
+ RCTUpdateHoverStyleForView(self);
1215
+ #endif // [visionOS]
1216
+
1212
1217
  #if TARGET_OS_OSX // [macOS
1213
1218
  // clipsToBounds is stubbed out on macOS because it's not part of NSView
1214
1219
  layer.masksToBounds = self.clipsToBounds;
@@ -1347,6 +1352,33 @@ static void RCTUpdateShadowPathForView(RCTView *view)
1347
1352
  }
1348
1353
  }
1349
1354
 
1355
+ #if !TARGET_OS_OSX // [visionOS
1356
+ static void RCTUpdateHoverStyleForView(RCTView *view)
1357
+ {
1358
+ if (@available(iOS 17.0, *)) {
1359
+ UIHoverStyle *hoverStyle = nil;
1360
+ if ([view cursor] == RCTCursorPointer) {
1361
+ const RCTCornerRadii cornerRadii = [view cornerRadii];
1362
+ const RCTCornerInsets cornerInsets = RCTGetCornerInsets(cornerRadii, UIEdgeInsetsZero);
1363
+ #if TARGET_OS_IOS
1364
+ // Due to an Apple bug, it seems on iOS, `[UIShape shapeWithBezierPath:]` needs to
1365
+ // be calculated in the superviews' coordinate space (view.frame). This is not true
1366
+ // on other platforms like visionOS.
1367
+ CGPathRef borderPath = RCTPathCreateWithRoundedRect(view.frame, cornerInsets, NULL);
1368
+ #else // TARGET_OS_VISION
1369
+ CGPathRef borderPath = RCTPathCreateWithRoundedRect(view.bounds, cornerInsets, NULL);
1370
+ #endif
1371
+ UIBezierPath *bezierPath = [UIBezierPath bezierPathWithCGPath:borderPath];
1372
+ CGPathRelease(borderPath);
1373
+ UIShape *shape = [UIShape shapeWithBezierPath:bezierPath];
1374
+
1375
+ hoverStyle = [UIHoverStyle styleWithEffect:[UIHoverHighlightEffect effect] shape:shape];
1376
+ }
1377
+ [view setHoverStyle:hoverStyle];
1378
+ }
1379
+ }
1380
+ #endif // visionOS]
1381
+
1350
1382
  - (void)updateClippingForLayer:(CALayer *)layer
1351
1383
  {
1352
1384
  CALayer *mask = nil;
@@ -1474,8 +1506,9 @@ setBorderColor() setBorderColor(Top) setBorderColor(Right) setBorderColor(Bottom
1474
1506
  - (void)resetCursorRects
1475
1507
  {
1476
1508
  [self discardCursorRects];
1477
- NSCursor *cursor = [RCTConvert NSCursor:self.cursor];
1478
- if (cursor) {
1509
+ if ([self cursor] != RCTCursorAuto)
1510
+ {
1511
+ NSCursor *cursor = NSCursorFromRCTCursor(self.cursor);
1479
1512
  [self addCursorRect:self.bounds cursor:cursor];
1480
1513
  }
1481
1514
  }
@@ -13,6 +13,7 @@
13
13
  #import "RCTBridge.h"
14
14
  #import "RCTConvert+Transform.h"
15
15
  #import "RCTConvert.h"
16
+ #import "RCTCursor.h" // [macOS] [visionOS]
16
17
  #import "RCTLog.h"
17
18
  #import "RCTShadowView.h"
18
19
  #import "RCTTransformOrigin.h"
@@ -22,10 +23,6 @@
22
23
  #import "RCTView.h"
23
24
  #import "UIView+React.h"
24
25
 
25
- #if TARGET_OS_OSX // [macOS
26
- #import "RCTCursor.h"
27
- #endif // macOS]
28
-
29
26
  @implementation RCTConvert (UIAccessibilityTraits)
30
27
 
31
28
  #if !TARGET_OS_OSX // [macOS]
@@ -253,6 +250,7 @@ RCT_REMAP_VIEW_PROPERTY(testID, reactAccessibilityElement.accessibilityIdentifie
253
250
 
254
251
  RCT_EXPORT_VIEW_PROPERTY(backgroundColor, UIColor)
255
252
  RCT_REMAP_VIEW_PROPERTY(backfaceVisibility, layer.doubleSided, css_backface_visibility_t)
253
+ RCT_EXPORT_VIEW_PROPERTY(cursor, RCTCursor) // [visionOS]
256
254
  #if !TARGET_OS_OSX // [macOS]
257
255
  RCT_REMAP_VIEW_PROPERTY(opacity, alpha, CGFloat)
258
256
  #else // [macOS
@@ -588,7 +586,6 @@ RCT_EXPORT_VIEW_PROPERTY(onBlur, RCTBubblingEventBlock)
588
586
  #if TARGET_OS_OSX // [macOS
589
587
  #pragma mark - macOS properties
590
588
 
591
- RCT_EXPORT_VIEW_PROPERTY(cursor, RCTCursor)
592
589
  RCT_EXPORT_VIEW_PROPERTY(onMouseEnter, RCTDirectEventBlock)
593
590
  RCT_EXPORT_VIEW_PROPERTY(onMouseLeave, RCTDirectEventBlock)
594
591
  RCT_EXPORT_VIEW_PROPERTY(onDragEnter, RCTDirectEventBlock)
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.73.17
1
+ VERSION_NAME=0.73.18
2
2
  react.internal.publishingGroup=com.facebook.react
3
3
 
4
4
  android.useAndroidX=true
@@ -17,6 +17,6 @@ public class ReactNativeVersion {
17
17
  public static final Map<String, Object> VERSION = MapBuilder.<String, Object>of(
18
18
  "major", 0,
19
19
  "minor", 73,
20
- "patch", 17,
20
+ "patch", 18,
21
21
  "prerelease", null);
22
22
  }
@@ -17,7 +17,7 @@ namespace facebook::react {
17
17
  constexpr struct {
18
18
  int32_t Major = 0;
19
19
  int32_t Minor = 73;
20
- int32_t Patch = 17;
20
+ int32_t Patch = 18;
21
21
  std::string_view Prerelease = "";
22
22
  } ReactNativeVersion;
23
23
 
@@ -140,6 +140,15 @@ BaseViewProps::BaseViewProps(
140
140
  "shadowRadius",
141
141
  sourceProps.shadowRadius,
142
142
  {})),
143
+ cursor(
144
+ CoreFeatures::enablePropIteratorSetter
145
+ ? sourceProps.cursor
146
+ : convertRawProp(
147
+ context,
148
+ rawProps,
149
+ "cursor",
150
+ sourceProps.cursor,
151
+ {})),
143
152
  transform(
144
153
  CoreFeatures::enablePropIteratorSetter ? sourceProps.transform
145
154
  : convertRawProp(
@@ -51,6 +51,8 @@ class BaseViewProps : public YogaStylableProps, public AccessibilityProps {
51
51
  Size shadowOffset{0, -3};
52
52
  Float shadowOpacity{};
53
53
  Float shadowRadius{3};
54
+
55
+ Cursor cursor{};
54
56
 
55
57
  // Transform
56
58
  Transform transform{};
@@ -51,7 +51,7 @@ void ViewShadowNode::initialize() noexcept {
51
51
  viewProps.accessibilityElementsHidden ||
52
52
  viewProps.accessibilityViewIsModal ||
53
53
  viewProps.importantForAccessibility != ImportantForAccessibility::Auto ||
54
- viewProps.removeClippedSubviews ||
54
+ viewProps.removeClippedSubviews || viewProps.cursor != Cursor::Auto ||
55
55
  HostPlatformViewTraitsInitializer::formsStackingContext(viewProps);
56
56
 
57
57
  bool formsView = formsStackingContext ||
@@ -686,6 +686,102 @@ inline void fromRawValue(
686
686
  react_native_expect(false);
687
687
  }
688
688
 
689
+ // [macOS [visionOS]
690
+ inline void fromRawValue(
691
+ const PropsParserContext& context,
692
+ const RawValue& value,
693
+ Cursor& result) {
694
+ result = Cursor::Auto;
695
+ react_native_expect(value.hasType<std::string>());
696
+ if (!value.hasType<std::string>()) {
697
+ return;
698
+ }
699
+ auto stringValue = (std::string)value;
700
+ if (stringValue == "alias") {
701
+ result = Cursor::Alias;
702
+ return;
703
+ }
704
+ if (stringValue == "auto") {
705
+ result = Cursor::Auto;
706
+ return;
707
+ }
708
+ if (stringValue == "col-resize") {
709
+ result = Cursor::ColumnResize;
710
+ return;
711
+ }
712
+ if (stringValue == "context-menu") {
713
+ result = Cursor::ContextualMenu;
714
+ return;
715
+ }
716
+ if (stringValue == "copy") {
717
+ result = Cursor::Copy;
718
+ return;
719
+ }
720
+ if (stringValue == "crosshair") {
721
+ result = Cursor::Crosshair;
722
+ return;
723
+ }
724
+ if (stringValue == "default") {
725
+ result = Cursor::Default;
726
+ return;
727
+ }
728
+ if (stringValue == "disappearing-item") {
729
+ result = Cursor::DisappearingItem;
730
+ return;
731
+ }
732
+ if (stringValue == "e-resize") {
733
+ result = Cursor::EastResize;
734
+ return;
735
+ }
736
+ if (stringValue == "grab") {
737
+ result = Cursor::Grab;
738
+ return;
739
+ }
740
+ if (stringValue == "grabbing") {
741
+ result = Cursor::Grabbing;
742
+ return;
743
+ }
744
+ if (stringValue == "n-resize") {
745
+ result = Cursor::NorthResize;
746
+ return;
747
+ }
748
+ if (stringValue == "no-drop") {
749
+ result = Cursor::NoDrop;
750
+ return;
751
+ }
752
+ if (stringValue == "not-allowed") {
753
+ result = Cursor::NotAllowed;
754
+ return;
755
+ }
756
+ if (stringValue == "pointer") {
757
+ result = Cursor::Pointer;
758
+ return;
759
+ }
760
+ if (stringValue == "row-resize") {
761
+ result = Cursor::RowResize;
762
+ return;
763
+ }
764
+ if (stringValue == "s-resize") {
765
+ result = Cursor::SouthResize;
766
+ return;
767
+ }
768
+ if (stringValue == "text") {
769
+ result = Cursor::Text;
770
+ return;
771
+ }
772
+ if (stringValue == "vertical-text") {
773
+ result = Cursor::VerticalText;
774
+ return;
775
+ }
776
+ if (stringValue == "w-resize") {
777
+ result = Cursor::WestResize;
778
+ return;
779
+ }
780
+ LOG(ERROR) << "Could not parse Cursor:" << stringValue;
781
+ react_native_expect(false);
782
+ }
783
+ // macOS] [visionOS]
784
+
689
785
  inline void fromRawValue(
690
786
  const PropsParserContext& /*context*/,
691
787
  const RawValue& value,
@@ -91,6 +91,31 @@ enum class BorderCurve : uint8_t { Circular, Continuous };
91
91
 
92
92
  enum class BorderStyle : uint8_t { Solid, Dotted, Dashed };
93
93
 
94
+ // [macOS [visionOS]
95
+ enum class Cursor : uint8_t {
96
+ Auto,
97
+ Alias,
98
+ ColumnResize,
99
+ ContextualMenu,
100
+ Copy,
101
+ Crosshair,
102
+ Default,
103
+ DisappearingItem,
104
+ EastResize,
105
+ Grab,
106
+ Grabbing,
107
+ NorthResize,
108
+ NoDrop,
109
+ NotAllowed,
110
+ Pointer,
111
+ RowResize,
112
+ SouthResize,
113
+ Text,
114
+ VerticalText,
115
+ WestResize,
116
+ };
117
+ // macOS] [visionOS]
118
+
94
119
  enum class LayoutConformance : uint8_t { Undefined, Classic, Strict };
95
120
 
96
121
  template <typename T>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-macos",
3
- "version": "0.73.17",
3
+ "version": "0.73.18",
4
4
  "description": "React Native for macOS",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,105 +0,0 @@
1
- /*
2
- * Copyright (c) Facebook, Inc. and its 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
-
8
- #import <React/RCTCursor.h>
9
-
10
- @implementation RCTConvert (RCTCursor)
11
-
12
- RCT_ENUM_CONVERTER(
13
- RCTCursor,
14
- (@{
15
- @"alias" : @(RCTCursorDragLink),
16
- @"auto" : @(RCTCursorAuto),
17
- @"col-resize" : @(RCTCursorResizeLeftRight),
18
- @"context-menu" : @(RCTCursorContextualMenu),
19
- @"copy" : @(RCTCursorDragCopy),
20
- @"crosshair" : @(RCTCursorCrosshair),
21
- @"default" : @(RCTCursorArrow),
22
- @"disappearing-item" : @(RCTCursorDisappearingItem),
23
- @"e-resize" : @(RCTCursorResizeRight),
24
- @"grab" : @(RCTCursorOpenHand),
25
- @"grabbing" : @(RCTCursorClosedHand),
26
- @"n-resize" : @(RCTCursorResizeUp),
27
- @"no-drop" : @(RCTCursorOperationNotAllowed),
28
- @"not-allowed" : @(RCTCursorOperationNotAllowed),
29
- @"pointer" : @(RCTCursorPointingHand),
30
- @"row-resize" : @(RCTCursorResizeUpDown),
31
- @"s-resize" : @(RCTCursorResizeDown),
32
- @"text" : @(RCTCursorIBeam),
33
- @"vertical-text" : @(RCTCursorIBeamCursorForVerticalLayout),
34
- @"w-resize" : @(RCTCursorResizeLeft),
35
- }),
36
- RCTCursorAuto,
37
- integerValue)
38
-
39
- #if TARGET_OS_OSX // [macOS
40
- + (NSCursor *)NSCursor:(RCTCursor)rctCursor
41
- {
42
- NSCursor *cursor;
43
-
44
- switch (rctCursor) {
45
- case RCTCursorArrow:
46
- cursor = [NSCursor arrowCursor];
47
- break;
48
- case RCTCursorClosedHand:
49
- cursor = [NSCursor closedHandCursor];
50
- break;
51
- case RCTCursorContextualMenu:
52
- cursor = [NSCursor contextualMenuCursor];
53
- break;
54
- case RCTCursorCrosshair:
55
- cursor = [NSCursor crosshairCursor];
56
- break;
57
- case RCTCursorDisappearingItem:
58
- cursor = [NSCursor disappearingItemCursor];
59
- break;
60
- case RCTCursorDragCopy:
61
- cursor = [NSCursor dragCopyCursor];
62
- break;
63
- case RCTCursorDragLink:
64
- cursor = [NSCursor dragLinkCursor];
65
- break;
66
- case RCTCursorIBeam:
67
- cursor = [NSCursor IBeamCursor];
68
- break;
69
- case RCTCursorIBeamCursorForVerticalLayout:
70
- cursor = [NSCursor IBeamCursorForVerticalLayout];
71
- break;
72
- case RCTCursorOpenHand:
73
- cursor = [NSCursor openHandCursor];
74
- break;
75
- case RCTCursorOperationNotAllowed:
76
- cursor = [NSCursor operationNotAllowedCursor];
77
- break;
78
- case RCTCursorPointingHand:
79
- cursor = [NSCursor pointingHandCursor];
80
- break;
81
- case RCTCursorResizeDown:
82
- cursor = [NSCursor resizeDownCursor];
83
- break;
84
- case RCTCursorResizeLeft:
85
- cursor = [NSCursor resizeLeftCursor];
86
- break;
87
- case RCTCursorResizeLeftRight:
88
- cursor = [NSCursor resizeLeftRightCursor];
89
- break;
90
- case RCTCursorResizeRight:
91
- cursor = [NSCursor resizeRightCursor];
92
- break;
93
- case RCTCursorResizeUp:
94
- cursor = [NSCursor resizeUpCursor];
95
- break;
96
- case RCTCursorResizeUpDown:
97
- cursor = [NSCursor resizeUpDownCursor];
98
- break;
99
- }
100
-
101
- return cursor;
102
- }
103
- #endif // macOS]
104
-
105
- @end