react-native-macos 0.71.13 → 0.71.15

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.
@@ -196,12 +196,66 @@ type Props = $ReadOnly<{|
196
196
  */
197
197
  validKeysUp?: ?Array<string>,
198
198
 
199
+ /**
200
+ * Specifies whether the view should receive the mouse down event when the
201
+ * containing window is in the background.
202
+ *
203
+ * @platform macos
204
+ */
199
205
  acceptsFirstMouse?: ?boolean,
206
+
207
+ /**
208
+ * Specifies whether clicking and dragging the view can move the window. This is useful
209
+ * to disable in Button like components like Pressable where mouse the user should still
210
+ * be able to click and drag off the view to cancel the click without accidentally moving the window.
211
+ *
212
+ * @platform macos
213
+ */
214
+ mouseDownCanMoveWindow?: ?boolean,
215
+
216
+ /**
217
+ * Specifies whether system focus ring should be drawn when the view has keyboard focus.
218
+ *
219
+ * @platform macos
220
+ */
200
221
  enableFocusRing?: ?boolean,
222
+
223
+ /**
224
+ * Specifies the Tooltip for the Pressable.
225
+ * @platform macos
226
+ */
201
227
  tooltip?: ?string,
228
+
229
+ /**
230
+ * Fired when a file is dragged into the Pressable via the mouse.
231
+ *
232
+ * @platform macos
233
+ */
202
234
  onDragEnter?: (event: MouseEvent) => void,
235
+
236
+ /**
237
+ * Fired when a file is dragged out of the Pressable via the mouse.
238
+ *
239
+ * @platform macos
240
+ */
203
241
  onDragLeave?: (event: MouseEvent) => void,
242
+
243
+ /**
244
+ * Fired when a file is dropped on the Pressable via the mouse.
245
+ *
246
+ * @platform macos
247
+ */
204
248
  onDrop?: (event: MouseEvent) => void,
249
+
250
+ /**
251
+ * The types of dragged files that the Pressable will accept.
252
+ *
253
+ * Possible values for `draggedTypes` are:
254
+ *
255
+ * - `'fileUrl'`
256
+ *
257
+ * @platform macos
258
+ */
205
259
  draggedTypes?: ?DraggedTypesType,
206
260
  // macOS]
207
261
 
@@ -250,8 +304,6 @@ type Props = $ReadOnly<{|
250
304
  * LTI update could not be added via codemod */
251
305
  function Pressable(props: Props, forwardedRef): React.Node {
252
306
  const {
253
- acceptsFirstMouse, // [macOS]
254
- enableFocusRing, // [macOS]
255
307
  accessible,
256
308
  accessibilityState,
257
309
  'aria-live': ariaLive,
@@ -282,6 +334,9 @@ function Pressable(props: Props, forwardedRef): React.Node {
282
334
  onBlur,
283
335
  onKeyDown,
284
336
  onKeyUp,
337
+ acceptsFirstMouse,
338
+ mouseDownCanMoveWindow,
339
+ enableFocusRing,
285
340
  // macOS]
286
341
  pressRetentionOffset,
287
342
  style,
@@ -322,7 +377,8 @@ function Pressable(props: Props, forwardedRef): React.Node {
322
377
  const restPropsWithDefaults: React.ElementConfig<typeof View> = {
323
378
  ...restProps,
324
379
  ...android_rippleConfig?.viewProps,
325
- acceptsFirstMouse: acceptsFirstMouse !== false && !disabled, // [macOS
380
+ acceptsFirstMouse: acceptsFirstMouse !== false && !disabled, // [macOS]
381
+ mouseDownCanMoveWindow: false, // [macOS]
326
382
  enableFocusRing: enableFocusRing !== false && !disabled,
327
383
  accessible: accessible !== false,
328
384
  accessibilityViewIsModal:
@@ -37,6 +37,7 @@ const UIView = {
37
37
  style: ReactNativeStyleAttributes,
38
38
  // [macOS
39
39
  acceptsFirstMouse: true,
40
+ mouseDownCanMoveWindow: true,
40
41
  enableFocusRing: true,
41
42
  focusable: true,
42
43
  onMouseEnter: true,
@@ -173,6 +173,7 @@ export type DraggedTypesType = DraggedType | DraggedType[];
173
173
 
174
174
  export interface ViewPropsMacOS {
175
175
  acceptsFirstMouse?: boolean | undefined;
176
+ mouseDownCanMoveWindow?: boolean | undefined;
176
177
  enableFocusRing?: boolean | undefined;
177
178
  onMouseEnter?: ((event: MouseEvent) => void) | undefined;
178
179
  onMouseLeave?: ((event: MouseEvent) => void) | undefined;
@@ -474,14 +474,14 @@ type IOSViewProps = $ReadOnly<{|
474
474
  // [macOS
475
475
  type MacOSViewProps = $ReadOnly<{|
476
476
  /**
477
- * Fired when a dragged element enters a valid drop target
477
+ * Fired when a file is dragged into the view via the mouse.
478
478
  *
479
479
  * @platform macos
480
480
  */
481
481
  onDragEnter?: (event: MouseEvent) => void,
482
482
 
483
483
  /**
484
- * Fired when a dragged element leaves a valid drop target
484
+ * Fired when a file is dragged out of the view via the mouse.
485
485
  *
486
486
  * @platform macos
487
487
  */
@@ -509,14 +509,23 @@ type MacOSViewProps = $ReadOnly<{|
509
509
  acceptsFirstMouse?: ?boolean,
510
510
 
511
511
  /**
512
- * Specifies whether focus ring should be drawn when the view has the first responder status.
512
+ * Specifies whether clicking and dragging the view can move the window. This is useful
513
+ * to disable in Button like components like Pressable where mouse the user should still
514
+ * be able to click and drag off the view to cancel the click without accidentally moving the window.
515
+ *
516
+ * @platform macos
517
+ */
518
+ mouseDownCanMoveWindow?: ?boolean,
519
+
520
+ /**
521
+ * Specifies whether system focus ring should be drawn when the view has keyboard focus.
513
522
  *
514
523
  * @platform macos
515
524
  */
516
525
  enableFocusRing?: ?boolean,
517
526
 
518
527
  /**
519
- * Enables Drag'n'Drop Support for certain types of dragged types
528
+ * The types of dragged files that the view will accept.
520
529
  *
521
530
  * Possible values for `draggedTypes` are:
522
531
  *
@@ -12,6 +12,6 @@
12
12
  exports.version = {
13
13
  major: 0,
14
14
  minor: 71,
15
- patch: 13,
15
+ patch: 15,
16
16
  prerelease: null,
17
17
  };
@@ -54,6 +54,7 @@ const validAttributesForNonEventProps = {
54
54
  tooltip: true,
55
55
  validKeysDown: true,
56
56
  validKeysUp: true,
57
+ mouseDownCanMoveWindow: true,
57
58
  };
58
59
 
59
60
  // Props for bubbling and direct events
@@ -232,6 +232,8 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)coder)
232
232
  CGPoint rootViewLocation = [_cachedRootView.window.contentView convertPoint:location toView:_cachedRootView];
233
233
  NSView *touchView = _touchViews[touchIndex];
234
234
  CGPoint touchViewLocation = [touchView convertPoint:location fromView:nil];
235
+ // JavaScript expects coordinates to have (0,0) at top left, unlike the macOS coordinate system
236
+ rootViewLocation.y = NSHeight([[_cachedRootView window] frame]) - rootViewLocation.y;
235
237
  #endif // macOS]
236
238
 
237
239
  NSMutableDictionary *reactTouch = _reactTouches[touchIndex];
@@ -405,6 +405,9 @@ CGPathRef UIBezierPathCreateCGPathRef(UIBezierPath *path);
405
405
  * containing window is in the background.
406
406
  */
407
407
  @property (nonatomic, assign) BOOL acceptsFirstMouse;
408
+
409
+ @property (nonatomic, assign) BOOL mouseDownCanMoveWindow;
410
+
408
411
  /**
409
412
  * Specifies whether the view participates in the key view loop as user tabs through different controls
410
413
  * This is equivalent to acceptsFirstResponder on mac OS.
@@ -23,7 +23,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
23
23
  __rnVersion = @{
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(71),
26
- RCTVersionPatch: @(13),
26
+ RCTVersionPatch: @(15),
27
27
  RCTVersionPrerelease: [NSNull null],
28
28
  };
29
29
  });
@@ -215,6 +215,7 @@ CGPathRef UIBezierPathCreateCGPathRef(UIBezierPath *bezierPath)
215
215
  NSColor *_backgroundColor;
216
216
  BOOL _clipsToBounds;
217
217
  BOOL _userInteractionEnabled;
218
+ BOOL _mouseDownCanMoveWindow;
218
219
  }
219
220
 
220
221
  + (NSSet<NSString *> *)keyPathsForValuesAffectingValueForKey:(NSString *)key
@@ -243,6 +244,7 @@ static RCTUIView *RCTUIViewCommonInit(RCTUIView *self)
243
244
  self.wantsLayer = YES;
244
245
  self->_userInteractionEnabled = YES;
245
246
  self->_enableFocusRing = YES;
247
+ self->_mouseDownCanMoveWindow = YES;
246
248
  }
247
249
  return self;
248
250
  }
@@ -288,6 +290,14 @@ static RCTUIView *RCTUIViewCommonInit(RCTUIView *self)
288
290
  [self didMoveToWindow];
289
291
  }
290
292
 
293
+ - (BOOL)mouseDownCanMoveWindow{
294
+ return _mouseDownCanMoveWindow;
295
+ }
296
+
297
+ - (void)setMouseDownCanMoveWindow:(BOOL)mouseDownCanMoveWindow{
298
+ _mouseDownCanMoveWindow = mouseDownCanMoveWindow;
299
+ }
300
+
291
301
  - (BOOL)isFlipped
292
302
  {
293
303
  return YES;
@@ -133,6 +133,7 @@ static NSString *RCTRecursiveAccessibilityLabel(RCTUIView *view) // [macOS]
133
133
  #if TARGET_OS_OSX // [macOS
134
134
  NSTrackingArea *_trackingArea;
135
135
  BOOL _hasMouseOver;
136
+ BOOL _mouseDownCanMoveWindow;
136
137
  #endif // macOS]
137
138
  NSMutableDictionary<NSString *, NSDictionary *> *accessibilityActionsNameMap;
138
139
  NSMutableDictionary<NSString *, NSDictionary *> *accessibilityActionsLabelMap;
@@ -172,6 +173,7 @@ static NSString *RCTRecursiveAccessibilityLabel(RCTUIView *view) // [macOS]
172
173
  #if TARGET_OS_OSX // [macOS
173
174
  _transform3D = CATransform3DIdentity;
174
175
  _shadowColor = nil;
176
+ _mouseDownCanMoveWindow = YES;
175
177
  #endif // macOS]
176
178
 
177
179
  _backgroundColor = super.backgroundColor;
@@ -1495,6 +1497,15 @@ setBorderColor() setBorderColor(Top) setBorderColor(Right) setBorderColor(Bottom
1495
1497
  additionalData:nil];
1496
1498
  }
1497
1499
 
1500
+ - (BOOL)mouseDownCanMoveWindow{
1501
+ return _mouseDownCanMoveWindow;
1502
+ }
1503
+
1504
+ - (void)setMouseDownCanMoveWindow:(BOOL)mouseDownCanMoveWindow{
1505
+ _mouseDownCanMoveWindow = mouseDownCanMoveWindow;
1506
+ }
1507
+
1508
+
1498
1509
  - (NSDictionary*)locationInfoFromEvent:(NSEvent*)event
1499
1510
  {
1500
1511
  NSPoint locationInWindow = event.locationInWindow;
@@ -417,12 +417,16 @@ RCT_CUSTOM_VIEW_PROPERTY(acceptsFirstMouse, BOOL, RCTView)
417
417
  view.acceptsFirstMouse = json ? [RCTConvert BOOL:json] : defaultView.acceptsFirstMouse;
418
418
  }
419
419
  }
420
+
421
+ RCT_EXPORT_VIEW_PROPERTY(mouseDownCanMoveWindow, BOOL)
422
+
420
423
  RCT_CUSTOM_VIEW_PROPERTY(focusable, BOOL, RCTView)
421
424
  {
422
425
  if ([view respondsToSelector:@selector(setFocusable:)]) {
423
426
  view.focusable = json ? [RCTConvert BOOL:json] : defaultView.focusable;
424
427
  }
425
428
  }
429
+
426
430
  RCT_CUSTOM_VIEW_PROPERTY(enableFocusRing, BOOL, RCTView)
427
431
  {
428
432
  if ([view respondsToSelector:@selector(setEnableFocusRing:)]) {
@@ -511,6 +515,7 @@ RCT_EXPORT_VIEW_PROPERTY(onKeyDown, RCTDirectEventBlock) // macOS keyboard event
511
515
  RCT_EXPORT_VIEW_PROPERTY(onKeyUp, RCTDirectEventBlock) // macOS keyboard events
512
516
  RCT_EXPORT_VIEW_PROPERTY(validKeysDown, NSArray<NSString*>)
513
517
  RCT_EXPORT_VIEW_PROPERTY(validKeysUp, NSArray<NSString*>)
518
+
514
519
  #endif // macOS]
515
520
 
516
521
  #pragma mark - ShadowView properties
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.71.13
1
+ VERSION_NAME=0.71.15
2
2
  GROUP=com.facebook.react
3
3
 
4
4
  # JVM Versions
@@ -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", 71,
20
- "patch", 13,
20
+ "patch", 15,
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 = 71;
20
- int32_t Patch = 13;
20
+ int32_t Patch = 15;
21
21
  std::string_view Prerelease = "";
22
22
  } ReactNativeVersion;
23
23
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-macos",
3
- "version": "0.71.13",
3
+ "version": "0.71.15",
4
4
  "bin": "./cli.js",
5
5
  "description": "React Native for macOS",
6
6
  "license": "MIT",
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "dependencies": {
14
14
  "react": "18.2.0",
15
- "react-native-macos": "0.71.13"
15
+ "react-native-macos": "0.71.15"
16
16
  },
17
17
  "devDependencies": {
18
18
  "@babel/core": "^7.20.0",